本文整理汇总了Java中org.telegram.ui.Cells.ContextLinkCell类的典型用法代码示例。如果您正苦于以下问题:Java ContextLinkCell类的具体用法?Java ContextLinkCell怎么用?Java ContextLinkCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContextLinkCell类属于org.telegram.ui.Cells包,在下文中一共展示了ContextLinkCell类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reset
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
public void reset() {
if (openStickerPreviewRunnable != null) {
AndroidUtilities.cancelRunOnUIThread(openStickerPreviewRunnable);
openStickerPreviewRunnable = null;
}
if (currentStickerPreviewCell != null) {
if (currentStickerPreviewCell instanceof StickerEmojiCell) {
((StickerEmojiCell) currentStickerPreviewCell).setScaled(false);
} else if (currentStickerPreviewCell instanceof StickerCell) {
((StickerCell) currentStickerPreviewCell).setScaled(false);
} else if (currentStickerPreviewCell instanceof ContextLinkCell) {
((ContextLinkCell) currentStickerPreviewCell).setScaled(false);
}
currentStickerPreviewCell = null;
}
}
示例2: onBindViewHolder
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (searchResultBotContext != null) {
boolean hasTop = searchResultBotContextSwitch != null;
if (holder.getItemViewType() == 2) {
if (hasTop) {
((BotSwitchCell) holder.itemView).setText(searchResultBotContextSwitch.text);
}
} else {
if (hasTop) {
position--;
}
((ContextLinkCell) holder.itemView).setLink(searchResultBotContext.get(position), contextMedia, position != searchResultBotContext.size() - 1, hasTop && position == 0);
}
} else {
if (searchResultUsernames != null) {
((MentionCell) holder.itemView).setUser(searchResultUsernames.get(position));
} else if (searchResultHashtags != null) {
((MentionCell) holder.itemView).setText(searchResultHashtags.get(position));
} else if (searchResultCommands != null) {
((MentionCell) holder.itemView).setBotCommand(searchResultCommands.get(position), searchResultCommandsHelp.get(position), searchResultCommandsUsers != null ? searchResultCommandsUsers.get(position) : null);
}
}
}
示例3: 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;
}
示例4: onBindViewHolder
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
MediaController.SearchImage photoEntry = recentImages.get(i);
if (photoEntry.document != null) {
((ContextLinkCell) viewHolder.itemView).setGif(photoEntry.document, false);
}
}
示例5: getPlaceForPhoto
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
if (index < 0 || index >= botContextResults.size()) {
return null;
}
int count = mentionListView.getChildCount();
Object result = botContextResults.get(index);
for (int a = 0; a < count; a++) {
ImageReceiver imageReceiver = null;
View view = mentionListView.getChildAt(a);
if (view instanceof ContextLinkCell) {
ContextLinkCell cell = (ContextLinkCell) view;
if (cell.getResult() == result) {
imageReceiver = cell.getPhotoImage();
}
}
if (imageReceiver != null) {
int coords[] = new int[2];
view.getLocationInWindow(coords);
PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
object.viewX = coords[0];
object.viewY = coords[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
object.parentView = mentionListView;
object.imageReceiver = imageReceiver;
object.thumb = imageReceiver.getBitmap();
object.radius = imageReceiver.getRoundRadius();
return object;
}
}
return null;
}
示例6: onBindViewHolder
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
TLRPC.Document document = recentGifs.get(i);
if (document != null) {
((ContextLinkCell) viewHolder.itemView).setGif(document, false);
}
}
示例7: onBindViewHolder
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (holder.getItemViewType() == 3) {
TextView textView = (TextView) holder.itemView;
TLRPC.Chat chat = parentFragment.getCurrentChat();
if (chat != null) {
if (AndroidUtilities.isBannedForever(chat.banned_rights.until_date)) {
textView.setText(LocaleController.getString("AttachInlineRestrictedForever", R.string.AttachInlineRestrictedForever));
} else {
textView.setText(LocaleController.formatString("AttachInlineRestricted", R.string.AttachInlineRestricted, LocaleController.formatDateForBan(chat.banned_rights.until_date)));
}
}
} else if (searchResultBotContext != null) {
boolean hasTop = searchResultBotContextSwitch != null;
if (holder.getItemViewType() == 2) {
if (hasTop) {
((BotSwitchCell) holder.itemView).setText(searchResultBotContextSwitch.text);
}
} else {
if (hasTop) {
position--;
}
((ContextLinkCell) holder.itemView).setLink(searchResultBotContext.get(position), contextMedia, position != searchResultBotContext.size() - 1, hasTop && position == 0);
}
} else {
if (searchResultUsernames != null) {
((MentionCell) holder.itemView).setUser(searchResultUsernames.get(position));
} else if (searchResultHashtags != null) {
((MentionCell) holder.itemView).setText(searchResultHashtags.get(position));
} else if (searchResultSuggestions != null) {
((MentionCell) holder.itemView).setEmojiSuggestion(searchResultSuggestions.get(position));
} else if (searchResultCommands != null) {
((MentionCell) holder.itemView).setBotCommand(searchResultCommands.get(position), searchResultCommandsHelp.get(position), searchResultCommandsUsers != null ? searchResultCommandsUsers.get(position) : null);
}
}
}
示例8: onCreateViewHolder
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
ContextLinkCell view = new ContextLinkCell(mContext);
return new Holder(view);
}
示例9: 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;
}
示例10: onCreateViewHolder
import org.telegram.ui.Cells.ContextLinkCell; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
ContextLinkCell view = new ContextLinkCell(mContext);
return new RecyclerListView.Holder(view);
}