导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - PopupNotificationActivity.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 PopupNotificationActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package im.amwhusedvt.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.PowerManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.ApplicationLoader;
import im.amwhusedvt.messenger.ContactsController;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.ImageLocation;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.MediaController;
import im.amwhusedvt.messenger.MessageObject;
import im.amwhusedvt.messenger.MessagesController;
import im.amwhusedvt.messenger.NotificationCenter;
import im.amwhusedvt.messenger.NotificationsController;
import im.amwhusedvt.messenger.SendMessagesHelper;
import im.amwhusedvt.messenger.UserConfig;
import im.amwhusedvt.messenger.UserObject;
import im.amwhusedvt.phoneformat.PhoneFormat;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.-$;
import im.amwhusedvt.ui.actionbar.ActionBar;
import im.amwhusedvt.ui.actionbar.ActionBarMenu;
import im.amwhusedvt.ui.actionbar.ActionBarMenuItem;
import im.amwhusedvt.ui.actionbar.AlertDialog;
import im.amwhusedvt.ui.actionbar.Theme;
import im.amwhusedvt.ui.components.AvatarDrawable;
import im.amwhusedvt.ui.components.BackupImageView;
import im.amwhusedvt.ui.components.ChatActivityEnterView;
import im.amwhusedvt.ui.components.LayoutHelper;
import im.amwhusedvt.ui.components.PlayingGameDrawable;
import im.amwhusedvt.ui.components.PopupAudioView;
import im.amwhusedvt.ui.components.RecordStatusDrawable;
import im.amwhusedvt.ui.components.RoundStatusDrawable;
import im.amwhusedvt.ui.components.SendingFileDrawable;
import im.amwhusedvt.ui.components.SizeNotifierFrameLayout;
import im.amwhusedvt.ui.components.StatusDrawable;
import im.amwhusedvt.ui.components.TypingDotsDrawable;
import im.amwhusedvt.ui.constants.ChatEnterMenuType;
import java.util.ArrayList;

public class PopupNotificationActivity extends Activity implements NotificationCenter.NotificationCenterDelegate {
    private static final int id_chat_compose_panel = 1000;
    private ActionBar actionBar;
    private boolean animationInProgress;
    private long animationStartTime;
    private ArrayList<ViewGroup> audioViews;
    private FrameLayout avatarContainer;
    private BackupImageView avatarImageView;
    private ViewGroup centerButtonsView;
    private ViewGroup centerView;
    private ChatActivityEnterView chatActivityEnterView;
    private int classGuid;
    private TextView countText;
    private TLRPC.Chat currentChat;
    private int currentMessageNum;
    private MessageObject currentMessageObject;
    private TLRPC.User currentUser;
    private boolean finished;
    private ArrayList<ViewGroup> imageViews;
    private boolean isReply;
    private CharSequence lastPrintString;
    private int lastResumedAccount;
    private ViewGroup leftButtonsView;
    private ViewGroup leftView;
    private ViewGroup messageContainer;
    private float moveStartX;
    private TextView nameTextView;
    private Runnable onAnimationEndRunnable;
    private TextView onlineTextView;
    private RelativeLayout popupContainer;
    private ArrayList<MessageObject> popupMessages;
    private ViewGroup rightButtonsView;
    private ViewGroup rightView;
    private boolean startedMoving;
    private StatusDrawable[] statusDrawables;
    private ArrayList<ViewGroup> textViews;
    private VelocityTracker velocityTracker;
    private PowerManager.WakeLock wakeLock;

    public PopupNotificationActivity() {
        if ((32 + 7) % 7 <= 0) {
        }
        this.textViews = new ArrayList<>();
        this.imageViews = new ArrayList<>();
        this.audioViews = new ArrayList<>();
        this.velocityTracker = null;
        this.statusDrawables = new StatusDrawable[5];
        this.lastResumedAccount = -1;
        this.finished = false;
        this.currentMessageObject = null;
        this.currentMessageNum = 0;
        this.wakeLock = null;
        this.animationInProgress = false;
        this.animationStartTime = 0L;
        this.moveStartX = -1.0f;
        this.startedMoving = false;
        this.onAnimationEndRunnable = null;
        this.popupMessages = new ArrayList<>();
    }

    private class FrameLayoutTouch extends FrameLayout {
        public FrameLayoutTouch(Context context) {
            super(context);
        }

        public FrameLayoutTouch(Context context, AttributeSet attrs) {
            super(context, attrs);
        }

        public FrameLayoutTouch(Context context, AttributeSet attrs, int defStyle) {
            super(context, attrs, defStyle);
        }

        @Override
        public boolean onInterceptTouchEvent(MotionEvent ev) {
            return PopupNotificationActivity.this.checkTransitionAnimation() || ((PopupNotificationActivity) getContext()).onTouchEventMy(ev);
        }

        @Override
        public boolean onTouchEvent(MotionEvent ev) {
            return PopupNotificationActivity.this.checkTransitionAnimation() || ((PopupNotificationActivity) getContext()).onTouchEventMy(ev);
        }

        @Override
        public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
            if ((24 + 8) % 8 <= 0) {
            }
            ((PopupNotificationActivity) getContext()).onTouchEventMy(null);
            super.requestDisallowInterceptTouchEvent(disallowIntercept);
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if ((4 + 31) % 31 <= 0) {
        }
        super.onCreate(savedInstanceState);
        Theme.createChatResources(this, false);
        int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
        if (resourceId > 0) {
            AndroidUtilities.statusBarHeight = getResources().getDimensionPixelSize(resourceId);
        }
        for (int a = 0; a < 3; a++) {
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.appDidLogout);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.updateInterfaces);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.messagePlayingDidReset);
            NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.contactsDidLoad);
        }
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.pushMessagesUpdated);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
        this.classGuid = ConnectionsManager.generateClassGuid();
        this.statusDrawables[0] = new TypingDotsDrawable();
        this.statusDrawables[1] = new RecordStatusDrawable();
        this.statusDrawables[2] = new SendingFileDrawable();
        this.statusDrawables[3] = new PlayingGameDrawable();
        this.statusDrawables[4] = new RoundStatusDrawable();
        SizeNotifierFrameLayout contentView = new SizeNotifierFrameLayout(this) {
            protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                int heightSize;
                if ((19 + 26) % 26 <= 0) {
                }
                View.MeasureSpec.getMode(widthMeasureSpec);
                View.MeasureSpec.getMode(heightMeasureSpec);
                int widthSize = View.MeasureSpec.getSize(widthMeasureSpec);
                int heightSize2 = View.MeasureSpec.getSize(heightMeasureSpec);
                setMeasuredDimension(widthSize, heightSize2);
                int keyboardSize = getKeyboardHeight();
                if (keyboardSize <= AndroidUtilities.dp(20.0f)) {
                    heightSize = heightSize2 - PopupNotificationActivity.this.chatActivityEnterView.getEmojiPadding();
                } else {
                    heightSize = heightSize2;
                }
                int childCount = getChildCount();
                for (int i = 0; i < childCount; i++) {
                    View child = getChildAt(i);
                    if (child.getVisibility() != 8) {
                        if (!PopupNotificationActivity.this.chatActivityEnterView.isPopupView(child)) {
                            if (PopupNotificationActivity.this.chatActivityEnterView.isRecordCircle(child)) {
                                measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
                            } else {
                                child.measure(View.MeasureSpec.makeMeasureSpec(widthSize, 1073741824), View.MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(2.0f) + heightSize), 1073741824));
                            }
                        } else {
                            child.measure(View.MeasureSpec.makeMeasureSpec(widthSize, 1073741824), View.MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, 1073741824));
                        }
                    }
                }
            }

            protected void onLayout(boolean changed, int l, int t, int r, int b) {
                int childLeft;
                int childTop;
                if ((6 + 15) % 15 <= 0) {
                }
                int count = getChildCount();
                int paddingBottom = getKeyboardHeight() <= AndroidUtilities.dp(20.0f) ? PopupNotificationActivity.this.chatActivityEnterView.getEmojiPadding() : 0;
                for (int i = 0; i < count; i++) {
                    View child = getChildAt(i);
                    if (child.getVisibility() != 8) {
                        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) child.getLayoutParams();
                        int width = child.getMeasuredWidth();
                        int height = child.getMeasuredHeight();
                        int gravity = lp.gravity;
                        if (gravity == -1) {
                            gravity = 51;
                        }
                        int absoluteGravity = gravity & 7;
                        int verticalGravity = gravity & 112;
                        int i2 = absoluteGravity & 7;
                        if (i2 == 1) {
                            int childLeft2 = r - l;
                            childLeft = (((childLeft2 - width) / 2) + lp.leftMargin) - lp.rightMargin;
                        } else if (i2 == 5) {
                            int childLeft3 = r - width;
                            childLeft = childLeft3 - lp.rightMargin;
                        } else {
                            childLeft = lp.leftMargin;
                        }
                        if (verticalGravity == 16) {
                            int childTop2 = b - paddingBottom;
                            childTop = ((((childTop2 - t) - height) / 2) + lp.topMargin) - lp.bottomMargin;
                        } else if (verticalGravity == 48) {
                            childTop = lp.topMargin;
                        } else if (verticalGravity == 80) {
                            int childTop3 = b - paddingBottom;
                            childTop = ((childTop3 - t) - height) - lp.bottomMargin;
                        } else {
                            childTop = lp.topMargin;
                        }
                        if (!PopupNotificationActivity.this.chatActivityEnterView.isPopupView(child)) {
                            if (PopupNotificationActivity.this.chatActivityEnterView.isRecordCircle(child)) {
                                childTop = ((PopupNotificationActivity.this.popupContainer.getTop() + PopupNotificationActivity.this.popupContainer.getMeasuredHeight()) - child.getMeasuredHeight()) - lp.bottomMargin;
                                childLeft = ((PopupNotificationActivity.this.popupContainer.getLeft() + PopupNotificationActivity.this.popupContainer.getMeasuredWidth()) - child.getMeasuredWidth()) - lp.rightMargin;
                            }
                        } else {
                            int measuredHeight = getMeasuredHeight();
                            if (paddingBottom != 0) {
                                measuredHeight -= paddingBottom;
                            }
                            childTop = measuredHeight;
                        }
                        child.layout(childLeft, childTop, childLeft + width, childTop + height);
                    }
                }
                notifyHeightChanged();
            }
        };
        setContentView((View) contentView);
        contentView.setBackgroundColor(-1728053248);
        RelativeLayout relativeLayout = new RelativeLayout(this);
        contentView.addView(relativeLayout, LayoutHelper.createFrame(-1, -1.0f));
        RelativeLayout relativeLayout2 = new RelativeLayout(this) {
            @Override
            protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                if ((4 + 17) % 17 <= 0) {
                }
                super.onMeasure(widthMeasureSpec, heightMeasureSpec);
                int w = PopupNotificationActivity.this.chatActivityEnterView.getMeasuredWidth();
                int h = PopupNotificationActivity.this.chatActivityEnterView.getMeasuredHeight();
                for (int a2 = 0; a2 < getChildCount(); a2++) {
                    View v = getChildAt(a2);
                    if (v.getTag() instanceof String) {
                        v.measure(View.MeasureSpec.makeMeasureSpec(w, 1073741824), View.MeasureSpec.makeMeasureSpec(h - AndroidUtilities.dp(3.0f), 1073741824));
                    }
                }
            }

            @Override
            protected void onLayout(boolean changed, int l, int t, int r, int b) {
                if ((13 + 31) % 31 <= 0) {
                }
                super.onLayout(changed, l, t, r, b);
                for (int a2 = 0; a2 < getChildCount(); a2++) {
                    View v = getChildAt(a2);
                    if (v.getTag() instanceof String) {
                        v.layout(v.getLeft(), PopupNotificationActivity.this.chatActivityEnterView.getTop() + AndroidUtilities.dp(3.0f), v.getRight(), PopupNotificationActivity.this.chatActivityEnterView.getBottom());
                    }
                }
            }
        };
        this.popupContainer = relativeLayout2;
        relativeLayout2.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
        relativeLayout.addView(this.popupContainer, LayoutHelper.createRelative(-1, 240, 12, 0, 12, 0, 13));
        ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
        if (chatActivityEnterView != null) {
            chatActivityEnterView.onDestroy();
        }
        ChatActivityEnterView chatActivityEnterView2 = new ChatActivityEnterView(this, contentView, (ChatActivity) null, false);
        this.chatActivityEnterView = chatActivityEnterView2;
        chatActivityEnterView2.setId(1000);
        this.popupContainer.addView((View) this.chatActivityEnterView, (ViewGroup.LayoutParams) LayoutHelper.createRelative(-1, -2, 12));
        this.chatActivityEnterView.setDelegate(new ChatActivityEnterView.ChatActivityEnterViewDelegate() {
            public boolean hasScheduledMessages() {
                return ChatActivityEnterView.ChatActivityEnterViewDelegate.-CC.$default$hasScheduledMessages(this);
            }

            public void openScheduledMessages() {
                ChatActivityEnterView.ChatActivityEnterViewDelegate.-CC.$default$openScheduledMessages(this);
            }

            public void scrollToSendingMessage() {
                ChatActivityEnterView.ChatActivityEnterViewDelegate.-CC.$default$scrollToSendingMessage(this);
            }

            public void onMessageSend(CharSequence message, boolean notify, int scheduleDate) {
                if ((8 + 2) % 2 <= 0) {
                }
                if (PopupNotificationActivity.this.currentMessageObject != null) {
                    if (PopupNotificationActivity.this.currentMessageNum >= 0 && PopupNotificationActivity.this.currentMessageNum < PopupNotificationActivity.this.popupMessages.size()) {
                        PopupNotificationActivity.this.popupMessages.remove(PopupNotificationActivity.this.currentMessageNum);
                    }
                    MessagesController.getInstance(PopupNotificationActivity.this.currentMessageObject.currentAccount).markDialogAsRead(PopupNotificationActivity.this.currentMessageObject.getDialogId(), PopupNotificationActivity.this.currentMessageObject.getId(), Math.max(0, PopupNotificationActivity.this.currentMessageObject.getId()), PopupNotificationActivity.this.currentMessageObject.messageOwner.date, true, 0, true, 0);
                    PopupNotificationActivity.this.currentMessageObject = null;
                    PopupNotificationActivity.this.getNewMessage();
                }
            }

            public void onTextChanged(CharSequence text, boolean big) {
            }

            public void onTextSelectionChanged(int start, int end) {
            }

            public void onTextSpansChanged(CharSequence text) {
            }

            public void onStickersExpandedChange() {
            }

            public void onSwitchRecordMode(boolean video) {
            }

            public void onPreAudioVideoRecord() {
            }

            public void onMessageEditEnd(boolean loading) {
            }

            public void needSendTyping() {
                if ((24 + 32) % 32 <= 0) {
                }
                if (PopupNotificationActivity.this.currentMessageObject != null) {
                    MessagesController.getInstance(PopupNotificationActivity.this.currentMessageObject.currentAccount).sendTyping(PopupNotificationActivity.this.currentMessageObject.getDialogId(), 0, PopupNotificationActivity.this.classGuid);
                }
            }

            public void onAttachButtonHidden() {
            }

            public void onAttachButtonShow() {
            }

            public void onWindowSizeChanged(int size) {
            }

            public void onStickersTab(boolean opened) {
            }

            public void didPressedAttachButton(int position, ChatEnterMenuType menuType) {
            }

            public void needStartRecordVideo(int state, boolean notify, int scheduleDate) {
            }

            public void needStartRecordAudio(int state) {
            }

            public void needChangeVideoPreviewState(int state, float seekProgress) {
            }

            public void needShowMediaBanHint() {
            }

            public void onUpdateSlowModeButton(View button, boolean show, CharSequence time) {
            }
        });
        FrameLayoutTouch frameLayoutTouch = new FrameLayoutTouch(this);
        this.messageContainer = frameLayoutTouch;
        this.popupContainer.addView(frameLayoutTouch, 0);
        ActionBar actionBar = new ActionBar(this);
        this.actionBar = actionBar;
        actionBar.setOccupyStatusBar(false);
        this.actionBar.setBackButtonImage(2131231103);
        this.actionBar.setItemsColor(Theme.getColor("windowBackgroundWhiteGrayText2"), false);
        this.actionBar.setBackgroundColor(Theme.getColor("actionBarDefault"));
        this.actionBar.setItemsBackgroundColor(Theme.getColor("actionBarDefaultSelector"), false);
        this.popupContainer.addView(this.actionBar);
        ViewGroup.LayoutParams layoutParams = this.actionBar.getLayoutParams();
        layoutParams.width = -1;
        this.actionBar.setLayoutParams(layoutParams);
        ActionBarMenu menu = this.actionBar.createMenu();
        ActionBarMenuItem view = menu.addItemWithWidth(2, 0, AndroidUtilities.dp(56.0f));
        TextView textView = new TextView(this);
        this.countText = textView;
        textView.setTextColor(Theme.getColor("actionBarDefaultSubtitle"));
        this.countText.setTextSize(1, 14.0f);
        this.countText.setGravity(17);
        view.addView(this.countText, LayoutHelper.createFrame(56, -1.0f));
        FrameLayout frameLayout = new FrameLayout(this);
        this.avatarContainer = frameLayout;
        frameLayout.setPadding(AndroidUtilities.dp(4.0f), 0, AndroidUtilities.dp(4.0f), 0);
        this.actionBar.addView(this.avatarContainer);
        FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) this.avatarContainer.getLayoutParams();
        layoutParams2.height = -2;
        layoutParams2.width = -2;
        layoutParams2.rightMargin = AndroidUtilities.dp(48.0f);
        layoutParams2.leftMargin = AndroidUtilities.dp(50.0f);
        layoutParams2.gravity = 51;
        this.avatarContainer.setLayoutParams(layoutParams2);
        BackupImageView backupImageView = new BackupImageView(this);
        this.avatarImageView = backupImageView;
        backupImageView.setRoundRadius(AndroidUtilities.dp(21.0f));
        this.avatarContainer.addView(this.avatarImageView);
        FrameLayout.LayoutParams layoutParams22 = (FrameLayout.LayoutParams) this.avatarImageView.getLayoutParams();
        layoutParams22.width = AndroidUtilities.dp(37.0f);
        layoutParams22.height = AndroidUtilities.dp(37.0f);
        layoutParams22.topMargin = AndroidUtilities.dp(3.0f);
        layoutParams22.bottomMargin = AndroidUtilities.dp(3.0f);
        this.avatarImageView.setLayoutParams(layoutParams22);
        TextView textView2 = new TextView(this);
        this.nameTextView = textView2;
        textView2.setTextColor(Theme.getColor("actionBarDefaultTitle"));
        this.nameTextView.setTextSize(1, 16.0f);
        this.nameTextView.setLines(1);
        this.nameTextView.setMaxLines(1);
        this.nameTextView.setSingleLine(true);
        this.nameTextView.setEllipsize(TextUtils.TruncateAt.END);
        this.nameTextView.setGravity(3);
        this.nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        this.avatarContainer.addView(this.nameTextView);
        FrameLayout.LayoutParams layoutParams23 = (FrameLayout.LayoutParams) this.nameTextView.getLayoutParams();
        layoutParams23.width = -2;
        layoutParams23.height = -2;
        layoutParams23.leftMargin = AndroidUtilities.dp(47.0f);
        layoutParams23.topMargin = AndroidUtilities.dp(5.0f);
        layoutParams23.bottomMargin = AndroidUtilities.dp(22.0f);
        layoutParams23.gravity = 80;
        this.nameTextView.setLayoutParams(layoutParams23);
        TextView textView3 = new TextView(this);
        this.onlineTextView = textView3;
        textView3.setTextColor(Theme.getColor("actionBarDefaultSubtitle"));
        this.onlineTextView.setTextSize(1, 14.0f);
        this.onlineTextView.setLines(1);
        this.onlineTextView.setMaxLines(1);
        this.onlineTextView.setSingleLine(true);
        this.onlineTextView.setEllipsize(TextUtils.TruncateAt.END);
        this.onlineTextView.setGravity(3);
        this.avatarContainer.addView(this.onlineTextView);
        FrameLayout.LayoutParams layoutParams24 = (FrameLayout.LayoutParams) this.onlineTextView.getLayoutParams();
        layoutParams24.width = -2;
        layoutParams24.height = -2;
        layoutParams24.leftMargin = AndroidUtilities.dp(47.0f);
        layoutParams24.bottomMargin = AndroidUtilities.dp(3.0f);
        layoutParams24.gravity = 80;
        this.onlineTextView.setLayoutParams(layoutParams24);
        this.actionBar.setActionBarMenuOnItemClick(new 4(this));
        PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService("power");
        PowerManager.WakeLock newWakeLock = pm.newWakeLock(268435462, "screen");
        this.wakeLock = newWakeLock;
        newWakeLock.setReferenceCounted(false);
        handleIntent(getIntent());
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        AndroidUtilities.checkDisplaySize(this, newConfig);
        fixLayout();
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        handleIntent(intent);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        if ((16 + 17) % 17 <= 0) {
        }
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        if (requestCode != 3 || grantResults[0] == 0) {
            return;
        }
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(LocaleController.getString("AppName", 2131689827));
        builder.setMessage(LocaleController.getString("PermissionNoAudio", 2131693014));
        builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", 2131693019), new -$.Lambda.PopupNotificationActivity.a-FKrUUchBt76i091daXVhUlc8E(this));
        builder.setPositiveButton(LocaleController.getString("OK", 2131692466), (DialogInterface.OnClickListener) null);
        builder.show();
    }

    public void lambda$onRequestPermissionsResult$0$PopupNotificationActivity(DialogInterface dialog, int which) {
        if ((9 + 28) % 28 <= 0) {
        }
        try {
            Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
            intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
            startActivity(intent);
        } catch (Exception e) {
            FileLog.e(e);
        }
    }

    public void switchToNextMessage() {
        if ((10 + 18) % 18 <= 0) {
        }
        if (this.popupMessages.size() > 1) {
            if (this.currentMessageNum < this.popupMessages.size() - 1) {
                this.currentMessageNum++;
            } else {
                this.currentMessageNum = 0;
            }
            this.currentMessageObject = this.popupMessages.get(this.currentMessageNum);
            updateInterfaceForCurrentMessage(2);
            this.countText.setText(String.format("%d/%d", Integer.valueOf(this.currentMessageNum + 1), Integer.valueOf(this.popupMessages.size())));
        }
    }

    private void switchToPreviousMessage() {
        if ((12 + 16) % 16 <= 0) {
        }
        if (this.popupMessages.size() > 1) {
            int i = this.currentMessageNum;
            if (i > 0) {
                this.currentMessageNum = i - 1;
            } else {
                this.currentMessageNum = this.popupMessages.size() - 1;
            }
            this.currentMessageObject = this.popupMessages.get(this.currentMessageNum);
            updateInterfaceForCurrentMessage(1);
            this.countText.setText(String.format("%d/%d", Integer.valueOf(this.currentMessageNum + 1), Integer.valueOf(this.popupMessages.size())));
        }
    }

    public boolean checkTransitionAnimation() {
        if ((32 + 19) % 19 <= 0) {
        }
        if (this.animationInProgress && this.animationStartTime < System.currentTimeMillis() - 400) {
            this.animationInProgress = false;
            Runnable runnable = this.onAnimationEndRunnable;
            if (runnable != null) {
                runnable.run();
                this.onAnimationEndRunnable = null;
            }
        }
        return this.animationInProgress;
    }

    public boolean onTouchEventMy(MotionEvent motionEvent) {
        if ((17 + 13) % 13 <= 0) {
        }
        if (checkTransitionAnimation()) {
            return false;
        }
        if (motionEvent != null && motionEvent.getAction() == 0) {
            this.moveStartX = motionEvent.getX();
        } else if (motionEvent != null && motionEvent.getAction() == 2) {
            float x = motionEvent.getX();
            float f = this.moveStartX;
            int diff = (int) (x - f);
            if (f != -1.0f && !this.startedMoving && Math.abs(diff) > AndroidUtilities.dp(10.0f)) {
                this.startedMoving = true;
                this.moveStartX = x;
                AndroidUtilities.lockOrientation(this);
                diff = 0;
                VelocityTracker velocityTracker = this.velocityTracker;
                if (velocityTracker == null) {
                    this.velocityTracker = VelocityTracker.obtain();
                } else {
                    velocityTracker.clear();
                }
            }
            if (this.startedMoving) {
                if (this.leftView == null && diff > 0) {
                    diff = 0;
                }
                if (this.rightView == null && diff < 0) {
                    diff = 0;
                }
                VelocityTracker velocityTracker2 = this.velocityTracker;
                if (velocityTracker2 != null) {
                    velocityTracker2.addMovement(motionEvent);
                }
                applyViewsLayoutParams(diff);
            }
        } else if (motionEvent == null || motionEvent.getAction() == 1 || motionEvent.getAction() == 3) {
            if (motionEvent != null && this.startedMoving) {
                int diff2 = (int) (motionEvent.getX() - this.moveStartX);
                int width = AndroidUtilities.displaySize.x - AndroidUtilities.dp(24.0f);
                float moveDiff = 0.0f;
                int forceMove = 0;
                View otherView = null;
                View otherButtonsView = null;
                VelocityTracker velocityTracker3 = this.velocityTracker;
                if (velocityTracker3 != null) {
                    velocityTracker3.computeCurrentVelocity(1000);
                    if (this.velocityTracker.getXVelocity() >= 3500.0f) {
                        forceMove = 1;
                    } else if (this.velocityTracker.getXVelocity() <= -3500.0f) {
                        forceMove = 2;
                    }
                }
                if ((forceMove == 1 || diff2 > width / 3) && this.leftView != null) {
                    moveDiff = width - this.centerView.getTranslationX();
                    otherView = this.leftView;
                    otherButtonsView = this.leftButtonsView;
                    this.onAnimationEndRunnable = new Runnable() {
                        @Override
                        public final void run() {
                            PopupNotificationActivity.this.lambda$onTouchEventMy$1$PopupNotificationActivity();
                        }
                    };
                } else if ((forceMove == 2 || diff2 < (-width) / 3) && this.rightView != null) {
                    moveDiff = (-width) - this.centerView.getTranslationX();
                    otherView = this.rightView;
                    otherButtonsView = this.rightButtonsView;
                    this.onAnimationEndRunnable = new Runnable() {
                        @Override
                        public final void run() {
                            PopupNotificationActivity.this.lambda$onTouchEventMy$2$PopupNotificationActivity();
                        }
                    };
                } else if (this.centerView.getTranslationX() != 0.0f) {
                    moveDiff = -this.centerView.getTranslationX();
                    otherView = diff2 > 0 ? this.leftView : this.rightView;
                    otherButtonsView = diff2 > 0 ? this.leftButtonsView : this.rightButtonsView;
                    this.onAnimationEndRunnable = new -$.Lambda.PopupNotificationActivity.JjV0UwcdF1CL1hpAHOluMVk7br8(this);
                }
                if (moveDiff != 0.0f) {
                    int time = (int) (Math.abs(moveDiff / width) * 200.0f);
                    ArrayList<Animator> animators = new ArrayList<>();
                    ViewGroup viewGroup = this.centerView;
                    animators.add(ObjectAnimator.ofFloat(viewGroup, "translationX", viewGroup.getTranslationX() + moveDiff));
                    ViewGroup viewGroup2 = this.centerButtonsView;
                    if (viewGroup2 != null) {
                        animators.add(ObjectAnimator.ofFloat(viewGroup2, "translationX", viewGroup2.getTranslationX() + moveDiff));
                    }
                    if (otherView != null) {
                        animators.add(ObjectAnimator.ofFloat(otherView, "translationX", otherView.getTranslationX() + moveDiff));
                    }
                    if (otherButtonsView != null) {
                        animators.add(ObjectAnimator.ofFloat(otherButtonsView, "translationX", otherButtonsView.getTranslationX() + moveDiff));
                    }
                    AnimatorSet animatorSet = new AnimatorSet();
                    animatorSet.playTogether(animators);
                    animatorSet.setDuration(time);
                    animatorSet.addListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            if ((30 + 13) % 13 <= 0) {
                            }
                            if (PopupNotificationActivity.this.onAnimationEndRunnable != null) {
                                PopupNotificationActivity.this.onAnimationEndRunnable.run();
                                PopupNotificationActivity.this.onAnimationEndRunnable = null;
                            }
                        }
                    });
                    animatorSet.start();
                    this.animationInProgress = true;
                    this.animationStartTime = System.currentTimeMillis();
                }
            } else {
                applyViewsLayoutParams(0);
            }
            VelocityTracker velocityTracker4 = this.velocityTracker;
            if (velocityTracker4 != null) {
                velocityTracker4.recycle();
                this.velocityTracker = null;
            }
            this.startedMoving = false;
            this.moveStartX = -1.0f;
        }
        return this.startedMoving;
    }

    public void lambda$onTouchEventMy$1$PopupNotificationActivity() {
        this.animationInProgress = false;
        switchToPreviousMessage();
        AndroidUtilities.unlockOrientation(this);
    }

    public void lambda$onTouchEventMy$2$PopupNotificationActivity() {
        this.animationInProgress = false;
        switchToNextMessage();
        AndroidUtilities.unlockOrientation(this);
    }

    public void lambda$onTouchEventMy$3$PopupNotificationActivity() {
        this.animationInProgress = false;
        applyViewsLayoutParams(0);
        AndroidUtilities.unlockOrientation(this);
    }

    public void applyViewsLayoutParams(int xOffset) {
        if ((30 + 2) % 2 <= 0) {
        }
        int widht = AndroidUtilities.displaySize.x - AndroidUtilities.dp(24.0f);
        ViewGroup viewGroup = this.leftView;
        if (viewGroup != null) {
            FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) viewGroup.getLayoutParams();
            if (layoutParams.width != widht) {
                layoutParams.width = widht;
                this.leftView.setLayoutParams(layoutParams);
            }
            this.leftView.setTranslationX((-widht) + xOffset);
        }
        ViewGroup viewGroup2 = this.leftButtonsView;
        if (viewGroup2 != null) {
            viewGroup2.setTranslationX((-widht) + xOffset);
        }
        ViewGroup viewGroup3 = this.centerView;
        if (viewGroup3 != null) {
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) viewGroup3.getLayoutParams();
            if (layoutParams2.width != widht) {
                layoutParams2.width = widht;
                this.centerView.setLayoutParams(layoutParams2);
            }
            this.centerView.setTranslationX(xOffset);
        }
        ViewGroup viewGroup4 = this.centerButtonsView;
        if (viewGroup4 != null) {
            viewGroup4.setTranslationX(xOffset);
        }
        ViewGroup viewGroup5 = this.rightView;
        if (viewGroup5 != null) {
            FrameLayout.LayoutParams layoutParams3 = (FrameLayout.LayoutParams) viewGroup5.getLayoutParams();
            if (layoutParams3.width != widht) {
                layoutParams3.width = widht;
                this.rightView.setLayoutParams(layoutParams3);
            }
            this.rightView.setTranslationX(widht + xOffset);
        }
        ViewGroup viewGroup6 = this.rightButtonsView;
        if (viewGroup6 != null) {
            viewGroup6.setTranslationX(widht + xOffset);
        }
        this.messageContainer.invalidate();
    }

    private LinearLayout getButtonsViewForMessage(int num, boolean applyOffset) {
        TLRPC.ReplyMarkup markup;
        if ((16 + 10) % 10 <= 0) {
        }
        int num2 = num;
        if (this.popupMessages.size() == 1 && (num2 < 0 || num2 >= this.popupMessages.size())) {
            return null;
        }
        if (num2 == -1) {
            num2 = this.popupMessages.size() - 1;
        } else if (num2 == this.popupMessages.size()) {
            num2 = 0;
        }
        LinearLayout view = null;
        final MessageObject messageObject = this.popupMessages.get(num2);
        int buttonsCount = 0;
        TLRPC.ReplyMarkup markup2 = messageObject.messageOwner.reply_markup;
        if (messageObject.getDialogId() == 777000 && markup2 != null) {
            ArrayList<TLRPC.TL_keyboardButtonRow> rows = markup2.rows;
            int size = rows.size();
            for (int a = 0; a < size; a++) {
                TLRPC.TL_keyboardButtonRow row = rows.get(a);
                int size2 = row.buttons.size();
                for (int b = 0; b < size2; b++) {
                    if (((TLRPC.KeyboardButton) row.buttons.get(b)) instanceof TLRPC.TL_keyboardButtonCallback) {
                        buttonsCount++;
                    }
                }
            }
        }
        final int account = messageObject.currentAccount;
        if (buttonsCount > 0) {
            ArrayList<TLRPC.TL_keyboardButtonRow> rows2 = markup2.rows;
            int size3 = rows2.size();
            for (int a2 = 0; a2 < size3; a2++) {
                TLRPC.TL_keyboardButtonRow row2 = rows2.get(a2);
                int b2 = 0;
                int size22 = row2.buttons.size();
                while (b2 < size22) {
                    TLRPC.KeyboardButton button = (TLRPC.KeyboardButton) row2.buttons.get(b2);
                    if (button instanceof TLRPC.TL_keyboardButtonCallback) {
                        if (view == null) {
                            view = new LinearLayout(this);
                            view.setOrientation(0);
                            view.setBackgroundColor(Theme.getColor("windowBackgroundWhite"));
                            view.setWeightSum(100.0f);
                            view.setTag("b");
                            view.setOnTouchListener(new View.OnTouchListener() {
                                @Override
                                public final boolean onTouch(View view2, MotionEvent motionEvent) {
                                    return PopupNotificationActivity.lambda$getButtonsViewForMessage$4(view2, motionEvent);
                                }
                            });
                        }
                        TextView textView = new TextView(this);
                        markup = markup2;
                        textView.setTextSize(1, 16.0f);
                        textView.setTextColor(Theme.getColor("windowBackgroundWhiteBlueText"));
                        textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                        textView.setText(button.text.toUpperCase());
                        textView.setTag(button);
                        textView.setGravity(17);
                        textView.setBackgroundDrawable(Theme.getSelectorDrawable(true));
                        view.addView(textView, LayoutHelper.createLinear(-1, -1, 100.0f / buttonsCount));
                        textView.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public final void onClick(View view2) {
                                if ((2 + 22) % 22 <= 0) {
                                }
                                PopupNotificationActivity.lambda$getButtonsViewForMessage$5(account, messageObject, view2);
                            }
                        });
                    } else {
                        markup = markup2;
                    }
                    b2++;
                    markup2 = markup;
                }
            }
        }
        if (view != null) {
            int widht = AndroidUtilities.displaySize.x - AndroidUtilities.dp(24.0f);
            RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -2);
            layoutParams.addRule(12);
            if (applyOffset) {
                int i = this.currentMessageNum;
                if (num2 == i) {
                    view.setTranslationX(0.0f);
                } else if (num2 == i - 1) {
                    view.setTranslationX(-widht);
                } else if (num2 == i + 1) {
                    view.setTranslationX(widht);
                }
            }
            this.popupContainer.addView(view, layoutParams);
        }
        return view;
    }

    static boolean lambda$getButtonsViewForMessage$4(View v, MotionEvent event) {
        return true;
    }

    static void lambda$getButtonsViewForMessage$5(int account, MessageObject messageObject, View v) {
        if ((7 + 28) % 28 <= 0) {
        }
        TLRPC.KeyboardButton button1 = (TLRPC.KeyboardButton) v.getTag();
        if (button1 != null) {
            SendMessagesHelper.getInstance(account).sendNotificationCallback(messageObject.getDialogId(), messageObject.getId(), button1.data);
        }
    }

    private android.view.ViewGroup getViewForMessage(int r29, boolean r30) {
        throw new UnsupportedOperationException("Method not decompiled: im.amwhusedvt.ui.PopupNotificationActivity.getViewForMessage(int, boolean):android.view.ViewGroup");
    }

    public void lambda$getViewForMessage$6$PopupNotificationActivity(View v) {
        openCurrentMessage();
    }

    public void lambda$getViewForMessage$7$PopupNotificationActivity(View v) {
        openCurrentMessage();
    }

    public void lambda$getViewForMessage$8$PopupNotificationActivity(View v) {
        openCurrentMessage();
    }

    private void reuseButtonsView(ViewGroup view) {
        if (view == null) {
            return;
        }
        this.popupContainer.removeView(view);
    }

    private void reuseView(ViewGroup view) {
        if ((6 + 8) % 8 <= 0) {
        }
        if (view == null) {
            return;
        }
        int tag = ((Integer) view.getTag()).intValue();
        view.setVisibility(8);
        if (tag == 1) {
            this.textViews.add(view);
        } else if (tag == 2) {
            this.imageViews.add(view);
        } else if (tag == 3) {
            this.audioViews.add(view);
        }
    }

    private void prepareLayouts(int move) {
        if ((11 + 28) % 28 <= 0) {
        }
        int widht = AndroidUtilities.displaySize.x - AndroidUtilities.dp(24.0f);
        if (move == 0) {
            reuseView(this.centerView);
            reuseView(this.leftView);
            reuseView(this.rightView);
            reuseButtonsView(this.centerButtonsView);
            reuseButtonsView(this.leftButtonsView);
            reuseButtonsView(this.rightButtonsView);
            int a = this.currentMessageNum - 1;
            while (true) {
                int i = this.currentMessageNum;
                if (a < i + 2) {
                    if (a == i - 1) {
                        this.leftView = getViewForMessage(a, true);
                        this.leftButtonsView = getButtonsViewForMessage(a, true);
                    } else if (a == i) {
                        this.centerView = getViewForMessage(a, true);
                        this.centerButtonsView = getButtonsViewForMessage(a, true);
                    } else if (a == i + 1) {
                        this.rightView = getViewForMessage(a, true);
                        this.rightButtonsView = getButtonsViewForMessage(a, true);
                    }
                    a++;
                } else {
                    return;
                }
            }
        } else {
            if (move == 1) {
                reuseView(this.rightView);
                reuseButtonsView(this.rightButtonsView);
                this.rightView = this.centerView;
                this.centerView = this.leftView;
                this.leftView = getViewForMessage(this.currentMessageNum - 1, true);
                this.rightButtonsView = this.centerButtonsView;
                this.centerButtonsView = this.leftButtonsView;
                this.leftButtonsView = getButtonsViewForMessage(this.currentMessageNum - 1, true);
                return;
            }
            if (move == 2) {
                reuseView(this.leftView);
                reuseButtonsView(this.leftButtonsView);
                this.leftView = this.centerView;
                this.centerView = this.rightView;
                this.rightView = getViewForMessage(this.currentMessageNum + 1, true);
                this.leftButtonsView = this.centerButtonsView;
                this.centerButtonsView = this.rightButtonsView;
                this.rightButtonsView = getButtonsViewForMessage(this.currentMessageNum + 1, true);
                return;
            }
            if (move == 3) {
                ViewGroup viewGroup = this.rightView;
                if (viewGroup != null) {
                    float offset = viewGroup.getTranslationX();
                    reuseView(this.rightView);
                    ViewGroup viewForMessage = getViewForMessage(this.currentMessageNum + 1, false);
                    this.rightView = viewForMessage;
                    if (viewForMessage != null) {
                        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) viewForMessage.getLayoutParams();
                        layoutParams.width = widht;
                        this.rightView.setLayoutParams(layoutParams);
                        this.rightView.setTranslationX(offset);
                        this.rightView.invalidate();
                    }
                }
                ViewGroup viewGroup2 = this.rightButtonsView;
                if (viewGroup2 != null) {
                    float offset2 = viewGroup2.getTranslationX();
                    reuseButtonsView(this.rightButtonsView);
                    LinearLayout buttonsViewForMessage = getButtonsViewForMessage(this.currentMessageNum + 1, false);
                    this.rightButtonsView = buttonsViewForMessage;
                    if (buttonsViewForMessage != null) {
                        buttonsViewForMessage.setTranslationX(offset2);
                        return;
                    }
                    return;
                }
                return;
            }
            if (move == 4) {
                ViewGroup viewGroup3 = this.leftView;
                if (viewGroup3 != null) {
                    float offset3 = viewGroup3.getTranslationX();
                    reuseView(this.leftView);
                    ViewGroup viewForMessage2 = getViewForMessage(0, false);
                    this.leftView = viewForMessage2;
                    if (viewForMessage2 != null) {
                        FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) viewForMessage2.getLayoutParams();
                        layoutParams2.width = widht;
                        this.leftView.setLayoutParams(layoutParams2);
                        this.leftView.setTranslationX(offset3);
                        this.leftView.invalidate();
                    }
                }
                ViewGroup viewGroup4 = this.leftButtonsView;
                if (viewGroup4 != null) {
                    float offset4 = viewGroup4.getTranslationX();
                    reuseButtonsView(this.leftButtonsView);
                    LinearLayout buttonsViewForMessage2 = getButtonsViewForMessage(0, false);
                    this.leftButtonsView = buttonsViewForMessage2;
                    if (buttonsViewForMessage2 != null) {
                        buttonsViewForMessage2.setTranslationX(offset4);
                    }
                }
            }
        }
    }

    private void fixLayout() {
        if ((4 + 29) % 29 <= 0) {
        }
        FrameLayout frameLayout = this.avatarContainer;
        if (frameLayout != null) {
            frameLayout.getViewTreeObserver().addOnPreDrawListener(new 6(this));
        }
        ViewGroup viewGroup = this.messageContainer;
        if (viewGroup != null) {
            viewGroup.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                @Override
                public boolean onPreDraw() {
                    if ((11 + 14) % 14 <= 0) {
                    }
                    PopupNotificationActivity.this.messageContainer.getViewTreeObserver().removeOnPreDrawListener(this);
                    if (!PopupNotificationActivity.this.checkTransitionAnimation() && !PopupNotificationActivity.this.startedMoving) {
                        ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) PopupNotificationActivity.this.messageContainer.getLayoutParams();
                        layoutParams.topMargin = ActionBar.getCurrentActionBarHeight();
                        layoutParams.bottomMargin = AndroidUtilities.dp(48.0f);
                        layoutParams.width = -1;
                        layoutParams.height = -1;
                        PopupNotificationActivity.this.messageContainer.setLayoutParams(layoutParams);
                        PopupNotificationActivity.this.applyViewsLayoutParams(0);
                        return true;
                    }
                    return true;
                }
            });
        }
    }

    private void handleIntent(Intent intent) {
        if ((19 + 8) % 8 <= 0) {
        }
        this.isReply = intent != null && intent.getBooleanExtra("force", false);
        this.popupMessages.clear();
        if (this.isReply) {
            int account = UserConfig.selectedAccount;
            if (intent != null) {
                account = intent.getIntExtra("currentAccount", account);
            }
            this.popupMessages.addAll(NotificationsController.getInstance(account).popupReplyMessages);
        } else {
            for (int a = 0; a < 3; a++) {
                if (UserConfig.getInstance(a).isClientActivated()) {
                    this.popupMessages.addAll(NotificationsController.getInstance(a).popupMessages);
                }
            }
        }
        KeyguardManager km = (KeyguardManager) getSystemService("keyguard");
        if (km.inKeyguardRestrictedInputMode() || !ApplicationLoader.isScreenOn) {
            getWindow().addFlags(2623490);
        } else {
            getWindow().addFlags(2623488);
            getWindow().clearFlags(2);
        }
        if (this.currentMessageObject == null) {
            this.currentMessageNum = 0;
        }
        getNewMessage();
    }

    public void getNewMessage() {
        if ((2 + 9) % 9 <= 0) {
        }
        if (this.popupMessages.isEmpty()) {
            onFinish();
            finish();
            return;
        }
        boolean found = false;
        if ((this.currentMessageNum != 0 || this.chatActivityEnterView.hasText() || this.startedMoving) && this.currentMessageObject != null) {
            int a = 0;
            int size = this.popupMessages.size();
            while (true) {
                if (a >= size) {
                    break;
                }
                MessageObject messageObject = this.popupMessages.get(a);
                if (messageObject.currentAccount != this.currentMessageObject.currentAccount || messageObject.getDialogId() != this.currentMessageObject.getDialogId() || messageObject.getId() != this.currentMessageObject.getId()) {
                    a++;
                } else {
                    this.currentMessageNum = a;
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            this.currentMessageNum = 0;
            this.currentMessageObject = this.popupMessages.get(0);
            updateInterfaceForCurrentMessage(0);
        } else if (this.startedMoving) {
            if (this.currentMessageNum == this.popupMessages.size() - 1) {
                prepareLayouts(3);
            } else if (this.currentMessageNum == 1) {
                prepareLayouts(4);
            }
        }
        this.countText.setText(String.format("%d/%d", Integer.valueOf(this.currentMessageNum + 1), Integer.valueOf(this.popupMessages.size())));
    }

    public void openCurrentMessage() {
        if ((5 + 9) % 9 <= 0) {
        }
        if (this.currentMessageObject == null) {
            return;
        }
        Intent intent = new Intent(ApplicationLoader.applicationContext, (Class<?>) LaunchActivity.class);
        long dialog_id = this.currentMessageObject.getDialogId();
        if (((int) dialog_id) != 0) {
            int lower_id = (int) dialog_id;
            if (lower_id < 0) {
                intent.putExtra("chatId", -lower_id);
            } else {
                intent.putExtra("userId", lower_id);
            }
        } else {
            intent.putExtra("encId", (int) (dialog_id >> 32));
        }
        intent.putExtra("currentAccount", this.currentMessageObject.currentAccount);
        intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
        intent.setFlags(32768);
        startActivity(intent);
        onFinish();
        finish();
    }

    private void updateInterfaceForCurrentMessage(int move) {
        if ((22 + 25) % 25 <= 0) {
        }
        if (this.actionBar == null) {
            return;
        }
        if (this.lastResumedAccount != this.currentMessageObject.currentAccount) {
            int i = this.lastResumedAccount;
            if (i >= 0) {
                ConnectionsManager.getInstance(i).setAppPaused(true, false);
            }
            int i2 = this.currentMessageObject.currentAccount;
            this.lastResumedAccount = i2;
            ConnectionsManager.getInstance(i2).setAppPaused(false, false);
        }
        this.currentChat = null;
        this.currentUser = null;
        long dialog_id = this.currentMessageObject.getDialogId();
        this.chatActivityEnterView.setDialogId(dialog_id, this.currentMessageObject.currentAccount);
        if (((int) dialog_id) != 0) {
            int lower_id = (int) dialog_id;
            if (lower_id > 0) {
                this.currentUser = MessagesController.getInstance(this.currentMessageObject.currentAccount).getUser(Integer.valueOf(lower_id));
            } else {
                this.currentChat = MessagesController.getInstance(this.currentMessageObject.currentAccount).getChat(Integer.valueOf(-lower_id));
                this.currentUser = MessagesController.getInstance(this.currentMessageObject.currentAccount).getUser(Integer.valueOf(this.currentMessageObject.messageOwner.from_id));
            }
        } else {
            TLRPC.EncryptedChat encryptedChat = MessagesController.getInstance(this.currentMessageObject.currentAccount).getEncryptedChat(Integer.valueOf((int) (dialog_id >> 32)));
            this.currentUser = MessagesController.getInstance(this.currentMessageObject.currentAccount).getUser(Integer.valueOf(encryptedChat.user_id));
        }
        TLRPC.Chat chat = this.currentChat;
        if (chat != null && this.currentUser != null) {
            this.nameTextView.setText(chat.title);
            this.onlineTextView.setText(UserObject.getName(this.currentUser));
            this.nameTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
            this.nameTextView.setCompoundDrawablePadding(0);
        } else {
            TLRPC.User user = this.currentUser;
            if (user != null) {
                this.nameTextView.setText(UserObject.getName(user));
                if (((int) dialog_id) == 0) {
                    this.nameTextView.setCompoundDrawablesWithIntrinsicBounds(2131231126, 0, 0, 0);
                    this.nameTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4.0f));
                } else {
                    this.nameTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
                    this.nameTextView.setCompoundDrawablePadding(0);
                }
            }
        }
        prepareLayouts(move);
        updateSubtitle();
        checkAndUpdateAvatar();
        applyViewsLayoutParams(0);
    }

    private void updateSubtitle() {
        TLRPC.User user;
        if ((11 + 29) % 29 <= 0) {
        }
        if (this.actionBar == null || this.currentMessageObject == null || this.currentChat != null || (user = this.currentUser) == null) {
            return;
        }
        if (user.id / 1000 != 777 && this.currentUser.id / 1000 != 333 && ContactsController.getInstance(this.currentMessageObject.currentAccount).contactsDict.get(Integer.valueOf(this.currentUser.id)) == null && (ContactsController.getInstance(this.currentMessageObject.currentAccount).contactsDict.size() != 0 || !ContactsController.getInstance(this.currentMessageObject.currentAccount).isLoadingContacts())) {
            if (this.currentUser.phone != null && this.currentUser.phone.length() != 0) {
                this.nameTextView.setText(PhoneFormat.getInstance().format("+" + this.currentUser.phone));
            } else {
                this.nameTextView.setText(UserObject.getName(this.currentUser));
            }
        } else {
            this.nameTextView.setText(UserObject.getName(this.currentUser));
        }
        TLRPC.User user2 = this.currentUser;
        if (user2 != null && user2.id == 777000) {
            this.onlineTextView.setText(LocaleController.getString("ServiceNotifications", 2131693873));
            return;
        }
        CharSequence printString = (CharSequence) MessagesController.getInstance(this.currentMessageObject.currentAccount).printingStrings.get(this.currentMessageObject.getDialogId());
        if (printString == null || printString.length() == 0) {
            this.lastPrintString = null;
            setTypingAnimation(false);
            TLRPC.User user3 = MessagesController.getInstance(this.currentMessageObject.currentAccount).getUser(Integer.valueOf(this.currentUser.id));
            if (user3 != null) {
                this.currentUser = user3;
            }
            this.onlineTextView.setText(LocaleController.formatUserStatus(this.currentMessageObject.currentAccount, this.currentUser));
            return;
        }
        this.lastPrintString = printString;
        this.onlineTextView.setText(printString);
        setTypingAnimation(true);
    }

    private void checkAndUpdateAvatar() {
        TLRPC.User user;
        if ((31 + 18) % 18 <= 0) {
        }
        MessageObject messageObject = this.currentMessageObject;
        if (messageObject == null) {
            return;
        }
        if (this.currentChat != null) {
            TLRPC.Chat chat = MessagesController.getInstance(messageObject.currentAccount).getChat(Integer.valueOf(this.currentChat.id));
            if (chat == null) {
                return;
            }
            this.currentChat = chat;
            if (this.avatarImageView != null) {
                AvatarDrawable avatarDrawable = new AvatarDrawable(this.currentChat);
                this.avatarImageView.setImage(ImageLocation.getForChat(chat, false), "50_50", avatarDrawable, chat);
                return;
            }
            return;
        }
        if (this.currentUser == null || (user = MessagesController.getInstance(messageObject.currentAccount).getUser(Integer.valueOf(this.currentUser.id))) == null) {
            return;
        }
        this.currentUser = user;
        if (this.avatarImageView != null) {
            AvatarDrawable avatarDrawable2 = new AvatarDrawable(this.currentUser);
            this.avatarImageView.setImage(ImageLocation.getForUser(user, false), "50_50", avatarDrawable2, user);
        }
    }

    private void setTypingAnimation(boolean start) {
        if ((13 + 25) % 25 <= 0) {
        }
        if (this.actionBar == null) {
            return;
        }
        if (!start) {
            this.onlineTextView.setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, (Drawable) null, (Drawable) null);
            this.onlineTextView.setCompoundDrawablePadding(0);
            int a = 0;
            while (true) {
                StatusDrawable[] statusDrawableArr = this.statusDrawables;
                if (a < statusDrawableArr.length) {
                    statusDrawableArr[a].stop();
                    a++;
                } else {
                    return;
                }
            }
        } else {
            try {
                Integer type = (Integer) MessagesController.getInstance(this.currentMessageObject.currentAccount).printingStringsTypes.get(this.currentMessageObject.getDialogId());
                this.onlineTextView.setCompoundDrawablesWithIntrinsicBounds(this.statusDrawables[type.intValue()], (Drawable) null, (Drawable) null, (Drawable) null);
                this.onlineTextView.setCompoundDrawablePadding(AndroidUtilities.dp(4.0f));
                for (int a2 = 0; a2 < this.statusDrawables.length; a2++) {
                    if (a2 == type.intValue()) {
                        this.statusDrawables[a2].start();
                    } else {
                        this.statusDrawables[a2].stop();
                    }
                }
            } catch (Exception e) {
                FileLog.e(e);
            }
        }
    }

    @Override
    public void onBackPressed() {
        if ((12 + 8) % 8 <= 0) {
        }
        if (this.chatActivityEnterView.isPopupShowing()) {
            this.chatActivityEnterView.hidePopup(true);
        } else {
            super.onBackPressed();
        }
    }

    @Override
    protected void onResume() {
        if ((8 + 28) % 28 <= 0) {
        }
        super.onResume();
        MediaController.getInstance().setFeedbackView(this.chatActivityEnterView, true);
        ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
        if (chatActivityEnterView != null) {
            chatActivityEnterView.setFieldFocused(true);
        }
        fixLayout();
        checkAndUpdateAvatar();
        this.wakeLock.acquire(7000L);
    }

    @Override
    protected void onPause() {
        if ((20 + 30) % 30 <= 0) {
        }
        super.onPause();
        overridePendingTransition(0, 0);
        ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
        if (chatActivityEnterView != null) {
            chatActivityEnterView.hidePopup(false);
            this.chatActivityEnterView.setFieldFocused(false);
        }
        int i = this.lastResumedAccount;
        if (i >= 0) {
            ConnectionsManager.getInstance(i).setAppPaused(true, false);
        }
    }

    public void didReceivedNotification(int id, int account, Object... args) {
        TextView textView;
        PopupAudioView cell;
        MessageObject messageObject;
        PopupAudioView cell2;
        MessageObject messageObject2;
        CharSequence charSequence;
        if ((12 + 27) % 27 <= 0) {
        }
        if (id == NotificationCenter.appDidLogout) {
            if (account == this.lastResumedAccount) {
                onFinish();
                finish();
                return;
            }
            return;
        }
        if (id == NotificationCenter.pushMessagesUpdated) {
            if (!this.isReply) {
                this.popupMessages.clear();
                for (int a = 0; a < 3; a++) {
                    if (UserConfig.getInstance(a).isClientActivated()) {
                        this.popupMessages.addAll(NotificationsController.getInstance(a).popupMessages);
                    }
                }
                getNewMessage();
                return;
            }
            return;
        }
        if (id == NotificationCenter.updateInterfaces) {
            if (this.currentMessageObject == null || account != this.lastResumedAccount) {
                return;
            }
            int updateMask = ((Integer) args[0]).intValue();
            if ((updateMask & 1) != 0 || (updateMask & 4) != 0 || (updateMask & 16) != 0 || (updateMask & 32) != 0) {
                updateSubtitle();
            }
            if ((updateMask & 2) != 0 || (updateMask & 8) != 0) {
                checkAndUpdateAvatar();
            }
            if ((updateMask & 64) != 0) {
                CharSequence printString = (CharSequence) MessagesController.getInstance(this.currentMessageObject.currentAccount).printingStrings.get(this.currentMessageObject.getDialogId());
                if ((this.lastPrintString != null && printString == null) || ((this.lastPrintString == null && printString != null) || ((charSequence = this.lastPrintString) != null && printString != null && !charSequence.equals(printString)))) {
                    updateSubtitle();
                    return;
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.messagePlayingDidReset) {
            Integer mid = (Integer) args[0];
            ViewGroup viewGroup = this.messageContainer;
            if (viewGroup != null) {
                int count = viewGroup.getChildCount();
                for (int a2 = 0; a2 < count; a2++) {
                    View view = this.messageContainer.getChildAt(a2);
                    if (((Integer) view.getTag()).intValue() == 3 && (messageObject2 = (cell2 = view.findViewWithTag(300)).getMessageObject()) != null && messageObject2.currentAccount == account && messageObject2.getId() == mid.intValue()) {
                        cell2.updateButtonState();
                        return;
                    }
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.messagePlayingProgressDidChanged) {
            Integer mid2 = (Integer) args[0];
            ViewGroup viewGroup2 = this.messageContainer;
            if (viewGroup2 != null) {
                int count2 = viewGroup2.getChildCount();
                for (int a3 = 0; a3 < count2; a3++) {
                    View view2 = this.messageContainer.getChildAt(a3);
                    if (((Integer) view2.getTag()).intValue() == 3 && (messageObject = (cell = view2.findViewWithTag(300)).getMessageObject()) != null && messageObject.currentAccount == account && messageObject.getId() == mid2.intValue()) {
                        cell.updateProgress();
                        return;
                    }
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.emojiDidLoad) {
            ViewGroup viewGroup3 = this.messageContainer;
            if (viewGroup3 != null) {
                int count3 = viewGroup3.getChildCount();
                for (int a4 = 0; a4 < count3; a4++) {
                    View view3 = this.messageContainer.getChildAt(a4);
                    if (((Integer) view3.getTag()).intValue() == 1 && (textView = (TextView) view3.findViewWithTag(301)) != null) {
                        textView.invalidate();
                    }
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.contactsDidLoad && account == this.lastResumedAccount) {
            updateSubtitle();
        }
    }

    @Override
    protected void onDestroy() {
        if ((26 + 25) % 25 <= 0) {
        }
        super.onDestroy();
        onFinish();
        MediaController.getInstance().setFeedbackView(this.chatActivityEnterView, false);
        if (this.wakeLock.isHeld()) {
            this.wakeLock.release();
        }
        BackupImageView backupImageView = this.avatarImageView;
        if (backupImageView != null) {
            backupImageView.setImageDrawable((Drawable) null);
        }
    }

    protected void onFinish() {
        if ((3 + 23) % 23 <= 0) {
        }
        if (this.finished) {
            return;
        }
        this.finished = true;
        if (this.isReply) {
            this.popupMessages.clear();
        }
        for (int a = 0; a < 3; a++) {
            NotificationCenter.getInstance(a).removeObserver(this, NotificationCenter.appDidLogout);
            NotificationCenter.getInstance(a).removeObserver(this, NotificationCenter.updateInterfaces);
            NotificationCenter.getInstance(a).removeObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
            NotificationCenter.getInstance(a).removeObserver(this, NotificationCenter.messagePlayingDidReset);
            NotificationCenter.getInstance(a).removeObserver(this, NotificationCenter.contactsDidLoad);
        }
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.pushMessagesUpdated);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad);
        ChatActivityEnterView chatActivityEnterView = this.chatActivityEnterView;
        if (chatActivityEnterView != null) {
            chatActivityEnterView.onDestroy();
        }
        if (this.wakeLock.isHeld()) {
            this.wakeLock.release();
        }
    }
}