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

The following examples show how to use org.telegram.messenger.NotificationCenter#chatInfoDidLoaded() . 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: GroupInviteActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull info = (TLRPC.ChatFull) args[0];
        int guid = (int) args[1];
        if (info.id == chat_id && guid == classGuid) {
            invite = MessagesController.getInstance(currentAccount).getExportedInvite(chat_id);
            if (!(invite instanceof TLRPC.TL_chatInviteExported)) {
                generateLink(false);
            } else {
                loading = false;
                if (listAdapter != null) {
                    listAdapter.notifyDataSetChanged();
                }
            }
        }
    }
}
 
Example 2
Source File: GroupStickersActivity.java    From TelePlus-Android 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.stickersDidLoaded) {
        if ((Integer) args[0] == DataQuery.TYPE_IMAGE) {
            updateRows();
        }
    } else if (id == NotificationCenter.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null && chatFull.stickerset != null) {
                selectedStickerSet = DataQuery.getInstance(currentAccount).getGroupStickerSetById(chatFull.stickerset);
            }
            info = chatFull;
            updateRows();
        }
    } else if (id == NotificationCenter.groupStickersDidLoaded) {
        long setId = (Long) args[0];
        if (info != null && info.stickerset != null && info.stickerset.id == id) {
            updateRows();
        }
    }
}
 
Example 3
Source File: ChannelPermissionsActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null) {
                historyHidden = chatFull.hidden_prehistory;
                if (radioButtonCell3 != null) {
                    radioButtonCell3.setChecked(!historyHidden, false);
                    radioButtonCell4.setChecked(historyHidden, false);
                }
            }
            info = chatFull;
        }
    }
}
 
Example 4
Source File: ChannelEditInfoActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null) {
                descriptionTextView.setText(chatFull.about);
                historyHidden = chatFull.hidden_prehistory;
                if (radioButtonCell3 != null) {
                    radioButtonCell3.setChecked(!historyHidden, false);
                    radioButtonCell4.setChecked(historyHidden, false);
                }
            }
            info = chatFull;
            invite = chatFull.exported_invite;
            updatePrivatePublic();
        }
    }
}
 
Example 5
Source File: SetAdminsActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chat_id) {
            info = chatFull;
            updateChatParticipants();
            updateRowsIds();
        }
    } else if (id == NotificationCenter.updateInterfaces) {
        int mask = (Integer) args[0];
        if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
            if (listView != null) {
                int count = listView.getChildCount();
                for (int a = 0; a < count; a++) {
                    View child = listView.getChildAt(a);
                    if (child instanceof UserCell) {
                        ((UserCell) child).update(mask);
                    }
                }
            }
        }
    }
}
 
Example 6
Source File: GroupInviteActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull info = (TLRPC.ChatFull) args[0];
        int guid = (int) args[1];
        if (info.id == chat_id && guid == classGuid) {
            invite = MessagesController.getInstance(currentAccount).getExportedInvite(chat_id);
            if (!(invite instanceof TLRPC.TL_chatInviteExported)) {
                generateLink(false);
            } else {
                loading = false;
                if (listAdapter != null) {
                    listAdapter.notifyDataSetChanged();
                }
            }
        }
    }
}
 
Example 7
Source File: GroupStickersActivity.java    From TelePlus-Android 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.stickersDidLoaded) {
        if ((Integer) args[0] == DataQuery.TYPE_IMAGE) {
            updateRows();
        }
    } else if (id == NotificationCenter.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null && chatFull.stickerset != null) {
                selectedStickerSet = DataQuery.getInstance(currentAccount).getGroupStickerSetById(chatFull.stickerset);
            }
            info = chatFull;
            updateRows();
        }
    } else if (id == NotificationCenter.groupStickersDidLoaded) {
        long setId = (Long) args[0];
        if (info != null && info.stickerset != null && info.stickerset.id == id) {
            updateRows();
        }
    }
}
 
Example 8
Source File: ChannelPermissionsActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null) {
                historyHidden = chatFull.hidden_prehistory;
                if (radioButtonCell3 != null) {
                    radioButtonCell3.setChecked(!historyHidden, false);
                    radioButtonCell4.setChecked(historyHidden, false);
                }
            }
            info = chatFull;
        }
    }
}
 
Example 9
Source File: ChannelEditInfoActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chatId) {
            if (info == null) {
                descriptionTextView.setText(chatFull.about);
                historyHidden = chatFull.hidden_prehistory;
                if (radioButtonCell3 != null) {
                    radioButtonCell3.setChecked(!historyHidden, false);
                    radioButtonCell4.setChecked(historyHidden, false);
                }
            }
            info = chatFull;
            invite = chatFull.exported_invite;
            updatePrivatePublic();
        }
    }
}
 
Example 10
Source File: SetAdminsActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chat_id) {
            info = chatFull;
            updateChatParticipants();
            updateRowsIds();
        }
    } else if (id == NotificationCenter.updateInterfaces) {
        int mask = (Integer) args[0];
        if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
            if (listView != null) {
                int count = listView.getChildCount();
                for (int a = 0; a < count; a++) {
                    View child = listView.getChildAt(a);
                    if (child instanceof UserCell) {
                        ((UserCell) child).update(mask);
                    }
                }
            }
        }
    }
}
 
Example 11
Source File: ChatUsersActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        boolean byChannelUsers = (Boolean) args[2];
        if (chatFull.id == chatId && !byChannelUsers) {
            info = chatFull;
            fetchUsers();
            updateRows();
        }
    }
}
 
Example 12
Source File: ChannelUsersActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        boolean byChannelUsers = (Boolean) args[2];
        if (chatFull.id == chatId && !byChannelUsers) {
            AndroidUtilities.runOnUIThread(() -> {
                firstEndReached = false;
                getChannelParticipants(0, 200);
            });
        }
    }
}
 
Example 13
Source File: ChannelEditActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chat_id) {
            boolean byChannelUsers = (Boolean) args[2];
            if (info instanceof TLRPC.TL_channelFull) {
                if (chatFull.participants == null && info != null) {
                    chatFull.participants = info.participants;
                }
            }
            boolean loadChannelParticipants = info == null && chatFull instanceof TLRPC.TL_channelFull;
            info = chatFull;
            fetchUsersFromChannelInfo();
            updateRowsIds();
            if (listViewAdapter != null) {
                listViewAdapter.notifyDataSetChanged();
            }
            TLRPC.Chat newChat = MessagesController.getInstance(currentAccount).getChat(chat_id);
            if (newChat != null) {
                currentChat = newChat;
            }
            if (loadChannelParticipants || !byChannelUsers) {
                getChannelParticipants(true);
            }
        }
    } else if (id == NotificationCenter.closeChats) {
        removeSelfFromStack();
    }
}
 
Example 14
Source File: ChatUsersActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        boolean byChannelUsers = (Boolean) args[2];
        if (chatFull.id == chatId && !byChannelUsers) {
            info = chatFull;
            fetchUsers();
            updateRows();
        }
    }
}
 
Example 15
Source File: ChannelUsersActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        boolean byChannelUsers = (Boolean) args[2];
        if (chatFull.id == chatId && !byChannelUsers) {
            AndroidUtilities.runOnUIThread(() -> {
                firstEndReached = false;
                getChannelParticipants(0, 200);
            });
        }
    }
}
 
Example 16
Source File: ChannelEditActivity.java    From TelePlus-Android 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.chatInfoDidLoaded) {
        TLRPC.ChatFull chatFull = (TLRPC.ChatFull) args[0];
        if (chatFull.id == chat_id) {
            boolean byChannelUsers = (Boolean) args[2];
            if (info instanceof TLRPC.TL_channelFull) {
                if (chatFull.participants == null && info != null) {
                    chatFull.participants = info.participants;
                }
            }
            boolean loadChannelParticipants = info == null && chatFull instanceof TLRPC.TL_channelFull;
            info = chatFull;
            fetchUsersFromChannelInfo();
            updateRowsIds();
            if (listViewAdapter != null) {
                listViewAdapter.notifyDataSetChanged();
            }
            TLRPC.Chat newChat = MessagesController.getInstance(currentAccount).getChat(chat_id);
            if (newChat != null) {
                currentChat = newChat;
            }
            if (loadChannelParticipants || !byChannelUsers) {
                getChannelParticipants(true);
            }
        }
    } else if (id == NotificationCenter.closeChats) {
        removeSelfFromStack();
    }
}