Java Code Examples for org.telegram.messenger.NotificationCenter#stickersDidLoad()

The following examples show how to use org.telegram.messenger.NotificationCenter#stickersDidLoad() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StickersActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.stickersDidLoad) {
        final int type = (int) args[0];
        if (type == currentType) {
            updateRows();
        } else if (currentType == MediaDataController.TYPE_IMAGE && type == MediaDataController.TYPE_MASK) {
            listAdapter.notifyItemChanged(masksRow);
        }
    } else if (id == NotificationCenter.featuredStickersDidLoad) {
        if (listAdapter != null) {
            listAdapter.notifyItemChanged(0);
        }
    } else if (id == NotificationCenter.archivedStickersCountDidLoad) {
        if ((Integer) args[0] == currentType) {
            updateRows();
        }
    }
}
 
Example 2
Source File: GroupStickersActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.stickersDidLoad) {
        if ((Integer) args[0] == MediaDataController.TYPE_IMAGE) {
            updateRows();
        }
    } else if (id == NotificationCenter.chatInfoDidLoad) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null && chatFull.stickerset != null) {
                selectedStickerSet = MediaDataController.getInstance(currentAccount).getGroupStickerSetById(chatFull.stickerset);
            }
            info = chatFull;
            updateRows();
        }
    } else if (id == NotificationCenter.groupStickersDidLoad) {
        long setId = (Long) args[0];
        if (info != null && info.stickerset != null && info.stickerset.id == id) {
            updateRows();
        }
    }
}
 
Example 3
Source File: TrendingStickersLayout.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.stickersDidLoad) {
        if ((Integer) args[0] == MediaDataController.TYPE_IMAGE) {
            if (loaded) {
                updateVisibleTrendingSets();
            } else {
                adapter.refreshStickerSets();
            }
        }
    } else if (id == NotificationCenter.featuredStickersDidLoad) {
        if (hash != MediaDataController.getInstance(currentAccount).getFeaturesStickersHashWithoutUnread()) {
            loaded = false;
        }
        if (loaded) {
            updateVisibleTrendingSets();
        } else {
            adapter.refreshStickerSets();
        }
    }
}
 
Example 4
Source File: StickerMasksAlert.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@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.emojiDidLoad) {
        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();
                }
            }
        }
    }
}
 
Example 5
Source File: StickersActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.stickersDidLoad) {
        final int type = (int) args[0];
        if (type == currentType) {
            updateRows();
        } else if (currentType == MediaDataController.TYPE_IMAGE && type == MediaDataController.TYPE_MASK) {
            listAdapter.notifyItemChanged(masksRow);
        }
    } else if (id == NotificationCenter.featuredStickersDidLoad) {
        if (listAdapter != null) {
            listAdapter.notifyItemChanged(0);
        }
    } else if (id == NotificationCenter.archivedStickersCountDidLoad) {
        if ((Integer) args[0] == currentType) {
            updateRows();
        }
    }
}
 
Example 6
Source File: GroupStickersActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.stickersDidLoad) {
        if ((Integer) args[0] == MediaDataController.TYPE_IMAGE) {
            updateRows();
        }
    } else if (id == NotificationCenter.chatInfoDidLoad) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null && chatFull.stickerset != null) {
                selectedStickerSet = MediaDataController.getInstance(currentAccount).getGroupStickerSetById(chatFull.stickerset);
            }
            info = chatFull;
            updateRows();
        }
    } else if (id == NotificationCenter.groupStickersDidLoad) {
        long setId = (Long) args[0];
        if (info != null && info.stickerset != null && info.stickerset.id == id) {
            updateRows();
        }
    }
}
 
Example 7
Source File: TrendingStickersLayout.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.stickersDidLoad) {
        if ((Integer) args[0] == MediaDataController.TYPE_IMAGE) {
            if (loaded) {
                updateVisibleTrendingSets();
            } else {
                adapter.refreshStickerSets();
            }
        }
    } else if (id == NotificationCenter.featuredStickersDidLoad) {
        if (hash != MediaDataController.getInstance(currentAccount).getFeaturesStickersHashWithoutUnread()) {
            loaded = false;
        }
        if (loaded) {
            updateVisibleTrendingSets();
        } else {
            adapter.refreshStickerSets();
        }
    }
}
 
Example 8
Source File: StickerMasksAlert.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@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.emojiDidLoad) {
        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();
                }
            }
        }
    }
}
 
Example 9
Source File: ArchivedStickersActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.needAddArchivedStickers) {
        final List<TLRPC.StickerSetCovered> newSets = new ArrayList<>((List<TLRPC.StickerSetCovered>) args[0]);
        for (int i = newSets.size() - 1; i >= 0; i--) {
            for (int j = 0, size2 = sets.size(); j < size2; j++) {
                if (sets.get(j).set.id == newSets.get(i).set.id) {
                    newSets.remove(i);
                    break;
                }
            }
        }
        if (!newSets.isEmpty()) {
            sets.addAll(0, newSets);
            updateRows();
            if (listAdapter != null) {
                listAdapter.notifyItemRangeInserted(stickersStartRow, newSets.size());
            }
        }
    } else if (id == NotificationCenter.stickersDidLoad) {
        if (listView != null) {
            for (int i = 0, size = listView.getChildCount(); i < size; i++) {
                final View view = listView.getChildAt(i);
                if (view instanceof ArchivedStickerSetCell) {
                    final ArchivedStickerSetCell cell = (ArchivedStickerSetCell) view;
                    final TLRPC.StickerSetCovered stickersSet = cell.getStickersSet();
                    if (stickersSet != null) {
                        final boolean isInstalled = MediaDataController.getInstance(currentAccount).isStickerPackInstalled(stickersSet.set.id);
                        if (isInstalled) {
                            installingStickerSets.remove(stickersSet.set.id);
                            cell.setDrawProgress(false, true);
                        }
                        cell.setChecked(isInstalled, true, false);
                    }
                }
            }
        }
    }
}
 
Example 10
Source File: FeaturedStickersActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.featuredStickersDidLoad) {
        if (unreadStickers == null) {
            unreadStickers = MediaDataController.getInstance(currentAccount).getUnreadStickerSets();
        }
        updateRows();
    } else if (id == NotificationCenter.stickersDidLoad) {
        updateVisibleTrendingSets();
    }
}
 
Example 11
Source File: ArchivedStickersActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.needAddArchivedStickers) {
        final List<TLRPC.StickerSetCovered> newSets = new ArrayList<>((List<TLRPC.StickerSetCovered>) args[0]);
        for (int i = newSets.size() - 1; i >= 0; i--) {
            for (int j = 0, size2 = sets.size(); j < size2; j++) {
                if (sets.get(j).set.id == newSets.get(i).set.id) {
                    newSets.remove(i);
                    break;
                }
            }
        }
        if (!newSets.isEmpty()) {
            sets.addAll(0, newSets);
            updateRows();
            if (listAdapter != null) {
                listAdapter.notifyItemRangeInserted(stickersStartRow, newSets.size());
            }
        }
    } else if (id == NotificationCenter.stickersDidLoad) {
        if (listView != null) {
            for (int i = 0, size = listView.getChildCount(); i < size; i++) {
                final View view = listView.getChildAt(i);
                if (view instanceof ArchivedStickerSetCell) {
                    final ArchivedStickerSetCell cell = (ArchivedStickerSetCell) view;
                    final TLRPC.StickerSetCovered stickersSet = cell.getStickersSet();
                    if (stickersSet != null) {
                        final boolean isInstalled = MediaDataController.getInstance(currentAccount).isStickerPackInstalled(stickersSet.set.id);
                        if (isInstalled) {
                            installingStickerSets.remove(stickersSet.set.id);
                            cell.setDrawProgress(false, true);
                        }
                        cell.setChecked(isInstalled, true, false);
                    }
                }
            }
        }
    }
}
 
Example 12
Source File: FeaturedStickersActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void didReceivedNotification(int id, int account, Object... args) {
    if (id == NotificationCenter.featuredStickersDidLoad) {
        if (unreadStickers == null) {
            unreadStickers = MediaDataController.getInstance(currentAccount).getUnreadStickerSets();
        }
        updateRows();
    } else if (id == NotificationCenter.stickersDidLoad) {
        updateVisibleTrendingSets();
    }
}