Java Code Examples for org.telegram.messenger.NotificationCenter#needDeleteDialog()
The following examples show how to use
org.telegram.messenger.NotificationCenter#needDeleteDialog() .
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: PeopleNearbyActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void didReceivedNotification(int id, int account, Object... args) { if (id == NotificationCenter.newLocationAvailable) { sendRequest(false, 0); } else if (id == NotificationCenter.newPeopleNearbyAvailable) { TLRPC.TL_updatePeerLocated update = (TLRPC.TL_updatePeerLocated) args[0]; for (int b = 0, N2 = update.peers.size(); b < N2; b++) { TLRPC.PeerLocated object = update.peers.get(b); if (object instanceof TLRPC.TL_peerLocated) { TLRPC.TL_peerLocated peerLocated = (TLRPC.TL_peerLocated) object; boolean found = false; ArrayList<TLRPC.TL_peerLocated> arrayList; if (peerLocated.peer instanceof TLRPC.TL_peerUser) { arrayList = users; } else { arrayList = chats; } for (int a = 0, N = arrayList.size(); a < N; a++) { TLRPC.TL_peerLocated old = arrayList.get(a); if (old.peer.user_id != 0 && old.peer.user_id == peerLocated.peer.user_id || old.peer.chat_id != 0 && old.peer.chat_id == peerLocated.peer.chat_id || old.peer.channel_id != 0 && old.peer.channel_id == peerLocated.peer.channel_id) { arrayList.set(a, peerLocated); found = true; } } if (!found) { arrayList.add(peerLocated); } } } checkForExpiredLocations(true); updateRows(); } else if (id == NotificationCenter.needDeleteDialog) { if (fragmentView == null || isPaused) { return; } long dialogId = (Long) args[0]; TLRPC.User user = (TLRPC.User) args[1]; TLRPC.Chat chat = (TLRPC.Chat) args[2]; boolean revoke = (Boolean) args[3]; Runnable deleteRunnable = () -> { if (chat != null) { if (ChatObject.isNotInChat(chat)) { getMessagesController().deleteDialog(dialogId, 0, revoke); } else { getMessagesController().deleteUserFromChat((int) -dialogId, getMessagesController().getUser(getUserConfig().getClientUserId()), null, false, revoke); } } else { getMessagesController().deleteDialog(dialogId, 0, revoke); } }; if (undoView != null) { undoView.showWithAction(dialogId, UndoView.ACTION_DELETE, deleteRunnable); } else { deleteRunnable.run(); } } }
Example 2
Source File: PeopleNearbyActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public void didReceivedNotification(int id, int account, Object... args) { if (id == NotificationCenter.newLocationAvailable) { sendRequest(false, 0); } else if (id == NotificationCenter.newPeopleNearbyAvailable) { TLRPC.TL_updatePeerLocated update = (TLRPC.TL_updatePeerLocated) args[0]; for (int b = 0, N2 = update.peers.size(); b < N2; b++) { TLRPC.PeerLocated object = update.peers.get(b); if (object instanceof TLRPC.TL_peerLocated) { TLRPC.TL_peerLocated peerLocated = (TLRPC.TL_peerLocated) object; boolean found = false; ArrayList<TLRPC.TL_peerLocated> arrayList; if (peerLocated.peer instanceof TLRPC.TL_peerUser) { arrayList = users; } else { arrayList = chats; } for (int a = 0, N = arrayList.size(); a < N; a++) { TLRPC.TL_peerLocated old = arrayList.get(a); if (old.peer.user_id != 0 && old.peer.user_id == peerLocated.peer.user_id || old.peer.chat_id != 0 && old.peer.chat_id == peerLocated.peer.chat_id || old.peer.channel_id != 0 && old.peer.channel_id == peerLocated.peer.channel_id) { arrayList.set(a, peerLocated); found = true; } } if (!found) { arrayList.add(peerLocated); } } } checkForExpiredLocations(true); updateRows(); } else if (id == NotificationCenter.needDeleteDialog) { if (fragmentView == null || isPaused) { return; } long dialogId = (Long) args[0]; TLRPC.User user = (TLRPC.User) args[1]; TLRPC.Chat chat = (TLRPC.Chat) args[2]; boolean revoke = (Boolean) args[3]; Runnable deleteRunnable = () -> { if (chat != null) { if (ChatObject.isNotInChat(chat)) { getMessagesController().deleteDialog(dialogId, 0, revoke); } else { getMessagesController().deleteUserFromChat((int) -dialogId, getMessagesController().getUser(getUserConfig().getClientUserId()), null, false, revoke); } } else { getMessagesController().deleteDialog(dialogId, 0, revoke); } }; if (undoView != null) { undoView.showWithAction(dialogId, UndoView.ACTION_DELETE, deleteRunnable); } else { deleteRunnable.run(); } } }