Search in sources :

Example 1 with PassportActivity

use of org.telegram.ui.PassportActivity in project Telegram-FOSS by Telegram-FOSS-Team.

the class ChatAttachAlert method openDocumentsLayout.

private void openDocumentsLayout(boolean show) {
    if (documentLayout == null) {
        layouts[4] = documentLayout = new ChatAttachAlertDocumentLayout(this, getContext(), false, resourcesProvider);
        documentLayout.setDelegate(new ChatAttachAlertDocumentLayout.DocumentSelectActivityDelegate() {

            @Override
            public void didSelectFiles(ArrayList<String> files, String caption, ArrayList<MessageObject> fmessages, boolean notify, int scheduleDate) {
                if (baseFragment instanceof ChatActivity) {
                    ((ChatActivity) baseFragment).didSelectFiles(files, caption, fmessages, notify, scheduleDate);
                } else if (baseFragment instanceof PassportActivity) {
                    ((PassportActivity) baseFragment).didSelectFiles(files, caption, notify, scheduleDate);
                }
            }

            @Override
            public void didSelectPhotos(ArrayList<SendMessagesHelper.SendingMediaInfo> photos, boolean notify, int scheduleDate) {
                if (baseFragment instanceof ChatActivity) {
                    ((ChatActivity) baseFragment).didSelectPhotos(photos, notify, scheduleDate);
                } else if (baseFragment instanceof PassportActivity) {
                    ((PassportActivity) baseFragment).didSelectPhotos(photos, notify, scheduleDate);
                }
            }

            @Override
            public void startDocumentSelectActivity() {
                if (baseFragment instanceof ChatActivity) {
                    ((ChatActivity) baseFragment).startDocumentSelectActivity();
                } else if (baseFragment instanceof PassportActivity) {
                    ((PassportActivity) baseFragment).startDocumentSelectActivity();
                }
            }

            @Override
            public void startMusicSelectActivity() {
                openAudioLayout(true);
            }
        });
    }
    if (baseFragment instanceof ChatActivity) {
        ChatActivity chatActivity = (ChatActivity) baseFragment;
        TLRPC.Chat currentChat = chatActivity.getCurrentChat();
        documentLayout.setMaxSelectedFiles(currentChat != null && !ChatObject.hasAdminRights(currentChat) && currentChat.slowmode_enabled || editingMessageObject != null ? 1 : -1);
    } else {
        documentLayout.setMaxSelectedFiles(maxSelectedPhotos);
        documentLayout.setCanSelectOnlyImageFiles(true);
    }
    if (show) {
        showLayout(documentLayout);
    }
}
Also used : ChatActivity(org.telegram.ui.ChatActivity) TextPaint(android.text.TextPaint) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) TLRPC(org.telegram.tgnet.TLRPC) PassportActivity(org.telegram.ui.PassportActivity) MessageObject(org.telegram.messenger.MessageObject)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1 TextPaint (android.text.TextPaint)1 MessageObject (org.telegram.messenger.MessageObject)1 TLRPC (org.telegram.tgnet.TLRPC)1 ChatActivity (org.telegram.ui.ChatActivity)1 PassportActivity (org.telegram.ui.PassportActivity)1