use of org.telegram.ui.Cells.StickerSetNameCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class EmojiView method didReceivedNotification.
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.stickersDidLoad) {
if ((Integer) args[0] == MediaDataController.TYPE_IMAGE) {
updateStickerTabs();
updateVisibleTrendingSets();
reloadStickersAdapter();
checkPanels();
}
} else if (id == NotificationCenter.recentDocumentsDidLoad) {
boolean isGif = (Boolean) args[0];
int type = (Integer) args[1];
if (isGif || type == MediaDataController.TYPE_IMAGE || type == MediaDataController.TYPE_FAVE) {
checkDocuments(isGif);
}
} else if (id == NotificationCenter.featuredStickersDidLoad) {
updateVisibleTrendingSets();
if (typeTabs != null) {
int count = typeTabs.getChildCount();
for (int a = 0; a < count; a++) {
typeTabs.getChildAt(a).invalidate();
}
}
updateStickerTabs();
} else if (id == NotificationCenter.groupStickersDidLoad) {
if (info != null && info.stickerset != null && info.stickerset.id == (Long) args[0]) {
updateStickerTabs();
}
} else if (id == NotificationCenter.emojiLoaded) {
if (stickersGridView != null) {
int count = stickersGridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = stickersGridView.getChildAt(a);
if (child instanceof StickerSetNameCell || child instanceof StickerEmojiCell) {
child.invalidate();
}
}
}
if (pickerView != null) {
pickerView.invalidate();
}
if (gifTabs != null) {
gifTabs.invalidateTabs();
}
} else if (id == NotificationCenter.newEmojiSuggestionsAvailable) {
if (emojiGridView != null && needEmojiSearch && (emojiSearchField.progressDrawable.isAnimating() || emojiGridView.getAdapter() == emojiSearchAdapter) && !TextUtils.isEmpty(emojiSearchAdapter.lastSearchEmojiString)) {
emojiSearchAdapter.search(emojiSearchAdapter.lastSearchEmojiString);
}
}
}
use of org.telegram.ui.Cells.StickerSetNameCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class StickerMasksAlert method didReceivedNotification.
@Override
public void didReceivedNotification(int id, int account, Object... args) {
if (id == NotificationCenter.stickersDidLoad) {
if ((Integer) args[0] == currentType) {
updateStickerTabs();
reloadStickersAdapter();
checkPanels();
}
} else if (id == NotificationCenter.recentDocumentsDidLoad) {
boolean isGif = (Boolean) args[0];
int type = (Integer) args[1];
if (!isGif && (type == currentType || type == MediaDataController.TYPE_FAVE)) {
checkDocuments(false);
}
} else if (id == NotificationCenter.emojiLoaded) {
if (gridView != null) {
int count = gridView.getChildCount();
for (int a = 0; a < count; a++) {
View child = gridView.getChildAt(a);
if (child instanceof StickerSetNameCell || child instanceof StickerEmojiCell) {
child.invalidate();
}
}
}
}
}
use of org.telegram.ui.Cells.StickerSetNameCell 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