本文整理汇总了Java中org.telegram.ui.Cells.ContextLinkCell.isSticker方法的典型用法代码示例。如果您正苦于以下问题:Java ContextLinkCell.isSticker方法的具体用法?Java ContextLinkCell.isSticker怎么用?Java ContextLinkCell.isSticker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.ui.Cells.ContextLinkCell
的用法示例。
在下文中一共展示了ContextLinkCell.isSticker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInterceptTouchEvent
import org.telegram.ui.Cells.ContextLinkCell; //导入方法依赖的package包/类
public boolean onInterceptTouchEvent(MotionEvent event, final View listView, final int height) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
int x = (int) event.getX();
int y = (int) event.getY();
int count = 0;
if (listView instanceof AbsListView) {
count = ((AbsListView) listView).getChildCount();
} else if (listView instanceof RecyclerListView) {
count = ((RecyclerListView) listView).getChildCount();
}
for (int a = 0; a < count; a++) {
View view = null;
if (listView instanceof AbsListView) {
view = ((AbsListView) listView).getChildAt(a);
} else if (listView instanceof RecyclerListView) {
view = ((RecyclerListView) listView).getChildAt(a);
}
if (view == null) {
return false;
}
int top = view.getTop();
int bottom = view.getBottom();
int left = view.getLeft();
int right = view.getRight();
if (top > y || bottom < y || left > x || right < x) {
continue;
}
boolean ok = false;
if (view instanceof StickerEmojiCell) {
ok = ((StickerEmojiCell) view).showingBitmap();
} else if (view instanceof StickerCell) {
ok = ((StickerCell) view).showingBitmap();
} else if (view instanceof ContextLinkCell) {
ContextLinkCell cell = (ContextLinkCell) view;
ok = cell.isSticker() && cell.showingBitmap();
}
if (!ok) {
return false;
}
startX = x;
startY = y;
currentStickerPreviewCell = view;
openStickerPreviewRunnable = new Runnable() {
@Override
public void run() {
if (openStickerPreviewRunnable == null) {
return;
}
if (listView instanceof AbsListView) {
((AbsListView) listView).setOnItemClickListener(null);
((AbsListView) listView).requestDisallowInterceptTouchEvent(true);
} else if (listView instanceof RecyclerListView) {
((RecyclerListView) listView).setOnItemClickListener(null);
((RecyclerListView) listView).requestDisallowInterceptTouchEvent(true);
}
openStickerPreviewRunnable = null;
setParentActivity((Activity) listView.getContext());
setKeyboardHeight(height);
if (currentStickerPreviewCell instanceof StickerEmojiCell) {
open(((StickerEmojiCell) currentStickerPreviewCell).getSticker());
((StickerEmojiCell) currentStickerPreviewCell).setScaled(true);
} else if (currentStickerPreviewCell instanceof StickerCell) {
open(((StickerCell) currentStickerPreviewCell).getSticker());
((StickerCell) currentStickerPreviewCell).setScaled(true);
} else if (currentStickerPreviewCell instanceof ContextLinkCell) {
open(((ContextLinkCell) currentStickerPreviewCell).getDocument());
((ContextLinkCell) currentStickerPreviewCell).setScaled(true);
}
}
};
AndroidUtilities.runOnUIThread(openStickerPreviewRunnable, 200);
return true;
}
}
return false;
}
示例2: onInterceptTouchEvent
import org.telegram.ui.Cells.ContextLinkCell; //导入方法依赖的package包/类
public boolean onInterceptTouchEvent(MotionEvent event, final View listView, final int height, StickerPreviewViewerDelegate stickerPreviewViewerDelegate) {
delegate = stickerPreviewViewerDelegate;
if (event.getAction() == MotionEvent.ACTION_DOWN) {
int x = (int) event.getX();
int y = (int) event.getY();
int count = 0;
if (listView instanceof AbsListView) {
count = ((AbsListView) listView).getChildCount();
} else if (listView instanceof RecyclerListView) {
count = ((RecyclerListView) listView).getChildCount();
}
for (int a = 0; a < count; a++) {
View view = null;
if (listView instanceof AbsListView) {
view = ((AbsListView) listView).getChildAt(a);
} else if (listView instanceof RecyclerListView) {
view = ((RecyclerListView) listView).getChildAt(a);
}
if (view == null) {
return false;
}
int top = view.getTop();
int bottom = view.getBottom();
int left = view.getLeft();
int right = view.getRight();
if (top > y || bottom < y || left > x || right < x) {
continue;
}
boolean ok = false;
if (view instanceof StickerEmojiCell) {
ok = ((StickerEmojiCell) view).showingBitmap();
} else if (view instanceof StickerCell) {
ok = ((StickerCell) view).showingBitmap();
} else if (view instanceof ContextLinkCell) {
ContextLinkCell cell = (ContextLinkCell) view;
ok = cell.isSticker() && cell.showingBitmap();
}
if (!ok) {
return false;
}
startX = x;
startY = y;
currentStickerPreviewCell = view;
openStickerPreviewRunnable = new Runnable() {
@Override
public void run() {
if (openStickerPreviewRunnable == null) {
return;
}
if (listView instanceof AbsListView) {
((AbsListView) listView).setOnItemClickListener(null);
((AbsListView) listView).requestDisallowInterceptTouchEvent(true);
} else if (listView instanceof RecyclerListView) {
((RecyclerListView) listView).setOnItemClickListener((RecyclerListView.OnItemClickListener) null);
((RecyclerListView) listView).requestDisallowInterceptTouchEvent(true);
}
openStickerPreviewRunnable = null;
setParentActivity((Activity) listView.getContext());
setKeyboardHeight(height);
if (currentStickerPreviewCell instanceof StickerEmojiCell) {
open(((StickerEmojiCell) currentStickerPreviewCell).getSticker(), ((StickerEmojiCell) currentStickerPreviewCell).isRecent());
((StickerEmojiCell) currentStickerPreviewCell).setScaled(true);
} else if (currentStickerPreviewCell instanceof StickerCell) {
open(((StickerCell) currentStickerPreviewCell).getSticker(), false);
((StickerCell) currentStickerPreviewCell).setScaled(true);
} else if (currentStickerPreviewCell instanceof ContextLinkCell) {
open(((ContextLinkCell) currentStickerPreviewCell).getDocument(), false);
((ContextLinkCell) currentStickerPreviewCell).setScaled(true);
}
}
};
AndroidUtilities.runOnUIThread(openStickerPreviewRunnable, 200);
return true;
}
}
return false;
}