Java Code Examples for org.telegram.messenger.MessagesController#getInputChannel()

The following examples show how to use org.telegram.messenger.MessagesController#getInputChannel() . 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: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void loadAdmins() {
    TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.filter = new TLRPC.TL_channelParticipantsAdmins();
    req.offset = 0;
    req.limit = 200;
    int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
        @Override
        public void run(final TLObject response, final TLRPC.TL_error error) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public void run() {
                    if (error == null) {
                        TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
                        MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                        admins = res.participants;
                        if (visibleDialog instanceof AdminLogFilterAlert) {
                            ((AdminLogFilterAlert) visibleDialog).setCurrentAdmins(admins);
                        }
                    }
                }
            });
        }
    });
    ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
}
 
Example 2
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void loadAdmins() {
    TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.filter = new TLRPC.TL_channelParticipantsAdmins();
    req.offset = 0;
    req.limit = 200;
    int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
        @Override
        public void run(final TLObject response, final TLRPC.TL_error error) {
            AndroidUtilities.runOnUIThread(new Runnable() {
                @Override
                public void run() {
                    if (error == null) {
                        TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
                        MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                        admins = res.participants;
                        if (visibleDialog instanceof AdminLogFilterAlert) {
                            ((AdminLogFilterAlert) visibleDialog).setCurrentAdmins(admins);
                        }
                    }
                }
            });
        }
    });
    ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
}
 
Example 3
Source File: ChannelAdminLogActivity.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void loadAdmins() {
    TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.filter = new TLRPC.TL_channelParticipantsAdmins();
    req.offset = 0;
    req.limit = 200;
    int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
            MessagesController.getInstance(currentAccount).putUsers(res.users, false);
            admins = res.participants;
            if (visibleDialog instanceof AdminLogFilterAlert) {
                ((AdminLogFilterAlert) visibleDialog).setCurrentAdmins(admins);
            }
        }
    }));
    ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
}
 
Example 4
Source File: ChannelAdminLogActivity.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void loadAdmins() {
    TLRPC.TL_channels_getParticipants req = new TLRPC.TL_channels_getParticipants();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.filter = new TLRPC.TL_channelParticipantsAdmins();
    req.offset = 0;
    req.limit = 200;
    int reqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (error == null) {
            TLRPC.TL_channels_channelParticipants res = (TLRPC.TL_channels_channelParticipants) response;
            MessagesController.getInstance(currentAccount).putUsers(res.users, false);
            admins = res.participants;
            if (visibleDialog instanceof AdminLogFilterAlert) {
                ((AdminLogFilterAlert) visibleDialog).setCurrentAdmins(admins);
            }
        }
    }));
    ConnectionsManager.getInstance(currentAccount).bindRequestToGuid(reqId, classGuid);
}
 
Example 5
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void loadMessages(boolean reset) {
    if (loading) {
        return;
    }
    if (reset) {
        minEventId = Long.MAX_VALUE;
        if (progressView != null) {
            progressView.setVisibility(View.VISIBLE);
            emptyViewContainer.setVisibility(View.INVISIBLE);
            chatListView.setEmptyView(null);
        }
        messagesDict.clear();
        messages.clear();
        messagesByDays.clear();
    }
    loading = true;
    TLRPC.TL_channels_getAdminLog req = new TLRPC.TL_channels_getAdminLog();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.q = searchQuery;
    req.limit = 50;
    if (!reset && !messages.isEmpty()) {
        req.max_id = minEventId;
    } else {
        req.max_id = 0;
    }
    req.min_id = 0;
    if (currentFilter != null) {
        req.flags |= 1;
        req.events_filter = currentFilter;
    }
    if (selectedAdmins != null) {
        req.flags |= 2;
        for (int a = 0; a < selectedAdmins.size(); a++) {
            req.admins.add(MessagesController.getInstance(currentAccount).getInputUser(selectedAdmins.valueAt(a)));
        }
    }
    updateEmptyPlaceholder();
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
        @Override
        public void run(TLObject response, TLRPC.TL_error error) {
            if (response != null) {
                final TLRPC.TL_channels_adminLogResults res = (TLRPC.TL_channels_adminLogResults) response;
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                        MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                        boolean added = false;
                        int oldRowsCount = messages.size();
                        for (int a = 0; a < res.events.size(); a++) {
                            TLRPC.TL_channelAdminLogEvent event = res.events.get(a);
                            if (messagesDict.indexOfKey(event.id) >= 0) {
                                continue;
                            }
                            minEventId = Math.min(minEventId, event.id);
                            added = true;
                            MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid);
                            if (messageObject.contentType < 0) {
                                continue;
                            }
                            messagesDict.put(event.id, messageObject);
                        }
                        int newRowsCount = messages.size() - oldRowsCount;
                        loading = false;
                        if (!added) {
                            endReached = true;
                        }
                        progressView.setVisibility(View.INVISIBLE);
                        chatListView.setEmptyView(emptyViewContainer);
                        if (newRowsCount != 0) {
                            boolean end = false;
                            if (endReached) {
                                end = true;
                                chatAdapter.notifyItemRangeChanged(0, 2);
                            }
                            int firstVisPos = chatLayoutManager.findLastVisibleItemPosition();
                            View firstVisView = chatLayoutManager.findViewByPosition(firstVisPos);
                            int top = ((firstVisView == null) ? 0 : firstVisView.getTop()) - chatListView.getPaddingTop();
                            if (newRowsCount - (end ? 1 : 0) > 0) {
                                int insertStart = 1 + (end ? 0 : 1);
                                chatAdapter.notifyItemChanged(insertStart);
                                chatAdapter.notifyItemRangeInserted(insertStart, newRowsCount - (end ? 1 : 0));
                            }
                            if (firstVisPos != -1) {
                                chatLayoutManager.scrollToPositionWithOffset(firstVisPos + newRowsCount - (end ? 1 : 0), top);
                            }
                        } else if (endReached) {
                            chatAdapter.notifyItemRemoved(0);
                        }
                    }
                });
            }
        }
    });
    if (reset && chatAdapter != null) {
        chatAdapter.notifyDataSetChanged();
    }
}
 
Example 6
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private void loadMessages(boolean reset) {
    if (loading) {
        return;
    }
    if (reset) {
        minEventId = Long.MAX_VALUE;
        if (progressView != null) {
            progressView.setVisibility(View.VISIBLE);
            emptyViewContainer.setVisibility(View.INVISIBLE);
            chatListView.setEmptyView(null);
        }
        messagesDict.clear();
        messages.clear();
        messagesByDays.clear();
    }
    loading = true;
    TLRPC.TL_channels_getAdminLog req = new TLRPC.TL_channels_getAdminLog();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.q = searchQuery;
    req.limit = 50;
    if (!reset && !messages.isEmpty()) {
        req.max_id = minEventId;
    } else {
        req.max_id = 0;
    }
    req.min_id = 0;
    if (currentFilter != null) {
        req.flags |= 1;
        req.events_filter = currentFilter;
    }
    if (selectedAdmins != null) {
        req.flags |= 2;
        for (int a = 0; a < selectedAdmins.size(); a++) {
            req.admins.add(MessagesController.getInstance(currentAccount).getInputUser(selectedAdmins.valueAt(a)));
        }
    }
    updateEmptyPlaceholder();
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
        @Override
        public void run(TLObject response, TLRPC.TL_error error) {
            if (response != null) {
                final TLRPC.TL_channels_adminLogResults res = (TLRPC.TL_channels_adminLogResults) response;
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                        MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                        boolean added = false;
                        int oldRowsCount = messages.size();
                        for (int a = 0; a < res.events.size(); a++) {
                            TLRPC.TL_channelAdminLogEvent event = res.events.get(a);
                            if (messagesDict.indexOfKey(event.id) >= 0) {
                                continue;
                            }
                            minEventId = Math.min(minEventId, event.id);
                            added = true;
                            MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid);
                            if (messageObject.contentType < 0) {
                                continue;
                            }
                            messagesDict.put(event.id, messageObject);
                        }
                        int newRowsCount = messages.size() - oldRowsCount;
                        loading = false;
                        if (!added) {
                            endReached = true;
                        }
                        progressView.setVisibility(View.INVISIBLE);
                        chatListView.setEmptyView(emptyViewContainer);
                        if (newRowsCount != 0) {
                            boolean end = false;
                            if (endReached) {
                                end = true;
                                chatAdapter.notifyItemRangeChanged(0, 2);
                            }
                            int firstVisPos = chatLayoutManager.findLastVisibleItemPosition();
                            View firstVisView = chatLayoutManager.findViewByPosition(firstVisPos);
                            int top = ((firstVisView == null) ? 0 : firstVisView.getTop()) - chatListView.getPaddingTop();
                            if (newRowsCount - (end ? 1 : 0) > 0) {
                                int insertStart = 1 + (end ? 0 : 1);
                                chatAdapter.notifyItemChanged(insertStart);
                                chatAdapter.notifyItemRangeInserted(insertStart, newRowsCount - (end ? 1 : 0));
                            }
                            if (firstVisPos != -1) {
                                chatLayoutManager.scrollToPositionWithOffset(firstVisPos + newRowsCount - (end ? 1 : 0), top);
                            }
                        } else if (endReached) {
                            chatAdapter.notifyItemRemoved(0);
                        }
                    }
                });
            }
        }
    });
    if (reset && chatAdapter != null) {
        chatAdapter.notifyDataSetChanged();
    }
}
 
Example 7
Source File: ChatLinkActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void linkChat(TLRPC.Chat chat, BaseFragment createFragment) {
    if (chat == null) {
        return;
    }
    if (!ChatObject.isChannel(chat)) {
        MessagesController.getInstance(currentAccount).convertToMegaGroup(getParentActivity(), chat.id, this, param -> {
            if (param != 0) {
                MessagesController.getInstance(currentAccount).toogleChannelInvitesHistory(param, false);
                linkChat(getMessagesController().getChat(param), createFragment);
            }
        });
        return;
    }
    final AlertDialog[] progressDialog = new AlertDialog[]{createFragment != null ? null : new AlertDialog(getParentActivity(), 3)};
    TLRPC.TL_channels_setDiscussionGroup req = new TLRPC.TL_channels_setDiscussionGroup();
    req.broadcast = MessagesController.getInputChannel(currentChat);
    req.group = MessagesController.getInputChannel(chat);
    int requestId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (progressDialog[0] != null) {
            try {
                progressDialog[0].dismiss();
            } catch (Throwable ignore) {

            }
            progressDialog[0] = null;
        }
        info.linked_chat_id = chat.id;
        NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.chatInfoDidLoad, info, 0, false, null);
        getMessagesController().loadFullChat(currentChatId, 0, true);
        if (createFragment != null) {
            removeSelfFromStack();
            createFragment.finishFragment();
        } else {
            finishFragment();
        }
    }));
    AndroidUtilities.runOnUIThread(() -> {
        if (progressDialog[0] == null) {
            return;
        }
        progressDialog[0].setOnCancelListener(dialog -> ConnectionsManager.getInstance(currentAccount).cancelRequest(requestId, true));
        showDialog(progressDialog[0]);
    }, 500);
}
 
Example 8
Source File: ChannelAdminLogActivity.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private void loadMessages(boolean reset) {
    if (loading) {
        return;
    }
    if (reset) {
        minEventId = Long.MAX_VALUE;
        if (progressView != null) {
            progressView.setVisibility(View.VISIBLE);
            emptyViewContainer.setVisibility(View.INVISIBLE);
            chatListView.setEmptyView(null);
        }
        messagesDict.clear();
        messages.clear();
        messagesByDays.clear();
    }
    loading = true;
    TLRPC.TL_channels_getAdminLog req = new TLRPC.TL_channels_getAdminLog();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.q = searchQuery;
    req.limit = 50;
    if (!reset && !messages.isEmpty()) {
        req.max_id = minEventId;
    } else {
        req.max_id = 0;
    }
    req.min_id = 0;
    if (currentFilter != null) {
        req.flags |= 1;
        req.events_filter = currentFilter;
    }
    if (selectedAdmins != null) {
        req.flags |= 2;
        for (int a = 0; a < selectedAdmins.size(); a++) {
            req.admins.add(MessagesController.getInstance(currentAccount).getInputUser(selectedAdmins.valueAt(a)));
        }
    }
    updateEmptyPlaceholder();
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            final TLRPC.TL_channels_adminLogResults res = (TLRPC.TL_channels_adminLogResults) response;
            AndroidUtilities.runOnUIThread(() -> {
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                boolean added = false;
                int oldRowsCount = messages.size();
                for (int a = 0; a < res.events.size(); a++) {
                    TLRPC.TL_channelAdminLogEvent event = res.events.get(a);
                    if (messagesDict.indexOfKey(event.id) >= 0) {
                        continue;
                    }
                    if (event.action instanceof TLRPC.TL_channelAdminLogEventActionParticipantToggleAdmin) {
                        if (event.action.prev_participant instanceof TLRPC.TL_channelParticipantCreator && !(event.action.new_participant instanceof TLRPC.TL_channelParticipantCreator)) {
                            continue;
                        }
                    }
                    minEventId = Math.min(minEventId, event.id);
                    added = true;
                    MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid);
                    if (messageObject.contentType < 0) {
                        continue;
                    }
                    messagesDict.put(event.id, messageObject);
                }
                int newRowsCount = messages.size() - oldRowsCount;
                loading = false;
                if (!added) {
                    endReached = true;
                }
                progressView.setVisibility(View.INVISIBLE);
                chatListView.setEmptyView(emptyViewContainer);
                if (newRowsCount != 0) {
                    boolean end = false;
                    if (endReached) {
                        end = true;
                        chatAdapter.notifyItemRangeChanged(0, 2);
                    }
                    int firstVisPos = chatLayoutManager.findLastVisibleItemPosition();
                    View firstVisView = chatLayoutManager.findViewByPosition(firstVisPos);
                    int top = ((firstVisView == null) ? 0 : firstVisView.getTop()) - chatListView.getPaddingTop();
                    if (newRowsCount - (end ? 1 : 0) > 0) {
                        int insertStart = 1 + (end ? 0 : 1);
                        chatAdapter.notifyItemChanged(insertStart);
                        chatAdapter.notifyItemRangeInserted(insertStart, newRowsCount - (end ? 1 : 0));
                    }
                    if (firstVisPos != -1) {
                        chatLayoutManager.scrollToPositionWithOffset(firstVisPos + newRowsCount - (end ? 1 : 0), top);
                    }
                } else if (endReached) {
                    chatAdapter.notifyItemRemoved(0);
                }
            });
        }
    });
    if (reset && chatAdapter != null) {
        chatAdapter.notifyDataSetChanged();
    }
}
 
Example 9
Source File: ChatLinkActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void linkChat(TLRPC.Chat chat, BaseFragment createFragment) {
    if (chat == null) {
        return;
    }
    if (!ChatObject.isChannel(chat)) {
        MessagesController.getInstance(currentAccount).convertToMegaGroup(getParentActivity(), chat.id, this, param -> {
            if (param != 0) {
                MessagesController.getInstance(currentAccount).toogleChannelInvitesHistory(param, false);
                linkChat(getMessagesController().getChat(param), createFragment);
            }
        });
        return;
    }
    final AlertDialog[] progressDialog = new AlertDialog[]{createFragment != null ? null : new AlertDialog(getParentActivity(), 3)};
    TLRPC.TL_channels_setDiscussionGroup req = new TLRPC.TL_channels_setDiscussionGroup();
    req.broadcast = MessagesController.getInputChannel(currentChat);
    req.group = MessagesController.getInputChannel(chat);
    int requestId = getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
        if (progressDialog[0] != null) {
            try {
                progressDialog[0].dismiss();
            } catch (Throwable ignore) {

            }
            progressDialog[0] = null;
        }
        info.linked_chat_id = chat.id;
        NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.chatInfoDidLoad, info, 0, false, null);
        getMessagesController().loadFullChat(currentChatId, 0, true);
        if (createFragment != null) {
            removeSelfFromStack();
            createFragment.finishFragment();
        } else {
            finishFragment();
        }
    }));
    AndroidUtilities.runOnUIThread(() -> {
        if (progressDialog[0] == null) {
            return;
        }
        progressDialog[0].setOnCancelListener(dialog -> ConnectionsManager.getInstance(currentAccount).cancelRequest(requestId, true));
        showDialog(progressDialog[0]);
    }, 500);
}
 
Example 10
Source File: ChannelAdminLogActivity.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private void loadMessages(boolean reset) {
    if (loading) {
        return;
    }
    if (reset) {
        minEventId = Long.MAX_VALUE;
        if (progressView != null) {
            progressView.setVisibility(View.VISIBLE);
            emptyViewContainer.setVisibility(View.INVISIBLE);
            chatListView.setEmptyView(null);
        }
        messagesDict.clear();
        messages.clear();
        messagesByDays.clear();
    }
    loading = true;
    TLRPC.TL_channels_getAdminLog req = new TLRPC.TL_channels_getAdminLog();
    req.channel = MessagesController.getInputChannel(currentChat);
    req.q = searchQuery;
    req.limit = 50;
    if (!reset && !messages.isEmpty()) {
        req.max_id = minEventId;
    } else {
        req.max_id = 0;
    }
    req.min_id = 0;
    if (currentFilter != null) {
        req.flags |= 1;
        req.events_filter = currentFilter;
    }
    if (selectedAdmins != null) {
        req.flags |= 2;
        for (int a = 0; a < selectedAdmins.size(); a++) {
            req.admins.add(MessagesController.getInstance(currentAccount).getInputUser(selectedAdmins.valueAt(a)));
        }
    }
    updateEmptyPlaceholder();
    ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> {
        if (response != null) {
            final TLRPC.TL_channels_adminLogResults res = (TLRPC.TL_channels_adminLogResults) response;
            AndroidUtilities.runOnUIThread(() -> {
                MessagesController.getInstance(currentAccount).putUsers(res.users, false);
                MessagesController.getInstance(currentAccount).putChats(res.chats, false);
                boolean added = false;
                int oldRowsCount = messages.size();
                for (int a = 0; a < res.events.size(); a++) {
                    TLRPC.TL_channelAdminLogEvent event = res.events.get(a);
                    if (messagesDict.indexOfKey(event.id) >= 0) {
                        continue;
                    }
                    if (event.action instanceof TLRPC.TL_channelAdminLogEventActionParticipantToggleAdmin) {
                        if (event.action.prev_participant instanceof TLRPC.TL_channelParticipantCreator && !(event.action.new_participant instanceof TLRPC.TL_channelParticipantCreator)) {
                            continue;
                        }
                    }
                    minEventId = Math.min(minEventId, event.id);
                    added = true;
                    MessageObject messageObject = new MessageObject(currentAccount, event, messages, messagesByDays, currentChat, mid);
                    if (messageObject.contentType < 0) {
                        continue;
                    }
                    messagesDict.put(event.id, messageObject);
                }
                int newRowsCount = messages.size() - oldRowsCount;
                loading = false;
                if (!added) {
                    endReached = true;
                }
                progressView.setVisibility(View.INVISIBLE);
                chatListView.setEmptyView(emptyViewContainer);
                if (newRowsCount != 0) {
                    boolean end = false;
                    if (endReached) {
                        end = true;
                        chatAdapter.notifyItemRangeChanged(0, 2);
                    }
                    int firstVisPos = chatLayoutManager.findLastVisibleItemPosition();
                    View firstVisView = chatLayoutManager.findViewByPosition(firstVisPos);
                    int top = ((firstVisView == null) ? 0 : firstVisView.getTop()) - chatListView.getPaddingTop();
                    if (newRowsCount - (end ? 1 : 0) > 0) {
                        int insertStart = 1 + (end ? 0 : 1);
                        chatAdapter.notifyItemChanged(insertStart);
                        chatAdapter.notifyItemRangeInserted(insertStart, newRowsCount - (end ? 1 : 0));
                    }
                    if (firstVisPos != -1) {
                        chatLayoutManager.scrollToPositionWithOffset(firstVisPos + newRowsCount - (end ? 1 : 0), top);
                    }
                } else if (endReached) {
                    chatAdapter.notifyItemRemoved(0);
                }
            });
        }
    });
    if (reset && chatAdapter != null) {
        chatAdapter.notifyDataSetChanged();
    }
}