导航菜单

页面标题

页面副标题

CallApp v2.226 - ContactDetailsActivity.java 源代码

正在查看: CallApp v2.226 应用的 ContactDetailsActivity.java JAVA 源代码文件

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


package com.callapp.contacts.activity.contact.details;

import a1.d0;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.provider.ContactsContract;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.activity.result.ActivityResult;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.e0;
import androidx.fragment.app.p0;
import androidx.lifecycle.v;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.n0;
import apk.tool.patcher.Premium;
import com.applovin.impl.j8;
import com.applovin.impl.t9;
import com.bumptech.glide.n;
import com.callapp.ads.api.bidder.OpenRTBJsonObjects;
import com.callapp.common.model.json.JSONProfileViewed;
import com.callapp.common.util.UrlUtils;
import com.callapp.contacts.CallAppApplication;
import com.callapp.contacts.R;
import com.callapp.contacts.action.Action;
import com.callapp.contacts.action.local.AddIncognitoContactAction;
import com.callapp.contacts.action.local.BaseCallReminderAction;
import com.callapp.contacts.action.local.BlockCallAction;
import com.callapp.contacts.action.local.CreateContactsAction;
import com.callapp.contacts.action.local.NoteAction;
import com.callapp.contacts.action.local.RemoveIncognitoContactAction;
import com.callapp.contacts.action.local.SpamAction;
import com.callapp.contacts.action.local.UnBlockCallAction;
import com.callapp.contacts.action.local.UnSpamAction;
import com.callapp.contacts.activity.InterstitialAdLoader;
import com.callapp.contacts.activity.analytics.cards.CDAnalyticsAdCard;
import com.callapp.contacts.activity.base.BaseActivity;
import com.callapp.contacts.activity.contact.cards.AdCard;
import com.callapp.contacts.activity.contact.cards.AnalyticsCarouselCard;
import com.callapp.contacts.activity.contact.cards.CDLargeAdCard;
import com.callapp.contacts.activity.contact.cards.CallRecorderPlayerCard;
import com.callapp.contacts.activity.contact.cards.ScrollWhenCDAnalyticsExpand;
import com.callapp.contacts.activity.contact.cards.framework.CardArrayRecyclerViewAdapterWithPriority;
import com.callapp.contacts.activity.contact.details.BaseContactDetailsActivity;
import com.callapp.contacts.activity.contact.details.BaseContactDetailsParallaxImpl;
import com.callapp.contacts.activity.contact.details.CallFabWithActionsView;
import com.callapp.contacts.activity.contact.details.ContactDetailsActivity;
import com.callapp.contacts.activity.contact.details.PostCallActivity;
import com.callapp.contacts.activity.contact.details.PresentersContainer;
import com.callapp.contacts.activity.contact.details.incall.InCallActions;
import com.callapp.contacts.activity.contact.details.incall.IncomingCallComponent;
import com.callapp.contacts.activity.contact.details.overlay.driveMode.DriveModePopUp;
import com.callapp.contacts.activity.contact.details.presenter.BaseUserCorrectedInfoPresenter;
import com.callapp.contacts.activity.contact.details.presenter.CallFabUtils;
import com.callapp.contacts.activity.contact.details.presenter.IsSpamPresenter;
import com.callapp.contacts.activity.contact.details.presenter.QuickResponseDialogPopup;
import com.callapp.contacts.activity.contact.details.presenter.UserCorrectedInfoPresenter;
import com.callapp.contacts.activity.contact.details.presenter.bottombar.BottomBarScrollListener;
import com.callapp.contacts.activity.contact.details.presenter.callbarpresenter.AudioRouteSelectorDialogListener;
import com.callapp.contacts.activity.contact.details.presenter.callbarpresenter.CallBarPresenter;
import com.callapp.contacts.activity.contact.details.presenter.simple.PhotoPresenter;
import com.callapp.contacts.activity.contact.details.presenter.simple.TopSheetPresenter;
import com.callapp.contacts.activity.contact.header.ThemeState;
import com.callapp.contacts.activity.contact.list.ContactsListActivity;
import com.callapp.contacts.activity.contact.list.keypad.KeypadFragment;
import com.callapp.contacts.activity.contact.list.keypad.KeypadView;
import com.callapp.contacts.activity.contact.list.keypad.TwelveKeyDialer;
import com.callapp.contacts.activity.contact.list.search.T9Helper;
import com.callapp.contacts.activity.crop.CallAppCropActivity;
import com.callapp.contacts.activity.idplus.CallAppFirstTimeCallDialog;
import com.callapp.contacts.activity.idplus.IDPlusActivity;
import com.callapp.contacts.activity.interfaces.AdCardHidingEvent;
import com.callapp.contacts.activity.interfaces.AdCardShowingEvent;
import com.callapp.contacts.activity.interfaces.DialpadToggleListener;
import com.callapp.contacts.activity.interfaces.DriveModeTouchEventListener;
import com.callapp.contacts.activity.interfaces.FastCacheChangedListener;
import com.callapp.contacts.activity.interfaces.FinishActivityListener;
import com.callapp.contacts.activity.interfaces.InterstitialDismissListener;
import com.callapp.contacts.activity.interfaces.InvalidateDataListener;
import com.callapp.contacts.activity.interfaces.KeypadVisibilityEvents;
import com.callapp.contacts.activity.interfaces.KeypadVisibilityListener;
import com.callapp.contacts.activity.interfaces.NotifyDataChangedListener;
import com.callapp.contacts.activity.interfaces.OnIncognitoCallStartedListener;
import com.callapp.contacts.activity.interfaces.PresenterEvents;
import com.callapp.contacts.activity.interfaces.RecorderStateListener;
import com.callapp.contacts.activity.interfaces.RefreshSearchListener;
import com.callapp.contacts.activity.interfaces.SearchContactsEvents;
import com.callapp.contacts.activity.interfaces.SearchContactsFilter;
import com.callapp.contacts.activity.interfaces.ShowKeypadListener;
import com.callapp.contacts.activity.interfaces.ThemeChangedListener;
import com.callapp.contacts.activity.interfaces.UserPresentUpdateListener;
import com.callapp.contacts.activity.marketplace.BasePreviewActivity;
import com.callapp.contacts.activity.marketplace.CallScreenThemeBannerViewController;
import com.callapp.contacts.activity.marketplace.MarketPlaceActivity;
import com.callapp.contacts.activity.marketplace.PersonalCallScreenThemePreviewActivity;
import com.callapp.contacts.activity.marketplace.PersonalStoreItemHelper;
import com.callapp.contacts.activity.missedcall.MissedCallManager;
import com.callapp.contacts.activity.records.CallRecordsActivity;
import com.callapp.contacts.activity.select.PersonSelectActivity;
import com.callapp.contacts.activity.whoViewedMyProfile.WhoViewedMyProfileDataManager;
import com.callapp.contacts.api.helper.common.RemoteAccountHelper;
import com.callapp.contacts.api.helper.common.SocialNetworksSearchUtil;
import com.callapp.contacts.api.helper.instantmessaging.basetypes.BaseImSenderHelper;
import com.callapp.contacts.api.helper.instantmessaging.basetypes.ImSender;
import com.callapp.contacts.event.EventBusManager;
import com.callapp.contacts.event.bus.EventBus;
import com.callapp.contacts.event.bus.EventType;
import com.callapp.contacts.event.listener.PauseListener;
import com.callapp.contacts.event.listener.ResumeListener;
import com.callapp.contacts.framework.log.GenomeLoaderFileLogger;
import com.callapp.contacts.inCallService.TelecomAdapter;
import com.callapp.contacts.loader.ChosenContactPhotoManager;
import com.callapp.contacts.loader.FastCacheDataManager;
import com.callapp.contacts.loader.PersonalStoreItemDataManager;
import com.callapp.contacts.loader.device.CallHistoryLoader;
import com.callapp.contacts.loader.device.NoteLoader;
import com.callapp.contacts.manager.ActionsManager;
import com.callapp.contacts.manager.BlockManager;
import com.callapp.contacts.manager.CallAppRemoteConfigManager;
import com.callapp.contacts.manager.ContactLoaderManager;
import com.callapp.contacts.manager.CurrentCallDynamicObject;
import com.callapp.contacts.manager.FeedbackManager;
import com.callapp.contacts.manager.IncognitoCallManager;
import com.callapp.contacts.manager.MainThreadTimer;
import com.callapp.contacts.manager.NotificationIntentHandler;
import com.callapp.contacts.manager.NotificationManager;
import com.callapp.contacts.manager.OverlayManager;
import com.callapp.contacts.manager.ProximityManager;
import com.callapp.contacts.manager.UserProfileManager;
import com.callapp.contacts.manager.WindowInsetsManager;
import com.callapp.contacts.manager.analytics.AnalyticsManager;
import com.callapp.contacts.manager.contacts.ContactUtils;
import com.callapp.contacts.manager.keyguard.KeyguardActivityStateManager;
import com.callapp.contacts.manager.permission.PermissionManager;
import com.callapp.contacts.manager.phone.BluetoothHeadsetConnectivityManager;
import com.callapp.contacts.manager.phone.CallDetailsListener;
import com.callapp.contacts.manager.phone.CallStateListener;
import com.callapp.contacts.manager.phone.PhoneManager;
import com.callapp.contacts.manager.phone.PhoneStateManager;
import com.callapp.contacts.manager.popup.DialogPopup;
import com.callapp.contacts.manager.popup.PopupManager;
import com.callapp.contacts.manager.preferences.Prefs;
import com.callapp.contacts.manager.preferences.prefs.BooleanPref;
import com.callapp.contacts.manager.preferences.prefs.DatePref;
import com.callapp.contacts.manager.preferences.prefs.IntegerPref;
import com.callapp.contacts.manager.preferences.prefs.JSONObjectPref;
import com.callapp.contacts.manager.preferences.prefs.LongPref;
import com.callapp.contacts.manager.task.Task;
import com.callapp.contacts.model.Constants;
import com.callapp.contacts.model.DataChangedInfo;
import com.callapp.contacts.model.RecentSearchesData;
import com.callapp.contacts.model.ReminderAnalyticsData;
import com.callapp.contacts.model.Reward;
import com.callapp.contacts.model.call.CallData;
import com.callapp.contacts.model.call.CallState;
import com.callapp.contacts.model.contact.ContactData;
import com.callapp.contacts.model.contact.ContactDataChangeListener;
import com.callapp.contacts.model.contact.ContactDataUtils;
import com.callapp.contacts.model.contact.ContactField;
import com.callapp.contacts.model.contact.DataSource;
import com.callapp.contacts.model.contact.DeviceData;
import com.callapp.contacts.model.contact.PhotoUrls;
import com.callapp.contacts.model.contact.social.ContactFieldEnumSets;
import com.callapp.contacts.model.objectbox.CallRecorder;
import com.callapp.contacts.model.objectbox.CallReminderFrequentData;
import com.callapp.contacts.model.objectbox.ChosenContactPhoto;
import com.callapp.contacts.model.objectbox.ENTRYPOINT;
import com.callapp.contacts.model.objectbox.ExtractedInfo;
import com.callapp.contacts.model.objectbox.FastCacheData;
import com.callapp.contacts.model.objectbox.PersonalStoreItemUrlData;
import com.callapp.contacts.model.objectbox.ProfileViewedData;
import com.callapp.contacts.model.objectbox.ProfileViewedData_;
import com.callapp.contacts.model.objectbox.TYPE;
import com.callapp.contacts.observers.CallAppContentObserver;
import com.callapp.contacts.observers.OneShotContentContentObserver;
import com.callapp.contacts.popup.OptInWithTopImagePopup;
import com.callapp.contacts.popup.contact.DialogContactMultiNumber;
import com.callapp.contacts.popup.contact.DrawOverAppsRequestDialog;
import com.callapp.contacts.popup.contact.EditContactPopup;
import com.callapp.contacts.popup.contact.callrecorder.DialogCallRecorderPlayer;
import com.callapp.contacts.popup.contact.callrecorder.ReenableAccessibilitServiceDialog;
import com.callapp.contacts.receiver.BaseReceiver;
import com.callapp.contacts.recorder.CallRecorderManager;
import com.callapp.contacts.recorder.interfaces.CallRecorderEvent;
import com.callapp.contacts.recorder.loader.CallRecorderLoader;
import com.callapp.contacts.recorder.recordertest.RecorderTestFragment;
import com.callapp.contacts.recorder.recordertest.RecorderTestManager;
import com.callapp.contacts.sync.syncer.upload.UploadSyncer;
import com.callapp.contacts.util.Activities;
import com.callapp.contacts.util.AdUtils;
import com.callapp.contacts.util.AndroidUtils;
import com.callapp.contacts.util.AppRater;
import com.callapp.contacts.util.ArrayUtils;
import com.callapp.contacts.util.CLog;
import com.callapp.contacts.util.CallLogUtils;
import com.callapp.contacts.util.ColorUtils;
import com.callapp.contacts.util.DefaultInterfaceImplUtils$ClickListener;
import com.callapp.contacts.util.ImageUtils;
import com.callapp.contacts.util.LocaleUtils;
import com.callapp.contacts.util.MissedCallUtils;
import com.callapp.contacts.util.PowerUtils;
import com.callapp.contacts.util.SpamAppPermissionsUtils;
import com.callapp.contacts.util.ThemeUtils;
import com.callapp.contacts.util.UserCorrectedInfoUtil;
import com.callapp.contacts.util.ViewUtils;
import com.callapp.contacts.util.animation.AnimationListenerAdapter;
import com.callapp.contacts.util.animation.CallappAnimationUtils;
import com.callapp.contacts.util.date.DateUtils;
import com.callapp.contacts.util.glide.GlideCacheHandler;
import com.callapp.contacts.util.glide.GlideUtils;
import com.callapp.contacts.util.http.HttpRequestParams;
import com.callapp.contacts.util.http.HttpUtils;
import com.callapp.contacts.widget.AudioRouteSelectorDialogFragment;
import com.callapp.contacts.widget.CallAppCheckBox;
import com.callapp.contacts.widget.DrawingViewWithCallback;
import com.callapp.contacts.widget.RewardView;
import com.callapp.contacts.widget.floatingwidget.ui.callapp.CallAppChatHeadLifecycleObserverManager;
import com.callapp.contacts.widget.recyclerviewext.CardRecyclerView;
import com.callapp.contacts.widget.referandearn.ShareCallAppDialogFragment;
import com.callapp.framework.phone.Phone;
import com.callapp.framework.util.CollectionUtils;
import com.callapp.framework.util.StringUtils;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import com.skyfishjy.library.RippleBackground;
import io.objectbox.query.QueryBuilder;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
import k2.t;
import kotlin.jvm.internal.Intrinsics;
import md.f;
import org.jetbrains.annotations.NotNull;
import s4.y;

public class ContactDetailsActivity extends BaseContactDetailsActivity implements CallStateListener, ContactDataChangeListener, CallRecorderEvent, BottomBarScrollListener.Listener, InCallActions, CallDetailsListener, DialpadToggleListener, KeypadVisibilityListener, KeypadFragment.KeypadEvents, SearchContactsEvents, AdCardShowingEvent, AdCardHidingEvent, CallScreenThemeBannerViewController.Listener, ThemeChangedListener, TopSheetPresenter.TopSheetListener, AudioRouteSelectorDialogFragment.AudioRouteSelectorListener, CallAppFirstTimeCallDialog.ActionClick, FinishActivityListener, ScrollWhenCDAnalyticsExpand, CallFabWithActionsView.OnCallFabActionListener, RecorderTestFragment.RecorderTestFragmentEvents, InterstitialDismissListener, BaseUserCorrectedInfoPresenter.CorrectionClickListener {
    public static final String ACTION_DONT_CLEAR_POPUPS = "DONT_CLEAR_POPUP_ACTION";
    private static final int BRING_TO_FRONT_REPEATS = 4;
    private static final int BRING_TO_FRONT_SHOW_DETAILS_DELAY = 300;
    private static final int BRING_TO_FRONT_SHOW_DETAILS_DELAY_VIA_INTENT = 200;
    public static final long CALL_SHOW_THRESHOLD_SEC = 15;
    public static final String EXTRA_BRING_TO_FRONT_RETRY = "EXTRA_BRING_TO_FRONT_RETRY";
    private static final String EXTRA_BRING_TO_FRONT_RETRY_LEFT = "EXTRA_BRING_TO_FRONT_RETRY_LEFT";
    public static final String EXTRA_DATA_CHANGE_INFO = "EXTRA_DATA_CHANGE_INFO";
    public static final String EXTRA_FORCE_SHOW_CORRECTED_INFO_PRESENTER = "EXTRA_FORCE_SHOW_CORRECTED_INFO_PRESENTER";
    public static final String EXTRA_FORCE_SHOW_IS_SPAM_PRESENTER = "EXTRA_FORCE_SHOW_IS_SPAM_PRESENTER";
    public static final String EXTRA_FULL_NAME = "fullName";
    public static final String EXTRA_IS_BLOCKED = "isBlocked";
    public static final String EXTRA_IS_CALL_WAITING = "EXTRA_IS_CALL_WAITING";
    public static final String EXTRA_PARCELABLE_BUNDLE = "EXTRA_PARCELABLE_BUNDLE";
    private static final String EXTRA_SUPPRESS_ACTIVITY_CREATION_ANIMATION = "shouldSuppressAnimation";
    public static final String EXTRA_WHO_VIEW_PROFILE_NOTIFICATION = "EXTRA_WHO_VIEW_PROFILE_NOTIFICATION";
    private static final int FADE_DURATION_MILLIS = 300;
    public static final int FADE_START_DELAY_MILLIS = 2000;
    public static final int ONE_SEC_IN_MILLIS = 1000;
    private static final String SHOULD_FINISH_ACTIVITY = "SHOULD_FINISH_ACTIVITY";
    private static final int SHOW_IMAGE_CHANGE_TOAST_AFTER_X_CONTACT_DETAILS_INTERVAL = 4;
    private static final int SNACK_BAR_DURATION = 4000;
    public static final int TOOLTIP_DURATION_SECONDS = 7;
    public static final int TOOLTIP_SHOW_COUNT = 2;
    private static final Handler handler;
    private static final HandlerThread handlerThread;
    public static final AtomicBoolean isStartedFromACall;
    private static String keypadNumbers;
    private AudioRouteSelectorDialogFragment audioRouteSelectorDialogFragment;
    private View bottomActionBar;
    private ValueAnimator bottomActionBarClosingAnimation;
    private View bottomActionsContainerWithShadow;
    private BringToFrontLifecycleObserver bringToFrontLifecycleObserver;
    private View callActionBtn;
    private ObjectAnimator callActionBtnFadeInAnim;
    private View callBarLayoutRoot;
    private CallBarPresenter callBarPresenter;
    private View callBtn;
    private CallFabWithActionsView callFab;
    private CallScreenThemeBannerViewController callScreenThemeBannerViewController;
    private CardRecyclerView cardsRecyclerview;
    private View cardsRecyclerviewContainer;
    private ImageView centerBottomActionSmallIcon;
    private View contactDetailsActionAdd;
    private View contactDetailsActionEditContainer;
    private ImageView contactDetailsActionEye;
    private View contactDetailsActionMore;
    private View contactDetailsEditContactNameIcon;
    private View contactDetailsFirstCircleButton;
    private ViewGroup contactDetailsRootView;
    private View contactDetailsSecondCircleButton;
    private View contactDetailsTopStrip;
    private CallAppCheckBox favoritesBtn;
    private boolean forcePreCallState;
    private FrameLayout fullScreenBannerContainer;
    private boolean isAdLoaded;
    private boolean isAnalyticsAdLoaded;
    private boolean isAutoScrollEnabled;
    private boolean isGoldUserAndNeedAndContactInstalled;
    private boolean keypadShown;
    private KeypadVisibilityEvents keypadVisiblityEvents;
    private RippleBackground profileRippleBackground;
    private View recorderTestContainer;
    private ViewStub recorderTestContainerStub;
    private RecorderTestFragment recorderTestFragment;
    private SingleContactContentObserver singleContactContentObserver;
    private View snackBarContainer;
    private View snackBarContainerKeypad;
    private j.b spamAppLauncher;
    private View topSheetContainer;
    private TopSheetPresenter topSheetPresenter;
    public static final int BOTTOM_ACTION_BAR_HEIGHT_FULLY_OPEN = (int) t.b(2131165444);
    public static final int BOTTOM_ACTION_BAR_HEIGHT_FULLY_CLOSED = (int) t.b(2131165441);
    private final String TAG = getClass().getSimpleName();
    public boolean isEyeTooltipShown = false;
    private final String classSimpleName = getClass().getSimpleName();
    private boolean isIdentified = false;
    private long autoScrollType = 0;
    private int extraDelayAfterShowingCorrectedInfo = 0;
    private CallState callState = CallState.PRE_CALL;
    private boolean manualRecorderDialogShown = false;
    private boolean presentersInitialized = false;
    private boolean lastBottomBarDirectionWasExpand = true;
    private IncomingCallComponent incomingCallComponent = null;
    private ExtractedInfo origin = null;
    private ENTRYPOINT whoViewedMyProfileEntrypoint = null;
    private boolean genomeLoaded = false;
    private boolean incognitoLoaded = false;
    private final AtomicBoolean isAutoScrollRunning = new AtomicBoolean(false);
    private long remainingTimesToAutoScroll = CallAppRemoteConfigManager.get().c("cdTimesToAutoScroll");
    private final String recorderTestFragmentTag = "RecorderTestFragment";
    private final AtomicBoolean isKeepScreenOnSet = new AtomicBoolean(false);
    private final j.a spamAppLauncherCallback = new l(this);
    private final MainThreadTimer finishTask = new MainThreadTimer(new AnonymousClass1());
    private final Runnable keepScreenRunnable = new j(this, 1);
    private final Runnable runAutoScrollIfNeeded = new Runnable() {
        @Override
        public final void run() {
            ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
            contactDetailsActivity.isAutoScrollRunning.set(false);
            contactDetailsActivity.doAutoScrollIfNeeded();
        }
    };
    private final Runnable fadeInCallActionBtnRunnable = new Runnable() {
        @Override
        public final void run() {
            ContactDetailsActivity.this.enableCallActionBtn(true);
        }
    };
    private final FastCacheChangedListener fastCacheChangedListener = new FastCacheChangedListener() {
        @Override
        public final void a(ContactData contactData) {
            ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
            if (contactDetailsActivity.presenterContainer.getContact() == contactData) {
                contactDetailsActivity.notifyEventBusData();
            }
        }
    };
    private final InvalidateDataListener invalidateDataListener = new InvalidateDataListener() {
        @Override
        public final void invalidateData(EventBusManager.CallAppDataType callAppDataType) {
            EventBusManager.CallAppDataType callAppDataType2 = EventBusManager.CallAppDataType.UNSET_INCOGNITO;
            ?? r1 = ContactDetailsActivity.this;
            if (callAppDataType == callAppDataType2) {
                ContactData contactData = r1.contact;
                if (contactData != null) {
                    CallHistoryLoader.e(contactData);
                }
                IncognitoCallManager.get().unMarkIncognito(r1.contact.getPhone());
                Intent intent = r1.getIntent();
                if (intent != null && intent.getBooleanExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL, false)) {
                    intent.removeExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL);
                    r1.onNewIntent(intent);
                }
            }
            if (callAppDataType == EventBusManager.CallAppDataType.BLOCK) {
                r1.onContactChanged(r1.contact, ContactFieldEnumSets.ALL);
            }
        }
    };
    private final PresenterEvents presenterEvents = new PresenterEvents() {
        @Override
        public final void a() {
            ContactDetailsActivity.this.extraDelayAfterShowingCorrectedInfo = OpenRTBJsonObjects.TMAX_VALUE;
        }
    };
    private final ProximityManager.AudioModeChanged audioModeChangedListener = new ProximityManager.AudioModeChanged() {
        @Override
        public final void a() {
            CallAppApplication.get().runOnBackgroundThread(new Runnable() {
                @Override
                public final void run() {
                    ContactDetailsActivity.this.requestUpdateUI();
                }
            });
        }
    };
    private final BroadcastReceiver broadcastReceiver = new BaseReceiver() {
        @Override
        public final void a(Context context, Intent intent) {
            ?? r5 = ContactDetailsActivity.this;
            boolean hasWindowFocus = r5.hasWindowFocus();
            r5.hasFocus = hasWindowFocus;
            EventBusManager.a.b(UserPresentUpdateListener.a, Boolean.valueOf(hasWindowFocus), false);
            String unused = ((ContactDetailsActivity) r5).TAG;
            AndroidUtils.c(intent);
            CLog.a();
        }
    };
    private float callIconScale = 1.0f;
    private boolean showSmallIcon = false;

    public class AnonymousClass1 implements MainThreadTimer.DelaytedTaskEvents {
        public AnonymousClass1() {
        }

        @Override
        public final void a() {
            ?? r0 = ContactDetailsActivity.this;
            if (!Activities.q(r0, null) || PhoneManager.get().isRinging()) {
                return;
            }
            r0.safeRunOnUIThread(new p(this, 0));
        }
    }

    public class AnonymousClass12 implements BaseContactDetailsParallaxImpl.PositionChangedListener {
        public AnonymousClass12() {
        }

        public final void a(BaseContactDetailsParallaxImpl.Position position) {
            int i = AnonymousClass54.a[position.ordinal()];
            ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
            if (i != 1) {
                if (i != 2) {
                    return;
                }
                if (contactDetailsActivity.needToHandleEyeIcon()) {
                    contactDetailsActivity.contactDetailsActionEye.setVisibility(0);
                }
                contactDetailsActivity.animateBottomActionBar(true, true);
                return;
            }
            if (contactDetailsActivity.needToHandleEyeIcon()) {
                contactDetailsActivity.contactDetailsActionEye.setVisibility(8);
            }
            if (Activities.isOrientationLandscape() && contactDetailsActivity.topSheetPresenter != null && contactDetailsActivity.topSheetPresenter.isTopSheetOpened()) {
                contactDetailsActivity.animateBottomActionBar(true, false);
            } else {
                contactDetailsActivity.animateBottomActionBar(false, true);
            }
        }
    }

    public class AnonymousClass48 implements DialogContactMultiNumber.DialogContactMultiNumberListener {
        public AnonymousClass48() {
        }

        @Override
        public final void a(final Phone phone, boolean z) {
            boolean m = OptInWithTopImagePopup.m();
            ?? r0 = ContactDetailsActivity.this;
            if (m) {
                final int i = 0;
                final int i2 = 1;
                OptInWithTopImagePopup.n(r0, new DialogPopup.IDialogOnClickListener(this) {
                    public final ContactDetailsActivity.AnonymousClass48 b;

                    {
                        this.b = this;
                    }

                    @Override
                    public final void onClickListener(Activity activity) {
                        switch (i) {
                            case 0:
                                ContactDetailsActivity.AnonymousClass48 anonymousClass48 = this.b;
                                anonymousClass48.getClass();
                                Phone phone2 = phone;
                                if (phone2 != null && phone2.isNotEmpty() && !CallLogUtils.s(phone2.getRawNumber())) {
                                    ?? r4 = ContactDetailsActivity.this;
                                    r4.callPhone(r4, phone2, true);
                                    r4.eventBus.b(OnIncognitoCallStartedListener.f611j8, r4.contact, false);
                                    break;
                                }
                                break;
                            default:
                                ContactDetailsActivity.AnonymousClass48 anonymousClass482 = this.b;
                                anonymousClass482.getClass();
                                Phone phone3 = phone;
                                if (phone3 != null && phone3.isNotEmpty() && !CallLogUtils.s(phone3.getRawNumber())) {
                                    ?? r42 = ContactDetailsActivity.this;
                                    r42.callPhone(r42, phone3, false);
                                    break;
                                }
                                break;
                        }
                    }
                }, new DialogPopup.IDialogOnClickListener(this) {
                    public final ContactDetailsActivity.AnonymousClass48 b;

                    {
                        this.b = this;
                    }

                    @Override
                    public final void onClickListener(Activity activity) {
                        switch (i2) {
                            case 0:
                                ContactDetailsActivity.AnonymousClass48 anonymousClass48 = this.b;
                                anonymousClass48.getClass();
                                Phone phone2 = phone;
                                if (phone2 != null && phone2.isNotEmpty() && !CallLogUtils.s(phone2.getRawNumber())) {
                                    ?? r4 = ContactDetailsActivity.this;
                                    r4.callPhone(r4, phone2, true);
                                    r4.eventBus.b(OnIncognitoCallStartedListener.f611j8, r4.contact, false);
                                    break;
                                }
                                break;
                            default:
                                ContactDetailsActivity.AnonymousClass48 anonymousClass482 = this.b;
                                anonymousClass482.getClass();
                                Phone phone3 = phone;
                                if (phone3 != null && phone3.isNotEmpty() && !CallLogUtils.s(phone3.getRawNumber())) {
                                    ?? r42 = ContactDetailsActivity.this;
                                    r42.callPhone(r42, phone3, false);
                                    break;
                                }
                                break;
                        }
                    }
                });
            } else {
                if (phone == null || !phone.isNotEmpty() || CallLogUtils.s(phone.getRawNumber())) {
                    return;
                }
                r0.callPhone(r0, phone, true);
            }
        }
    }

    public class AnonymousClass52 implements Runnable {
        public AnonymousClass52() {
        }

        @Override
        public final void run() {
            ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
            contactDetailsActivity.profileRippleBackground.setVisibility(0);
            contactDetailsActivity.profileRippleBackground.b();
            CallAppApplication.get().postRunnableDelayed(new Runnable() {
                @Override
                public final void run() {
                    AnonymousClass52 anonymousClass52 = AnonymousClass52.this;
                    if (!ContactDetailsActivity.this.isActivityVisible()) {
                        if (ContactDetailsActivity.this.profileRippleBackground != null) {
                            ContactDetailsActivity.this.profileRippleBackground.c();
                            ContactDetailsActivity.this.profileRippleBackground.setVisibility(8);
                            return;
                        }
                        return;
                    }
                    AlphaAnimation alphaAnimation = new AlphaAnimation(0.85f, 0.0f);
                    alphaAnimation.setDuration(250L);
                    alphaAnimation.setFillAfter(true);
                    alphaAnimation.setAnimationListener(new AnimationListenerAdapter() {
                        @Override
                        public final void onAnimationEnd(Animation animation) {
                            AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
                            ContactDetailsActivity.this.profileRippleBackground.c();
                            ContactDetailsActivity.this.profileRippleBackground.setVisibility(8);
                        }
                    });
                    ContactDetailsActivity.this.profileRippleBackground.startAnimation(alphaAnimation);
                }
            }, 4000L);
        }
    }

    public static class AnonymousClass54 {
        public static final int[] a;
        public static final int[] b;
        public static final int[] c;
        public static final int[] d;

        static {
            int[] iArr = new int[BaseContactDetailsActivity.DetailsActivityMode.values().length];
            d = iArr;
            try {
                iArr[BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                d[BaseContactDetailsActivity.DetailsActivityMode.IN_CALL.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                d[BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            int[] iArr2 = new int[ContactAction.values().length];
            c = iArr2;
            try {
                iArr2[ContactAction.SMS_MESSAGE.ordinal()] = 1;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                c[ContactAction.WHATSAPP.ordinal()] = 2;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                c[ContactAction.HANGOUTS.ordinal()] = 3;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                c[ContactAction.SIGNAL.ordinal()] = 4;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                c[ContactAction.MEET.ordinal()] = 5;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                c[ContactAction.WECHAT.ordinal()] = 6;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                c[ContactAction.ALLO.ordinal()] = 7;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                c[ContactAction.TELEGRAM.ordinal()] = 8;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                c[ContactAction.VIBER.ordinal()] = 9;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                c[ContactAction.NOTE.ordinal()] = 10;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                c[ContactAction.BLOCK.ordinal()] = 11;
            } catch (NoSuchFieldError unused14) {
            }
            try {
                c[ContactAction.UN_BLOCK.ordinal()] = 12;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                c[ContactAction.SPAM.ordinal()] = 13;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                c[ContactAction.UN_SPAM.ordinal()] = 14;
            } catch (NoSuchFieldError unused17) {
            }
            try {
                c[ContactAction.ADD_CONTACT.ordinal()] = 15;
            } catch (NoSuchFieldError unused18) {
            }
            try {
                c[ContactAction.PVR.ordinal()] = 16;
            } catch (NoSuchFieldError unused19) {
            }
            try {
                c[ContactAction.INCOGNITO.ordinal()] = 17;
            } catch (NoSuchFieldError unused20) {
            }
            try {
                c[ContactAction.UN_INCOGNITO.ordinal()] = 18;
            } catch (NoSuchFieldError unused21) {
            }
            try {
                c[ContactAction.REFER_AND_EARN.ordinal()] = 19;
            } catch (NoSuchFieldError unused22) {
            }
            int[] iArr3 = new int[CallState.values().length];
            b = iArr3;
            try {
                iArr3[CallState.CONNECTING.ordinal()] = 1;
            } catch (NoSuchFieldError unused23) {
            }
            try {
                b[CallState.DISCONNECTED.ordinal()] = 2;
            } catch (NoSuchFieldError unused24) {
            }
            try {
                b[CallState.RINGING_OUTGOING.ordinal()] = 3;
            } catch (NoSuchFieldError unused25) {
            }
            try {
                b[CallState.RINGING_INCOMING.ordinal()] = 4;
            } catch (NoSuchFieldError unused26) {
            }
            try {
                b[CallState.TALKING.ordinal()] = 5;
            } catch (NoSuchFieldError unused27) {
            }
            try {
                b[CallState.ON_HOLD.ordinal()] = 6;
            } catch (NoSuchFieldError unused28) {
            }
            try {
                b[CallState.POST_CALL.ordinal()] = 7;
            } catch (NoSuchFieldError unused29) {
            }
            try {
                b[CallState.PRE_CALL.ordinal()] = 8;
            } catch (NoSuchFieldError unused30) {
            }
            int[] iArr4 = new int[BaseContactDetailsParallaxImpl.Position.values().length];
            a = iArr4;
            try {
                iArr4[BaseContactDetailsParallaxImpl.Position.CLOSED.ordinal()] = 1;
            } catch (NoSuchFieldError unused31) {
            }
            try {
                a[BaseContactDetailsParallaxImpl.Position.SEMI_OPEN.ordinal()] = 2;
            } catch (NoSuchFieldError unused32) {
            }
        }
    }

    public static class BringToFrontLifecycleObserver implements androidx.lifecycle.e {
        public boolean a;

        public BringToFrontLifecycleObserver(int i) {
            this();
        }

        public final void onPause(v vVar) {
            this.a = false;
        }

        public final void onResume(v vVar) {
            this.a = true;
        }

        private BringToFrontLifecycleObserver() {
            this.a = true;
        }
    }

    public static final class BringToFrontTask extends Task {
        public final Intent a;

        public BringToFrontTask(Intent intent) {
            this.a = intent;
        }

        @Override
        public final void doTask() {
            Activities.E(CallAppApplication.get(), this.a);
        }
    }

    public enum PostCallDuration {
        AFTER_2_SEC(2),
        AFTER_5_SEC(5),
        AFTER_10_SEC(10),
        AFTER_12_SEC(12),
        AFTER_20_SEC(20),
        AFTER_30_SEC(30);

        public final int duration;

        PostCallDuration(int i) {
            this.duration = i;
        }
    }

    public class SingleContactContentObserver extends CallAppContentObserver {
        public static final int g = 0;
        public long e;

        public SingleContactContentObserver(Handler handler) {
            super(handler);
        }

        @Override
        public final Runnable a() {
            return new p(this, 1);
        }

        public final void b(long j) {
            if (this.e == j) {
                return;
            }
            c();
            this.e = j;
            if (j > 0) {
                try {
                    StringUtils.I(SingleContactContentObserver.class);
                    CLog.a();
                    CallAppApplication.get().getContentResolver().registerContentObserver(Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(j)), true, ContactDetailsActivity.this.singleContactContentObserver);
                } catch (Exception unused) {
                }
            }
        }

        public final void c() {
            try {
                if (this.e > 0) {
                    StringUtils.I(SingleContactContentObserver.class);
                    CLog.a();
                    CallAppApplication.get().getContentResolver().unregisterContentObserver(this);
                    this.e = 0L;
                }
            } catch (Exception e) {
                CLog.m(ContactDetailsActivity.this.TAG, e);
            }
        }
    }

    static {
        HandlerThread handlerThread2 = new HandlerThread(SingleContactContentObserver.class.getSimpleName());
        handlerThread = handlerThread2;
        isStartedFromACall = new AtomicBoolean(false);
        handlerThread2.start();
        AndroidUtils.b(handlerThread2.getLooper());
        handler = new Handler(handlerThread2.getLooper());
    }

    public void callPhone(Context context, Phone phone, boolean z) {
        if (phone != null) {
            PhoneManager.c(context, phone, this.contact.getDeviceId(), this.contact.getFullName(), Constants.CALLS, "ClickCallCDButton", "", z || this.contact.isIncognito(), null);
            if (z) {
                this.eventBus.b(OnIncognitoCallStartedListener.f611j8, this.contact, false);
            }
        }
    }

    private boolean cleanAllDataIfContactChanged(long j, Phone phone) {
        if (!shouldReplaceContact(j, phone)) {
            return false;
        }
        releaseContact();
        this.contact = new ContactData(phone, 0L, this.origin);
        TopSheetPresenter topSheetPresenter = this.topSheetPresenter;
        if (topSheetPresenter != null) {
            topSheetPresenter.b();
        }
        onContactChanged(this.contact, ContactFieldEnumSets.ALL.clone());
        this.contact = new ContactData(Phone.v, 0L, this.origin);
        resetLayoutState();
        return true;
    }

    private static void copyIntentCallData(Intent intent, Intent intent2) {
        if (intent == null) {
            return;
        }
        long longExtra = intent.getLongExtra("contactId", 0L);
        String stringExtra = intent.getStringExtra(Constants.EXTRA_PHONE_NUMBER);
        if (longExtra != 0) {
            intent2.putExtra("contactId", longExtra);
        }
        if (StringUtils.x(stringExtra)) {
            intent2.putExtra(Constants.EXTRA_PHONE_NUMBER, stringExtra);
        }
        intent2.putExtra(Constants.EXTRA_PHONE_ORIGIN, intent.getSerializableExtra(Constants.EXTRA_PHONE_ORIGIN));
        if (intent.hasExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL)) {
            intent2.putExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL, intent.getBooleanExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL, false));
        }
        if (intent.hasExtra(Constants.EXTRA_CALL_TELECOM_ID)) {
            intent2.putExtra(Constants.EXTRA_CALL_TELECOM_ID, intent.getStringExtra(Constants.EXTRA_CALL_TELECOM_ID));
        }
    }

    public static Intent createIntent(Context context, long j, String str) {
        Intent addFlags = new Intent(context, (Class<?>) ContactDetailsActivity.class).setFlags(268435456).addFlags(537198592);
        fillIntentWithCallData(addFlags, j, str, null, null, true, null, null);
        return addFlags;
    }

    private BaseContactDetailsActivity.DetailsActivityMode determineTargetMode() {
        if (RecorderTestManager.get().getIsInRecorderTestMode()) {
            return BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST;
        }
        if (PhoneStateManager.get().getCallListSize() > 1) {
            return BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS;
        }
        return null;
    }

    public void doAutoScrollIfNeeded() {
        int i = 0;
        if (!this.isAdLoaded || !this.isAutoScrollEnabled || this.isAutoScrollRunning.getAndSet(true) || getRecyclerView().isUserTouchedItOrItsChildrenOnce() || this.callState.isPreCall() || this.callState.isPostCall() || this.callState.isIncoming()) {
            BaseContactDetailsParallaxImpl parallax = getParallax();
            if (parallax.f) {
                parallax.f = false;
                return;
            }
            return;
        }
        if (this.isAnalyticsAdLoaded && (CallAppRemoteConfigManager.get().b("CDAnalyticsAdAlwaysShow") || Prefs.L6.get().booleanValue())) {
            i = getCDAnalyticsAdPosition();
        }
        getRecyclerView().z0(new CardRecyclerView.OnAutoScrollEventsListener() {
            @Override
            public final void a() {
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                BaseContactDetailsActivity.FlingListener flingListener = contactDetailsActivity.flingListener;
                flingListener.b = false;
                flingListener.a = false;
                BaseContactDetailsParallaxImpl parallax2 = contactDetailsActivity.getParallax();
                if (!parallax2.f) {
                    parallax2.f = true;
                }
                contactDetailsActivity.snapToPosition(BaseContactDetailsParallaxImpl.Position.CLOSED, true);
            }

            @Override
            public final void b() {
                BaseContactDetailsParallaxImpl.Position position = BaseContactDetailsParallaxImpl.Position.SEMI_OPEN;
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                contactDetailsActivity.snapToPosition(position, true);
                BaseContactDetailsParallaxImpl parallax2 = contactDetailsActivity.getParallax();
                if (parallax2.f) {
                    parallax2.f = false;
                }
                contactDetailsActivity.updateRemainingTimeToAutoScroll();
            }
        }, this.autoScrollType, i);
    }

    private void editOrCreateContact() {
        if (this.contact != null) {
            AnalyticsManager.get().p(Constants.CONTACT_DETAILS, "Edit or Create contact", Constants.CLICK);
            new Task() {
                @Override
                public final void doTask() {
                    PopupManager popupManager = PopupManager.get();
                    ?? r2 = ContactDetailsActivity.this;
                    popupManager.d(r2, new EditContactPopup(r2.contact, true));
                }
            }.execute();
        }
    }

    public void enableCallActionBtn(boolean z) {
        if (this.callActionBtnFadeInAnim != null) {
            CallAppApplication.get().removePostedRunnable(this.fadeInCallActionBtnRunnable);
            this.callActionBtnFadeInAnim.cancel();
        }
        if (!z) {
            setBottomBarFunctionality(true);
            return;
        }
        ObjectAnimator c = CallappAnimationUtils.c(this.callActionBtn, 300, 0);
        this.callActionBtnFadeInAnim = c;
        if (c != null) {
            c.addListener(new Animator.AnimatorListener() {
                @Override
                public final void onAnimationCancel(Animator animator) {
                }

                @Override
                public final void onAnimationEnd(Animator animator) {
                    ContactDetailsActivity.this.setBottomBarFunctionality(true);
                }

                @Override
                public final void onAnimationRepeat(Animator animator) {
                }

                @Override
                public final void onAnimationStart(Animator animator) {
                }
            });
            this.callActionBtnFadeInAnim.start();
        }
    }

    public static void fillIntentWithCallData(Intent intent, long j, String str, String str2, ExtractedInfo extractedInfo, boolean z, DataChangedInfo dataChangedInfo, ENTRYPOINT entrypoint) {
        PhotoUrls photoUrls;
        if (j != 0) {
            intent.putExtra("contactId", j);
        }
        if (StringUtils.x(str)) {
            intent.putExtra(Constants.EXTRA_PHONE_NUMBER, str);
        }
        try {
            FastCacheData c = FastCacheDataManager.c(j, PhoneManager.get().e(str));
            if (c != null && (photoUrls = c.getPhotoUrls()) != null) {
                String photoUrl = photoUrls.getPhotoUrl();
                if (StringUtils.x(photoUrl)) {
                    GlideCacheHandler glideCacheHandler = GlideCacheHandler.a;
                    DataSource photoDataSource = c.getPhotoDataSource();
                    glideCacheHandler.getClass();
                    GlideCacheHandler.b(photoUrl, photoDataSource, null, null);
                }
            }
        } catch (Exception e) {
            CLog.k(ContactDetailsActivity.class, e);
        }
        intent.putExtra(Constants.EXTRA_PHONE_ORIGIN, extractedInfo);
        if (z) {
            intent.putExtra("forceIdleState", true);
        }
        if (dataChangedInfo != null) {
            Bundle bundle = new Bundle();
            bundle.putParcelable(EXTRA_DATA_CHANGE_INFO, dataChangedInfo);
            intent.putExtra(EXTRA_PARCELABLE_BUNDLE, bundle);
        }
        if (entrypoint != null) {
            intent.putExtra(Constants.EXTRA_WHO_VIEWED_ENTRY_POINT, entrypoint);
        }
        if (StringUtils.x(str2)) {
            intent.putExtra(Constants.EXTRA_CALL_TELECOM_ID, str2);
        }
    }

    public void fireContactChange() {
        synchronized (this.contactFieldsLock) {
            try {
                if (this.presentersInitialized && CollectionUtils.h(this.contactFields)) {
                    onContactChanged(this.contact, this.contactFields);
                    this.contactFields = null;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public <T extends BaseUserCorrectedInfoPresenter> void forceShowPresenterIfNeeded(Intent intent, String str, Class<T> cls) {
        BaseUserCorrectedInfoPresenter baseUserCorrectedInfoPresenter;
        if (!intent.getBooleanExtra(str, false) || this.contact == null || Premium.Premium() || (baseUserCorrectedInfoPresenter = (BaseUserCorrectedInfoPresenter) this.presenterManager.f(cls)) == null) {
            return;
        }
        baseUserCorrectedInfoPresenter.forceShowPresenter();
    }

    private ValueAnimator getBottomActionBarAnimation(final int i, int i2) {
        this.showSmallIcon = i2 < i;
        return CallappAnimationUtils.f(i, i2, CallappAnimationUtils.a, new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public final void onAnimationUpdate(ValueAnimator valueAnimator) {
                float animatedFraction = valueAnimator.getAnimatedFraction();
                float f = ContactDetailsActivity.BOTTOM_ACTION_BAR_HEIGHT_FULLY_OPEN - ContactDetailsActivity.BOTTOM_ACTION_BAR_HEIGHT_FULLY_CLOSED;
                int i3 = i;
                float f2 = (i3 - r1) / f;
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                if (contactDetailsActivity.showSmallIcon) {
                    contactDetailsActivity.callIconScale = f2 - (animatedFraction * f2);
                    contactDetailsActivity.centerBottomActionSmallIcon.setColorFilter(contactDetailsActivity.presenterContainer.getColor(2131100067));
                } else {
                    contactDetailsActivity.callIconScale = (((r0 - i3) / f) * animatedFraction) + f2;
                }
                if (Prefs.o.get().booleanValue()) {
                    if (!contactDetailsActivity.callFab.isActionsHidden()) {
                        contactDetailsActivity.callFab.d();
                    } else {
                        contactDetailsActivity.callFab.setScaleX(contactDetailsActivity.callIconScale);
                        contactDetailsActivity.callFab.setScaleY(contactDetailsActivity.callIconScale);
                    }
                }
            }
        });
    }

    private int getCDAnalyticsAdPosition() {
        if (getRecyclerViewAdapter() != null) {
            for (int i = 0; i < getRecyclerViewAdapter().getItemCount(); i++) {
                if (getRecyclerViewAdapter().getItem(i) instanceof CDAnalyticsAdCard) {
                    return i;
                }
            }
        }
        return 0;
    }

    private CallData getCallData(Phone phone, String str) {
        if (!this.forcePreCallState && phone != null) {
            return StringUtils.x(str) ? PhoneStateManager.get().getCallForPhoneByTelecomId(str) : PhoneStateManager.get().getCallForPhone(phone);
        }
        if (phone == null) {
            phone = Phone.v;
        }
        return new CallData(phone, CallState.PRE_CALL, null);
    }

    public CardArrayRecyclerViewAdapterWithPriority getRecyclerViewAdapter() {
        if (getRecyclerView() != null) {
            return getRecyclerView().getAdapter();
        }
        return null;
    }

    private void handleKeepScreenOnIfNeeded(CallState callState) {
        if (AdUtils.c() || !CallAppRemoteConfigManager.get().b("KeepScreenOnDuringCall")) {
            return;
        }
        if (callState == CallState.POST_CALL) {
            if (this.isKeepScreenOnSet.getAndSet(false)) {
                runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        ContactDetailsActivity.this.getWindow().clearFlags(128);
                    }
                });
                CLog.a();
            }
            CallAppApplication.get().removePostedRunnable(this.keepScreenRunnable);
            return;
        }
        if ((callState == CallState.RINGING_INCOMING || callState == CallState.RINGING_OUTGOING || callState == CallState.TALKING) && !this.isKeepScreenOnSet.getAndSet(true)) {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    ContactDetailsActivity.this.getWindow().addFlags(128);
                }
            });
            long c = CallAppRemoteConfigManager.get().c("KeepScreenOnDuringCallDurationInSec");
            CLog.a();
            if (c > 0) {
                CallAppApplication.get().postRunnableDelayed(this.keepScreenRunnable, c * 1000);
            }
        }
    }

    private void handleRemoveIncognitoMode() {
        if (ThemeUtils.isThemeLight() != ((ThemeState) Prefs.w3.get()).isLightTheme()) {
            CallAppApplication.get().runOnMainThread(new Runnable() {
                @Override
                public final void run() {
                    ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                    ThemeUtils.i(contactDetailsActivity.contactDetailsParallaxThemeState, false);
                    contactDetailsActivity.updateIncognitoThemeColors(contactDetailsActivity.detailsActivityMode);
                    contactDetailsActivity.presenterContainer.getEventBus().b(ThemeChangedListener.f618w8, null, false);
                }
            });
        }
    }

    private boolean isCallSmallIcon() {
        return ((double) this.callIconScale) <= 0.5d;
    }

    public boolean isIncomingCall() {
        return this.detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.INCOMING_CALL;
    }

    private boolean isScreenLocked() {
        CardArrayRecyclerViewAdapterWithPriority recyclerViewAdapter = getRecyclerViewAdapter();
        return recyclerViewAdapter != null && recyclerViewAdapter.getIsScreenLocked();
    }

    private boolean isUnknownNumber() {
        return this.presenterContainer.getContact() != null && this.presenterContainer.getContact().isUnknownNumber();
    }

    public boolean isWebSearchIntent(Intent intent) {
        return StringUtils.k(intent.getAction(), Constants.EXTRA_WEB_SEARCH);
    }

    public static boolean k0(ContactDetailsActivity contactDetailsActivity) {
        return true;
    }

    public void lambda$animateBottomActionBar$8(boolean z, boolean z2) {
        int i;
        int i2;
        ValueAnimator valueAnimator = this.bottomActionBarClosingAnimation;
        if (valueAnimator != null) {
            valueAnimator.cancel();
        }
        if (z) {
            i = BOTTOM_ACTION_BAR_HEIGHT_FULLY_OPEN;
            i2 = BOTTOM_ACTION_BAR_HEIGHT_FULLY_CLOSED;
        } else {
            i = BOTTOM_ACTION_BAR_HEIGHT_FULLY_CLOSED;
            i2 = BOTTOM_ACTION_BAR_HEIGHT_FULLY_OPEN;
        }
        ValueAnimator bottomActionBarAnimation = getBottomActionBarAnimation(i2, i);
        this.bottomActionBarClosingAnimation = bottomActionBarAnimation;
        if (!z2) {
            bottomActionBarAnimation.setDuration(0L);
        }
        this.bottomActionBarClosingAnimation.start();
    }

    public static void lambda$createIntent$7(String str, ExtractedInfo extractedInfo, long j) {
        ContactLoaderManager.get().registerForContactDetailsStack(new Phone(str), extractedInfo, j, null, ContactFieldEnumSets.ALL);
    }

    public void lambda$new$0(ActivityResult activityResult) {
        if (!SpamAppPermissionsUtils.b(activityResult.getResultCode(), "contactScreen")) {
            showDrawOverOtherAppsPermissionDialog();
        } else {
            if (isFinishing()) {
                return;
            }
            finish();
        }
    }

    public void lambda$new$1() {
        handleKeepScreenOnIfNeeded(CallState.POST_CALL);
    }

    public void lambda$onCallStateChanged$10() {
        setBottomBarFunctionality(false);
    }

    public void lambda$onCallStateChanged$11(CallData callData, boolean z) {
        setBottomBarFunctionality(callData.getState().isPreCall() && !isUnknownNumber());
        if (callData.getState().isPostCall()) {
            if (!z && !Prefs.t1.get().booleanValue() && PostCallActivity.needToShowPostCall(this.presenterContainer.getContact(), callData) == PostCallActivity.PostCallShowStatus.SHOW) {
                finish();
            } else {
                if (isUnknownNumber()) {
                    return;
                }
                CallAppApplication.get().postRunnableDelayed(this.fadeInCallActionBtnRunnable, 2000L);
            }
        }
    }

    public void lambda$onCallStateChanged$12(CallData callData, int i, int i2) {
        if (callData.getState().isTalking() || callData.getState().isOutgoing() || callData.getState().isOnHold()) {
            it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView recyclerView = getRecyclerView();
            int paddingLeft = recyclerView.getPaddingLeft();
            int paddingTop = recyclerView.getPaddingTop();
            int paddingRight = recyclerView.getPaddingRight();
            if (i == Integer.MIN_VALUE) {
                i = recyclerView.getPaddingBottom();
            }
            recyclerView.setPadding(paddingLeft, paddingTop, paddingRight, i);
            return;
        }
        it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView recyclerView2 = getRecyclerView();
        int paddingLeft2 = recyclerView2.getPaddingLeft();
        int paddingTop2 = recyclerView2.getPaddingTop();
        int paddingRight2 = recyclerView2.getPaddingRight();
        if (i2 == Integer.MIN_VALUE) {
            i2 = recyclerView2.getPaddingBottom();
        }
        recyclerView2.setPadding(paddingLeft2, paddingTop2, paddingRight2, i2);
    }

    public void lambda$onCallStateChanged$13() {
        setStatusBarColor(this.presenterContainer.getColor(R.color.background));
        this.contactDetailsRootView.setBackgroundColor(this.presenterContainer.getColor(R.color.background));
        BaseActivity.setStatusBarTextColor(getWindow(), ThemeUtils.isThemeLight());
    }

    public void lambda$onContactChanged$14(ContactData contactData) {
        if (StringUtils.x(contactData.getCover())) {
            setHasPersonalCover(true);
            GlideUtils.GlideRequestBuilder glideRequestBuilder = new GlideUtils.GlideRequestBuilder(this.coverImageView, contactData.getCover(), (Context) this);
            glideRequestBuilder.y = true;
            glideRequestBuilder.a();
        } else {
            setHasPersonalCover(false);
            if (!this.hasPersonalStoreItemTypeCover) {
                com.bumptech.glide.n d = GlideUtils.d(this);
                ImageView imageView = this.coverImageView;
                d.getClass();
                d.j(new n.b(imageView));
            }
            this.assetManager.getAssets();
        }
        setParallaxAndStatusBarColors(this.detailsActivityMode, false);
    }

    public void lambda$onContactChanged$15(ContactData contactData) {
        if (!contactData.isSpammer()) {
            updateRecentSearchesName(contactData);
        }
        Prefs.I7.set(Boolean.FALSE);
    }

    public void lambda$onThemeChanged$17() {
        KeypadFragment keypadFragment;
        this.contactDetailsParallaxThemeState = (ThemeState) Prefs.w3.get();
        setDetailsActivityMode(true);
        this.presenterContainer.getEventBus().b(ThemeChangedListener.f618w8, null, false);
        if (!this.keypadShown || (keypadFragment = (KeypadFragment) getSupportFragmentManager().G("KEYPAD_FRAGMENT_TAG")) == null) {
            return;
        }
        keypadFragment.A();
    }

    public void lambda$onTopBarIconClicked$16(boolean z) {
        UserCorrectedInfoPresenter userCorrectedInfoPresenter;
        if (!z || (userCorrectedInfoPresenter = (UserCorrectedInfoPresenter) this.presenterManager.f(UserCorrectedInfoPresenter.class)) == null) {
            return;
        }
        userCorrectedInfoPresenter.collapseCorrectedInfoViewForHelpUsIdentifyNumber();
    }

    public void lambda$requestBluetoothPermission$5() {
        this.audioRouteSelectorDialogFragment = AudioRouteSelectorDialogFragment.A(getSupportFragmentManager(), false);
    }

    public void lambda$requestBluetoothPermission$6() {
        this.audioRouteSelectorDialogFragment = AudioRouteSelectorDialogFragment.A(getSupportFragmentManager(), true);
    }

    public void lambda$setDetailsActivityMode$2(boolean z) {
        androidx.fragment.app.a aVar;
        getParallax().setDetailsActivityMode(this.detailsActivityMode);
        setComponentsVisibility();
        setParallaxAndStatusBarColors(this.detailsActivityMode, z);
        if (this.detailsActivityMode != BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST) {
            removeFragment(this.recorderTestFragmentTag);
        }
        int color = this.presenterContainer.getColor(R.color.background);
        ContactData contactData = this.contact;
        if (contactData != null && contactData.isVerifiedBusiness()) {
            int i = ThemeUtils.isThemeLight() ? R.color.verified_business_gradient_start : R.color.verified_business_gradient_start_dark;
            this.contactDetailsRootView.setBackgroundColor(ThemeUtils.getColor(i));
            getRecyclerViewContainer().setBackgroundColor(ThemeUtils.getColor(R.color.background));
            ViewUtils.t(this.contactDetailsRootView.findViewById(R.id.coverFrameLayout), new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ThemeUtils.getColor(i), ThemeUtils.getColor(R.color.background)}));
            ViewUtils.t(this.contactDetailsRootView.findViewById(R.id.coverBackground), null);
            ViewUtils.b(Boolean.TRUE, (TextView) this.contactDetailsRootView.findViewById(R.id.nameText));
            return;
        }
        int i2 = AnonymousClass54.d[this.detailsActivityMode.ordinal()];
        int i3 = 0;
        if (i2 == 1) {
            this.callBarPresenter.setHangButton(false);
            if (this.contact != null && Premium.Premium()) {
                this.contactDetailsRootView.setBackgroundColor(ThemeUtils.getColor(R.color.incall_gradient_gold_end_color));
                getRecyclerViewContainer().setBackgroundColor(ThemeUtils.getColor(R.color.background));
                ViewUtils.t(this.contactDetailsRootView.findViewById(R.id.coverFrameLayout), new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ThemeUtils.getColor(R.color.incall_gradient_gold_end_color), ThemeUtils.getColor(R.color.incall_gradient_gold_center_color), ThemeUtils.getColor(R.color.background)}));
                ViewUtils.t(this.contactDetailsRootView.findViewById(R.id.coverBackground), null);
                return;
            }
            getRecyclerViewContainer().setBackgroundColor(color);
            if (isSpammer()) {
                return;
            }
            if (StringUtils.t(this.coverUrl) && !this.hasPersonalStoreItemTypeCover && !this.hasPersonalCover) {
                this.contactDetailsRootView.setBackgroundColor(ThemeUtils.getColor(R.color.background));
                return;
            } else {
                ViewUtils.t(this.coverBackground, new ColorDrawable(ThemeUtils.getColor(R.color.background)));
                this.contactDetailsRootView.setBackgroundColor(ThemeUtils.getColor(2131100075));
                return;
            }
        }
        if (i2 == 2) {
            this.callBarPresenter.setHangButton(false);
            if (this.contact != null && Premium.Premium()) {
                getRecyclerViewContainer().setBackgroundColor(ThemeUtils.getColor(R.color.background));
                this.contactDetailsRootView.setBackgroundColor(ThemeUtils.getColor(R.color.incall_gradient_gold_end_color));
                ViewUtils.t(this.contactDetailsRootView.findViewById(R.id.coverFrameLayout), new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, new int[]{ThemeUtils.getColor(R.color.incall_gradient_gold_end_color), ThemeUtils.getColor(R.color.incall_gradient_gold_center_color), ThemeUtils.getColor(R.color.background)}));
                return;
            } else {
                if (isSpammer()) {
                    int color2 = ThemeUtils.getColor(R.color.background);
                    getRecyclerViewContainer().setBackgroundColor(color2);
                    ViewUtils.t(findViewById(R.id.contactDetailsRootViewInner), new ColorDrawable(color2));
                    return;
                }
                if (!StringUtils.t(this.coverUrl) || this.hasPersonalStoreItemTypeCover || this.hasPersonalCover) {
                    this.contactDetailsRootView.setBackgroundColor(ThemeUtils.getColor(2131100075));
                    getRecyclerViewContainer().setBackgroundColor(ThemeUtils.getColor(R.color.background));
                } else {
                    getRecyclerViewContainer().setBackgroundColor(this.presenterContainer.getColor(2131101162));
                }
                ViewUtils.t(this.contactDetailsRootView, ColorUtils.a(this.presenterContainer.getColor(R.color.incall_gradient_end_color), this.presenterContainer.getColor(R.color.incall_gradient_center_color), this.presenterContainer.getColor(R.color.incall_gradient_start_color)));
                this.contactDetailsRootView.findViewById(R.id.coverFrameLayout).setBackground(null);
                return;
            }
        }
        if (i2 != 3) {
            return;
        }
        if (this.recorderTestContainer == null) {
            this.recorderTestContainer = ViewUtils.m(this.recorderTestContainerStub);
        }
        RecorderTestFragment recorderTestFragment = (RecorderTestFragment) getSupportFragmentManager().G(this.recorderTestFragmentTag);
        this.recorderTestFragment = recorderTestFragment;
        if (recorderTestFragment == null) {
            this.recorderTestFragment = new RecorderTestFragment();
        }
        if (!this.recorderTestFragment.isAdded()) {
            FragmentManager supportFragmentManager = getSupportFragmentManager();
            String simpleName = this.recorderTestFragment.getClass().getSimpleName();
            while (true) {
                if (i3 >= supportFragmentManager.J()) {
                    FragmentManager supportFragmentManager2 = getSupportFragmentManager();
                    androidx.fragment.app.a f = d0.f(supportFragmentManager2, supportFragmentManager2);
                    f.g(R.id.recorderTestContainer, this.recorderTestFragment, this.recorderTestFragmentTag, 1);
                    f.p();
                    break;
                }
                if (i3 == supportFragmentManager.d.size()) {
                    aVar = supportFragmentManager.h;
                    if (aVar == null) {
                        throw new IndexOutOfBoundsException();
                    }
                } else {
                    aVar = (e0) supportFragmentManager.d.get(i3);
                }
                if (simpleName.equals(((p0) aVar).i)) {
                    break;
                } else {
                    i3++;
                }
            }
        }
        getRecyclerViewContainer().setBackgroundColor(color);
    }

    public static void lambda$showDrawOverOtherAppsPermissionDialog$3(AnalyticsManager analyticsManager, boolean z) {
        if (z) {
            analyticsManager.p(Constants.PERMISSIONS, "Gave Permission", "");
        }
    }

    public static void lambda$showDrawOverOtherAppsPermissionDialog$4(AnalyticsManager analyticsManager, Activity activity) {
        analyticsManager.p(Constants.PERMISSIONS, "Draw On Screen", "Clicked yes from Contact Details");
        Activities.A(activity, new k(analyticsManager));
    }

    public void lambda$showPopupIfNeeded$9() {
        FrameLayout frameLayout = new FrameLayout(this);
        this.fullScreenBannerContainer = frameLayout;
        frameLayout.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
        this.contactDetailsRootView.addView(this.fullScreenBannerContainer);
        CallScreenThemeBannerViewController callScreenThemeBannerViewController = new CallScreenThemeBannerViewController(this, this.fullScreenBannerContainer);
        this.callScreenThemeBannerViewController = callScreenThemeBannerViewController;
        callScreenThemeBannerViewController.setListener(this);
        CallScreenThemeBannerViewController callScreenThemeBannerViewController2 = this.callScreenThemeBannerViewController;
        callScreenThemeBannerViewController2.i.animate().alpha(1.0f).setDuration(200L).start();
        callScreenThemeBannerViewController2.g.animate().scaleX(1.0f).scaleY(1.0f).setDuration(200L).start();
        View[] viewArr = {callScreenThemeBannerViewController2.a, callScreenThemeBannerViewController2.b, callScreenThemeBannerViewController2.c, callScreenThemeBannerViewController2.d, callScreenThemeBannerViewController2.f, callScreenThemeBannerViewController2.e};
        for (int i = 0; i < 6; i++) {
            viewArr[i].animate().setStartDelay(180L).setDuration(200L).alpha(1.0f).start();
        }
    }

    public void loadContact(Intent intent, long j, Phone phone, boolean z) {
        if (!Activities.q(this, null)) {
            CLog.a();
            return;
        }
        synchronized (this.contactFieldsLock) {
            Pair<ContactData, Set<ContactField>> loadNewContact = loadNewContact(phone, j);
            this.contact = (ContactData) loadNewContact.first;
            this.contactFields = (Set) loadNewContact.second;
        }
        updateStorePersonalCoverIfNeeded(j);
        String stringExtra = intent.getStringExtra(EXTRA_FULL_NAME);
        if (StringUtils.x(stringExtra)) {
            try {
                this.contact.assertIntentDataExists();
                this.contact.getIntentData().setFullName(stringExtra);
                this.contact.updateFullName();
            } catch (Exception unused) {
            }
        }
        if (z) {
            fireContactChange();
        }
        if (this.callFab == null || !Prefs.o.get().booleanValue()) {
            return;
        }
        CallFabWithActionsView callFabWithActionsView = this.callFab;
        CallFabUtils.Companion companion = CallFabUtils.a;
        ContactData contactData = this.contact;
        companion.getClass();
        callFabWithActionsView.g(this, CallFabUtils.Companion.a(contactData));
    }

    private void loadContactWhenCreated() {
        if (getIntent() == null || getIntent().getExtras() == null) {
            return;
        }
        final long j = getIntent().getExtras().getLong("contactId");
        final Phone e = PhoneManager.get().e(getIntent().getExtras().getString(Constants.EXTRA_PHONE_NUMBER));
        handler.post(new Runnable() {
            @Override
            public final void run() {
                ?? r0 = ContactDetailsActivity.this;
                r0.loadContact(r0.getIntent(), j, e, false);
                if (((ContactDetailsActivity) r0).presentersInitialized) {
                    final PhotoPresenter photoPresenter = (PhotoPresenter) r0.presenterManager.f(PhotoPresenter.class);
                    r0.presenterContainer.safeRunOnUIThread(new Runnable(this) {
                        @Override
                        public final void run() {
                            PhotoPresenter photoPresenter2 = photoPresenter;
                            if (photoPresenter2 != null) {
                                photoPresenter2.initPhotoWithContactData(PhoneStateManager.get().isIncomingCallRingingState());
                            }
                        }
                    });
                }
            }
        });
    }

    public boolean needToHandleEyeIcon() {
        return (1 == 0 || this.contactDetailsActionEye == null || this.detailsActivityMode != BaseContactDetailsActivity.DetailsActivityMode.IN_CALL) ? false : true;
    }

    public void notifyEventBusData() {
        Bundle bundleExtra;
        DataChangedInfo dataChangedInfo;
        Intent intent = getIntent();
        if (intent != null) {
            if (intent.hasExtra(EXTRA_PARCELABLE_BUNDLE) && (bundleExtra = intent.getBundleExtra(EXTRA_PARCELABLE_BUNDLE)) != null && (dataChangedInfo = (DataChangedInfo) bundleExtra.getParcelable(EXTRA_DATA_CHANGE_INFO)) != null) {
                EventBusManager.a.b(NotifyDataChangedListener.g8, dataChangedInfo, false);
            }
            EventBusManager.a.b(RefreshSearchListener.a, EventBusManager.CallAppDataType.REFRESH_SEARCH, false);
        }
    }

    public void pausePlayerCardIdNeeded() {
        final CallRecorderPlayerCard callRecorderPlayerCard = (CallRecorderPlayerCard) this.presenterManager.e(CallRecorderPlayerCard.class);
        if (callRecorderPlayerCard != null) {
            safeRunOnUIThread(new Runnable(this) {
                @Override
                public final void run() {
                    callRecorderPlayerCard.onPausePlayerCard();
                }
            });
        }
    }

    private boolean postCallDismiss(boolean z) {
        ContactData contactData = this.contact;
        if (contactData == null || !((contactData.hasPhone(this.callData.getNumber()) || this.contact.isUnknownNumber()) && this.callData.getState().isPostCall())) {
            AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "isUnknownNumber");
            return false;
        }
        if (Prefs.t1.get().booleanValue()) {
            AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "fullScreenModeForPostCallEnabled");
        } else {
            PostCallActivity.PostCallShowStatus needToShowPostCall = PostCallActivity.needToShowPostCall(this.presenterContainer.getContact(), this.callData);
            if (needToShowPostCall == PostCallActivity.PostCallShowStatus.SHOW) {
                finish();
                long deviceId = this.contact.getDeviceId();
                String fullName = this.contact.getFullName();
                boolean isSpammer = this.contact.isSpammer();
                boolean z2 = this.contact != null && Premium.Premium();
                PostCallActivity.startIfScreenIsNotLocked(deviceId, fullName, isSpammer, z2, this.callData, "FromCD" + z, null);
                return true;
            }
            AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "CDshowStatus-" + needToShowPostCall.name());
        }
        int i = ((PostCallDuration) Prefs.d2.get()).duration * 1000;
        if (i <= 0 || this.contact.isUnknownNumber()) {
            finish();
            return true;
        }
        BringToFrontLifecycleObserver bringToFrontLifecycleObserver = this.bringToFrontLifecycleObserver;
        if (bringToFrontLifecycleObserver != null && bringToFrontLifecycleObserver.a) {
            Intent intent = new Intent(getIntent());
            intent.putExtra(EXTRA_BRING_TO_FRONT_RETRY, true);
            intent.putExtra(EXTRA_BRING_TO_FRONT_RETRY_LEFT, 4);
            for (int i2 = 0; i2 < 4; i2++) {
                new BringToFrontTask(intent).schedule(i2 * 300);
            }
        }
        this.finishTask.d(i + this.extraDelayAfterShowingCorrectedInfo, true);
        return false;
    }

    private void removeAutoScrollRunnable() {
        CallAppApplication.get().removePostedRunnable(this.runAutoScrollIfNeeded);
        BaseContactDetailsParallaxImpl parallax = getParallax();
        if (parallax.f) {
            parallax.f = false;
        }
    }

    private void removeFragment(String... strArr) {
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        androidx.fragment.app.a f = d0.f(supportFragmentManager, supportFragmentManager);
        for (String str : strArr) {
            Fragment G = getSupportFragmentManager().G(str);
            if (G != null && G.isAdded()) {
                f.h(G);
            }
        }
        if (((p0) f).a.isEmpty()) {
            return;
        }
        f.n(true, true);
    }

    public void requestUpdateUI() {
        CallBarPresenter callBarPresenter = (CallBarPresenter) this.presenterManager.f(CallBarPresenter.class);
        this.callBarPresenter = callBarPresenter;
        if (callBarPresenter != null && !PhoneManager.get().isDefaultPhoneApp()) {
            this.callBarPresenter.B();
        }
        CallAppApplication.get().postRunnableDelayed(new Runnable(this) {
            @Override
            public final void run() {
                if (PhoneStateManager.get().isAnyCallActive()) {
                    PhoneStateManager.get().updateCallAppInCallNotification();
                }
            }
        }, 1000L);
    }

    private void resetKeypadNumbers() {
        keypadNumbers = "";
    }

    private void resetLayoutState() {
        CallAppApplication.get().runOnMainThread(new Runnable() {
            @Override
            public final void run() {
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                contactDetailsActivity.snapToPositionByOrientation();
                contactDetailsActivity.getRecyclerView().setToInitialState();
            }
        });
    }

    public void scrollToEndWhenLargeAdIsVisible() {
        if (getRecyclerViewAdapter() != null) {
            int itemCount = getRecyclerViewAdapter().getItemCount() - 2;
            if (getRecyclerView() == null || !getRecyclerView().isUserTouchedItOrItsChildrenOnce()) {
                return;
            }
            it.gmariotti.cardslib.library.recyclerview.view.CardRecyclerView recyclerView = getRecyclerView();
            View q = getRecyclerView().getLayoutManager().q(itemCount);
            Rect rect = new Rect();
            if (q == null || q.getVisibility() != 0 || recyclerView == null || recyclerView.getParent() == null || !q.getGlobalVisibleRect(rect)) {
                return;
            }
            long height = rect.height() * rect.width();
            long height2 = q.getHeight() * q.getWidth();
            if (height2 > 0 && height * 100 >= 1 * height2) {
                getRecyclerView().t0(getRecyclerViewAdapter().getItemCount() - 1);
                snapToPosition(BaseContactDetailsParallaxImpl.Position.CLOSED, true);
            }
        }
    }

    private void scrollToPosition(final int i, final BaseContactDetailsParallaxImpl.Position position) {
        CallAppApplication.get().runOnMainThread(new Runnable() {
            @Override
            public final void run() {
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                contactDetailsActivity.getRecyclerView().t0(i);
                contactDetailsActivity.snapToPosition(position, true);
            }
        });
    }

    private void sendFabActionEvent(String str, String str2) {
        AnalyticsManager.get().p(Constants.BOTTOM_ACTION_BAR, str, str2);
    }

    private void sendWhoViewedMyProfileIfNeeded() {
        final ENTRYPOINT entrypoint = this.whoViewedMyProfileEntrypoint;
        if (!this.genomeLoaded || !this.incognitoLoaded || this.contact.isIncognito() || this.presenterContainer.isIncognito(this.contact) || Prefs.O6.get().booleanValue() || entrypoint == null || !this.contact.isInstalledApp()) {
            return;
        }
        new Task() {
            @Override
            public final void doTask() {
                ReentrantLock reentrantLock;
                final String c = ContactDetailsActivity.this.contact.getPhone().c();
                ReentrantLock reentrantLock2 = WhoViewedMyProfileDataManager.c;
                WhoViewedMyProfileDataManager.a.getClass();
                Intrinsics.checkNotNullParameter(c, "viewedPhoneNumber");
                final ENTRYPOINT entrypoint2 = entrypoint;
                Intrinsics.checkNotNullParameter(entrypoint2, Constants.EXTRA_ENTRY_POINT);
                try {
                    reentrantLock2.lock();
                    io.objectbox.a aVar = WhoViewedMyProfileDataManager.d;
                    QueryBuilder i = aVar.i();
                    i.k(ProfileViewedData_.phoneNumber, c, QueryBuilder.b.CASE_INSENSITIVE);
                    i.e(QueryBuilder.a.AND);
                    io.objectbox.g gVar = ProfileViewedData_.type;
                    TYPE type = TYPE.MYVIEW;
                    i.j(gVar, type.getValue());
                    i.B(ProfileViewedData_.lastViewed, 1);
                    ProfileViewedData profileViewedData = (ProfileViewedData) i.b().j0();
                    final String userFullName = UserProfileManager.get().getUserFullName();
                    try {
                        if (profileViewedData == null) {
                            long currentTimeMillis = System.currentTimeMillis();
                            Intrinsics.c(userFullName);
                            reentrantLock = reentrantLock2;
                            aVar.g(new ProfileViewedData(0L, c, entrypoint2, currentTimeMillis, userFullName, 0, type, 33, null));
                            Intrinsics.checkNotNullParameter(c, "viewedPhoneNumber");
                            Intrinsics.checkNotNullParameter(userFullName, "viewerName");
                            Intrinsics.checkNotNullParameter(entrypoint2, Constants.EXTRA_ENTRY_POINT);
                            new Task() {
                                @Override
                                public final void doTask() {
                                    HttpUtils.m(new HttpRequestParams.HttpRequestParamsBuilder(HttpUtils.getCallappServerPrefix() + "pv?myp=" + UrlUtils.a(Prefs.a1.get()) + "&tk=" + ((Object) Prefs.e1.get())).a(), UploadSyncer.getJsonObjectMapper().writeValueAsString(new JSONProfileViewed(c, userFullName, String.valueOf(entrypoint2.ordinal()))));
                                }
                            }.execute();
                        } else {
                            reentrantLock = reentrantLock2;
                            if (DateUtils.h(new Date(profileViewedData.getLastViewed()), new Date()) >= 7) {
                                Intrinsics.c(userFullName);
                                Intrinsics.checkNotNullParameter(c, "viewedPhoneNumber");
                                Intrinsics.checkNotNullParameter(userFullName, "viewerName");
                                Intrinsics.checkNotNullParameter(entrypoint2, Constants.EXTRA_ENTRY_POINT);
                                new Task() {
                                    @Override
                                    public final void doTask() {
                                        HttpUtils.m(new HttpRequestParams.HttpRequestParamsBuilder(HttpUtils.getCallappServerPrefix() + "pv?myp=" + UrlUtils.a(Prefs.a1.get()) + "&tk=" + ((Object) Prefs.e1.get())).a(), UploadSyncer.getJsonObjectMapper().writeValueAsString(new JSONProfileViewed(c, userFullName, String.valueOf(entrypoint2.ordinal()))));
                                    }
                                }.execute();
                                profileViewedData.setLastViewed(System.currentTimeMillis());
                            }
                            profileViewedData.setCounter(profileViewedData.getCounter() + 1);
                            aVar.g(profileViewedData);
                        }
                        reentrantLock.unlock();
                    } catch (Throwable th) {
                        th = th;
                        reentrantLock2.unlock();
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        }.execute();
    }

    public void setBottomBarFunctionality(boolean z) {
        View view = this.callActionBtn;
        if (view == null || this.callBtn == null) {
            return;
        }
        view.setAlpha(z ? 1.0f : 0.15f);
        this.callBtn.setClickable(z);
        this.callBtn.setEnabled(z);
    }

    private void setComponentsVisibility() {
        safeRunOnUIThread(new Runnable() {
            @Override
            public final void run() {
                throw new UnsupportedOperationException("Method not decompiled: com.callapp.contacts.activity.contact.details.ContactDetailsActivity.AnonymousClass9.run():void");
            }
        });
    }

    private void setDetailsActivityMode(boolean z) {
        try {
            safeRunOnUIThread(new androidx.media3.exoplayer.audio.j(this, z, 4));
        } catch (Exception e) {
            CLog.m(this.TAG, e);
        }
    }

    public void setFavoriteButton() {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                BaseContactDetailsActivity.DetailsActivityMode detailsActivityMode;
                Boolean isFavorite;
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                if (contactDetailsActivity.favoritesBtn != null) {
                    ContactData contactData = contactDetailsActivity.contact;
                    if (contactData == null || !contactData.isContactInDevice() || contactDetailsActivity.presenterContainer.isIncognito(contactDetailsActivity.contact) || (detailsActivityMode = contactDetailsActivity.detailsActivityMode) == BaseContactDetailsActivity.DetailsActivityMode.IN_CALL) {
                        contactDetailsActivity.favoritesBtn.setVisibility(4);
                        return;
                    }
                    boolean z = false;
                    if (detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS) {
                        contactDetailsActivity.favoritesBtn.setVisibility(0);
                    }
                    DeviceData deviceData = contactDetailsActivity.contact.getDeviceData();
                    if (deviceData != null && (isFavorite = deviceData.isFavorite()) != null) {
                        z = isFavorite.booleanValue();
                    }
                    contactDetailsActivity.favoritesBtn.setChecked(z);
                }
            }
        });
    }

    private void setMode(BaseContactDetailsActivity.DetailsActivityMode detailsActivityMode) {
        if (this.detailsActivityMode != detailsActivityMode) {
            this.detailsActivityMode = detailsActivityMode;
            setDetailsActivityMode(false);
        }
    }

    public void setScreenLocked(boolean z) {
        CardArrayRecyclerViewAdapterWithPriority recyclerViewAdapter = getRecyclerViewAdapter();
        if (recyclerViewAdapter != null) {
            recyclerViewAdapter.setIsScreenLocked(z);
        }
    }

    private boolean shouldReplaceContact(long j, Phone phone) {
        ContactData contactData = this.contact;
        if (contactData == null) {
            return false;
        }
        if (j == 0) {
            if (phone.isNotEmpty() && !phone.equals(this.contact.getPhone()) && !this.contact.getPhones().contains(phone)) {
                this.isIdentified = false;
                return true;
            }
        } else if (j != contactData.getDeviceId()) {
            this.isIdentified = false;
            return true;
        }
        return false;
    }

    public static void showDialogToAllowNotificationAccessAfterMissedCall(Activity activity) {
        if (Activities.isNotificationListenerServiceSupportedOnDevice()) {
            IntegerPref integerPref = Prefs.k2;
            if (integerPref.get().intValue() <= 3) {
                integerPref.a(1);
            }
            if (integerPref.get().intValue() == 3) {
                Activities.C(activity, Activities.getString(R.string.liked_our_missed_call_notification_title), Activities.getString(R.string.liked_our_missed_call_notification_content));
                return;
            }
            FeedbackManager.get().a("missed notification click count:" + integerPref.get());
        }
    }

    private void showDrawOverOtherAppsPermissionDialog() {
        Prefs.u5.a(1);
        final AnalyticsManager analyticsManager = AnalyticsManager.get();
        analyticsManager.q(Constants.PERMISSIONS, "Draw On Screen", "Popup shown from Contact Details", r0.get().intValue(), new String[0]);
        PopupManager.get().c(this, new DrawOverAppsRequestDialog(this, new k(analyticsManager), "contactScreen") {
            @Override
            public final void onDialogDismissed(DialogInterface dialogInterface) {
                analyticsManager.p(Constants.PERMISSIONS, "Draw On Screen", "Clicked no from Contact Details");
            }
        }, true);
    }

    public void showLockedNotificationOnScreen() {
        if (this.snackBarContainer == null) {
            this.snackBarContainer = findViewById(R.id.snackbarContainer);
        }
        boolean z = this.keypadShown;
        View view = z ? this.snackBarContainerKeypad : this.snackBarContainer;
        if (view != null) {
            if (z) {
                view.setPadding(0, 0, 0, (WindowInsetsManager.get().getNavigationBarHeight() - Math.round(getResources().getDimension(2131166597))) * (-1));
            } else {
                view.setPadding(0, 0, 0, WindowInsetsManager.get().getNavigationBarHeight() * (-1));
            }
            final Snackbar g = Snackbar.g(view, Activities.getString(R.string.press_to_unlock));
            Snackbar.SnackbarLayout snackbarLayout = ((BaseTransientBottomBar) g).i;
            snackbarLayout.findViewById(2131365223).setVisibility(4);
            View inflate = getLayoutInflater().inflate(R.layout.custom_snack_bar, (ViewGroup) null);
            TextView textView = (TextView) inflate.findViewById(R.id.unlock_text);
            textView.setText(Activities.getString(R.string.press_to_unlock));
            textView.setTextColor(this.presenterContainer.getColor(2131101228));
            TextView textView2 = (TextView) inflate.findViewById(R.id.unlock_action);
            textView2.setText(Activities.getString(R.string.unlock));
            textView2.setTextColor(this.presenterContainer.getColor(R.color.colorPrimary));
            textView2.setOnClickListener(new DefaultInterfaceImplUtils$ClickListener() {
                @Override
                public final void a(View view2) {
                    ContactDetailsActivity.this.setScreenLocked(false);
                    g.b(3);
                }
            });
            snackbarLayout.addView(inflate, 0);
            g.h();
            CallAppApplication.get().postRunnableDelayed(new Runnable(this) {
                @Override
                public final void run() {
                    boolean c;
                    Snackbar snackbar = g;
                    snackbar.getClass();
                    ji.h b = ji.h.b();
                    BaseTransientBottomBar.e eVar = ((BaseTransientBottomBar) snackbar).t;
                    synchronized (b.a) {
                        c = b.c(eVar);
                    }
                    if (c) {
                        snackbar.b(3);
                    }
                }
            }, 4000L);
        }
    }

    private boolean showPermissionDialog() {
        boolean isToday = android.text.format.DateUtils.isToday(Prefs.o5.get().longValue());
        if (Build.VERSION.SDK_INT >= 30) {
            if (!Activities.c()) {
                if (isToday) {
                    SpamAppPermissionsUtils.c();
                    return false;
                }
                if (Activities.p("android.app.role.CALL_SCREENING")) {
                    showDrawOverOtherAppsPermissionDialog();
                    return true;
                }
                SpamAppPermissionsUtils.a(this.spamAppLauncher, this.spamAppLauncherCallback, true);
                return true;
            }
        } else if (!Activities.c()) {
            if (!isToday) {
                showDrawOverOtherAppsPermissionDialog();
                return true;
            }
            SpamAppPermissionsUtils.c();
        }
        return false;
    }

    private Pair<Boolean, String> showPopupIfNeeded() {
        boolean z;
        ContactData contactData;
        ContactData contactData2;
        FragmentManager supportFragmentManager = getSupportFragmentManager();
        boolean z2 = false;
        String str = "";
        if ((!Activities.q(this, null) || supportFragmentManager.J || supportFragmentManager.S()) ? false : true) {
            if (CallRecorderManager.get().o(this, this.contact, this.callData)) {
                str = "LowDeviceStorage";
                z = true;
            } else {
                z = false;
            }
            int i = Build.VERSION.SDK_INT;
            if (i >= 31) {
                BooleanPref booleanPref = Prefs.r6;
                if (!booleanPref.get().booleanValue() && !z) {
                    if (Prefs.j6.get().booleanValue()) {
                        DriveModePopUp.o.getClass();
                        z = DriveModePopUp.Companion.a();
                    } else {
                        DatePref datePref = Prefs.s0;
                        if (datePref.get() == null) {
                            datePref = Prefs.r0;
                        }
                        long h = DateUtils.h(datePref.get(), Calendar.getInstance().getTime());
                        if (Prefs.q6.get().booleanValue() && h >= 3) {
                            z = true;
                        }
                    }
                    if (z) {
                        DriveModePopUp.o.getClass();
                        DriveModePopUp.Companion.b(this, false, null);
                        booleanPref.set(Boolean.TRUE);
                    }
                }
            }
            if (!z && !Prefs.S2.get().booleanValue() && (contactData2 = this.contact) != null && contactData2.isRecognized()) {
                BooleanPref booleanPref2 = Prefs.N5;
                if (booleanPref2.get().booleanValue()) {
                    booleanPref2.set(Boolean.FALSE);
                    PopupManager.get().c(this, new CallAppFirstTimeCallDialog(this, this.contact.getPhone().getRawNumber(), this.contact.getFullName(), this.contact.getPhotoUrl()), true);
                    AnalyticsManager.get().o("IDPlus", "View/CreateFirstTimeExperiencePopup");
                    str = "CallAppFirstTimeCallDialog";
                    z = true;
                }
            }
            if (!z && !Activities.isStoreNameGooglePlay() && Prefs.T4.get().booleanValue() && ((Prefs.E4.get().booleanValue() || Prefs.F4.get().booleanValue()) && !Activities.isCallAppAccessibilityServiceEnabled() && i > 28 && !Prefs.V4.get().booleanValue())) {
                IntegerPref integerPref = Prefs.U4;
                if (integerPref.get().intValue() % 3 == 0) {
                    str = "accessibilityPopupCallCounter";
                    z = true;
                }
                integerPref.a(1);
                if (z) {
                    PopupManager.get().c(this, new ReenableAccessibilitServiceDialog(), true);
                }
            }
            if (!z && !Prefs.S2.get().booleanValue() && StringUtils.t(Prefs.B3.get())) {
                BooleanPref booleanPref3 = Prefs.J3;
                if (booleanPref3.get().booleanValue() && ((PhoneManager.get().isDefaultPhoneApp() && Prefs.I3.get().intValue() >= 10) || (!PhoneManager.get().isDefaultPhoneApp() && DateUtils.d(Prefs.H3.get(), new Date(), TimeUnit.DAYS) >= 4))) {
                    booleanPref3.set(Boolean.FALSE);
                    CallAppApplication.get().runOnMainThread(new j(this, 7));
                    str = "CallScreenThemeFullScreenBanner";
                    z = true;
                }
            }
            if (!z && PhoneManager.get().isDefaultPhoneApp() && !Activities.c()) {
                z = showPermissionDialog();
                str = "showOverlayPermissionDialog";
            }
            if (z || !this.callData.isCallAnswered().booleanValue() || (contactData = this.contact) == null || !AppRater.b(this, contactData, false, false)) {
                z2 = z;
            } else {
                str = "appRater";
                z2 = true;
            }
        }
        return new Pair<>(Boolean.valueOf(z2), str);
    }

    public void snapToPosition(BaseContactDetailsParallaxImpl.Position position, boolean z) {
        if (RecorderTestManager.get().getIsInRecorderTestMode()) {
            return;
        }
        getParallax().d(position, z);
    }

    public static boolean startFullDetailsActivity(Context context, Intent intent, ExtractedInfo extractedInfo, boolean z, boolean z2, String str, boolean z3) {
        Intent createIntent = createIntent(context, 0L, extractedInfo != null ? extractedInfo.phoneAsRaw : null, extractedInfo, false, null, str, null);
        copyIntentCallData(intent, createIntent);
        createIntent.addFlags(262144);
        createIntent.putExtra("shouldSuppressAnimation", true);
        if (!z2) {
            if (z3) {
                createIntent.setFlags(268468224);
            }
            CallAppChatHeadLifecycleObserverManager.get().b.d = true;
            Activities.E(context, createIntent);
        } else if (!Activities.J(context, createIntent)) {
            return false;
        }
        if (z) {
            createIntent.putExtra(EXTRA_BRING_TO_FRONT_RETRY, true);
            createIntent.putExtra(EXTRA_BRING_TO_FRONT_RETRY_LEFT, 1);
            new BringToFrontTask(createIntent).schedule(200);
        }
        return true;
    }

    private void startInstantMessaging(BaseImSenderHelper.SenderType senderType) {
        ImSender imSenderHelper;
        if (senderType == null || (imSenderHelper = BaseImSenderHelper.getImSenderHelper(senderType)) == null) {
            return;
        }
        imSenderHelper.openIm(this, this.contact);
    }

    private void startInviteDialog() {
        ShareCallAppDialogFragment.i.getClass();
        ShareCallAppDialogFragment.Companion.a(1, null, "float").show(this.presenterContainer.getFragmentManager(), ShareCallAppDialogFragment.getTAG());
    }

    private void startNewNote() {
        ContactData contactData = this.contact;
        if (contactData != null) {
            AddNoteActivity.startNoteActivity(contactData.getId(), this);
        }
    }

    private void startPersonalCallScreen() {
        Intent createIntent = BasePreviewActivity.createIntent(this, PersonalStoreItemHelper.a(PersonalStoreItemUrlData.PersonalStoreItemType.VIDEO_RINGTONE), "ContactDetailsActivity", PersonalCallScreenThemePreviewActivity.class);
        createIntent.putExtra(CallAppCropActivity.EXTRA_CONTACT_ID, this.contact.getId());
        startActivity(createIntent);
    }

    public void tryToShowRippleOnProfileView() {
        IntegerPref integerPref = Prefs.C4;
        integerPref.a(1);
        int intValue = integerPref.get().intValue();
        if (intValue >= 4 && intValue % 4 == 0) {
            IntegerPref integerPref2 = Prefs.D4;
            if (integerPref2.get().intValue() < 4) {
                integerPref2.a(1);
                CallAppApplication.get().runOnMainThread(new AnonymousClass52());
            }
        }
    }

    private void updateCallFabOnActionComplete(ContactAction contactAction) {
        List<ContactAction> actions = this.callFab.getActions();
        int indexOf = actions.indexOf(contactAction);
        if (indexOf == -1) {
            return;
        }
        switch (AnonymousClass54.c[contactAction.ordinal()]) {
            case 11:
                actions.set(indexOf, ContactAction.UN_BLOCK);
                this.callFab.g(this, actions);
                break;
            case 12:
                actions.set(indexOf, ContactAction.BLOCK);
                this.callFab.g(this, actions);
                break;
            case 13:
                actions.set(indexOf, ContactAction.UN_SPAM);
                this.callFab.g(this, actions);
                break;
            case 14:
                actions.set(indexOf, ContactAction.SPAM);
                this.callFab.g(this, actions);
                break;
            case 17:
                actions.set(indexOf, ContactAction.UN_INCOGNITO);
                this.callFab.g(this, actions);
                break;
            case 18:
                actions.set(indexOf, ContactAction.INCOGNITO);
                this.callFab.g(this, actions);
                break;
        }
    }

    private void updateCallFabOnContactChanged(ContactData contactData) {
        CallFabWithActionsView callFabWithActionsView;
        if (Prefs.o.get().booleanValue() && (callFabWithActionsView = this.callFab) != null && callFabWithActionsView.isValid()) {
            updateCallFabOnActionComplete(contactData.isSpammer() ? ContactAction.SPAM : ContactAction.UN_SPAM);
            updateCallFabOnActionComplete(BlockManager.g(contactData.getPhone()) ? ContactAction.BLOCK : ContactAction.UN_BLOCK);
            updateCallFabOnActionComplete(contactData.isIncognito() ? ContactAction.INCOGNITO : ContactAction.UN_INCOGNITO);
        }
    }

    private void updateContactData(Intent intent, long j, Phone phone, boolean z) {
        if (!z) {
            fireContactChange();
            return;
        }
        releaseContact();
        loadContact(intent, j, phone, true);
        setParallaxAndStatusBarColors(this.detailsActivityMode, false);
    }

    public void updateIncognitoThemeColors(BaseContactDetailsActivity.DetailsActivityMode detailsActivityMode) {
        if (getRecyclerViewContainer() != null) {
            getRecyclerViewContainer().setBackgroundColor(this.presenterContainer.getColor(R.color.background));
        }
        ViewGroup viewGroup = this.contactDetailsRootView;
        if (viewGroup != null) {
            ViewUtils.t(viewGroup, ColorUtils.a(this.presenterContainer.getColor(R.color.incall_gradient_end_color), this.presenterContainer.getColor(R.color.incall_gradient_center_color), this.presenterContainer.getColor(R.color.incall_gradient_start_color)));
        }
        setParallaxAndStatusBarColors(detailsActivityMode, true);
    }

    public void updateModelAndFireEvents(Intent intent, long j, Phone phone, String str, boolean z) {
        updateContactData(intent, j, phone, z);
        CallData callData = getCallData(phone, str);
        if (callData != null) {
            onCallStateChanged(callData);
            if (callData.getState() == CallState.PRE_CALL && this.detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS) {
                MissedCallManager.d(this.contact.getPhone(), CallReminderFrequentData.FrequentType.DELETE, 3, 0L);
            }
        }
    }

    public void updateRemainingTimeToAutoScroll() {
        long c = CallAppRemoteConfigManager.get().c("cdSecondsToWaitBeforeNextAutoScroll");
        if (c > 0) {
            long j = this.remainingTimesToAutoScroll;
            if (j > 0) {
                this.remainingTimesToAutoScroll = j - 1;
                removeAutoScrollRunnable();
                CallAppApplication.get().postRunnableDelayed(this.runAutoScrollIfNeeded, c * 1000);
            }
        }
    }

    private void updateScreenLockState(final boolean z) {
        CallAppApplication.get().runOnMainThread(new Runnable() {
            @Override
            public final void run() {
                ContactDetailsActivity.this.setScreenLocked(z);
            }
        });
    }

    private void updateStorePersonalCoverIfNeeded(long j) {
        PersonalStoreItemDataManager.Companion companion = PersonalStoreItemDataManager.a;
        String l = Long.toString(j);
        PersonalStoreItemUrlData.PersonalStoreItemType personalStoreItemType = PersonalStoreItemUrlData.PersonalStoreItemType.COVER;
        companion.getClass();
        final String d = PersonalStoreItemDataManager.Companion.d(l, personalStoreItemType);
        CallAppApplication.get().runOnMainThread(new Runnable() {
            @Override
            public final void run() {
                ?? r0 = ContactDetailsActivity.this;
                if (!r0.hasPersonalCover) {
                    if (StringUtils.x(Prefs.S3.get())) {
                        String str = d;
                        if (StringUtils.x(str)) {
                            r0.setHasPersonalStoreItemTypeCover(true);
                            GlideUtils.GlideRequestBuilder glideRequestBuilder = new GlideUtils.GlideRequestBuilder(r0.coverImageView, str, (Context) r0);
                            glideRequestBuilder.y = true;
                            glideRequestBuilder.B = true;
                            glideRequestBuilder.a();
                        }
                    }
                    r0.setHasPersonalStoreItemTypeCover(false);
                    try {
                        com.bumptech.glide.n d2 = GlideUtils.d(r0);
                        ImageView imageView = r0.coverImageView;
                        d2.getClass();
                        d2.j(new n.b(imageView));
                    } catch (Exception e) {
                        CLog.m(((ContactDetailsActivity) r0).TAG, e);
                    }
                    r0.assetManager.getAssets();
                }
                r0.setParallaxAndStatusBarColors(r0.detailsActivityMode, false);
            }
        });
    }

    public void updateWindow(final Window window, final boolean z, final int i, final boolean z2, final int i2) {
        CallAppApplication.get().runOnMainThread(new Runnable() {
            @Override
            public final void run() {
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                Window window2 = window;
                contactDetailsActivity.updateFullScreenWindow(window2);
                contactDetailsActivity.setStatusBarColor(i);
                BaseActivity.setStatusBarTextColor(window2, z2);
                BaseActivity.updateNavigationBarColorToThemeColor(window2, z, i2);
            }
        });
    }

    @Override
    public boolean allowLifecycleChangesDuringCalls() {
        return false;
    }

    @Override
    public void animateBottomActionBar(boolean z, boolean z2) {
        if (this.lastBottomBarDirectionWasExpand == z || RecorderTestManager.get().getIsInRecorderTestMode()) {
            return;
        }
        this.lastBottomBarDirectionWasExpand = z;
        View view = this.bottomActionBar;
        if (view == null || view.getVisibility() != 0) {
            return;
        }
        this.presenterContainer.safeRunOnUIThread(new m(this, z, z2, 0));
    }

    @Override
    public void animateBottomBar(boolean z, boolean z2) {
        animateBottomActionBar(z, z2);
    }

    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        if (keyEvent.getKeyCode() != 0) {
            this.finishTask.b();
        }
        return super.dispatchKeyEvent(keyEvent);
    }

    public boolean dispatchKeyShortcutEvent(KeyEvent keyEvent) {
        this.finishTask.b();
        return super/*androidx.core.app.ComponentActivity*/.dispatchKeyShortcutEvent(keyEvent);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        KeypadFragment keypadFragment;
        KeypadView keypadView;
        TwelveKeyDialer twelveKeyDialer;
        boolean dispatchTouchEvent = super.dispatchTouchEvent(motionEvent);
        int i = 0;
        if (motionEvent.getAction() == 0) {
            this.finishTask.b();
            RecyclerView recyclerView = getRecyclerView();
            if (recyclerView != null) {
                if (recyclerView.R0 != null) {
                    recyclerView.x0();
                    recyclerView.removeCallbacks(recyclerView.R0);
                    recyclerView.removeCallbacks(recyclerView.S0);
                    recyclerView.P0 = false;
                    recyclerView.R0 = null;
                }
                recyclerView.T0 = null;
                this.remainingTimesToAutoScroll = CallAppRemoteConfigManager.get().c("cdTimesToAutoScroll");
                long c = CallAppRemoteConfigManager.get().c("cdSecondsToWaitBeforeNextAutoScroll");
                if (c > 0 && !this.callState.isPreCall() && !this.callState.isPostCall()) {
                    recyclerView.Q0 = false;
                    removeAutoScrollRunnable();
                    CallAppApplication.get().postRunnableDelayed(this.runAutoScrollIfNeeded, c * 1000);
                }
            }
            EventBusManager.a.b(DriveModeTouchEventListener.V7, Boolean.TRUE, false);
            return dispatchTouchEvent;
        }
        if (motionEvent.getAction() == 1) {
            if (this.keypadShown && (keypadFragment = (KeypadFragment) getSupportFragmentManager().G("KEYPAD_FRAGMENT_TAG")) != null && (keypadView = keypadFragment.a) != null && (twelveKeyDialer = keypadView.a) != null) {
                twelveKeyDialer.i();
            }
            CallFabWithActionsView callFabWithActionsView = this.callFab;
            callFabWithActionsView.getClass();
            Intrinsics.checkNotNullParameter(motionEvent, "e");
            if (callFabWithActionsView.c == CallFabWithActionsView.State.Show) {
                Iterator it = callFabWithActionsView.b.iterator();
                while (it.hasNext()) {
                    Object next = it.next();
                    int i2 = i + 1;
                    if (i < 0) {
                        kotlin.collections.r.m();
                        throw null;
                    }
                    if (ViewUtils.n(motionEvent.getRawX(), motionEvent.getRawY(), (View) next)) {
                        ContactAction contactAction = (ContactAction) callFabWithActionsView.d.get(i);
                        callFabWithActionsView.k.removeCallbacks(callFabWithActionsView.f);
                        AndroidUtils.e(callFabWithActionsView, 1);
                        CallFabWithActionsView.OnCallFabActionListener onCallFabActionListener = callFabWithActionsView.a;
                        if (onCallFabActionListener != null) {
                            onCallFabActionListener.onCallFabActionClicked(contactAction);
                        }
                        callFabWithActionsView.e();
                        return dispatchTouchEvent;
                    }
                    i = i2;
                }
            }
        }
        return dispatchTouchEvent;
    }

    public boolean dispatchTrackballEvent(MotionEvent motionEvent) {
        this.finishTask.b();
        return super/*android.app.Activity*/.dispatchTrackballEvent(motionEvent);
    }

    public void finish() {
        isStartedFromACall.set(false);
        super/*android.app.Activity*/.finishAndRemoveTask();
    }

    @Override
    public void finishActivity(Boolean bool) {
        finish();
    }

    public View getBottomActionBar() {
        return this.bottomActionBar;
    }

    @Override
    @NotNull
    public CallBarPresenter getCallBarPresenter() {
        return this.callBarPresenter;
    }

    @Override
    public String getCurrentFilter() {
        return keypadNumbers;
    }

    @Override
    public int getLayoutResourceId() {
        return R.layout.activity_contact_details;
    }

    public BaseContactDetailsActivity.DetailsActivityMode getMode() {
        return this.detailsActivityMode;
    }

    @Override
    @NotNull
    public BaseContactDetailsParallaxImpl getParallax() {
        return super.getParallax();
    }

    @Override
    public BaseContactDetailsParallaxImpl getParallaxImpl(BaseContactDetailsActivity.FlingListener flingListener) {
        return new BaseContactDetailsParallaxImpl(this.presenterContainer, findViewById(R.id.contactDetailsRootView), getPositionChangedListener(), Prefs.R3.isNotNull(), getLifecycle(), this.detailsActivityMode);
    }

    @Override
    public BaseContactDetailsParallaxImpl.PositionChangedListener getPositionChangedListener() {
        return new AnonymousClass12();
    }

    @Override
    public PresentersContainer.MODE getPresenterContainerMode() {
        return PresentersContainer.MODE.CONTACT_DETAILS_SCREEN;
    }

    @Override
    public int getThemeResId() {
        Intent intent = getIntent();
        return (intent == null || !intent.getBooleanExtra("shouldSuppressAnimation", false)) ? super.getThemeResId() : ThemeUtils.getNoTitleThemeNoTransitions();
    }

    @Override
    public void handleIncognitoMode() {
        if (this.callState.isIdle()) {
            if (this.callState == CallState.POST_CALL) {
                this.isIncognitoCall = false;
                this.isOneTimeIncognitoCall = false;
                handleRemoveIncognitoMode();
                return;
            }
            return;
        }
        ContactData contactData = this.contact;
        boolean z = (contactData != null && contactData.isIncognito()) || this.isOneTimeIncognitoCall;
        this.isIncognitoCall = z;
        if (z) {
            CallAppApplication.get().runOnMainThread(new Runnable() {
                @Override
                public final void run() {
                    boolean isLightTheme = ((ThemeState) Prefs.w3.get()).isLightTheme();
                    ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                    if (isLightTheme && !contactDetailsActivity.isIncomingCall()) {
                        ThemeUtils.i(ThemeState.DARK, false);
                        contactDetailsActivity.updateIncognitoThemeColors(contactDetailsActivity.detailsActivityMode);
                    }
                    contactDetailsActivity.presenterContainer.getEventBus().b(ThemeChangedListener.f618w8, null, false);
                }
            });
        } else {
            handleRemoveIncognitoMode();
        }
    }

    @Override
    public boolean isClickValid(View view) {
        if (!PhoneStateManager.get().isAnyCallActive()) {
            return true;
        }
        switch (view.getId()) {
            case R.id.backButton:
            case R.id.contactDetails_action_add:
            case R.id.contactDetails_action_favorites:
            case R.id.contactDetails_action_more:
            case R.id.contactDetails_first_circle_button:
            case R.id.contactDetails_second_button_circle_img:
            case R.id.contactDetails_second_circle_button:
            case R.id.contact_details_top_strip:
            case R.id.coverFrameLayout:
            case R.id.editContactNameIcon:
            case R.id.header_bottom_strip:
            case R.id.map_view:
            case R.id.nameText:
            case R.id.profilePictureViewSwitcher:
            case R.id.profile_pic_action_icon_container:
                if (isScreenLocked()) {
                    showLockedNotificationOnScreen();
                    return false;
                }
            default:
                return true;
        }
    }

    @Override
    public boolean isSnapOnUpRulesOk() {
        BaseContactDetailsActivity.DetailsActivityMode detailsActivityMode = this.detailsActivityMode;
        return detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS || detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.IN_CALL;
    }

    public Pair<ContactData, Set<ContactField>> loadNewContact(Phone phone, long j) {
        this.presenterManager.i(this.presenterContainer);
        this.singleContactContentObserver.b(j);
        return ContactLoaderManager.get().registerForContactDetailsStack(phone, this.origin, j, this, ContactFieldEnumSets.ALL);
    }

    @Override
    public void onActivityResult(int i, int i2, final Intent intent) {
        ContactData contactData;
        super.onActivityResult(i, i2, intent);
        SocialNetworksSearchUtil.b(i, i2, intent);
        if (i == 100) {
            if (this.contact == null || intent == null) {
                return;
            }
            String stringExtra = intent.getStringExtra(AddNoteActivity.NOTE_EXTRA);
            this.contact.assertDeviceDataExist();
            DeviceData deviceData = this.contact.getDeviceData();
            String c = y.c(NoteLoader.g(deviceData.getNote()), "@@@", stringExtra);
            deviceData.setNote(c == null ? null : c.split("@@@"));
            this.contact.fireChange(ContactField.note);
            return;
        }
        if (i == 996) {
            if (i2 != -1 || intent == null) {
                return;
            }
            String string = intent.getExtras().getString(PersonSelectActivity.RESULT_INTENT_EXTRA_USER_ID);
            int i3 = intent.getExtras().getInt(PersonSelectActivity.INTENT_EXTRA_NET_ID);
            if ("DONTHAVE".equals(string)) {
                RemoteAccountHelper.getRemoteAccountHelper(i3).setDoesntHave(this.contact);
                return;
            } else {
                RemoteAccountHelper.getRemoteAccountHelper(i3).E(this.contact, string, true);
                return;
            }
        }
        if (i != 9625) {
            if (i == 64206 && (contactData = this.contact) != null) {
                contactData.fireChange(EnumSet.of(ContactField.facebookId, ContactField.facebookSearchResults));
                return;
            }
            return;
        }
        if (intent != null) {
            new Task() {
                @Override
                public final void doTask() {
                    ArrayList b = AndroidUtils.FieldsChangedHandler.b(DataSource.class, intent);
                    ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                    ContactData contactData2 = contactDetailsActivity.contact;
                    if (contactData2 != null) {
                        contactData2.assertDeviceDataExist();
                        contactDetailsActivity.contact.resetSocialNetworks(b);
                    }
                }
            }.execute();
        }
        if (this.contact == null || !CollectionUtils.b(AndroidUtils.FieldsChangedHandler.b(ContactField.class, intent), ContactField.photoUrl)) {
            return;
        }
        ChosenContactPhoto b = ChosenContactPhotoManager.b(this.contact.getDeviceId(), this.contact.getPhone());
        if (b == null || !b.getShouldHideSuggested() || b.hasRealChosenPhoto()) {
            this.contact.resetChosenPicture();
        } else {
            this.contact.resetChosenPicture(true);
        }
        this.contact.updatePhoto();
        EventBusManager.a.b(InvalidateDataListener.d8, EventBusManager.CallAppDataType.CONTACTS, false);
    }

    @Override
    public void onAdCardHidden(AdCard adCard) {
        if (adCard instanceof CDLargeAdCard) {
            this.isAdLoaded = false;
        } else if (adCard instanceof CDAnalyticsAdCard) {
            this.isAnalyticsAdLoaded = false;
        }
    }

    @Override
    public void onAdCardShowing(AdCard adCard) {
        if (!(adCard instanceof CDLargeAdCard)) {
            if (adCard instanceof CDAnalyticsAdCard) {
                this.isAnalyticsAdLoaded = true;
            }
        } else {
            runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                    if (contactDetailsActivity.getRecyclerViewAdapter() != null) {
                        contactDetailsActivity.getRecyclerViewAdapter().notifyDataSetChanged();
                    }
                }
            });
            this.isAdLoaded = true;
            if (this.callState.isPreCall()) {
                CallAppApplication.get().runOnMainThread(new Runnable() {
                    @Override
                    public final void run() {
                        ContactDetailsActivity.this.scrollToEndWhenLargeAdIsVisible();
                    }
                });
            } else {
                doAutoScrollIfNeeded();
            }
        }
    }

    @Override
    public void onAppliedConfiguration() {
        finish();
    }

    public void onAttachFragment(@NonNull Fragment fragment) {
        if (fragment.equals(this.audioRouteSelectorDialogFragment)) {
            this.audioRouteSelectorDialogFragment.setAudioRouteSelectorListener(this);
        }
    }

    @Override
    public void onAudioRouteSelected(int i) {
        TelecomAdapter.getInstance().setAudioRoute(i);
    }

    @Override
    public void onAudioRouteSelectorDismiss() {
    }

    public void onBackPressed() {
        ContactData contactData;
        if (this.detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST) {
            Activities.E(this, new Intent((Context) this, (Class<?>) ContactsListActivity.class));
            finish();
            return;
        }
        this.finishTask.b();
        CallScreenThemeBannerViewController callScreenThemeBannerViewController = this.callScreenThemeBannerViewController;
        if (callScreenThemeBannerViewController != null && callScreenThemeBannerViewController.isViewShown()) {
            this.callScreenThemeBannerViewController.e.callOnClick();
            return;
        }
        CallBarPresenter callBarPresenter = (CallBarPresenter) this.presenterManager.f(CallBarPresenter.class);
        this.callBarPresenter = callBarPresenter;
        if (callBarPresenter == null || !callBarPresenter.o()) {
            if (PhoneManager.h() || (contactData = this.contact) == null || !AppRater.b(this, contactData, true, false)) {
                TopSheetPresenter topSheetPresenter = this.topSheetPresenter;
                if (topSheetPresenter == null || !topSheetPresenter.isTopSheetOpened()) {
                    finish();
                } else {
                    this.topSheetPresenter.b();
                }
            }
        }
    }

    @Override
    public void onButtonBarIconClicked(View view) {
        ContactData contactData;
        CallFabWithActionsView callFabWithActionsView;
        if (!Activities.q(this, null) || view == null || (contactData = this.contact) == null) {
            return;
        }
        Collection<Phone> phones = contactData.getPhones();
        ArrayList arrayList = new ArrayList();
        Iterator<Phone> it = phones.iterator();
        while (it.hasNext()) {
            arrayList.add(T9Helper.f(it.next().getRawNumber()));
        }
        AndroidUtils.d(this);
        if (view.getId() != 2131362437) {
            return;
        }
        if (Prefs.o.get().booleanValue() && (callFabWithActionsView = this.callFab) != null) {
            callFabWithActionsView.d();
        }
        TopSheetPresenter topSheetPresenter = this.topSheetPresenter;
        if (topSheetPresenter != null) {
            topSheetPresenter.b();
        }
        AnalyticsManager.get().o(Constants.BOTTOM_ACTION_BAR, "Call button clicked");
        ContactUtils.c(this, this.contact.getPhone(), this.contact.getDeviceId(), arrayList, new DialogContactMultiNumber.DialogContactMultiNumberListener() {
            @Override
            public final void a(Phone phone, boolean z) {
                if (phone == null || !phone.isNotEmpty() || CallLogUtils.s(phone.getRawNumber())) {
                    return;
                }
                ?? r4 = ContactDetailsActivity.this;
                r4.callPhone(r4, phone, r4.presenterContainer.isIncognito(r4.contact));
            }
        });
    }

    @Override
    public void onButtonBarIconLongClicked(View view) {
        ContactData contactData;
        if (!Activities.q(this, null) || view == null || (contactData = this.contact) == null) {
            return;
        }
        Collection<Phone> phones = contactData.getPhones();
        ArrayList arrayList = new ArrayList();
        Iterator<Phone> it = phones.iterator();
        while (it.hasNext()) {
            arrayList.add(T9Helper.f(it.next().getRawNumber()));
        }
        if (view.getId() != 2131362437) {
            return;
        }
        if (!Prefs.o.get().booleanValue()) {
            TopSheetPresenter topSheetPresenter = this.topSheetPresenter;
            if (topSheetPresenter != null) {
                topSheetPresenter.b();
            }
            AnalyticsManager.get().o(Constants.BOTTOM_ACTION_BAR, "ClickLongCallButton");
            ContactUtils.c(this, this.contact.getPhone(), this.contact.getDeviceId(), arrayList, new AnonymousClass48());
            return;
        }
        if (isCallSmallIcon()) {
            return;
        }
        this.centerBottomActionSmallIcon.setVisibility(8);
        this.callFab.h();
        Prefs.n2.set(Boolean.TRUE);
        sendFabActionEvent("ClickLongCallButton");
    }

    @Override
    public void onCDAnalyticsExpand(boolean z) {
        if (getRecyclerViewAdapter() == null || !z) {
            return;
        }
        int i = 0;
        while (true) {
            if (i >= getRecyclerViewAdapter().getItemCount()) {
                break;
            }
            if (getRecyclerViewAdapter().getItem(i) instanceof AnalyticsCarouselCard) {
                scrollToPosition(i, BaseContactDetailsParallaxImpl.Position.CLOSED);
                break;
            }
            i++;
        }
        getRecyclerViewAdapter().notifyDataSetChanged();
    }

    @Override
    public void onCallDetailsChanged(int[] iArr) {
        Arrays.toString(iArr);
        CLog.a();
        this.eventBus.b(CallDetailsListener.B8, iArr, true);
        boolean[] a = ArrayUtils.a(iArr);
        setHoldContactData((Arrays.equals(a, Constants.CALL_ON_HOLD) || Arrays.equals(a, Constants.CALL_ADDED) || Arrays.equals(a, Constants.CALL_BEFORE_MERGE)) && !this.forcePreCallState);
    }

    @Override
    public void onCallFabActionClicked(@NotNull ContactAction contactAction) {
        switch (AnonymousClass54.c[contactAction.ordinal()]) {
            case 1:
                startInstantMessaging(contactAction.getType());
                sendFabActionEvent("ClickLongCallSMS");
                break;
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
                startInstantMessaging(contactAction.getType());
                sendFabActionEvent("ClickLongCall_IM", contactAction.name());
                break;
            case 10:
                new NoteAction().a(this, this.contact, null);
                sendFabActionEvent("ClickLongCallNote");
                break;
            case 11:
                new BlockCallAction().a(this, this.contact, null);
                sendFabActionEvent("ClickLongCallBlock");
                break;
            case 12:
                new UnBlockCallAction().a(this, this.contact, null);
                sendFabActionEvent("ClickLongCallUnBlock");
                break;
            case 13:
                new SpamAction().a(this, this.contact, null);
                sendFabActionEvent("ClickLongCallSpam");
                break;
            case 14:
                new UnSpamAction().a(this, this.contact, null);
                sendFabActionEvent("ClickLongCallUnSpam");
                break;
            case 15:
                new CreateContactsAction().a(this, this.contact, null);
                sendFabActionEvent("ClickLongCallAddToContacts");
                break;
            case 16:
                startPersonalCallScreen();
                sendFabActionEvent("ClickLongCallPromotedFeature", contactAction.name());
                break;
            case 17:
                new AddIncognitoContactAction().b(this, this.contact, null);
                sendFabActionEvent("ClickLongCallIncognito", contactAction.name());
                break;
            case 18:
                new RemoveIncognitoContactAction().b(this, this.contact, null);
                sendFabActionEvent("ClickLongCallUnIncognito", contactAction.name());
                break;
            case 19:
                startInviteDialog();
                sendFabActionEvent("ClickLongCallInvite", contactAction.name());
                break;
        }
    }

    @Override
    public void onCallFabActionsHidden() {
        this.centerBottomActionSmallIcon.setVisibility(0);
        if (Prefs.o.get().booleanValue()) {
            this.callFab.clearAnimation();
            this.callFab.animate().scaleX(this.callIconScale).scaleY(this.callIconScale).setDuration(250L).start();
        }
    }

    @Override
    public void onCallFabActionsShown(@NotNull List<? extends ContactAction> list) {
        StringBuilder sb2 = new StringBuilder();
        Iterator<? extends ContactAction> it = list.iterator();
        while (it.hasNext()) {
            sb2.append(it.next().name());
            sb2.append(", ");
        }
        sendFabActionEvent("LongCallOptions", sb2.toString());
    }

    @Override
    public void onCallStateChanged(CallData callData) {
        if (PhoneStateManager.get().hasAnyCallNorIncoming()) {
            CallAppApplication.get().runOnMainThread(new Runnable() {
                @Override
                public final void run() {
                    ContactDetailsActivity.this.setKeyguardDismissAndScreenWindowFlags();
                }
            });
        }
        Objects.toString(callData);
        CLog.a();
        boolean z = this.callState.isIdle() != callData.getState().isIdle();
        this.callState = callData.getState();
        this.callData = callData;
        handleIncognitoMode();
        handleKeepScreenOnIfNeeded(callData.getState());
        boolean isDefaultPhoneApp = PhoneManager.get().isDefaultPhoneApp();
        EventType eventType = CallStateListener.C8;
        if (!isDefaultPhoneApp) {
            int i = AnonymousClass54.b[callData.getState().ordinal()];
            if (i == 3 || i == 4 || i == 5) {
                setMode(BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
            }
        } else if (!PhoneStateManager.get().shouldConferenceScreenAppear()) {
            switch (AnonymousClass54.b[this.callState.ordinal()]) {
                case 1:
                    setMode(BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
                    break;
                case 2:
                    if (PhoneStateManager.get().getLastCall() != null) {
                        setMode(BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
                        onNewIntent(getIntent());
                        break;
                    }
                    break;
                case 3:
                    TopSheetPresenter topSheetPresenter = this.topSheetPresenter;
                    if (topSheetPresenter != null) {
                        topSheetPresenter.b();
                    }
                    MainThreadTimer mainThreadTimer = this.finishTask;
                    if (mainThreadTimer != null) {
                        mainThreadTimer.b();
                    }
                    if (this.detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST && !RecorderTestManager.get().getIsInRecorderTestMode()) {
                        setMode(BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS);
                        break;
                    } else {
                        setMode(BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
                        break;
                    }
                    break;
                case 4:
                    BaseContactDetailsActivity.FlingListener flingListener = this.flingListener;
                    if (flingListener != null) {
                        flingListener.b = false;
                        flingListener.a = false;
                    }
                    TopSheetPresenter topSheetPresenter2 = this.topSheetPresenter;
                    if (topSheetPresenter2 != null) {
                        topSheetPresenter2.b();
                    }
                    cleanAllDataIfContactChanged(0L, callData.getNumber());
                    setHoldContactData(false);
                    if (!PhoneStateManager.get().getIsIncomingCallOpenedOverlay() && isActivityVisible()) {
                        setMode(BaseContactDetailsActivity.DetailsActivityMode.INCOMING_CALL);
                        break;
                    }
                    break;
                case 5:
                    if (!this.forcePreCallState) {
                        if (!RecorderTestManager.get().getIsInRecorderTestMode()) {
                            setMode(BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
                            break;
                        } else {
                            AnalyticsManager.get().o(Constants.CALL_RECORDER, "PerformRecTestCall");
                            setMode(BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST);
                            break;
                        }
                    } else {
                        return;
                    }
                case 6:
                    this.eventBus.b(eventType, callData, true);
                    return;
                case 7:
                    animateBottomActionBar(true, false);
                    resetKeypadNumbers();
                    break;
            }
        } else {
            return;
        }
        int[] iArr = AnonymousClass54.b;
        int i2 = iArr[callData.getState().ordinal()];
        if (i2 != 5) {
            if (i2 != 7) {
                if (i2 == 8) {
                    KeypadVisibilityEvents keypadVisibilityEvents = this.keypadVisiblityEvents;
                    if (keypadVisibilityEvents != null) {
                        ((KeypadFragment) keypadVisibilityEvents).x(false, null);
                    }
                }
            }
            CallAppApplication.get().runOnMainThread(new j8(this, callData, isDefaultPhoneApp, 3));
        } else {
            this.manualRecorderDialogShown = false;
            CallAppApplication.get().runOnMainThread(new j(this, 4));
        }
        this.eventBus.b(eventType, callData, true);
        updateScreenLockState(callData.getState() != null && callData.getState().isConnectingOrConnected());
        int e = (int) Activities.e(8.0f);
        Resources resources = getResources();
        CallAppApplication.get().runOnMainThread(new o(this, callData, (int) (resources.getDimension(R.dimen.callbar_height) - ((resources.getDimension(2131165290) + e) + resources.getDimension(2131165795))), e, 0));
        if (PhoneManager.get().isDefaultPhoneApp() || PhoneStateManager.get().shouldShowFullScreenForNonDefault()) {
            int i3 = iArr[callData.getState().ordinal()];
            if (i3 == 3 || i3 == 4) {
                TopSheetPresenter topSheetPresenter3 = this.topSheetPresenter;
                if (topSheetPresenter3 != null) {
                    topSheetPresenter3.b();
                }
                resetLayoutState();
                CallScreenThemeBannerViewController callScreenThemeBannerViewController = this.callScreenThemeBannerViewController;
                if (callScreenThemeBannerViewController != null && callScreenThemeBannerViewController.isViewShown()) {
                    runOnUiThread(new j(this, 5));
                }
                pausePlayerCardIdNeeded();
                doAutoScrollIfNeeded();
            } else if (i3 == 5) {
                pausePlayerCardIdNeeded();
                doAutoScrollIfNeeded();
            } else if (i3 == 7) {
                if (this.isIncognitoCall) {
                    this.assetManager.getAssets();
                }
                ContactData contactData = this.contact;
                if (contactData != null && CollectionUtils.b(contactData.getLoadedFields(), ContactField.callHistoryData)) {
                    new Task() {
                        @Override
                        public final void doTask() {
                            ContactData contactData2 = ContactDetailsActivity.this.contact;
                            if (contactData2 != null) {
                                CallHistoryLoader.e(contactData2);
                            }
                        }
                    }.schedule(1000);
                }
                if (this.detailsActivityMode != BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST) {
                    CLog.a();
                    if (!isDefaultPhoneApp && !Prefs.t1.get().booleanValue()) {
                        AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "NonDefaultAndFullScreenModeForPostCallDisabled");
                    } else if (PhoneManager.get().isInDriveMode()) {
                        AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "isInDriveMode");
                        finish();
                    } else {
                        if (InterstitialAdLoader.b(false)) {
                            if (this.hasFocus) {
                                if (InterstitialAdLoader.g(callData)) {
                                    runOnUiThread(new j(this, 6));
                                    AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "showInterstitial");
                                    this.finishTask.b();
                                } else if (CallAppRemoteConfigManager.get().b("cdInterstitialShowAnalytics")) {
                                    AnalyticsManager.get().p(Constants.AD, "InterstitialShowFailed", "showInterstitialFailed");
                                }
                            } else if (CallAppRemoteConfigManager.get().b("cdInterstitialShowAnalytics")) {
                                AnalyticsManager.get().p(Constants.AD, "InterstitialShowFailed", "noFocus");
                            }
                        }
                        Pair<Boolean, String> showPopupIfNeeded = showPopupIfNeeded();
                        if (((Boolean) showPopupIfNeeded.first).booleanValue()) {
                            AnalyticsManager.get().p(Constants.POST_CALL_SCREEN, Constants.NOT_SHOWING_POST_CALL, "hasPopupInScreen-" + ((String) showPopupIfNeeded.second));
                            this.finishTask.b();
                        } else if (postCallDismiss(false)) {
                            return;
                        }
                    }
                }
            }
        }
        if (callData.getState().isPostCall()) {
            if (isDefaultPhoneApp) {
                BaseContactDetailsActivity.DetailsActivityMode detailsActivityMode = this.detailsActivityMode;
                BaseContactDetailsActivity.DetailsActivityMode detailsActivityMode2 = BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS;
                if (detailsActivityMode != detailsActivityMode2 && PhoneManager.get().getIncomingCall() == null) {
                    if (RecorderTestManager.get().getIsInRecorderTestMode()) {
                        setMode(BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST);
                    } else {
                        setMode(detailsActivityMode2);
                    }
                }
            } else {
                setMode(BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS);
            }
        }
        if (z) {
            this.eventBus.b(ThemeChangedListener.f618w8, null, false);
        }
    }

    @Override
    public void onCloseCallScreenThemeBannerClicked() {
        CallScreenThemeBannerViewController callScreenThemeBannerViewController = this.callScreenThemeBannerViewController;
        if (callScreenThemeBannerViewController != null) {
            this.fullScreenBannerContainer.removeView(callScreenThemeBannerViewController.getRootView());
            this.contactDetailsRootView.removeView(this.fullScreenBannerContainer);
            this.callScreenThemeBannerViewController.setListener(null);
            this.callScreenThemeBannerViewController = null;
        }
    }

    @Override
    public void onCloseKeypadRequestedByUser(boolean z) {
    }

    @Override
    public void onContactChanged(final ContactData contactData, Set<ContactField> set) {
        final int i = 0;
        final int i2 = 1;
        char c = 1;
        char c2 = 1;
        if (!this.presentersInitialized) {
            synchronized (this.contactFieldsLock) {
                try {
                    Set<ContactField> set2 = this.contactFields;
                    if (set2 != null) {
                        set2.addAll(set);
                    } else {
                        this.contactFields = set;
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
            return;
        }
        Objects.toString(set);
        int i3 = GenomeLoaderFileLogger.a;
        if (Prefs.E4.get().booleanValue() && this.callState == CallState.POST_CALL && !this.manualRecorderDialogShown && set.contains(ContactField.records) && !set.contains(ContactField.newContact) && this.detailsActivityMode != BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST) {
            this.manualRecorderDialogShown = true;
            List<CallRecorder> records = this.presenterContainer.getContact().getRecords();
            CallRecorder callRecorder = CollectionUtils.h(records) ? records.get(0) : null;
            if (callRecorder != null) {
                File file = new File(callRecorder.getFileName());
                Object[] objArr = TimeUnit.MILLISECONDS.toSeconds(Math.abs(callRecorder.getDate() - this.callData.getTalkingStartTime())) < 120;
                if (file.exists() && objArr != false) {
                    DialogCallRecorderPlayer dialogCallRecorderPlayer = new DialogCallRecorderPlayer(callRecorder, false, new DialogCallRecorderPlayer.CallRecorderPlayerEvents() {
                        @Override
                        public final void a(Activity activity) {
                            CallRecordsActivity.showAccessibilitDialogIfNeeded(activity, false);
                        }

                        @Override
                        public final void b() {
                            ContactDetailsActivity.this.finishTask.b();
                        }
                    });
                    dialogCallRecorderPlayer.setCancelable(false);
                    PopupManager.get().c(this, dialogCallRecorderPlayer, true);
                }
            }
        }
        this.presenterContainer.onContactChanged(contactData, set);
        updateCallFabOnContactChanged(contactData);
        if (CollectionUtils.b(set, ContactField.cover)) {
            CallAppApplication.get().runOnMainThread(new Runnable(this) {
                public final ContactDetailsActivity b;

                {
                    this.b = this;
                }

                @Override
                public final void run() {
                    switch (i) {
                        case 0:
                            this.b.lambda$onContactChanged$14(contactData);
                            break;
                        default:
                            this.b.lambda$onContactChanged$15(contactData);
                            break;
                    }
                }
            });
        }
        ContactField contactField = ContactField.deviceId;
        if (CollectionUtils.b(set, contactField)) {
            safeRunOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    BaseContactDetailsParallaxImpl parallax = ContactDetailsActivity.this.getParallax();
                    boolean isContactInDevice = contactData.isContactInDevice();
                    if (parallax.h != BaseContactDetailsActivity.DetailsActivityMode.INCOMING_CALL) {
                        parallax.r.setVisibility(isContactInDevice ? 8 : 0);
                    }
                }
            });
        }
        ContactField contactField2 = ContactField.isIncognito;
        if (CollectionUtils.b(set, contactField2)) {
            handleIncognitoMode();
            this.incognitoLoaded = true;
            sendWhoViewedMyProfileIfNeeded();
        }
        ContactField contactField3 = ContactField.spamScore;
        if (CollectionUtils.b(set, contactField3, contactField)) {
            setParallaxAndStatusBarColors(this.detailsActivityMode, false);
            KeypadFragment keypadFragment = (KeypadFragment) getSupportFragmentManager().G("KEYPAD_FRAGMENT_TAG");
            if (keypadFragment != null) {
                keypadFragment.A();
            }
        }
        if (CollectionUtils.b(set, contactField, ContactField.deviceIdChanged)) {
            this.singleContactContentObserver.b(contactData.getDeviceId());
        }
        ContactField contactField4 = ContactField.favorite;
        ContactField contactField5 = ContactField.photoUrl;
        if (CollectionUtils.b(set, contactField, contactField4, contactField2, contactField5, ContactField.googleMap)) {
            setComponentsVisibility();
        }
        if (CollectionUtils.b(set, contactField5)) {
            CallAppChatHeadLifecycleObserverManager callAppChatHeadLifecycleObserverManager = CallAppChatHeadLifecycleObserverManager.get();
            if (callAppChatHeadLifecycleObserverManager.isRegisteredActivity()) {
                callAppChatHeadLifecycleObserverManager.b.b(2);
            }
            FastCacheDataManager.e(contactData);
        }
        ContactField contactField6 = ContactField.fullName;
        if (CollectionUtils.b(set, contactField6)) {
            CallAppApplication.get().runOnBackgroundThread(new Runnable(this) {
                public final ContactDetailsActivity b;

                {
                    this.b = this;
                }

                @Override
                public final void run() {
                    switch (i2) {
                        case 0:
                            this.b.lambda$onContactChanged$14(contactData);
                            break;
                        default:
                            this.b.lambda$onContactChanged$15(contactData);
                            break;
                    }
                }
            });
            FastCacheDataManager.d(contactData);
        }
        if (CollectionUtils.b(set, contactField3)) {
            FastCacheDataManager.f(contactData);
            setDetailsActivityMode(true);
        }
        if (!this.isIdentified && ((set.contains(contactField) || set.contains(contactField6)) && !contactData.isContactInDevice() && StringUtils.x(contactData.getFullName()))) {
            this.isIdentified = true;
        }
        boolean b = CollectionUtils.b(set, ContactField.genomeData);
        if (b || CollectionUtils.b(set, ContactField.gold)) {
            setDetailsActivityMode(true);
            if (b) {
                this.genomeLoaded = true;
                sendWhoViewedMyProfileIfNeeded();
            }
        }
        if (this.incomingCallComponent == null || !isIncomingCall()) {
            return;
        }
        if (CollectionUtils.b(set, contactField6)) {
            ?? r10 = this.incomingCallComponent;
            boolean z = StringUtils.x(contactData.getFullName()) && !this.isIncognitoCall;
            if (r10.W) {
                CallAppApplication.get().runOnMainThread(new m(r10, z, c2 == true ? 1 : 0, c == true ? 1 : 0));
            }
        }
        if (contactData != null && contactData.isSpammer() && !Premium.Premium()) {
            this.incomingCallComponent.z();
        }
        Window window = getWindow();
        boolean isThemeLight = ThemeUtils.isThemeLight();
        IncomingCallComponent incomingCallComponent = this.incomingCallComponent;
        boolean isSpammer = contactData.isSpammer();
        incomingCallComponent.getClass();
        updateWindow(window, isThemeLight, 0, (!ThemeUtils.isThemeLight() || isSpammer || incomingCallComponent.L || incomingCallComponent.a0) ? false : true, this.incomingCallComponent.p(contactData.isSpammer(), Premium.Premium(), contactData.isVerifiedBusiness()));
    }

    @Override
    public void onCreate(Bundle bundle) {
        getWindow().setSoftInputMode(48);
        super.onCreate(bundle);
        AndroidUtils.c(getIntent());
        CLog.a();
        PhoneStateManager.get().setContactDetailsActivityAlive(true);
        Handler handler2 = handler;
        this.singleContactContentObserver = new SingleContactContentObserver(handler2);
        if (getIntent() != null && getIntent().getExtras() != null) {
            this.origin = (ExtractedInfo) getIntent().getExtras().getSerializable(Constants.EXTRA_PHONE_ORIGIN);
        }
        if (getIntent() != null) {
            getIntent().putExtra("EXTRA_REPORT_TRACK_VIEW", true);
        }
        if (PhoneStateManager.get().hasAnyCallNorIncoming()) {
            setKeyguardDismissAndScreenWindowFlags();
        }
        this.spamAppLauncher = registerForActivityResult(new k.f(), this.spamAppLauncherCallback);
        Bundle extras = getIntent().getExtras();
        this.contactDetailsRootView = (ViewGroup) findViewById(R.id.contactDetailsRootView);
        this.bottomActionsContainerWithShadow = findViewById(R.id.bottomActionsContainerWithShadow);
        if (PhoneManager.get().isDefaultPhoneApp()) {
            this.incomingCallComponent = (IncomingCallComponent) findViewById(R.id.incomigCallComponent);
        }
        this.cardsAdapter = new CardArrayRecyclerViewAdapterWithPriority(this, new ArrayList(), new CardArrayRecyclerViewAdapterWithPriority.CardEventsListener() {
            @Override
            public final void a() {
                ContactDetailsActivity.this.showLockedNotificationOnScreen();
            }

            @Override
            public final void b() {
                ContactDetailsActivity.this.snapToPosition(BaseContactDetailsParallaxImpl.Position.SEMI_OPEN, false);
            }
        });
        getRecyclerView().setAdapter(this.cardsAdapter);
        getRecyclerView().n(new BottomBarScrollListener(this));
        getRecyclerView().m(new n0() {
            public final void a(View view) {
                if (view.findViewById(R.id.seekbar) != null) {
                    ContactDetailsActivity.this.pausePlayerCardIdNeeded();
                }
            }

            public final void onChildViewAttachedToWindow(View view) {
            }
        });
        loadContactWhenCreated();
        this.presenterManager.g(this.presenterContainer);
        this.presentersInitialized = true;
        handler2.post(new Runnable() {
            @Override
            public final void run() {
                ContactDetailsActivity.this.fireContactChange();
            }
        });
        int i = 0;
        showActionBar(false);
        this.forcePreCallState = extras != null && extras.getBoolean("forceIdleState", false);
        AppBarLayout.Behavior behavior = findViewById(R.id.appbar).getLayoutParams().a;
        if (behavior != null) {
            behavior.setDragCallback(new AppBarLayout.Behavior.a() {
                public final boolean a() {
                    return ContactDetailsActivity.this.detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS;
                }
            });
        }
        this.centerBottomActionSmallIcon = (ImageView) findViewById(R.id.centerBottomActionSmallIcon);
        this.callActionBtn = findViewById(R.id.centerBottomAction);
        this.callBtn = findViewById(R.id.callBtn);
        this.callFab = (CallFabWithActionsView) findViewById(R.id.centerBottomActionIcon);
        if (Prefs.o.get().booleanValue()) {
            CallFabWithActionsView callFabWithActionsView = this.callFab;
            CallFabUtils.Companion companion = CallFabUtils.a;
            ContactData contactData = this.contact;
            companion.getClass();
            callFabWithActionsView.g(this, CallFabUtils.Companion.a(contactData));
            this.callFab.setActionListener(this);
        }
        KeyguardActivityStateManager.get().e(this.classSimpleName);
        this.profileRippleBackground = findViewById(R.id.cdRippleBackground);
        new Task() {
            @Override
            public final void doTask() {
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                contactDetailsActivity.presenterManager.b(contactDetailsActivity.presenterContainer);
                boolean z = false;
                if (((BaseActivity) contactDetailsActivity).mResumed != null) {
                    if (((BaseActivity) contactDetailsActivity).mResumed.booleanValue()) {
                        contactDetailsActivity.eventBus.b(ResumeListener.A8, null, false);
                    } else {
                        contactDetailsActivity.eventBus.b(PauseListener.z8, null, false);
                    }
                }
                contactDetailsActivity.autoScrollType = CallAppRemoteConfigManager.get().c("InCallAutoScroll");
                if (!RecorderTestManager.get().getIsInRecorderTestMode() && contactDetailsActivity.autoScrollType > 0) {
                    z = true;
                }
                contactDetailsActivity.isAutoScrollEnabled = z;
                LongPref longPref = Prefs.m2;
                long longValue = longPref.get().longValue();
                if (longValue < Long.MAX_VALUE) {
                    longPref.a();
                    if ((longValue + 1) % 4 == 0) {
                        FeedbackManager.get().g(Activities.getString(R.string.user_assist_change_image_toast), 1, 48);
                        longPref.set(Long.MAX_VALUE);
                    }
                }
                contactDetailsActivity.tryToShowRippleOnProfileView();
            }
        }.execute();
        CallBarPresenter callBarPresenter = (CallBarPresenter) this.presenterManager.f(CallBarPresenter.class);
        this.callBarPresenter = callBarPresenter;
        if (callBarPresenter != null) {
            callBarPresenter.setForcePreCall(this.forcePreCallState);
            this.callBarPresenter.setAudioRouteSelectorDialogListener(new AudioRouteSelectorDialogListener() {
                @Override
                public final void a() {
                    ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                    contactDetailsActivity.audioRouteSelectorDialogFragment = AudioRouteSelectorDialogFragment.A(contactDetailsActivity.getSupportFragmentManager(), false);
                }
            });
        }
        TopSheetPresenter topSheetPresenter = (TopSheetPresenter) this.presenterManager.f(TopSheetPresenter.class);
        this.topSheetPresenter = topSheetPresenter;
        topSheetPresenter.setTopSheetListener(this);
        this.presenterContainer.getEventBus().a(DialpadToggleListener.U7, this);
        this.presenterContainer.getEventBus().a(AdCardShowingEvent.R7, this);
        this.presenterContainer.getEventBus().a(AdCardHidingEvent.Q7, this);
        this.presenterContainer.getEventBus().a(ScrollWhenCDAnalyticsExpand.K7, this);
        ((UserCorrectedInfoPresenter) this.presenterManager.f(UserCorrectedInfoPresenter.class)).setCLickListener(this);
        ((IsSpamPresenter) this.presenterManager.f(IsSpamPresenter.class)).setCLickListener(this);
        if (!PhoneManager.get().isDefaultPhoneApp()) {
            this.bringToFrontLifecycleObserver = new BringToFrontLifecycleObserver(i);
            getLifecycle().addObserver(this.bringToFrontLifecycleObserver);
        }
        boolean addListenerIfNotPreCall = PhoneStateManager.get().addListenerIfNotPreCall(this, this.forcePreCallState);
        if (isStartedFromACall.getAndSet(false) && !addListenerIfNotPreCall && !this.forcePreCallState) {
            finish();
            return;
        }
        PhoneStateManager.get().addDetailsListener(this);
        this.bottomActionBar = findViewById(R.id.bottomActionsContainer);
        setTopBarClickedListeners(R.id.header_bottom_strip, R.id.editContactNameIcon, R.id.backButton, R.id.nameText, R.id.contactDetails_action_favorites, R.id.contactDetails_action_add, R.id.contactDetails_action_more, R.id.contactDetails_first_circle_button, R.id.contactDetails_second_circle_button);
        setButtonBarLongClickedListeners(R.id.callBtn);
        setButtonBarClickedListeners(R.id.callBtn);
        int i2 = LocaleUtils.isRTL() ? -1 : 1;
        View findViewById = findViewById(R.id.backButton);
        if (findViewById != null && i2 == -1) {
            findViewById.setPaddingRelative(0, 0, findViewById.getPaddingStart(), 0);
            findViewById.setScaleX(i2);
        }
        View findViewById2 = findViewById(R.id.profile_pic_action_icon_container);
        this.contactDetailsActionEditContainer = findViewById2;
        findViewById2.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public final boolean onLongClick(View view) {
                ?? r2 = ContactDetailsActivity.this;
                AddNoteActivity.startNoteActivity(r2.getContact().getId(), r2);
                return false;
            }
        });
        this.contactDetailsEditContactNameIcon = findViewById(R.id.editContactNameIcon);
        this.recorderTestContainerStub = (ViewStub) findViewById(R.id.recorderTestContainerStub);
        this.cardsRecyclerview = (CardRecyclerView) findViewById(R.id.cards_recyclerview);
        this.contactDetailsActionEye = (ImageView) findViewById(R.id.contactDetailsActionEye);
        onNewIntent(getIntent());
        this.eventBus.a(PresenterEvents.a, this.presenterEvents);
        EventBus eventBus = EventBusManager.a;
        eventBus.a(FinishActivityListener.W7, this);
        eventBus.a(FastCacheChangedListener.a, this.fastCacheChangedListener);
        eventBus.a(InvalidateDataListener.d8, this.invalidateDataListener);
        eventBus.a(InterstitialDismissListener.c8, this);
        CallRecorderManager.get().l(this, !RecorderTestManager.get().getIsInRecorderTestMode());
        this.cardsRecyclerviewContainer = findViewById(R.id.cards_recyclerview_container);
        this.topSheetContainer = findViewById(R.id.topSheetContainer);
        this.callBarLayoutRoot = findViewById(R.id.callBarLayoutRoot);
        this.contactDetailsTopStrip = findViewById(R.id.contact_details_top_strip);
        this.contactDetailsActionMore = findViewById(R.id.contactDetails_action_more);
        this.favoritesBtn = (CallAppCheckBox) findViewById(R.id.contactDetails_action_favorites);
        this.contactDetailsActionAdd = findViewById(R.id.contactDetails_action_add);
        this.contactDetailsFirstCircleButton = findViewById(R.id.contactDetails_first_circle_button);
        this.contactDetailsSecondCircleButton = findViewById(R.id.contactDetails_second_circle_button);
        this.snackBarContainerKeypad = findViewById(R.id.snackbarContainerKeypad);
        if ((extras == null || !extras.getBoolean(Constants.EXTRA_IS_INCOMING) || extras.getString(Constants.EXTRA_PHONE_NUMBER) == null) && !PhoneStateManager.get().isIncomingCallRingingState()) {
            CallData callData = this.callData;
            setMode((callData == null || callData.getState().isIdle()) ? BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS : BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
        } else {
            this.bottomActionsContainerWithShadow.setVisibility(8);
            setMode(BaseContactDetailsActivity.DetailsActivityMode.INCOMING_CALL);
        }
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.USER_PRESENT");
        if (Build.VERSION.SDK_INT >= 33) {
            CallAppApplication.get().registerReceiver(this.broadcastReceiver, intentFilter, 2);
        } else {
            CallAppApplication.get().registerReceiver(this.broadcastReceiver, intentFilter);
        }
        try {
            PermissionManager.get().getClass();
            BooleanPref booleanPref = Prefs.A7;
            if (!booleanPref.get().booleanValue() && !PhoneManager.get().isDefaultPhoneApp()) {
                PermissionManager.get().getClass();
                if (!PermissionManager.d("android.permission.ANSWER_PHONE_CALLS")) {
                    booleanPref.set(Boolean.TRUE);
                    androidx.core.app.c.a(this, new String[]{"android.permission.ANSWER_PHONE_CALLS"}, 11115);
                }
            }
        } catch (Exception e) {
            CLog.p(this.TAG, "Failed to grant ANSWER_PHONE_CALLS permission", e);
        }
        try {
            PermissionManager.get().getClass();
            if (Build.VERSION.SDK_INT > 29) {
                BooleanPref booleanPref2 = Prefs.D7;
                if (booleanPref2.get().booleanValue() || PhoneManager.get().isDefaultPhoneApp() || t.C("android.permission.READ_PHONE_NUMBERS")) {
                    return;
                }
                booleanPref2.set(Boolean.TRUE);
                androidx.core.app.c.a(this, new String[]{"android.permission.READ_PHONE_NUMBERS"}, 11116);
            }
        } catch (Exception e2) {
            CLog.p(this.TAG, "Failed to grant READ_PHONE_NUMBERS permission", e2);
        }
    }

    @Override
    public void onDestroy() {
        CLog.a();
        Prefs.I7.set(Boolean.FALSE);
        PhoneStateManager.get().setContactDetailsActivityAlive(false);
        this.spamAppLauncher.b();
        handleKeepScreenOnIfNeeded(CallState.POST_CALL);
        this.singleContactContentObserver.c();
        Handler handler2 = handler;
        if (handler2 != null) {
            handler2.removeCallbacksAndMessages(null);
        }
        this.finishTask.b();
        releaseContact();
        PhoneStateManager.get().removeListener(this);
        PhoneStateManager.get().removeDetailsListener(this);
        try {
            CallAppApplication.get().unregisterReceiver(this.broadcastReceiver);
        } catch (Exception e) {
            CLog.m(this.TAG, e);
        }
        if (this.bringToFrontLifecycleObserver != null) {
            getLifecycle().removeObserver(this.bringToFrontLifecycleObserver);
        }
        removeAutoScrollRunnable();
        ProximityManager.get().setDisableReleaseWaitForNoProximity(false);
        KeyguardActivityStateManager.get().g(this.classSimpleName);
        this.eventBus.f(PresenterEvents.a, this.presenterEvents);
        this.eventBus.f(AdCardShowingEvent.R7, this);
        this.eventBus.f(AdCardHidingEvent.Q7, this);
        this.eventBus.f(ScrollWhenCDAnalyticsExpand.K7, this);
        this.presenterContainer.getEventBus().f(DialpadToggleListener.U7, this);
        CallScreenThemeBannerViewController callScreenThemeBannerViewController = this.callScreenThemeBannerViewController;
        if (callScreenThemeBannerViewController != null) {
            callScreenThemeBannerViewController.setListener(null);
        }
        CallRecorderManager.get().s(this, !RecorderTestManager.get().getIsInRecorderTestMode());
        EventBus eventBus = EventBusManager.a;
        eventBus.f(FastCacheChangedListener.a, this.fastCacheChangedListener);
        eventBus.f(InvalidateDataListener.d8, this.invalidateDataListener);
        this.isAdLoaded = false;
        this.isAnalyticsAdLoaded = false;
        IncomingCallComponent incomingCallComponent = this.incomingCallComponent;
        if (incomingCallComponent != null) {
            incomingCallComponent.t();
            DrawingViewWithCallback drawingViewWithCallback = incomingCallComponent.G;
            if (drawingViewWithCallback != null) {
                drawingViewWithCallback.b();
            }
            DrawingViewWithCallback drawingViewWithCallback2 = incomingCallComponent.H;
            if (drawingViewWithCallback2 != null) {
                drawingViewWithCallback2.b();
            }
            View view = incomingCallComponent.U;
            if (view != null) {
                view.setOnTouchListener(null);
            }
            View view2 = incomingCallComponent.T;
            if (view2 != null) {
                view2.setOnTouchListener(null);
            }
            ImageUtils.f(incomingCallComponent.S);
            incomingCallComponent.S = null;
            ImageUtils.f(incomingCallComponent.R);
            incomingCallComponent.R = null;
        }
        eventBus.f(FinishActivityListener.W7, this);
        eventBus.f(InterstitialDismissListener.c8, this);
        super.onDestroy();
    }

    @Override
    public void onError(Bundle bundle) {
        this.eventBus.b(RecorderStateListener.a, bundle, false);
    }

    @Override
    public void onGetItNowCallScreenThemeBannerClicked() {
        CallScreenThemeBannerViewController callScreenThemeBannerViewController = this.callScreenThemeBannerViewController;
        if (callScreenThemeBannerViewController != null) {
            this.fullScreenBannerContainer.removeView(callScreenThemeBannerViewController.getRootView());
            this.contactDetailsRootView.removeView(this.fullScreenBannerContainer);
            Activities.E(this, new Intent((Context) this, (Class<?>) MarketPlaceActivity.class));
        }
    }

    @Override
    public void onHideRingtoneVideo() {
        this.isVideoRingtoneShow = false;
    }

    @Override
    public void onIncomeCallAnswer() {
        setMode(BaseContactDetailsActivity.DetailsActivityMode.IN_CALL);
        PhoneManager.get().a();
        CallBarPresenter callBarPresenter = this.callBarPresenter;
        if (callBarPresenter != null) {
            callBarPresenter.x(this.callData);
        }
    }

    @Override
    public void onIncomeCallDecline() {
        BaseContactDetailsActivity.DetailsActivityMode determineTargetMode = determineTargetMode();
        if (determineTargetMode != null) {
            setMode(determineTargetMode);
        }
        PhoneManager.get().getClass();
        PhoneManager.d();
    }

    @Override
    public void onInterstitialDismiss(Object obj) {
        postCallDismiss(true);
    }

    @Override
    public void onKeypadStateChanged(KeypadFragment.KeypadState keypadState) {
    }

    @Override
    public void onNewIntent(final Intent intent) {
        Phone e;
        AndroidUtils.c(intent);
        CLog.a();
        NotificationIntentHandler.a(this, getIntent());
        if (intent.getBooleanExtra(EXTRA_BRING_TO_FRONT_RETRY, false)) {
            int intExtra = intent.getIntExtra(EXTRA_BRING_TO_FRONT_RETRY_LEFT, 4);
            if (intExtra < 4) {
                int i = intExtra + 1;
                intent.putExtra(EXTRA_BRING_TO_FRONT_RETRY, true);
                intent.putExtra(EXTRA_BRING_TO_FRONT_RETRY_LEFT, i);
                new BringToFrontTask(intent).schedule(i * 200);
            }
            Intent intent2 = getIntent();
            if (PhoneManager.get().isDefaultPhoneApp() || !(intent2 == null || intent2.getBooleanExtra(EXTRA_BRING_TO_FRONT_RETRY, false))) {
                return;
            } else {
                finish();
            }
        } else {
            this.finishTask.b();
        }
        setIntent(intent);
        super.onNewIntent(intent);
        if (getLastCustomNonConfigurationInstance() != null) {
            intent.putExtra(ACTION_DONT_CLEAR_POPUPS, true);
        }
        OverlayManager.get().a();
        Bundle extras = intent.getExtras();
        if (extras == null) {
            AndroidUtils.c(intent);
            CLog.a();
            return;
        }
        if (extras.getBoolean("EXTRA_MISSED_CALL_NOTIFICATION_CLICKED", false)) {
            intent.removeExtra("EXTRA_MISSED_CALL_NOTIFICATION_CLICKED");
            AnalyticsManager.get().o(Constants.MISSED_CALL_ACTIONS, "User clicked the missed call notification");
            MissedCallUtils.a(false);
            showDialogToAllowNotificationAccessAfterMissedCall(this);
        }
        if (extras.getBoolean("EXTRA_NOT_ANSWERED_NOTIFICATION_CLICKED", false)) {
            intent.removeExtra("EXTRA_NOT_ANSWERED_NOTIFICATION_CLICKED");
            AnalyticsManager.get().o(Constants.MISSED_CALL_ACTIONS, "User clicked the not answered notification");
            MissedCallUtils.b(false);
        }
        this.whoViewedMyProfileEntrypoint = (ENTRYPOINT) getIntent().getExtras().getSerializable(Constants.EXTRA_WHO_VIEWED_ENTRY_POINT);
        if (getIntent().getBooleanExtra(EXTRA_WHO_VIEW_PROFILE_NOTIFICATION, false)) {
            WhoViewedMyProfileDataManager.a.setViewerNotificationCount(0);
        }
        if (getIntent().getBooleanExtra(Constants.WHO_VIEWED_MY_NOTIFICATION_CLICKED, false)) {
            AnalyticsManager.get().o(Constants.WHO_VIEWED_MY_PROFILE_CATEGORY, "ViewProfile_notification_open");
        }
        if (!extras.getBoolean(ACTION_DONT_CLEAR_POPUPS, false)) {
            PopupManager popupManager = PopupManager.get();
            popupManager.a.clear();
            popupManager.a();
        }
        final long j = extras.getLong("contactId");
        if (isWebSearchIntent(intent) && StringUtils.x(extras.getString(Constants.WEB_SEARCH_QUERY))) {
            e = PhoneManager.get().e(extras.getString(Constants.WEB_SEARCH_QUERY).replace("\"", ""));
            if (e.isValidForSearch()) {
                AnalyticsManager.get().p(Constants.GOOGLE_LOOKUP, "LookupResult", "FoundNumber");
            } else {
                AnalyticsManager.get().p(Constants.GOOGLE_LOOKUP, "LookupResult", "NotFound");
            }
        } else {
            e = PhoneManager.get().e(extras.getString(Constants.EXTRA_PHONE_NUMBER));
        }
        final Phone phone = e;
        final String string = extras.getString(Constants.EXTRA_CALL_TELECOM_ID);
        this.origin = (ExtractedInfo) extras.getSerializable(Constants.EXTRA_PHONE_ORIGIN);
        if (j == 0 && phone.isEmpty()) {
            AndroidUtils.c(intent);
            CLog.a();
            return;
        }
        boolean z = getIntent().getExtras().getBoolean("forceIdleState", false);
        this.forcePreCallState = z;
        if (!z && !PhoneStateManager.get().hasExistingCallForPhone(phone) && !isWebSearchIntent(intent)) {
            AndroidUtils.c(intent);
            CLog.a();
            return;
        }
        AndroidUtils.c(intent);
        CLog.a();
        final boolean cleanAllDataIfContactChanged = cleanAllDataIfContactChanged(j, phone);
        if (cleanAllDataIfContactChanged || this.contact == null || getIntent().getBooleanExtra("EXTRA_REPORT_TRACK_VIEW", false)) {
            AnalyticsManager.get().t(Constants.CONTACT_DETAILS_ACTIVITY_SCREEN, intent.getStringExtra(Constants.EXTRA_ENTRY_POINT));
        }
        if (this.forcePreCallState) {
            setHoldContactData(false);
            setMode(BaseContactDetailsActivity.DetailsActivityMode.CONTACT_DETAILS);
        } else if (RecorderTestManager.get().getIsInRecorderTestMode() && StringUtils.k(RecorderTestManager.get().getRecorderTestRawNumber(), phone.getRawNumber())) {
            setMode(BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST);
        }
        new Task() {
            @Override
            public final void doTask() {
                boolean z2 = cleanAllDataIfContactChanged;
                ?? r3 = ContactDetailsActivity.this;
                Intent intent3 = intent;
                ContactDetailsActivity.this.updateModelAndFireEvents(intent, j, phone, string, z2 || r3.contact == null || r3.isWebSearchIntent(intent3));
                r3.forceShowPresenterIfNeeded(intent3, ContactDetailsActivity.EXTRA_FORCE_SHOW_CORRECTED_INFO_PRESENTER, UserCorrectedInfoPresenter.class);
                r3.forceShowPresenterIfNeeded(intent3, ContactDetailsActivity.EXTRA_FORCE_SHOW_IS_SPAM_PRESENTER, IsSpamPresenter.class);
                if (intent3.getBooleanExtra("EXTRA_ASK_OPEN_RATE_US", false)) {
                    AppRater.b(r3, r3.contact, false, true ^ AppRater.isRatedYet());
                }
                if (intent3.getBooleanExtra("EXTRA_BLOCKED_CALL_NOTIFICATION_CLICKED", false)) {
                    NotificationManager notificationManager = NotificationManager.p;
                    PhoneStateManager.blockedCallsList.clear();
                    NotificationManager.r = 0;
                }
            }
        }.execute();
        this.isOneTimeIncognitoCall = intent.getBooleanExtra(BaseContactDetailsActivity.EXTRA_INCOGNITO_CALL, false);
        if (intent.getBooleanExtra(BaseContactDetailsActivity.EXTRA_SHOW_KEYPAD, false)) {
            this.presenterContainer.getEventBus().b(ShowKeypadListener.f615s8, Boolean.TRUE, false);
        }
        if (intent.hasExtra("future_target_index_key")) {
            m7.d dVar = (m7.d) NotificationManager.get().k.d.get(Integer.valueOf(intent.getIntExtra("future_target_index_key", -1)));
            if (dVar != null) {
                CurrentCallDynamicObject.a(dVar);
            }
        }
    }

    @Override
    public void onNumberChanged(String str, int i, int i2, int i3, boolean z) {
        keypadNumbers = str;
    }

    @Override
    public void onPause() {
        CLog.a();
        try {
            PhotoPresenter photoPresenter = (PhotoPresenter) this.presenterManager.f(PhotoPresenter.class);
            if (photoPresenter != null) {
                photoPresenter.activityInBackground();
            }
        } catch (Throwable th) {
            CLog.m(this.TAG, th);
        }
        ProximityManager.get().setAudioModeChangedListener(null);
        KeyguardActivityStateManager.get().b(this.classSimpleName);
        PhoneStateManager.get().setContactDetailsActivityVisible(false);
        if (this.isIncognitoCall || this.isOneTimeIncognitoCall) {
            ThemeUtils.setIsLight(((ThemeState) Prefs.w3.get()).isLightTheme());
        }
        AudioRouteSelectorDialogFragment audioRouteSelectorDialogFragment = this.audioRouteSelectorDialogFragment;
        if (audioRouteSelectorDialogFragment != null) {
            audioRouteSelectorDialogFragment.dismiss();
        }
        if (this.detailsActivityMode == BaseContactDetailsActivity.DetailsActivityMode.RECORDER_TEST && !RecorderTestManager.get().getIsInRecorderTestMode()) {
            finish();
        }
        super.onPause();
    }

    @Override
    public void onPreRecord(Bundle bundle) {
        this.eventBus.b(RecorderStateListener.a, bundle, false);
    }

    @Override
    public void onRecordFileReady(Bundle bundle) {
        this.eventBus.b(RecorderStateListener.a, bundle, false);
    }

    @Override
    public void onRecorderStarted(Bundle bundle) {
        this.eventBus.b(RecorderStateListener.a, bundle, false);
    }

    @Override
    public void onRecorderStopped(Bundle bundle) {
        CallRecorderLoader.e(this.contact);
        this.eventBus.b(RecorderStateListener.a, bundle, false);
    }

    public void onRestoreInstanceState(Bundle bundle) {
        super/*android.app.Activity*/.onRestoreInstanceState(bundle);
        if (bundle.getBoolean(SHOULD_FINISH_ACTIVITY)) {
            finish();
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        CLog.a();
        this.hasFocus = true;
        if (!PhoneManager.get().isDefaultPhoneApp()) {
            if (BluetoothHeadsetConnectivityManager.isUsingBT()) {
                setVolumeControlStream(1);
            } else {
                setVolumeControlStream(0);
            }
        }
        requestUpdateUI();
        ProximityManager.get().setAudioModeChangedListener(this.audioModeChangedListener);
        KeyguardActivityStateManager.get().c(this.classSimpleName);
        PhoneStateManager.get().setContactDetailsActivityVisible(true);
        if (this.isIncognitoCall || this.isOneTimeIncognitoCall) {
            ThemeUtils.setIsLight(false);
        }
    }

    public Object onRetainCustomNonConfigurationInstance() {
        return Boolean.TRUE;
    }

    @Override
    public void onSaveInstanceState(@NonNull Bundle bundle) {
        super.onSaveInstanceState(bundle);
        bundle.putBoolean(SHOULD_FINISH_ACTIVITY, this.finishTask.isRunning());
    }

    @Override
    public void onScroll() {
        if (needToHandleEyeIcon()) {
            this.contactDetailsActionEye.setVisibility(8);
        }
    }

    @Override
    public void onScrollStopped() {
    }

    public boolean onSearchRequested() {
        return true;
    }

    @Override
    public void onSetCallReminder() {
        BaseCallReminderAction baseCallReminderAction;
        KeyguardManager keyguardManager = (KeyguardManager) CallAppApplication.get().getSystemServiceDirect("keyguard");
        if (keyguardManager == null || !keyguardManager.isKeyguardLocked()) {
            ActionsManager actionsManager = ActionsManager.get();
            actionsManager.getClass();
            baseCallReminderAction = (BaseCallReminderAction) actionsManager.c("AddCallReminderAction");
        } else {
            ActionsManager actionsManager2 = ActionsManager.get();
            actionsManager2.getClass();
            baseCallReminderAction = (BaseCallReminderAction) actionsManager2.c("AddCallAppCallReminderAction");
        }
        baseCallReminderAction.a(this, this.contact, new ReminderAnalyticsData("Incoming"));
    }

    @Override
    public void onSetCallSms() {
        PopupManager.get().c(this, new QuickResponseDialogPopup(this.contact.getPhone()), false);
    }

    @Override
    public void onShowRingtoneVideo() {
        this.isVideoRingtoneShow = !isSpammer();
    }

    @Override
    public void onThemeChanged() {
        runOnUiThread(new j(this, 0));
    }

    @Override
    public void onTopBarIconClicked(View view) {
        ContactData contactData;
        if (!Activities.q(this, null) || view == 0) {
            return;
        }
        switch (view.getId()) {
            case R.id.backButton:
                AnalyticsManager.get().p(Constants.CONTACT_DETAILS, "Top bar button clicked: back.", Constants.CLICK);
                onBackPressed();
                break;
            case R.id.contactDetails_action_add:
                AnalyticsManager.get().p(Constants.CONTACT_DETAILS, "Top bar button clicked: add.", Constants.CLICK);
                editOrCreateContact();
                break;
            case R.id.contactDetails_action_favorites:
                if (this.contact != null) {
                    ?? r82 = (CallAppCheckBox) view;
                    r82.toggle();
                    AnalyticsManager.get().p(Constants.CONTACT_DETAILS, "Top bar button clicked: favorite. set contact as favorite:" + r82.isChecked(), Constants.CLICK);
                    CallAppApplication.get().getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, false, new OneShotContentContentObserver(new CallAppContentObserver.ContentObserverListener(this) {
                        @Override
                        public final void onContentChanged() {
                            EventBusManager.a.b(InvalidateDataListener.d8, EventBusManager.CallAppDataType.FAVORITES, false);
                        }
                    }, true));
                    ContactDataUtils.setIsFavorite(this.presenterContainer.getContact(), r82.isChecked());
                    break;
                }
                break;
            case R.id.contactDetails_action_more:
                AnalyticsManager.get().p(Constants.CONTACT_DETAILS, "Top bar button clicked: more.", Constants.CLICK);
                TopSheetPresenter topSheetPresenter = this.topSheetPresenter;
                if (topSheetPresenter != null) {
                    topSheetPresenter.c();
                    TopSheetPresenter topSheetPresenter2 = this.topSheetPresenter;
                    topSheetPresenter2.getClass();
                    ActionsManager actionsManager = ActionsManager.get();
                    ArrayList e = actionsManager.e(topSheetPresenter2.d.getContact(), Action.ContextType.CONTACT_DETAILS_ACTION_BOTTOM_SHEET, actionsManager.getContactDetailsBottomActionList(), null);
                    topSheetPresenter2.c.setNotifyOnChange(false);
                    topSheetPresenter2.c.clear();
                    topSheetPresenter2.c.addAll(e);
                    topSheetPresenter2.c.setNotifyOnChange(true);
                    topSheetPresenter2.c.notifyDataSetChanged();
                    CallAppApplication.get().postRunnable(topSheetPresenter2.f);
                    TopSheetPresenter.TopSheetListener topSheetListener = topSheetPresenter2.e;
                    if (topSheetListener != null) {
                        topSheetListener.animateBottomBar(true, true);
                        break;
                    }
                }
                break;
            case R.id.contactDetails_first_circle_button:
                Prefs.k.set(Boolean.FALSE);
                if (ThemeUtils.isThemeLight()) {
                    AnalyticsManager.get().o(Constants.CONTACT_DETAILS, "ClickModeButtonToDark");
                } else {
                    AnalyticsManager.get().o(Constants.CONTACT_DETAILS, "ClickModeButtonToLight");
                }
                ThemeUtils.i(this.contactDetailsParallaxThemeState.getLeftThemeChangedEvent(), true);
                EventBusManager.a.b(ThemeChangedListener.f618w8, null, false);
                break;
            case R.id.contactDetails_second_circle_button:
                getParallax().getThemeChangeViewController().a();
                break;
            case R.id.editContactNameIcon:
            case R.id.nameText:
                if (isClickValid(view) && (contactData = this.contact) != null) {
                    if (!contactData.isContactInDevice()) {
                        AnalyticsManager.get().p(Constants.CONTACT_DETAILS, "Top bar button clicked: edit.", Constants.CLICK);
                        Context realContext = this.presenterContainer.getRealContext();
                        ContactData contactData2 = this.contact;
                        contactData2.getPhone();
                        l lVar = new l(this);
                        contactData2.getFullName();
                        UserCorrectedInfoUtil.h(-1, realContext, lVar, contactData2, Constants.CONTACT_DETAILS, "Edit clicked - User corrected a contact info data", Constants.CONTACT_DETAILS);
                        break;
                    } else {
                        editOrCreateContact();
                        break;
                    }
                }
                break;
        }
    }

    @Override
    public void onUpdateSearchForNumberLoaderVisibility(boolean z) {
    }

    @Override
    public void onUserCorrectionPositiveClicked(@NonNull final View view, @NonNull final Reward reward) {
        ContactDetailsActivity contactDetailsActivity;
        final FrameLayout frameLayout = (FrameLayout) findViewById(R.id.rewardViewContainer);
        final RewardView rewardView = (RewardView) findViewById(R.id.rewardView);
        rewardView.setReward(reward.getRewardValue());
        final int[] iArr = new int[2];
        view.getLocationOnScreen(iArr);
        if (iArr[0] != 0) {
            contactDetailsActivity = this;
            CallAppApplication.get().runOnMainThread(new Runnable() {
                @Override
                public final void run() {
                    frameLayout.setVisibility(0);
                    ?? r0 = rewardView;
                    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) r0.getLayoutParams();
                    int[] iArr2 = iArr;
                    float f = iArr2[1];
                    ContactDetailsActivity contactDetailsActivity2 = ContactDetailsActivity.this;
                    float dimension = f - contactDetailsActivity2.getResources().getDimension(2131166642);
                    View view2 = view;
                    layoutParams.topMargin = (int) (((view2.getHeight() * 1.25f) + dimension) - contactDetailsActivity2.getTopInsetSize());
                    if (LocaleUtils.isRTL()) {
                        layoutParams.gravity = 3;
                        layoutParams.setMarginEnd(iArr2[0] - (view2.getWidth() / 2));
                    } else {
                        layoutParams.leftMargin = iArr2[0] - (view2.getWidth() / 2);
                    }
                    r0.setLayoutParams(layoutParams);
                    r0.n();
                    reward.onRewardGranted();
                }
            });
        } else {
            contactDetailsActivity = this;
        }
        UserCorrectedInfoPresenter userCorrectedInfoPresenter = (UserCorrectedInfoPresenter) contactDetailsActivity.presenterManager.f(UserCorrectedInfoPresenter.class);
        if (userCorrectedInfoPresenter != null) {
            userCorrectedInfoPresenter.hideButtons();
        }
        IsSpamPresenter isSpamPresenter = (IsSpamPresenter) contactDetailsActivity.presenterManager.f(IsSpamPresenter.class);
        if (isSpamPresenter != null) {
            isSpamPresenter.hideButtons();
        }
    }

    @Override
    public void onVoiceSearchRequested() {
    }

    @Override
    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        KeyguardActivityStateManager.get().d(this.classSimpleName, z);
        boolean isKeyguardLocked = ((KeyguardManager) CallAppApplication.get().getSystemServiceDirect("keyguard")).isKeyguardLocked();
        boolean isInteractive = PowerUtils.isInteractive();
        if (isUserPressedHomeButton() || (!isKeyguardLocked && isInteractive)) {
            this.hasFocus = z;
        }
        isUserPressedHomeButton();
        CLog.a();
    }

    @Override
    public void openIDPlus() {
        startActivity(new Intent((Context) this, (Class<?>) IDPlusActivity.class));
    }

    @Override
    public void registerFilteredEvents(SearchContactsFilter searchContactsFilter) {
    }

    public void releaseContact() {
        ContactLoaderManager.get().unRegisterForContactDetailsStack(this.contact, this);
        this.incognitoLoaded = false;
        this.genomeLoaded = false;
    }

    @Override
    public void requestBluetoothPermission(boolean z) {
        if (isDestroyed() || isFinishing() || Build.VERSION.SDK_INT < 31) {
            return;
        }
        if (z) {
            Activities.B(this, new com.callapp.contacts.manager.popup.ActivityResult() {
                @Override
                public final void h(Activity activity, int i, int i2, Intent intent) {
                    ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                    contactDetailsActivity.audioRouteSelectorDialogFragment = AudioRouteSelectorDialogFragment.A(contactDetailsActivity.getSupportFragmentManager(), true);
                }
            });
        } else {
            PermissionManager.get().f(this, new j(this, 2), new j(this, 3), PermissionManager.PermissionGroup.BLUETOOTH);
        }
    }

    @Override
    public boolean shouldSkipEmptyView() {
        return false;
    }

    @Override
    public void toggleDialpad(final boolean z, boolean z2, final int i, final int i2) {
        CallAppApplication.get().runOnMainThread(new Runnable() {
            @Override
            public final void run() {
                ContactDetailsActivity contactDetailsActivity = ContactDetailsActivity.this;
                boolean z3 = z;
                contactDetailsActivity.keypadShown = z3;
                FragmentManager supportFragmentManager = contactDetailsActivity.getSupportFragmentManager();
                supportFragmentManager.getClass();
                final androidx.fragment.app.a aVar = new androidx.fragment.app.a(supportFragmentManager);
                final KeypadFragment keypadFragment = (KeypadFragment) contactDetailsActivity.getSupportFragmentManager().G("KEYPAD_FRAGMENT_TAG");
                if (keypadFragment == null) {
                    keypadFragment = KeypadFragment.z(i2, i, 1, true);
                }
                if (z3) {
                    contactDetailsActivity.keypadMainContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                        @Override
                        public final boolean onPreDraw() {
                            AnonymousClass30 anonymousClass30 = AnonymousClass30.this;
                            ContactDetailsActivity.this.keypadMainContainer.getViewTreeObserver().removeOnPreDrawListener(this);
                            ContactDetailsActivity.this.callBarPresenter.setRecordingBarContainerMarginBottom(ContactDetailsActivity.this.keypadMainContainer.getHeight() - ((int) ContactDetailsActivity.this.getResources().getDimension(2131165444)));
                            return true;
                        }
                    });
                    aVar.i(R.id.keypadMainContainer, keypadFragment, "KEYPAD_FRAGMENT_TAG");
                    aVar.o();
                    keypadFragment.setKeypadShadowTopVisibility(8);
                    return;
                }
                contactDetailsActivity.callBarPresenter.setRecordingBarContainerMarginBottom(0);
                if (contactDetailsActivity.keypadVisiblityEvents != null) {
                    ((KeypadFragment) contactDetailsActivity.keypadVisiblityEvents).x(true, new AnimatorListenerAdapter() {
                        @Override
                        public final void onAnimationEnd(Animator animator) {
                            AnonymousClass30 anonymousClass30 = AnonymousClass30.this;
                            if (ContactDetailsActivity.this.getSupportFragmentManager().J) {
                                return;
                            }
                            aVar.h(keypadFragment).e();
                            ContactDetailsActivity.this.getSupportFragmentManager().D();
                        }
                    });
                }
            }
        });
    }

    @Override
    public void unRegisterFilteredEvents(SearchContactsFilter searchContactsFilter) {
    }

    @Override
    public void updateHasSearchResults(boolean z) {
    }

    public void updateRecentSearchesName(ContactData contactData) {
        final String b = StringUtils.b(contactData.getFullName());
        final String g = contactData.getPhone().g();
        final int i = 0;
        CallAppApplication.get().runOnBackgroundThread(new Runnable() {
            @Override
            public final void run() {
                switch (i) {
                    case 0:
                        JSONObjectPref jSONObjectPref = Prefs.J7;
                        RecentSearchesData recentSearchesData = (RecentSearchesData) jSONObjectPref.get();
                        if (recentSearchesData.getNumber().equals(g)) {
                            recentSearchesData.setName(b);
                            jSONObjectPref.set(new RecentSearchesData());
                            JSONObjectPref jSONObjectPref2 = Prefs.K7;
                            RecentSearchesData recentSearchesData2 = (RecentSearchesData) jSONObjectPref2.get();
                            JSONObjectPref jSONObjectPref3 = Prefs.L7;
                            RecentSearchesData recentSearchesData3 = (RecentSearchesData) jSONObjectPref3.get();
                            JSONObjectPref jSONObjectPref4 = Prefs.M7;
                            RecentSearchesData recentSearchesData4 = (RecentSearchesData) jSONObjectPref4.get();
                            if (!StringUtils.k(recentSearchesData2.getNumber(), recentSearchesData.getNumber()) && !StringUtils.k(recentSearchesData3.getNumber(), recentSearchesData.getNumber()) && !StringUtils.k(recentSearchesData4.getNumber(), recentSearchesData.getNumber())) {
                                jSONObjectPref4.set(recentSearchesData3);
                                jSONObjectPref3.set(recentSearchesData2);
                                jSONObjectPref2.set(recentSearchesData);
                                break;
                            }
                        }
                        break;
                    default:
                        String str = g;
                        Intrinsics.checkNotNullParameter(str, "$queriedEvent");
                        String str2 = b;
                        Intrinsics.checkNotNullParameter(str2, "$buttonText");
                        f.e.getClass();
                        f.a.c(str, str2, new float[0]);
                        break;
                }
            }
        });
    }

    private void sendFabActionEvent(String str) {
        AnalyticsManager.get().o(Constants.BOTTOM_ACTION_BAR, str);
    }

    @Override
    public void registerFilteredEvents(KeypadVisibilityEvents keypadVisibilityEvents) {
        this.keypadVisiblityEvents = keypadVisibilityEvents;
    }

    @Override
    public void unRegisterFilteredEvents(KeypadVisibilityEvents keypadVisibilityEvents) {
        if (this.keypadVisiblityEvents == keypadVisibilityEvents) {
            this.keypadVisiblityEvents = null;
        }
    }

    public static Intent createIntent(Context context, long j, String str, ExtractedInfo extractedInfo, boolean z, DataChangedInfo dataChangedInfo, String str2, ENTRYPOINT entrypoint) {
        if (StringUtils.x(str)) {
            CallAppApplication.get().runOnBackgroundThread(new t9(str, extractedInfo, j, 1));
        }
        Intent addFlags = new Intent(context, (Class<?>) ContactDetailsActivity.class).setFlags(268435456).addFlags(537198592);
        fillIntentWithCallData(addFlags, j, str, null, extractedInfo, z, dataChangedInfo, entrypoint);
        addFlags.putExtra(Constants.EXTRA_ENTRY_POINT, str2);
        return addFlags;
    }
}