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

The following examples show how to use org.telegram.messenger.NotificationCenter#contactsDidLoad() . 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: GroupCreateActivity.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.contactsDidLoad) {
        if (emptyView != null) {
            emptyView.showTextView();
        }
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
    } else if (id == NotificationCenter.updateInterfaces) {
        if (listView != null) {
            int mask = (Integer) args[0];
            int count = listView.getChildCount();
            if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
                for (int a = 0; a < count; a++) {
                    View child = listView.getChildAt(a);
                    if (child instanceof GroupCreateUserCell) {
                        ((GroupCreateUserCell) child).update(mask);
                    }
                }
            }
        }
    } else if (id == NotificationCenter.chatDidCreated) {
        removeSelfFromStack();
    }
}
 
Example 2
Source File: FilterUsersActivity.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.contactsDidLoad) {
        if (emptyView != null) {
            emptyView.showTextView();
        }
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
    } else if (id == NotificationCenter.updateInterfaces) {
        if (listView != null) {
            int mask = (Integer) args[0];
            int count = listView.getChildCount();
            if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
                for (int a = 0; a < count; a++) {
                    View child = listView.getChildAt(a);
                    if (child instanceof GroupCreateUserCell) {
                        ((GroupCreateUserCell) child).update(mask);
                    }
                }
            }
        }
    } else if (id == NotificationCenter.chatDidCreated) {
        removeSelfFromStack();
    }
}
 
Example 3
Source File: GroupCreateActivity.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.contactsDidLoad) {
        if (emptyView != null) {
            emptyView.showTextView();
        }
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
    } else if (id == NotificationCenter.updateInterfaces) {
        if (listView != null) {
            int mask = (Integer) args[0];
            int count = listView.getChildCount();
            if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
                for (int a = 0; a < count; a++) {
                    View child = listView.getChildAt(a);
                    if (child instanceof GroupCreateUserCell) {
                        ((GroupCreateUserCell) child).update(mask);
                    }
                }
            }
        }
    } else if (id == NotificationCenter.chatDidCreated) {
        removeSelfFromStack();
    }
}
 
Example 4
Source File: FilterUsersActivity.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.contactsDidLoad) {
        if (emptyView != null) {
            emptyView.showTextView();
        }
        if (adapter != null) {
            adapter.notifyDataSetChanged();
        }
    } else if (id == NotificationCenter.updateInterfaces) {
        if (listView != null) {
            int mask = (Integer) args[0];
            int count = listView.getChildCount();
            if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0 || (mask & MessagesController.UPDATE_MASK_STATUS) != 0) {
                for (int a = 0; a < count; a++) {
                    View child = listView.getChildAt(a);
                    if (child instanceof GroupCreateUserCell) {
                        ((GroupCreateUserCell) child).update(mask);
                    }
                }
            }
        }
    } else if (id == NotificationCenter.chatDidCreated) {
        removeSelfFromStack();
    }
}
 
Example 5
Source File: ContactsActivity.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.contactsDidLoad) {
        if (listViewAdapter != null) {
            listViewAdapter.notifyDataSetChanged();
        }
    } 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) {
            updateVisibleRows(mask);
        }
        if ((mask & MessagesController.UPDATE_MASK_STATUS) != 0 && !sortByName && listViewAdapter != null) {
            listViewAdapter.sortOnlineContacts();
        }
    } else if (id == NotificationCenter.encryptedChatCreated) {
        if (createSecretChat && creatingChat) {
            TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat) args[0];
            Bundle args2 = new Bundle();
            args2.putInt("enc_id", encryptedChat.id);
            NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
            presentFragment(new ChatActivity(args2), true);
        }
    } else if (id == NotificationCenter.closeChats) {
        if (!creatingChat) {
            removeSelfFromStack();
        }
    }
}
 
Example 6
Source File: ChatAttachAlertContactsLayout.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.contactsDidLoad) {
        if (listAdapter != null) {
            listAdapter.notifyDataSetChanged();
        }
    }
}
 
Example 7
Source File: ContactsActivity.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.contactsDidLoad) {
        if (listViewAdapter != null) {
            listViewAdapter.notifyDataSetChanged();
        }
    } 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) {
            updateVisibleRows(mask);
        }
        if ((mask & MessagesController.UPDATE_MASK_STATUS) != 0 && !sortByName && listViewAdapter != null) {
            listViewAdapter.sortOnlineContacts();
        }
    } else if (id == NotificationCenter.encryptedChatCreated) {
        if (createSecretChat && creatingChat) {
            TLRPC.EncryptedChat encryptedChat = (TLRPC.EncryptedChat) args[0];
            Bundle args2 = new Bundle();
            args2.putInt("enc_id", encryptedChat.id);
            NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.closeChats);
            presentFragment(new ChatActivity(args2), true);
        }
    } else if (id == NotificationCenter.closeChats) {
        if (!creatingChat) {
            removeSelfFromStack();
        }
    }
}
 
Example 8
Source File: ChatAttachAlertContactsLayout.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.contactsDidLoad) {
        if (listAdapter != null) {
            listAdapter.notifyDataSetChanged();
        }
    }
}