Search in sources :

Example 1 with StickerSetNameCell

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);
        }
    }
}
Also used : StickerEmojiCell(org.telegram.ui.Cells.StickerEmojiCell) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) StickerSetNameCell(org.telegram.ui.Cells.StickerSetNameCell)

Example 2 with StickerSetNameCell

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();
                }
            }
        }
    }
}
Also used : StickerEmojiCell(org.telegram.ui.Cells.StickerEmojiCell) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) StickerSetNameCell(org.telegram.ui.Cells.StickerSetNameCell)

Example 3 with StickerSetNameCell

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);
}
Also used : Space(android.widget.Space) EmptyCell(org.telegram.ui.Cells.EmptyCell) PorterDuffColorFilter(android.graphics.PorterDuffColorFilter) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) TextView(android.widget.TextView) RecyclerListView(org.telegram.ui.Components.RecyclerListView) StickerSetNameCell(org.telegram.ui.Cells.StickerSetNameCell) TLRPC(org.telegram.tgnet.TLRPC) FeaturedStickerSetInfoCell(org.telegram.ui.Cells.FeaturedStickerSetInfoCell) StickerEmojiCell(org.telegram.ui.Cells.StickerEmojiCell) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

View (android.view.View)3 ImageView (android.widget.ImageView)3 TextView (android.widget.TextView)3 RecyclerView (androidx.recyclerview.widget.RecyclerView)3 StickerEmojiCell (org.telegram.ui.Cells.StickerEmojiCell)3 StickerSetNameCell (org.telegram.ui.Cells.StickerSetNameCell)3 SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 LinearLayout (android.widget.LinearLayout)1 Space (android.widget.Space)1 TLRPC (org.telegram.tgnet.TLRPC)1 EmptyCell (org.telegram.ui.Cells.EmptyCell)1 FeaturedStickerSetInfoCell (org.telegram.ui.Cells.FeaturedStickerSetInfoCell)1 RecyclerListView (org.telegram.ui.Components.RecyclerListView)1