导航菜单

页面标题

页面副标题

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

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

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


package im.amwhusedvt.ui;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.ApplicationLoader;
import im.amwhusedvt.messenger.BuildVars;
import im.amwhusedvt.messenger.ContactsController;
import im.amwhusedvt.messenger.Emoji;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.ImageLocation;
import im.amwhusedvt.messenger.ImageReceiver;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.MessageObject;
import im.amwhusedvt.messenger.NotificationCenter;
import im.amwhusedvt.messenger.SendMessagesHelper;
import im.amwhusedvt.messenger.Utilities;
import im.amwhusedvt.messenger.voip.EncryptionKeyEmojifier;
import im.amwhusedvt.messenger.voip.VoIPBaseService;
import im.amwhusedvt.messenger.voip.VoIPController;
import im.amwhusedvt.messenger.voip.VoIPService;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.-$;
import im.amwhusedvt.ui.actionbar.AlertDialog;
import im.amwhusedvt.ui.actionbar.BottomSheet;
import im.amwhusedvt.ui.actionbar.DarkAlertDialog;
import im.amwhusedvt.ui.actionbar.Theme;
import im.amwhusedvt.ui.components.BackupImageView;
import im.amwhusedvt.ui.components.CorrectlyMeasuringTextView;
import im.amwhusedvt.ui.components.CubicBezierInterpolator;
import im.amwhusedvt.ui.components.IdenticonDrawable;
import im.amwhusedvt.ui.components.LayoutHelper;
import im.amwhusedvt.ui.components.voip.CallSwipeView;
import im.amwhusedvt.ui.components.voip.CheckableImageView;
import im.amwhusedvt.ui.components.voip.DarkTheme;
import im.amwhusedvt.ui.components.voip.FabBackgroundDrawable;
import im.amwhusedvt.ui.components.voip.VoIPHelper;
import im.amwhusedvt.ui.utils.translate.common.AudioEditConstant;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;

public class VoIPActivity extends Activity implements VoIPBaseService.StateListener, NotificationCenter.NotificationCenterDelegate {
    private static final String TAG = "hchat-voip-ui";
    private View acceptBtn;
    private CallSwipeView acceptSwipe;
    private TextView accountNameText;
    private ImageView addMemberBtn;
    private ImageView blurOverlayView1;
    private ImageView blurOverlayView2;
    private Bitmap blurredPhoto1;
    private Bitmap blurredPhoto2;
    private LinearLayout bottomButtons;
    private TextView brandingText;
    private int callState;
    private View cancelBtn;
    private ImageView chatBtn;
    private FrameLayout content;
    private Animator currentAcceptAnim;
    private Animator currentDeclineAnim;
    private View declineBtn;
    private CallSwipeView declineSwipe;
    private TextView durationText;
    private AnimatorSet ellAnimator;
    private TextAlphaSpan[] ellSpans;
    private AnimatorSet emojiAnimator;
    boolean emojiExpanded;
    private TextView emojiExpandedText;
    boolean emojiTooltipVisible;
    private LinearLayout emojiWrap;
    private View endBtn;
    private FabBackgroundDrawable endBtnBg;
    private View endBtnIcon;
    private TextView hintTextView;
    private boolean isIncomingWaiting;
    private boolean keyEmojiVisible;
    private String lastStateText;
    private CheckableImageView micToggle;
    private TextView nameText;
    private BackupImageView photoView;
    private AnimatorSet retryAnim;
    private boolean retrying;
    private int signalBarsCount;
    private SignalBarsDrawable signalBarsDrawable;
    private CheckableImageView spkToggle;
    private TextView stateText;
    private TextView stateText2;
    private LinearLayout swipeViewsWrap;
    private Animator textChangingAnim;
    private Animator tooltipAnim;
    private Runnable tooltipHider;
    private TLRPC.User user;
    private int currentAccount = -1;
    private boolean firstStateChange = true;
    private boolean didAcceptFromHere = false;
    private ImageView[] keyEmojiViews = new ImageView[4];

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        if ((12 + 27) % 27 <= 0) {
        }
        requestWindowFeature(1);
        getWindow().addFlags(524288);
        super.onCreate(savedInstanceState);
        if (VoIPService.getSharedInstance() == null) {
            finish();
            return;
        }
        int account = VoIPService.getSharedInstance().getAccount();
        this.currentAccount = account;
        if (account == -1) {
            finish();
            return;
        }
        if ((getResources().getConfiguration().screenLayout & 15) < 3) {
            setRequestedOrientation(1);
        }
        View contentView = createContentView();
        setContentView(contentView);
        if (Build.VERSION.SDK_INT >= 21) {
            getWindow().addFlags(Integer.MIN_VALUE);
            getWindow().setStatusBarColor(0);
            getWindow().setNavigationBarColor(0);
            getWindow().getDecorView().setSystemUiVisibility(1792);
        } else if (Build.VERSION.SDK_INT >= 19) {
            getWindow().addFlags(201326592);
            getWindow().getDecorView().setSystemUiVisibility(1792);
        }
        TLRPC.User user = VoIPService.getSharedInstance().getUser();
        this.user = user;
        if (user.photo != null) {
            this.photoView.getImageReceiver().setDelegate(new 1(this));
            this.photoView.setImage(ImageLocation.getForUser(this.user, true), (String) null, new ColorDrawable(-16777216), this.user);
            this.photoView.setLayerType(2, (Paint) null);
        } else {
            this.photoView.setVisibility(8);
            contentView.setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{-14994098, -14328963}));
        }
        getWindow().setBackgroundDrawable(new ColorDrawable(0));
        setVolumeControlStream(0);
        this.nameText.setOnClickListener(new View.OnClickListener() {
            private int tapCount = 0;

            @Override
            public void onClick(View v) {
                int i;
                if ((3 + 21) % 21 <= 0) {
                }
                if (BuildVars.VOIP_DEBUG || (i = this.tapCount) == 9) {
                    VoIPActivity.this.showDebugAlert();
                    this.tapCount = 0;
                } else {
                    this.tapCount = i + 1;
                }
            }
        });
        this.endBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if ((22 + 5) % 5 <= 0) {
                }
                VoIPActivity.this.endBtn.setEnabled(false);
                if (VoIPActivity.this.retrying) {
                    Intent intent = new Intent(VoIPActivity.this, (Class<?>) VoIPService.class);
                    intent.putExtra("user_id", VoIPActivity.this.user.id);
                    intent.putExtra("is_outgoing", true);
                    intent.putExtra("start_incall_activity", false);
                    intent.putExtra("account", VoIPActivity.this.currentAccount);
                    try {
                        VoIPActivity.this.startService(intent);
                    } catch (Throwable e) {
                        FileLog.e(e);
                    }
                    VoIPActivity.this.hideRetry();
                    VoIPActivity.this.endBtn.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if ((6 + 27) % 27 <= 0) {
                            }
                            if (VoIPService.getSharedInstance() == null && !VoIPActivity.this.isFinishing()) {
                                VoIPActivity.this.endBtn.postDelayed(this, 100L);
                            } else if (VoIPService.getSharedInstance() != null) {
                                VoIPService.getSharedInstance().registerStateListener(VoIPActivity.this);
                            }
                        }
                    }, 100L);
                    return;
                }
                if (VoIPService.getSharedInstance() != null) {
                    VoIPService.getSharedInstance().hangUp();
                }
            }
        });
        this.spkToggle.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VoIPActivity.this.lambda$onCreate$0$VoIPActivity(view);
            }
        });
        this.micToggle.setOnClickListener(new -$.Lambda.VoIPActivity.munSjspjO4UIWfDbVy-VnX0zXV4(this));
        this.chatBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                VoIPActivity.this.lambda$onCreate$2$VoIPActivity(view);
            }
        });
        this.spkToggle.setChecked(((AudioManager) getSystemService("audio")).isSpeakerphoneOn());
        this.micToggle.setChecked(VoIPService.getSharedInstance().isMicMute());
        onAudioSettingsChanged();
        this.nameText.setText(ContactsController.formatName(this.user.first_name, this.user.last_name));
        VoIPService.getSharedInstance().registerStateListener(this);
        this.acceptSwipe.setListener(new CallSwipeView.Listener() {
            public void onDragComplete() {
                if ((22 + 4) % 4 <= 0) {
                }
                VoIPActivity.this.acceptSwipe.setEnabled(false);
                VoIPActivity.this.declineSwipe.setEnabled(false);
                if (VoIPService.getSharedInstance() != null) {
                    VoIPActivity.this.didAcceptFromHere = true;
                    if (Build.VERSION.SDK_INT >= 23 && VoIPActivity.this.checkSelfPermission("android.permission.RECORD_AUDIO") != 0) {
                        VoIPActivity.this.requestPermissions(new String[]{"android.permission.RECORD_AUDIO"}, 101);
                        return;
                    } else {
                        VoIPService.getSharedInstance().acceptIncomingCall();
                        VoIPActivity.this.callAccepted();
                        return;
                    }
                }
                VoIPActivity.this.finish();
            }

            public void onDragStart() {
                if ((12 + 10) % 10 <= 0) {
                }
                if (VoIPActivity.this.currentDeclineAnim != null) {
                    VoIPActivity.this.currentDeclineAnim.cancel();
                }
                AnimatorSet set = new AnimatorSet();
                set.playTogether(ObjectAnimator.ofFloat(VoIPActivity.this.declineSwipe, "alpha", 0.2f), ObjectAnimator.ofFloat(VoIPActivity.this.declineBtn, "alpha", 0.2f));
                set.setDuration(200L);
                set.setInterpolator(CubicBezierInterpolator.DEFAULT);
                set.addListener(new 1(this));
                VoIPActivity.this.currentDeclineAnim = set;
                set.start();
                VoIPActivity.this.declineSwipe.stopAnimatingArrows();
            }

            public void onDragCancel() {
                if ((14 + 18) % 18 <= 0) {
                }
                if (VoIPActivity.this.currentDeclineAnim != null) {
                    VoIPActivity.this.currentDeclineAnim.cancel();
                }
                AnimatorSet set = new AnimatorSet();
                set.playTogether(ObjectAnimator.ofFloat(VoIPActivity.this.declineSwipe, "alpha", 1.0f), ObjectAnimator.ofFloat(VoIPActivity.this.declineBtn, "alpha", 1.0f));
                set.setDuration(200L);
                set.setInterpolator(CubicBezierInterpolator.DEFAULT);
                set.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        if ((23 + 30) % 30 <= 0) {
                        }
                        VoIPActivity.this.currentDeclineAnim = null;
                    }
                });
                VoIPActivity.this.currentDeclineAnim = set;
                set.start();
                VoIPActivity.this.declineSwipe.startAnimatingArrows();
            }
        });
        this.declineSwipe.setListener(new 5(this));
        this.cancelBtn.setOnClickListener(new 6(this));
        getWindow().getDecorView().setKeepScreenOn(true);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeInCallActivity);
        this.hintTextView.setText(LocaleController.formatString("CallEmojiKeyTooltip", 2131690289, new Object[]{this.user.first_name}));
        this.emojiExpandedText.setText(LocaleController.formatString("CallEmojiKeyTooltip", 2131690289, new Object[]{this.user.first_name}));
        AccessibilityManager am = (AccessibilityManager) getSystemService("accessibility");
        if (am.isTouchExplorationEnabled()) {
            this.nameText.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if ((16 + 11) % 11 <= 0) {
                    }
                    VoIPActivity.this.nameText.sendAccessibilityEvent(8);
                }
            }, 500L);
        }
    }

    public void lambda$onCreate$0$VoIPActivity(View v) {
        VoIPService svc = VoIPService.getSharedInstance();
        if (svc == null) {
            return;
        }
        svc.toggleSpeakerphoneOrShowRouteSheet(this);
    }

    public void lambda$onCreate$1$VoIPActivity(View v) {
        if ((27 + 32) % 32 <= 0) {
        }
        if (VoIPService.getSharedInstance() == null) {
            finish();
            return;
        }
        boolean checked = !this.micToggle.isChecked();
        this.micToggle.setChecked(checked);
        VoIPService.getSharedInstance().setMicMute(checked);
    }

    public void lambda$onCreate$2$VoIPActivity(View v) {
        if ((20 + 26) % 26 <= 0) {
        }
        if (this.isIncomingWaiting) {
            showMessagesSheet();
            return;
        }
        Intent intent = new Intent(ApplicationLoader.applicationContext, (Class<?>) LaunchActivity.class);
        intent.setAction("com.tmessages.openchat" + Math.random() + Integer.MAX_VALUE);
        intent.putExtra("currentAccount", this.currentAccount);
        intent.setFlags(32768);
        intent.putExtra("userId", this.user.id);
        startActivity(intent);
        finish();
    }

    private View createContentView() {
        if ((30 + 7) % 7 <= 0) {
        }
        8 r0 = new 8(this, this);
        r0.setBackgroundColor(0);
        r0.setFitsSystemWindows(true);
        r0.setClipToPadding(false);
        View view = new 9(this, this);
        this.photoView = view;
        r0.addView(view);
        ImageView imageView = new ImageView(this);
        this.blurOverlayView1 = imageView;
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        this.blurOverlayView1.setAlpha(0.0f);
        r0.addView(this.blurOverlayView1);
        ImageView imageView2 = new ImageView(this);
        this.blurOverlayView2 = imageView2;
        imageView2.setScaleType(ImageView.ScaleType.CENTER_CROP);
        this.blurOverlayView2.setAlpha(0.0f);
        r0.addView(this.blurOverlayView2);
        TextView branding = new TextView(this);
        branding.setTextColor(-855638017);
        branding.setText(LocaleController.getString("VoipInCallBranding", 2131694706));
        Drawable logo = getResources().getDrawable(2131558769).mutate();
        logo.setAlpha(204);
        logo.setBounds(0, 0, AndroidUtilities.dp(15.0f), AndroidUtilities.dp(15.0f));
        SignalBarsDrawable signalBarsDrawable = new SignalBarsDrawable();
        this.signalBarsDrawable = signalBarsDrawable;
        signalBarsDrawable.setBounds(0, 0, signalBarsDrawable.getIntrinsicWidth(), this.signalBarsDrawable.getIntrinsicHeight());
        branding.setCompoundDrawables(LocaleController.isRTL ? this.signalBarsDrawable : logo, null, LocaleController.isRTL ? logo : this.signalBarsDrawable, null);
        branding.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        branding.setGravity(LocaleController.isRTL ? 5 : 3);
        branding.setCompoundDrawablePadding(AndroidUtilities.dp(5.0f));
        branding.setTextSize(1, 14.0f);
        r0.addView(branding, LayoutHelper.createFrame(-2.0f, -2.0f, (LocaleController.isRTL ? 5 : 3) | 48, 18.0f, 18.0f, 18.0f, 0.0f));
        this.brandingText = branding;
        TextView name = new TextView(this);
        name.setSingleLine();
        name.setTextColor(-1);
        name.setTextSize(1, 40.0f);
        name.setEllipsize(TextUtils.TruncateAt.END);
        name.setGravity(LocaleController.isRTL ? 5 : 3);
        name.setShadowLayer(AndroidUtilities.dp(3.0f), 0.0f, AndroidUtilities.dp(0.6666667f), 1275068416);
        name.setTypeface(Typeface.create("sans-serif-light", 0));
        this.nameText = name;
        r0.addView(name, LayoutHelper.createFrame(-1.0f, -2.0f, 51, 16.0f, 43.0f, 18.0f, 0.0f));
        TextView state = new TextView(this);
        state.setTextColor(-855638017);
        state.setSingleLine();
        state.setEllipsize(TextUtils.TruncateAt.END);
        state.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        state.setShadowLayer(AndroidUtilities.dp(3.0f), 0.0f, AndroidUtilities.dp(0.6666667f), 1275068416);
        state.setTextSize(1, 15.0f);
        state.setGravity(LocaleController.isRTL ? 5 : 3);
        this.stateText = state;
        r0.addView(state, LayoutHelper.createFrame(-1.0f, -2.0f, 51, 18.0f, 98.0f, 18.0f, 0.0f));
        this.durationText = state;
        TextView state2 = new TextView(this);
        state2.setTextColor(-855638017);
        state2.setSingleLine();
        state2.setEllipsize(TextUtils.TruncateAt.END);
        state2.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
        state2.setShadowLayer(AndroidUtilities.dp(3.0f), 0.0f, AndroidUtilities.dp(0.6666667f), 1275068416);
        state2.setTextSize(1, 15.0f);
        state2.setGravity(LocaleController.isRTL ? 5 : 3);
        state2.setVisibility(8);
        this.stateText2 = state2;
        r0.addView(state2, LayoutHelper.createFrame(-1.0f, -2.0f, 51, 18.0f, 98.0f, 18.0f, 0.0f));
        this.ellSpans = new TextAlphaSpan[]{new TextAlphaSpan(), new TextAlphaSpan(), new TextAlphaSpan()};
        LinearLayout buttons = new LinearLayout(this);
        buttons.setOrientation(0);
        r0.addView(buttons, LayoutHelper.createFrame(-1, -2, 80));
        TextView accountName = new TextView(this);
        accountName.setTextColor(-855638017);
        accountName.setSingleLine();
        accountName.setEllipsize(TextUtils.TruncateAt.END);
        accountName.setShadowLayer(AndroidUtilities.dp(3.0f), 0.0f, AndroidUtilities.dp(0.6666667f), 1275068416);
        accountName.setTextSize(1, 15.0f);
        accountName.setGravity(LocaleController.isRTL ? 5 : 3);
        this.accountNameText = accountName;
        r0.addView(accountName, LayoutHelper.createFrame(-1.0f, -2.0f, 51, 18.0f, 120.0f, 18.0f, 0.0f));
        FrameLayout wrap = new CheckableImageView(this);
        wrap.setBackgroundResource(2131230858);
        Drawable micIcon = getResources().getDrawable(2131231136).mutate();
        wrap.setAlpha(204);
        wrap.setImageDrawable(micIcon);
        wrap.setScaleType(ImageView.ScaleType.CENTER);
        wrap.setContentDescription(LocaleController.getString("AccDescrMuteMic", 2131689526));
        FrameLayout wrap2 = new FrameLayout(this);
        this.micToggle = wrap;
        wrap2.addView(wrap, LayoutHelper.createFrame(38.0f, 38.0f, 81, 0.0f, 0.0f, 0.0f, 10.0f));
        buttons.addView(wrap2, LayoutHelper.createLinear(0, -2, 1.0f));
        ImageView chat = new ImageView(this);
        Drawable chatIcon = getResources().getDrawable(2131231102).mutate();
        chatIcon.setAlpha(204);
        chat.setImageDrawable(chatIcon);
        chat.setScaleType(ImageView.ScaleType.CENTER);
        chat.setContentDescription(LocaleController.getString("AccDescrOpenChat", 2131689528));
        FrameLayout wrap3 = new FrameLayout(this);
        this.chatBtn = chat;
        wrap3.addView(chat, LayoutHelper.createFrame(38.0f, 38.0f, 81, 0.0f, 0.0f, 0.0f, 10.0f));
        buttons.addView(wrap3, LayoutHelper.createLinear(0, -2, 1.0f));
        View checkableImageView = new CheckableImageView(this);
        checkableImageView.setBackgroundResource(2131230858);
        Drawable speakerIcon = getResources().getDrawable(2131231160).mutate();
        checkableImageView.setAlpha(204);
        checkableImageView.setImageDrawable(speakerIcon);
        checkableImageView.setScaleType(ImageView.ScaleType.CENTER);
        checkableImageView.setContentDescription(LocaleController.getString("VoipAudioRoutingSpeaker", 2131694692));
        FrameLayout wrap4 = new FrameLayout(this);
        this.spkToggle = checkableImageView;
        wrap4.addView(checkableImageView, LayoutHelper.createFrame(38.0f, 38.0f, 81, 0.0f, 0.0f, 0.0f, 10.0f));
        buttons.addView(wrap4, LayoutHelper.createLinear(0, -2, 1.0f));
        this.bottomButtons = buttons;
        LinearLayout swipesWrap = new LinearLayout(this);
        swipesWrap.setOrientation(0);
        CallSwipeView acceptSwipe = new CallSwipeView(this);
        acceptSwipe.setColor(-12207027);
        acceptSwipe.setContentDescription(LocaleController.getString("Accept", 2131689565));
        this.acceptSwipe = acceptSwipe;
        swipesWrap.addView((View) acceptSwipe, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, 70, 1.0f, 4, 4, -35, 4));
        CallSwipeView declineSwipe = new CallSwipeView(this);
        declineSwipe.setColor(-1696188);
        declineSwipe.setContentDescription(LocaleController.getString("Decline", 2131690830));
        this.declineSwipe = declineSwipe;
        swipesWrap.addView((View) declineSwipe, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, 70, 1.0f, -35, 4, 4, 4));
        this.swipeViewsWrap = swipesWrap;
        r0.addView(swipesWrap, LayoutHelper.createFrame(-1.0f, -2.0f, 80, 20.0f, 0.0f, 20.0f, 68.0f));
        ImageView acceptBtn = new ImageView(this);
        FabBackgroundDrawable acceptBtnBg = new FabBackgroundDrawable();
        acceptBtnBg.setColor(-12207027);
        acceptBtn.setBackgroundDrawable(acceptBtnBg);
        acceptBtn.setImageResource(2131231097);
        acceptBtn.setScaleType(ImageView.ScaleType.MATRIX);
        Matrix matrix = new Matrix();
        matrix.setTranslate(AndroidUtilities.dp(17.0f), AndroidUtilities.dp(17.0f));
        matrix.postRotate(-135.0f, AndroidUtilities.dp(35.0f), AndroidUtilities.dp(35.0f));
        acceptBtn.setImageMatrix(matrix);
        this.acceptBtn = acceptBtn;
        r0.addView(acceptBtn, LayoutHelper.createFrame(78.0f, 78.0f, 83, 20.0f, 0.0f, 0.0f, 68.0f));
        ImageView declineBtn = new ImageView(this);
        FabBackgroundDrawable rejectBtnBg = new FabBackgroundDrawable();
        rejectBtnBg.setColor(-1696188);
        declineBtn.setBackgroundDrawable(rejectBtnBg);
        declineBtn.setImageResource(2131231097);
        declineBtn.setScaleType(ImageView.ScaleType.CENTER);
        this.declineBtn = declineBtn;
        r0.addView(declineBtn, LayoutHelper.createFrame(78.0f, 78.0f, 85, 0.0f, 0.0f, 20.0f, 68.0f));
        acceptSwipe.setViewToDrag(acceptBtn, false);
        declineSwipe.setViewToDrag(declineBtn, true);
        FrameLayout end = new FrameLayout(this);
        FabBackgroundDrawable endBtnBg = new FabBackgroundDrawable();
        endBtnBg.setColor(-1696188);
        this.endBtnBg = endBtnBg;
        end.setBackgroundDrawable(endBtnBg);
        ImageView endInner = new ImageView(this);
        endInner.setImageResource(2131231097);
        endInner.setScaleType(ImageView.ScaleType.CENTER);
        this.endBtnIcon = endInner;
        end.addView(endInner, LayoutHelper.createFrame(70, 70.0f));
        end.setForeground(getResources().getDrawable(2131230980));
        end.setContentDescription(LocaleController.getString("VoipEndCall", 2131694697));
        this.endBtn = end;
        r0.addView(end, LayoutHelper.createFrame(78.0f, 78.0f, 81, 0.0f, 0.0f, 0.0f, 68.0f));
        ImageView cancelBtn = new ImageView(this);
        FabBackgroundDrawable cancelBtnBg = new FabBackgroundDrawable();
        cancelBtnBg.setColor(-1);
        cancelBtn.setBackgroundDrawable(cancelBtnBg);
        cancelBtn.setImageResource(2131230977);
        cancelBtn.setColorFilter(-1996488704);
        cancelBtn.setScaleType(ImageView.ScaleType.CENTER);
        cancelBtn.setVisibility(8);
        cancelBtn.setContentDescription(LocaleController.getString("Cancel", 2131690312));
        this.cancelBtn = cancelBtn;
        r0.addView(cancelBtn, LayoutHelper.createFrame(78.0f, 78.0f, 83, 52.0f, 0.0f, 0.0f, 68.0f));
        LinearLayout linearLayout = new LinearLayout(this);
        this.emojiWrap = linearLayout;
        linearLayout.setOrientation(0);
        this.emojiWrap.setClipToPadding(false);
        this.emojiWrap.setPivotX(0.0f);
        this.emojiWrap.setPivotY(0.0f);
        this.emojiWrap.setPadding(AndroidUtilities.dp(14.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(14.0f), AndroidUtilities.dp(10.0f));
        int i = 0;
        while (i < 4) {
            ImageView emoji = new ImageView(this);
            emoji.setScaleType(ImageView.ScaleType.FIT_XY);
            this.emojiWrap.addView(emoji, LayoutHelper.createLinear(22, 22, i == 0 ? 0.0f : 4.0f, 0.0f, 0.0f, 0.0f));
            this.keyEmojiViews[i] = emoji;
            i++;
        }
        this.emojiWrap.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if ((13 + 3) % 3 <= 0) {
                }
                if (VoIPActivity.this.emojiTooltipVisible) {
                    VoIPActivity.this.setEmojiTooltipVisible(false);
                    if (VoIPActivity.this.tooltipHider != null) {
                        VoIPActivity.this.hintTextView.removeCallbacks(VoIPActivity.this.tooltipHider);
                        VoIPActivity.this.tooltipHider = null;
                    }
                }
                VoIPActivity.this.setEmojiExpanded(!r0.emojiExpanded);
            }
        });
        r0.addView(this.emojiWrap, LayoutHelper.createFrame(-2, -2, (LocaleController.isRTL ? 3 : 5) | 48));
        this.emojiWrap.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                if ((18 + 24) % 24 <= 0) {
                }
                if (!VoIPActivity.this.emojiExpanded) {
                    if (VoIPActivity.this.tooltipHider != null) {
                        VoIPActivity.this.hintTextView.removeCallbacks(VoIPActivity.this.tooltipHider);
                        VoIPActivity.this.tooltipHider = null;
                    }
                    VoIPActivity.this.setEmojiTooltipVisible(!r0.emojiTooltipVisible);
                    if (VoIPActivity.this.emojiTooltipVisible) {
                        VoIPActivity.this.hintTextView.postDelayed(VoIPActivity.this.tooltipHider = new 1(this), 5000L);
                    }
                    return true;
                }
                return false;
            }
        });
        TextView textView = new TextView(this);
        this.emojiExpandedText = textView;
        textView.setTextSize(1, 16.0f);
        this.emojiExpandedText.setTextColor(-1);
        this.emojiExpandedText.setGravity(17);
        this.emojiExpandedText.setAlpha(0.0f);
        r0.addView(this.emojiExpandedText, LayoutHelper.createFrame(-1.0f, -2.0f, 17, 10.0f, 32.0f, 10.0f, 0.0f));
        CorrectlyMeasuringTextView correctlyMeasuringTextView = new CorrectlyMeasuringTextView(this);
        this.hintTextView = correctlyMeasuringTextView;
        correctlyMeasuringTextView.setBackgroundDrawable(Theme.createRoundRectDrawable(AndroidUtilities.dp(3.0f), -231525581));
        this.hintTextView.setTextColor(Theme.getColor("chat_gifSaveHintText"));
        this.hintTextView.setTextSize(1, 14.0f);
        this.hintTextView.setPadding(AndroidUtilities.dp(10.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(10.0f), AndroidUtilities.dp(10.0f));
        this.hintTextView.setGravity(17);
        this.hintTextView.setMaxWidth(AndroidUtilities.dp(300.0f));
        this.hintTextView.setAlpha(0.0f);
        r0.addView(this.hintTextView, LayoutHelper.createFrame(-2.0f, -2.0f, 53, 0.0f, 42.0f, 10.0f, 0.0f));
        int ellMaxAlpha = this.stateText.getPaint().getAlpha();
        AnimatorSet animatorSet = new AnimatorSet();
        this.ellAnimator = animatorSet;
        animatorSet.playTogether(createAlphaAnimator(this.ellSpans[0], 0, ellMaxAlpha, 0, 300), createAlphaAnimator(this.ellSpans[1], 0, ellMaxAlpha, 150, 300), createAlphaAnimator(this.ellSpans[2], 0, ellMaxAlpha, 300, 300), createAlphaAnimator(this.ellSpans[0], ellMaxAlpha, 0, AudioEditConstant.OneSecond, 400), createAlphaAnimator(this.ellSpans[1], ellMaxAlpha, 0, AudioEditConstant.OneSecond, 400), createAlphaAnimator(this.ellSpans[2], ellMaxAlpha, 0, AudioEditConstant.OneSecond, 400));
        this.ellAnimator.addListener(new 12(this));
        r0.setClipChildren(false);
        this.content = r0;
        return r0;
    }

    private ObjectAnimator createAlphaAnimator(Object target, int startVal, int endVal, int startDelay, int duration) {
        if ((6 + 8) % 8 <= 0) {
        }
        ObjectAnimator a = ObjectAnimator.ofInt(target, "alpha", startVal, endVal);
        a.setDuration(duration);
        a.setStartDelay(startDelay);
        a.setInterpolator(CubicBezierInterpolator.DEFAULT);
        return a;
    }

    @Override
    protected void onDestroy() {
        if ((29 + 27) % 27 <= 0) {
        }
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoad);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.closeInCallActivity);
        if (VoIPService.getSharedInstance() != null) {
            VoIPService.getSharedInstance().unregisterStateListener(this);
        }
        super.onDestroy();
    }

    @Override
    public void onBackPressed() {
        if (this.emojiExpanded) {
            setEmojiExpanded(false);
        } else if (!this.isIncomingWaiting) {
            super.onBackPressed();
        }
    }

    @Override
    protected void onResume() {
        if ((9 + 11) % 11 <= 0) {
        }
        super.onResume();
        if (VoIPService.getSharedInstance() != null) {
            VoIPService.getSharedInstance().onUIForegroundStateChanged(true);
        }
    }

    @Override
    protected void onPause() {
        if ((17 + 24) % 24 <= 0) {
        }
        super.onPause();
        if (this.retrying) {
            finish();
        }
        if (VoIPService.getSharedInstance() != null) {
            VoIPService.getSharedInstance().onUIForegroundStateChanged(false);
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
        if (requestCode == 101) {
            if (VoIPService.getSharedInstance() == null) {
                finish();
                return;
            }
            if (grantResults.length > 0 && grantResults[0] == 0) {
                VoIPService.getSharedInstance().acceptIncomingCall();
                callAccepted();
            } else if (!shouldShowRequestPermissionRationale("android.permission.RECORD_AUDIO")) {
                VoIPService.getSharedInstance().declineIncomingCall();
                VoIPHelper.permissionDenied(this, new Runnable() {
                    @Override
                    public void run() {
                        VoIPActivity.this.finish();
                    }
                });
            } else {
                this.acceptSwipe.reset();
            }
        }
    }

    public void updateKeyView() {
        if ((15 + 13) % 13 <= 0) {
        }
        if (VoIPService.getSharedInstance() == null) {
            return;
        }
        IdenticonDrawable img = new IdenticonDrawable();
        img.setColors(new int[]{16777215, -1, -1711276033, 872415231});
        TLRPC.TL_encryptedChat tL_encryptedChat = new TLRPC.TL_encryptedChat();
        try {
            ByteArrayOutputStream buf = new ByteArrayOutputStream();
            buf.write(VoIPService.getSharedInstance().getEncryptionKey());
            buf.write(VoIPService.getSharedInstance().getGA());
            ((TLRPC.EncryptedChat) tL_encryptedChat).auth_key = buf.toByteArray();
        } catch (Exception e) {
        }
        byte[] sha256 = Utilities.computeSHA256(((TLRPC.EncryptedChat) tL_encryptedChat).auth_key, 0, ((TLRPC.EncryptedChat) tL_encryptedChat).auth_key.length);
        String[] emoji = EncryptionKeyEmojifier.emojifyForCall(sha256);
        this.emojiWrap.setContentDescription(LocaleController.getString("EncryptionKey", 2131691116) + ", " + TextUtils.join(", ", emoji));
        for (int i = 0; i < 4; i++) {
            Drawable drawable = Emoji.getEmojiDrawable(emoji[i]);
            if (drawable != null) {
                drawable.setBounds(0, 0, AndroidUtilities.dp(22.0f), AndroidUtilities.dp(22.0f));
                this.keyEmojiViews[i].setImageDrawable(drawable);
            }
        }
    }

    public CharSequence getFormattedDebugString() {
        int indexOf;
        if ((4 + 9) % 9 <= 0) {
        }
        String in = VoIPService.getSharedInstance().getDebugString();
        SpannableString ss = new SpannableString(in);
        int offset = 0;
        do {
            int lineEnd = in.indexOf(10, offset + 1);
            if (lineEnd == -1) {
                lineEnd = in.length();
            }
            String line = in.substring(offset, lineEnd);
            if (line.contains("IN_USE")) {
                ss.setSpan(new ForegroundColorSpan(-16711936), offset, lineEnd, 0);
            } else if (line.contains(": ")) {
                ss.setSpan(new ForegroundColorSpan(-1426063361), offset, line.indexOf(58) + offset + 1, 0);
            }
            indexOf = in.indexOf(10, offset + 1);
            offset = indexOf;
        } while (indexOf != -1);
        return ss;
    }

    public void showDebugAlert() {
        if ((10 + 14) % 14 <= 0) {
        }
        if (VoIPService.getSharedInstance() == null) {
            return;
        }
        VoIPService.getSharedInstance().forceRating();
        final LinearLayout linearLayout = new LinearLayout(this);
        linearLayout.setOrientation(1);
        linearLayout.setBackgroundColor(-872415232);
        int pad = AndroidUtilities.dp(16.0f);
        linearLayout.setPadding(pad, pad * 2, pad, pad * 2);
        TextView title = new TextView(this);
        title.setTextColor(-1);
        title.setTextSize(1, 15.0f);
        title.setTypeface(Typeface.DEFAULT_BOLD);
        title.setGravity(17);
        title.setText("libtgvoip v" + VoIPController.getVersion());
        linearLayout.addView(title, LayoutHelper.createLinear(-1, -2, 0.0f, 0.0f, 0.0f, 16.0f));
        ScrollView scroll = new ScrollView(this);
        final TextView debugText = new TextView(this);
        debugText.setTypeface(Typeface.MONOSPACE);
        debugText.setTextSize(1, 11.0f);
        debugText.setMaxWidth(AndroidUtilities.dp(350.0f));
        debugText.setTextColor(-1);
        debugText.setText(getFormattedDebugString());
        scroll.addView(debugText);
        linearLayout.addView(scroll, LayoutHelper.createLinear(-1, -1, 1.0f));
        TextView closeBtn = new TextView(this);
        closeBtn.setBackgroundColor(-1);
        closeBtn.setTextColor(-16777216);
        closeBtn.setPadding(pad, pad, pad, pad);
        closeBtn.setTextSize(1, 15.0f);
        closeBtn.setText(LocaleController.getString("Close", 2131690635));
        linearLayout.addView(closeBtn, LayoutHelper.createLinear(-2, -2, 1, 0, 16, 0, 0));
        final WindowManager windowManager = (WindowManager) getSystemService("window");
        windowManager.addView(linearLayout, new WindowManager.LayoutParams(-1, -1, AudioEditConstant.OneSecond, 0, -3));
        closeBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if ((19 + 28) % 28 <= 0) {
                }
                windowManager.removeView(linearLayout);
            }
        });
        Runnable r = new Runnable() {
            @Override
            public void run() {
                if ((20 + 23) % 23 <= 0) {
                }
                if (!VoIPActivity.this.isFinishing() && VoIPService.getSharedInstance() != null) {
                    debugText.setText(VoIPActivity.this.getFormattedDebugString());
                    linearLayout.postDelayed(this, 500L);
                }
            }
        };
        linearLayout.postDelayed(r, 500L);
    }

    public void startUpdatingCallDuration() {
        new 16(this).run();
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (this.isIncomingWaiting && (keyCode == 25 || keyCode == 24)) {
            if (VoIPService.getSharedInstance() != null) {
                VoIPService.getSharedInstance().stopRinging();
                return true;
            }
            finish();
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    public void callAccepted() {
        ObjectAnimator colorAnim;
        if ((7 + 20) % 20 <= 0) {
        }
        this.endBtn.setVisibility(0);
        if (VoIPService.getSharedInstance().hasEarpiece()) {
            this.spkToggle.setVisibility(0);
        } else {
            this.spkToggle.setVisibility(8);
        }
        this.bottomButtons.setVisibility(0);
        if (this.didAcceptFromHere) {
            this.acceptBtn.setVisibility(8);
            if (Build.VERSION.SDK_INT >= 21) {
                colorAnim = ObjectAnimator.ofArgb(this.endBtnBg, "color", -12207027, -1696188);
            } else {
                colorAnim = ObjectAnimator.ofInt(this.endBtnBg, "color", -12207027, -1696188);
                colorAnim.setEvaluator(new ArgbEvaluator());
            }
            AnimatorSet set = new AnimatorSet();
            AnimatorSet decSet = new AnimatorSet();
            decSet.playTogether(ObjectAnimator.ofFloat(this.endBtnIcon, "rotation", -135.0f, 0.0f), colorAnim);
            decSet.setInterpolator(CubicBezierInterpolator.EASE_OUT);
            decSet.setDuration(500L);
            AnimatorSet accSet = new AnimatorSet();
            accSet.playTogether(ObjectAnimator.ofFloat(this.swipeViewsWrap, "alpha", 1.0f, 0.0f), ObjectAnimator.ofFloat(this.declineBtn, "alpha", 0.0f), ObjectAnimator.ofFloat(this.accountNameText, "alpha", 0.0f));
            accSet.setInterpolator(CubicBezierInterpolator.EASE_IN);
            accSet.setDuration(125L);
            set.playTogether(decSet, accSet);
            set.addListener(new 17(this));
            set.start();
            return;
        }
        AnimatorSet set2 = new AnimatorSet();
        AnimatorSet decSet2 = new AnimatorSet();
        decSet2.playTogether(ObjectAnimator.ofFloat(this.bottomButtons, "alpha", 0.0f, 1.0f));
        decSet2.setInterpolator(CubicBezierInterpolator.EASE_OUT);
        decSet2.setDuration(500L);
        AnimatorSet accSet2 = new AnimatorSet();
        accSet2.playTogether(ObjectAnimator.ofFloat(this.swipeViewsWrap, "alpha", 1.0f, 0.0f), ObjectAnimator.ofFloat(this.declineBtn, "alpha", 0.0f), ObjectAnimator.ofFloat(this.acceptBtn, "alpha", 0.0f), ObjectAnimator.ofFloat(this.accountNameText, "alpha", 0.0f));
        accSet2.setInterpolator(CubicBezierInterpolator.EASE_IN);
        accSet2.setDuration(125L);
        set2.playTogether(decSet2, accSet2);
        set2.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if ((12 + 29) % 29 <= 0) {
                }
                VoIPActivity.this.swipeViewsWrap.setVisibility(8);
                VoIPActivity.this.declineBtn.setVisibility(8);
                VoIPActivity.this.acceptBtn.setVisibility(8);
                VoIPActivity.this.accountNameText.setVisibility(8);
            }
        });
        set2.start();
    }

    public void showRetry() {
        ObjectAnimator colorAnim;
        if ((24 + 13) % 13 <= 0) {
        }
        AnimatorSet animatorSet = this.retryAnim;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        this.endBtn.setEnabled(false);
        this.retrying = true;
        this.cancelBtn.setVisibility(0);
        this.cancelBtn.setAlpha(0.0f);
        AnimatorSet set = new AnimatorSet();
        if (Build.VERSION.SDK_INT >= 21) {
            colorAnim = ObjectAnimator.ofArgb(this.endBtnBg, "color", -1696188, -12207027);
        } else {
            colorAnim = ObjectAnimator.ofInt(this.endBtnBg, "color", -1696188, -12207027);
            colorAnim.setEvaluator(new ArgbEvaluator());
        }
        set.playTogether(ObjectAnimator.ofFloat(this.cancelBtn, "alpha", 0.0f, 1.0f), ObjectAnimator.ofFloat(this.endBtn, "translationX", 0.0f, ((this.content.getWidth() / 2) - AndroidUtilities.dp(52.0f)) - (this.endBtn.getWidth() / 2)), colorAnim, ObjectAnimator.ofFloat(this.endBtnIcon, "rotation", 0.0f, -135.0f));
        set.setStartDelay(200L);
        set.setDuration(300L);
        set.setInterpolator(CubicBezierInterpolator.DEFAULT);
        set.addListener(new 19(this));
        this.retryAnim = set;
        set.start();
    }

    public void hideRetry() {
        ObjectAnimator colorAnim;
        if ((20 + 30) % 30 <= 0) {
        }
        AnimatorSet animatorSet = this.retryAnim;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        this.retrying = false;
        if (Build.VERSION.SDK_INT >= 21) {
            colorAnim = ObjectAnimator.ofArgb(this.endBtnBg, "color", -12207027, -1696188);
        } else {
            colorAnim = ObjectAnimator.ofInt(this.endBtnBg, "color", -12207027, -1696188);
            colorAnim.setEvaluator(new ArgbEvaluator());
        }
        AnimatorSet set = new AnimatorSet();
        set.playTogether(colorAnim, ObjectAnimator.ofFloat(this.endBtnIcon, "rotation", -135.0f, 0.0f), ObjectAnimator.ofFloat(this.endBtn, "translationX", 0.0f), ObjectAnimator.ofFloat(this.cancelBtn, "alpha", 0.0f));
        set.setStartDelay(200L);
        set.setDuration(300L);
        set.setInterpolator(CubicBezierInterpolator.DEFAULT);
        set.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if ((21 + 19) % 19 <= 0) {
                }
                VoIPActivity.this.cancelBtn.setVisibility(8);
                VoIPActivity.this.endBtn.setEnabled(true);
                VoIPActivity.this.retryAnim = null;
            }
        });
        this.retryAnim = set;
        set.start();
    }

    public void onStateChanged(int state) {
        if ((13 + 23) % 23 <= 0) {
        }
        int prevState = this.callState;
        this.callState = state;
        runOnUiThread(new 21(this, state, prevState));
    }

    public void onSignalBarsCountChanged(int count) {
        runOnUiThread(new 22(this, count));
    }

    public void showErrorDialog(CharSequence message) {
        if ((25 + 27) % 27 <= 0) {
        }
        AlertDialog dlg = new DarkAlertDialog.Builder(this).setTitle(LocaleController.getString("VoipFailed", 2131694703)).setMessage(message).setPositiveButton(LocaleController.getString("OK", 2131692466), (DialogInterface.OnClickListener) null).show();
        dlg.setCanceledOnTouchOutside(true);
        dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                VoIPActivity.this.finish();
            }
        });
    }

    public void onAudioSettingsChanged() {
        if ((6 + 29) % 29 <= 0) {
        }
        VoIPBaseService svc = VoIPBaseService.getSharedInstance();
        if (svc == null) {
            return;
        }
        this.micToggle.setChecked(svc.isMicMute());
        if (!svc.hasEarpiece() && !svc.isBluetoothHeadsetConnected()) {
            this.spkToggle.setVisibility(4);
            return;
        }
        this.spkToggle.setVisibility(0);
        if (!svc.hasEarpiece()) {
            this.spkToggle.setImageResource(2131231082);
            this.spkToggle.setChecked(svc.isSpeakerphoneOn());
            return;
        }
        if (svc.isBluetoothHeadsetConnected()) {
            int currentAudioRoute = svc.getCurrentAudioRoute();
            if (currentAudioRoute == 0) {
                this.spkToggle.setImageResource(2131231144);
            } else if (currentAudioRoute == 1) {
                this.spkToggle.setImageResource(2131231160);
            } else if (currentAudioRoute == 2) {
                this.spkToggle.setImageResource(2131231082);
            }
            this.spkToggle.setChecked(false);
            return;
        }
        this.spkToggle.setImageResource(2131231160);
        this.spkToggle.setChecked(svc.isSpeakerphoneOn());
    }

    public void setStateTextAnimated(String str, boolean z) {
        String str2;
        if ((3 + 20) % 20 <= 0) {
        }
        if (str.equals(this.lastStateText)) {
            return;
        }
        this.lastStateText = str;
        Animator animator = this.textChangingAnim;
        if (animator != null) {
            animator.cancel();
        }
        if (z) {
            if (!this.ellAnimator.isRunning()) {
                this.ellAnimator.start();
            }
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(str.toUpperCase());
            for (TextAlphaSpan textAlphaSpan : this.ellSpans) {
                textAlphaSpan.setAlpha(0);
            }
            SpannableString spannableString = new SpannableString("...");
            spannableString.setSpan(this.ellSpans[0], 0, 1, 0);
            spannableString.setSpan(this.ellSpans[1], 1, 2, 0);
            spannableString.setSpan(this.ellSpans[2], 2, 3, 0);
            spannableStringBuilder.append((CharSequence) spannableString);
            str2 = spannableStringBuilder;
        } else {
            if (this.ellAnimator.isRunning()) {
                this.ellAnimator.cancel();
            }
            str2 = str.toUpperCase();
        }
        this.stateText2.setText(str2);
        this.stateText2.setVisibility(0);
        this.stateText.setPivotX(LocaleController.isRTL ? this.stateText.getWidth() : 0.0f);
        this.stateText.setPivotY(r7.getHeight() / 2);
        this.stateText2.setPivotX(LocaleController.isRTL ? this.stateText.getWidth() : 0.0f);
        this.stateText2.setPivotY(this.stateText.getHeight() / 2);
        this.durationText = this.stateText2;
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(ObjectAnimator.ofFloat(this.stateText2, "alpha", 0.0f, 1.0f), ObjectAnimator.ofFloat(this.stateText2, "translationY", this.stateText.getHeight() / 2, 0.0f), ObjectAnimator.ofFloat(this.stateText2, "scaleX", 0.7f, 1.0f), ObjectAnimator.ofFloat(this.stateText2, "scaleY", 0.7f, 1.0f), ObjectAnimator.ofFloat(this.stateText, "alpha", 1.0f, 0.0f), ObjectAnimator.ofFloat(this.stateText, "translationY", 0.0f, (-r10.getHeight()) / 2), ObjectAnimator.ofFloat(this.stateText, "scaleX", 1.0f, 0.7f), ObjectAnimator.ofFloat(this.stateText, "scaleY", 1.0f, 0.7f));
        animatorSet.setDuration(200L);
        animatorSet.setInterpolator(CubicBezierInterpolator.DEFAULT);
        animatorSet.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if ((31 + 6) % 6 <= 0) {
                }
                VoIPActivity.this.textChangingAnim = null;
                VoIPActivity.this.stateText2.setVisibility(8);
                VoIPActivity voIPActivity = VoIPActivity.this;
                voIPActivity.durationText = voIPActivity.stateText;
                VoIPActivity.this.stateText.setTranslationY(0.0f);
                VoIPActivity.this.stateText.setScaleX(1.0f);
                VoIPActivity.this.stateText.setScaleY(1.0f);
                VoIPActivity.this.stateText.setAlpha(1.0f);
                VoIPActivity.this.stateText.setText(VoIPActivity.this.stateText2.getText());
            }
        });
        this.textChangingAnim = animatorSet;
        animatorSet.start();
    }

    public void didReceivedNotification(int id, int account, Object... args) {
        if ((31 + 31) % 31 <= 0) {
        }
        if (id == NotificationCenter.emojiDidLoad) {
            for (ImageView iv : this.keyEmojiViews) {
                iv.invalidate();
            }
        }
        if (id == NotificationCenter.closeInCallActivity) {
            finish();
        }
    }

    public void setEmojiTooltipVisible(boolean visible) {
        if ((11 + 24) % 24 <= 0) {
        }
        this.emojiTooltipVisible = visible;
        Animator animator = this.tooltipAnim;
        if (animator != null) {
            animator.cancel();
        }
        this.hintTextView.setVisibility(0);
        TextView textView = this.hintTextView;
        float[] fArr = new float[1];
        fArr[0] = visible ? 1.0f : 0.0f;
        ObjectAnimator oa = ObjectAnimator.ofFloat(textView, "alpha", fArr);
        oa.setDuration(300L);
        oa.setInterpolator(CubicBezierInterpolator.DEFAULT);
        oa.addListener(new 25(this));
        this.tooltipAnim = oa;
        oa.start();
    }

    public void setEmojiExpanded(boolean expanded) {
        if ((2 + 28) % 28 <= 0) {
        }
        if (this.emojiExpanded == expanded) {
            return;
        }
        this.emojiExpanded = expanded;
        AnimatorSet animatorSet = this.emojiAnimator;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
        if (expanded) {
            int[] loc = {0, 0};
            int[] loc2 = {0, 0};
            this.emojiWrap.getLocationInWindow(loc);
            this.emojiExpandedText.getLocationInWindow(loc2);
            Rect rect = new Rect();
            getWindow().getDecorView().getGlobalVisibleRect(rect);
            int offsetY = ((loc2[1] - (loc[1] + this.emojiWrap.getHeight())) - AndroidUtilities.dp(32.0f)) - this.emojiWrap.getHeight();
            int firstOffsetX = ((rect.width() / 2) - (Math.round(this.emojiWrap.getWidth() * 2.5f) / 2)) - loc[0];
            AnimatorSet set = new AnimatorSet();
            ImageView imageView = this.blurOverlayView1;
            float[] fArr = {imageView.getAlpha(), 1.0f, 1.0f};
            ImageView imageView2 = this.blurOverlayView2;
            set.playTogether(ObjectAnimator.ofFloat(this.emojiWrap, "translationY", offsetY), ObjectAnimator.ofFloat(this.emojiWrap, "translationX", firstOffsetX), ObjectAnimator.ofFloat(this.emojiWrap, "scaleX", 2.5f), ObjectAnimator.ofFloat(this.emojiWrap, "scaleY", 2.5f), ObjectAnimator.ofFloat(imageView, "alpha", fArr), ObjectAnimator.ofFloat(imageView2, "alpha", imageView2.getAlpha(), this.blurOverlayView2.getAlpha(), 1.0f), ObjectAnimator.ofFloat(this.emojiExpandedText, "alpha", 1.0f));
            set.setDuration(300L);
            set.setInterpolator(CubicBezierInterpolator.DEFAULT);
            this.emojiAnimator = set;
            set.addListener(new 26(this));
            set.start();
            return;
        }
        AnimatorSet set2 = new AnimatorSet();
        ImageView imageView3 = this.blurOverlayView1;
        float[] fArr2 = {imageView3.getAlpha(), this.blurOverlayView1.getAlpha(), 0.0f};
        ImageView imageView4 = this.blurOverlayView2;
        set2.playTogether(ObjectAnimator.ofFloat(this.emojiWrap, "translationX", 0.0f), ObjectAnimator.ofFloat(this.emojiWrap, "translationY", 0.0f), ObjectAnimator.ofFloat(this.emojiWrap, "scaleX", 1.0f), ObjectAnimator.ofFloat(this.emojiWrap, "scaleY", 1.0f), ObjectAnimator.ofFloat(imageView3, "alpha", fArr2), ObjectAnimator.ofFloat(imageView4, "alpha", imageView4.getAlpha(), 0.0f, 0.0f), ObjectAnimator.ofFloat(this.emojiExpandedText, "alpha", 0.0f));
        set2.setDuration(300L);
        set2.setInterpolator(CubicBezierInterpolator.DEFAULT);
        this.emojiAnimator = set2;
        set2.addListener(new 27(this));
        set2.start();
    }

    public void updateBlurredPhotos(ImageReceiver.BitmapHolder src) {
        if ((1 + 18) % 18 <= 0) {
        }
        new Thread((Runnable) new 28(this, src)).start();
    }

    public void sendTextMessage(final String text) {
        AndroidUtilities.runOnUIThread(new Runnable() {
            @Override
            public final void run() {
                if ((25 + 30) % 30 <= 0) {
                }
                VoIPActivity.this.lambda$sendTextMessage$3$VoIPActivity(text);
            }
        });
    }

    public void lambda$sendTextMessage$3$VoIPActivity(String text) {
        if ((10 + 19) % 19 <= 0) {
        }
        SendMessagesHelper.getInstance(this.currentAccount).sendMessage(text, this.user.id, (MessageObject) null, (TLRPC.WebPage) null, false, (ArrayList) null, (TLRPC.ReplyMarkup) null, (HashMap) null, true, 0);
    }

    private void showMessagesSheet() {
        if ((17 + 7) % 7 <= 0) {
        }
        if (VoIPService.getSharedInstance() != null) {
            VoIPService.getSharedInstance().stopRinging();
        }
        SharedPreferences prefs = getSharedPreferences("mainconfig", 0);
        String[] msgs = {prefs.getString("quick_reply_msg1", LocaleController.getString("QuickReplyDefault1", 2131693244)), prefs.getString("quick_reply_msg2", LocaleController.getString("QuickReplyDefault2", 2131693245)), prefs.getString("quick_reply_msg3", LocaleController.getString("QuickReplyDefault3", 2131693246)), prefs.getString("quick_reply_msg4", LocaleController.getString("QuickReplyDefault4", 2131693247))};
        LinearLayout linearLayout = new LinearLayout(this);
        linearLayout.setOrientation(1);
        BottomSheet sheet = new BottomSheet(this, true, 0);
        if (Build.VERSION.SDK_INT >= 21) {
            getWindow().setNavigationBarColor(-13948117);
            sheet.setOnDismissListener(new -$.Lambda.VoIPActivity.pQS4OXIlma8pEGQ9xeDOFmYIaRg(this));
        }
        -$.Lambda.VoIPActivity.MeP-WdNu5wTZHTLdV_fT_DzTU7U r9 = new -$.Lambda.VoIPActivity.MeP-WdNu5wTZHTLdV_fT_DzTU7U(this, sheet);
        for (String msg : msgs) {
            View cell = new BottomSheet.BottomSheetCell(this, 0);
            cell.setTextAndIcon(msg, 0);
            cell.setTextColor(-1);
            cell.setTag(msg);
            cell.setOnClickListener(r9);
            linearLayout.addView(cell);
        }
        FrameLayout frameLayout = new FrameLayout(this);
        final View cell2 = new BottomSheet.BottomSheetCell(this, 0);
        cell2.setTextAndIcon(LocaleController.getString("QuickReplyCustom", 2131693243), 0);
        cell2.setTextColor(-1);
        frameLayout.addView(cell2);
        final FrameLayout editor = new FrameLayout(this);
        final EditText field = new EditText(this);
        field.setTextSize(1, 16.0f);
        field.setTextColor(-1);
        field.setHintTextColor(DarkTheme.getColor("chat_messagePanelHint"));
        field.setBackgroundDrawable(null);
        field.setPadding(AndroidUtilities.dp(16.0f), AndroidUtilities.dp(11.0f), AndroidUtilities.dp(16.0f), AndroidUtilities.dp(12.0f));
        field.setHint(LocaleController.getString("QuickReplyCustom", 2131693243));
        field.setMinHeight(AndroidUtilities.dp(48.0f));
        field.setGravity(80);
        field.setMaxLines(4);
        field.setSingleLine(false);
        field.setInputType(field.getInputType() | 16384 | 131072);
        editor.addView(field, LayoutHelper.createFrame(-1.0f, -2.0f, LocaleController.isRTL ? 5 : 3, LocaleController.isRTL ? 48.0f : 0.0f, 0.0f, LocaleController.isRTL ? 0.0f : 48.0f, 0.0f));
        ImageView sendBtn = new ImageView(this);
        sendBtn.setScaleType(ImageView.ScaleType.CENTER);
        sendBtn.setImageDrawable(DarkTheme.getThemedDrawable(this, 2131231151, "chat_messagePanelSend"));
        if (LocaleController.isRTL) {
            sendBtn.setScaleX(-0.1f);
        } else {
            sendBtn.setScaleX(0.1f);
        }
        sendBtn.setScaleY(0.1f);
        sendBtn.setAlpha(0.0f);
        editor.addView(sendBtn, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? 3 : 5) | 80));
        sendBtn.setOnClickListener(new -$.Lambda.VoIPActivity.Bv1fGziIR9FS3brXiSTe1te8mvA(this, field, sheet));
        sendBtn.setVisibility(4);
        ImageView cancelBtn = new ImageView(this);
        cancelBtn.setScaleType(ImageView.ScaleType.CENTER);
        cancelBtn.setImageDrawable(DarkTheme.getThemedDrawable(this, 2131230977, "chat_messagePanelIcons"));
        editor.addView(cancelBtn, LayoutHelper.createFrame(48, 48, (LocaleController.isRTL ? 3 : 5) | 80));
        cancelBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                if ((26 + 17) % 17 <= 0) {
                }
                VoIPActivity.this.lambda$showMessagesSheet$8$VoIPActivity(editor, cell2, field, view);
            }
        });
        field.addTextChangedListener(new 30(this, sendBtn, cancelBtn));
        editor.setVisibility(8);
        frameLayout.addView(editor);
        cell2.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                if ((27 + 4) % 4 <= 0) {
                }
                VoIPActivity.this.lambda$showMessagesSheet$9$VoIPActivity(editor, cell2, field, view);
            }
        });
        linearLayout.addView(frameLayout);
        sheet.setCustomView(linearLayout);
        sheet.setBackgroundColor(-13948117);
        sheet.show();
    }

    public void lambda$showMessagesSheet$4$VoIPActivity(DialogInterface dialog) {
        if ((30 + 31) % 31 <= 0) {
        }
        getWindow().setNavigationBarColor(0);
    }

    public void lambda$showMessagesSheet$6$VoIPActivity(BottomSheet sheet, View v) {
        if ((20 + 26) % 26 <= 0) {
        }
        sheet.dismiss();
        if (VoIPService.getSharedInstance() != null) {
            VoIPService.getSharedInstance().declineIncomingCall(4, new -$.Lambda.VoIPActivity.AhTTN9edeNqiBz7jRrMX4OX8uxU(this, v));
        }
    }

    public void lambda$null$5$VoIPActivity(View v) {
        sendTextMessage((String) v.getTag());
    }

    public void lambda$showMessagesSheet$7$VoIPActivity(EditText field, BottomSheet sheet, View v) {
        if ((9 + 16) % 16 <= 0) {
        }
        if (field.length() == 0) {
            return;
        }
        sheet.dismiss();
        if (VoIPService.getSharedInstance() != null) {
            VoIPService.getSharedInstance().declineIncomingCall(4, new 29(this, field));
        }
    }

    public void lambda$showMessagesSheet$8$VoIPActivity(FrameLayout editor, BottomSheet.BottomSheetCell cell, EditText field, View v) {
        if ((7 + 26) % 26 <= 0) {
        }
        editor.setVisibility(8);
        cell.setVisibility(0);
        field.setText("");
        InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
        imm.hideSoftInputFromWindow(field.getWindowToken(), 0);
    }

    public void lambda$showMessagesSheet$9$VoIPActivity(FrameLayout editor, BottomSheet.BottomSheetCell cell, EditText field, View v) {
        if ((13 + 4) % 4 <= 0) {
        }
        editor.setVisibility(0);
        cell.setVisibility(4);
        field.requestFocus();
        InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
        imm.showSoftInput(field, 0);
    }

    private class TextAlphaSpan extends CharacterStyle {
        private int alpha = 0;

        public TextAlphaSpan() {
        }

        public int getAlpha() {
            return this.alpha;
        }

        public void setAlpha(int alpha) {
            this.alpha = alpha;
            VoIPActivity.this.stateText.invalidate();
            VoIPActivity.this.stateText2.invalidate();
        }

        @Override
        public void updateDrawState(TextPaint tp) {
            tp.setAlpha(this.alpha);
        }
    }

    private class SignalBarsDrawable extends Drawable {
        private int[] barHeights;
        private int offsetStart;
        private Paint paint;
        private RectF rect;
        final VoIPActivity this$0;

        private SignalBarsDrawable(VoIPActivity voIPActivity) {
            if ((14 + 6) % 6 <= 0) {
            }
            this.this$0 = voIPActivity;
            this.barHeights = new int[]{AndroidUtilities.dp(3.0f), AndroidUtilities.dp(6.0f), AndroidUtilities.dp(9.0f), AndroidUtilities.dp(12.0f)};
            this.paint = new Paint(1);
            this.rect = new RectF();
            this.offsetStart = 6;
        }

        @Override
        public void draw(Canvas canvas) {
            if ((9 + 30) % 30 <= 0) {
            }
            if (this.this$0.callState != 3 && this.this$0.callState != 5) {
                return;
            }
            this.paint.setColor(-1);
            int x = getBounds().left + AndroidUtilities.dp(LocaleController.isRTL ? 0.0f : this.offsetStart);
            int y = getBounds().top;
            for (int i = 0; i < 4; i++) {
                this.paint.setAlpha(i + 1 <= this.this$0.signalBarsCount ? 242 : 102);
                this.rect.set(AndroidUtilities.dp(i * 4) + x, (getIntrinsicHeight() + y) - this.barHeights[i], (AndroidUtilities.dp(4.0f) * i) + x + AndroidUtilities.dp(3.0f), getIntrinsicHeight() + y);
                canvas.drawRoundRect(this.rect, AndroidUtilities.dp(0.3f), AndroidUtilities.dp(0.3f), this.paint);
            }
        }

        @Override
        public void setAlpha(int alpha) {
        }

        @Override
        public void setColorFilter(ColorFilter colorFilter) {
        }

        @Override
        public int getIntrinsicWidth() {
            return AndroidUtilities.dp(this.offsetStart + 15);
        }

        @Override
        public int getIntrinsicHeight() {
            return AndroidUtilities.dp(12.0f);
        }

        @Override
        public int getOpacity() {
            return -3;
        }
    }
}