use of org.telegram.ui.Cells.FeaturedStickerSetInfoCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class EmojiView method updateVisibleTrendingSets.
private void updateVisibleTrendingSets() {
if (stickersGridView == null) {
return;
}
try {
int count = stickersGridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = stickersGridView.getChildAt(a);
if (child instanceof FeaturedStickerSetInfoCell) {
RecyclerListView.Holder holder = (RecyclerListView.Holder) stickersGridView.getChildViewHolder(child);
if (holder == null) {
continue;
}
FeaturedStickerSetInfoCell cell = (FeaturedStickerSetInfoCell) child;
ArrayList<Long> unreadStickers = MediaDataController.getInstance(currentAccount).getUnreadStickerSets();
TLRPC.StickerSetCovered stickerSetCovered = cell.getStickerSet();
boolean unread = unreadStickers != null && unreadStickers.contains(stickerSetCovered.set.id);
boolean forceInstalled = false;
for (int i = 0; i < primaryInstallingStickerSets.length; i++) {
if (primaryInstallingStickerSets[i] != null && primaryInstallingStickerSets[i].set.id == stickerSetCovered.set.id) {
forceInstalled = true;
break;
}
}
cell.setStickerSet(stickerSetCovered, unread, true, 0, 0, forceInstalled);
if (unread) {
MediaDataController.getInstance(currentAccount).markFaturedStickersByIdAsRead(stickerSetCovered.set.id);
}
boolean installing = installingStickerSets.indexOfKey(stickerSetCovered.set.id) >= 0;
boolean removing = removingStickerSets.indexOfKey(stickerSetCovered.set.id) >= 0;
if (installing || removing) {
if (installing && cell.isInstalled()) {
installingStickerSets.remove(stickerSetCovered.set.id);
installing = false;
} else if (removing && !cell.isInstalled()) {
removingStickerSets.remove(stickerSetCovered.set.id);
removing = false;
}
}
cell.setAddDrawProgress(!forceInstalled && installing, true);
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
use of org.telegram.ui.Cells.FeaturedStickerSetInfoCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class StickersSearchAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = null;
switch(viewType) {
case 0:
StickerEmojiCell stickerEmojiCell = new StickerEmojiCell(context, false) {
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(82), MeasureSpec.EXACTLY));
}
};
view = stickerEmojiCell;
stickerEmojiCell.getImageView().setLayerNum(3);
break;
case 1:
view = new EmptyCell(context);
break;
case 2:
view = new StickerSetNameCell(context, false, true, resourcesProvider);
break;
case 3:
view = new FeaturedStickerSetInfoCell(context, 17, true, true, resourcesProvider);
((FeaturedStickerSetInfoCell) view).setAddOnClickListener(v -> {
final FeaturedStickerSetInfoCell cell = (FeaturedStickerSetInfoCell) v.getParent();
TLRPC.StickerSetCovered pack = cell.getStickerSet();
if (pack == null || installingStickerSets.indexOfKey(pack.set.id) >= 0 || removingStickerSets.indexOfKey(pack.set.id) >= 0) {
return;
}
if (cell.isInstalled()) {
removingStickerSets.put(pack.set.id, pack);
delegate.onStickerSetRemove(cell.getStickerSet());
} else {
installStickerSet(pack, cell);
}
});
break;
case 4:
view = new View(context);
break;
case 5:
LinearLayout layout = new LinearLayout(context);
layout.setOrientation(LinearLayout.VERTICAL);
layout.setGravity(Gravity.CENTER);
emptyImageView = new ImageView(context);
emptyImageView.setScaleType(ImageView.ScaleType.CENTER);
emptyImageView.setImageResource(R.drawable.stickers_empty);
emptyImageView.setColorFilter(new PorterDuffColorFilter(getThemedColor(Theme.key_chat_emojiPanelEmptyText), PorterDuff.Mode.MULTIPLY));
layout.addView(emptyImageView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
layout.addView(new Space(context), LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 15));
emptyTextView = new TextView(context);
emptyTextView.setText(LocaleController.getString("NoStickersFound", R.string.NoStickersFound));
emptyTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
emptyTextView.setTextColor(getThemedColor(Theme.key_chat_emojiPanelEmptyText));
layout.addView(emptyTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT));
view = layout;
view.setMinimumHeight(AndroidUtilities.dp(112));
view.setLayoutParams(LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
break;
}
return new RecyclerListView.Holder(view);
}
Aggregations