Search in sources :

Example 1 with ImportingAlert

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

the class ChatActivity method onResume.

@Override
public void onResume() {
    super.onResume();
    checkShowBlur(false);
    activityResumeTime = System.currentTimeMillis();
    if (openImport && getSendMessagesHelper().getImportingHistory(dialog_id) != null) {
        ImportingAlert alert = new ImportingAlert(getParentActivity(), null, this, themeDelegate);
        alert.setOnHideListener(dialog -> {
            if (fragmentContextView != null) {
                fragmentContextView.checkImport(false);
            }
        });
        showDialog(alert);
        openImport = false;
    }
    checkAdjustResize();
    MediaController.getInstance().startRaiseToEarSensors(this);
    checkRaiseSensors();
    if (chatAttachAlert != null) {
        chatAttachAlert.onResume();
    }
    if (contentView != null) {
        contentView.onResume();
    }
    checkChecksHint();
    Bulletin.addDelegate(this, bulletinDelegate = new Bulletin.Delegate() {

        @Override
        public int getBottomOffset(int tag) {
            if (tag == 1) {
                return 0;
            }
            int height;
            if (chatActivityEnterView != null && chatActivityEnterView.getVisibility() == View.VISIBLE) {
                if (contentView.getKeyboardHeight() < AndroidUtilities.dp(20) && chatActivityEnterView.isPopupShowing() || chatActivityEnterView.pannelAniamationInProgress()) {
                    height = chatActivityEnterView.getHeight() + chatActivityEnterView.getEmojiPadding();
                } else {
                    height = chatActivityEnterView.getHeight();
                }
            } else {
                height = AndroidUtilities.dp(51);
            }
            if (chatActivityEnterView.pannelAniamationInProgress()) {
                float translationY = bottomPanelTranslationY - chatActivityEnterView.getEmojiPadding();
                height += translationY;
            }
            height += contentPanTranslation;
            return height - AndroidUtilities.dp(1.5f);
        }
    });
    checkActionBarMenu(false);
    if (replyImageLocation != null && replyImageView != null) {
        replyImageView.setImage(ImageLocation.getForObject(replyImageLocation, replyImageLocationObject), "50_50", ImageLocation.getForObject(replyImageThumbLocation, replyImageLocationObject), "50_50_b", null, replyImageSize, replyImageCacheType, replyingMessageObject);
    }
    if (pinnedImageLocation != null && pinnedMessageImageView != null) {
        MessageObject pinnedMessageObject = pinnedMessageObjects.get(currentPinnedMessageId);
        pinnedMessageImageView[0].setImage(ImageLocation.getForObject(pinnedImageLocation, pinnedImageLocationObject), "50_50", ImageLocation.getForObject(pinnedImageThumbLocation, pinnedImageLocationObject), "50_50_b", null, pinnedImageSize, pinnedImageCacheType, pinnedMessageObject);
    }
    if (chatMode == 0) {
        getNotificationsController().setOpenedDialogId(dialog_id);
    }
    getMessagesController().setLastVisibleDialogId(dialog_id, chatMode == MODE_SCHEDULED, true);
    if (scrollToTopOnResume) {
        if (scrollToTopUnReadOnResume && scrollToMessage != null) {
            if (chatListView != null) {
                int yOffset;
                boolean bottom = true;
                if (scrollToMessagePosition == -9000) {
                    yOffset = getScrollOffsetForMessage(scrollToMessage);
                    bottom = false;
                } else if (scrollToMessagePosition == -10000) {
                    yOffset = -AndroidUtilities.dp(11);
                    bottom = false;
                } else {
                    yOffset = scrollToMessagePosition;
                }
                chatLayoutManager.scrollToPositionWithOffset(chatAdapter.messagesStartRow + messages.indexOf(scrollToMessage), yOffset, bottom);
            }
        } else {
            moveScrollToLastMessage(false);
        }
        scrollToTopUnReadOnResume = false;
        scrollToTopOnResume = false;
        scrollToMessage = null;
    }
    paused = false;
    pausedOnLastMessage = false;
    checkScrollForLoad(false);
    if (wasPaused) {
        wasPaused = false;
        if (chatAdapter != null) {
            chatAdapter.notifyDataSetChanged(false);
        }
    }
    fixLayout();
    applyDraftMaybe(false);
    if (bottomOverlayChat != null && bottomOverlayChat.getVisibility() != View.VISIBLE && !actionBar.isSearchFieldVisible()) {
        chatActivityEnterView.setFieldFocused(true);
    }
    if (chatActivityEnterView != null) {
        chatActivityEnterView.onResume();
    }
    if (currentUser != null) {
        chatEnterTime = System.currentTimeMillis();
        chatLeaveTime = 0;
    }
    if (startVideoEdit != null) {
        AndroidUtilities.runOnUIThread(() -> {
            openVideoEditor(startVideoEdit, null);
            startVideoEdit = null;
        });
    }
    if (chatListView != null && (chatActivityEnterView == null || !chatActivityEnterView.isEditingMessage())) {
        chatListView.setOnItemLongClickListener(onItemLongClickListener);
        chatListView.setOnItemClickListener(onItemClickListener);
        chatListView.setLongClickable(true);
    }
    checkBotCommands();
    updateTitle();
    showGigagroupConvertAlert();
    if (pullingDownOffset != 0) {
        pullingDownOffset = 0;
        chatListView.invalidate();
    }
}
Also used : ChatActivityMemberRequestsDelegate(org.telegram.ui.Delegates.ChatActivityMemberRequestsDelegate) ImportingAlert(org.telegram.ui.Components.ImportingAlert) MessageObject(org.telegram.messenger.MessageObject) Paint(android.graphics.Paint) TextSelectionHint(org.telegram.ui.Components.TextSelectionHint) TextPaint(android.text.TextPaint) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1 TextPaint (android.text.TextPaint)1 MessageObject (org.telegram.messenger.MessageObject)1 ImportingAlert (org.telegram.ui.Components.ImportingAlert)1 TextSelectionHint (org.telegram.ui.Components.TextSelectionHint)1 ChatActivityMemberRequestsDelegate (org.telegram.ui.Delegates.ChatActivityMemberRequestsDelegate)1