package com.ss.android.ugc.aweme.im.sdk.relations.ui.activity;

import X.0AA;
import X.0AP;
import X.4tr;
import X.8gF;
import X.BGN;
import X.C1103Icg;
import X.C1537Ijg;
import X.C1842Iob;
import X.EIE;
import X.SNU;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.fragment.app.Fragment;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;
import com.ss.android.ugc.aweme.im.sdk.group.feature.selector.ui.fragment.GroupMemberSelectFragment;
import com.ss.android.ugc.aweme.im.sdk.relations.ui.fragment.RelationSelectFragment;
import java.util.HashMap;
import kotlin.h.b.n;

public final class RelationSelectActivity extends SNU implements EIE {
    public static final C1537Ijg LIZ = new C1537Ijg((byte) 0);
    public Fragment LIZIZ;
    public HashMap LIZJ;

    static {
        Covode.recordClassIndex(86867);
    }

    public final String LJII() {
        return "contact_list";
    }

    public final void _$_clearFindViewByIdCache() {
        HashMap hashMap = this.LIZJ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final View _$_findCachedViewById(int i) {
        if (this.LIZJ == null) {
            this.LIZJ = new HashMap();
        }
        View view = (View) this.LIZJ.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.LIZJ.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity, X.SNU, android.app.Activity] */
    public final void onDestroy() {
        8gF.LJ(this);
        RelationSelectActivity.super.onDestroy();
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity, X.SNU, android.app.Activity] */
    public final void onPause() {
        8gF.LIZJ(this);
        RelationSelectActivity.super.onPause();
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity, X.SNU, android.app.Activity] */
    public final void onResume() {
        8gF.LIZIZ(this);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity", "onResume", true);
        RelationSelectActivity.super.onResume();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity", "onResume", false);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity, X.SNU, android.app.Activity] */
    public final void onStart() {
        8gF.LIZ(this);
        RelationSelectActivity.super.onStart();
    }

    public final void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity", "onWindowFocusChanged", true);
        RelationSelectActivity.super.onWindowFocusChanged(z);
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity, X.SNU, android.app.Activity] */
    public final void onStop() {
        8gF.LIZLLL(this);
        RelationSelectActivity.super.onStop();
        if (EnterTransitionCrashOptimizer.getContext() != null) {
            try {
                getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
            } catch (Throwable unused) {
            }
        }
        try {
            getWindow().getDecorView().getViewTreeObserver().dispatchOnPreDraw();
        } catch (Throwable unused2) {
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:21:0x004c, code lost:
        if ((r2 - r1.bottom) != 0) goto L_0x004e;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onBackPressed() {
        /*
            r4 = this;
            androidx.fragment.app.Fragment r3 = r4.LIZIZ
            boolean r0 = r3 instanceof com.ss.android.ugc.aweme.im.sdk.relations.ui.fragment.RelationSelectFragment
            if (r0 == 0) goto L_0x0051
            java.lang.String r0 = "null cannot be cast to non-null type com.ss.android.ugc.aweme.im.sdk.relations.ui.fragment.RelationSelectFragment"
            java.util.Objects.requireNonNull(r3, r0)
            com.ss.android.ugc.aweme.im.sdk.relations.ui.fragment.RelationSelectFragment r3 = (com.ss.android.ugc.aweme.im.sdk.relations.ui.fragment.RelationSelectFragment) r3
            X.Ilr r1 = r3.LIZ
            r0 = 1
            r0 = 0
            if (r1 == 0) goto L_0x004e
            X.1hK r0 = r3.getActivity()
            if (r0 == 0) goto L_0x005a
            X.1hK r0 = r3.getActivity()
            if (r0 == 0) goto L_0x0058
            android.view.Window r0 = r0.getWindow()
            if (r0 == 0) goto L_0x0058
            android.view.View r0 = r0.getDecorView()
            if (r0 == 0) goto L_0x0058
            int r2 = r0.getHeight()
        L_0x002f:
            android.graphics.Rect r1 = new android.graphics.Rect
            r1.<init>()
            X.1hK r0 = r3.getActivity()
            if (r0 == 0) goto L_0x0049
            android.view.Window r0 = r0.getWindow()
            if (r0 == 0) goto L_0x0049
            android.view.View r0 = r0.getDecorView()
            if (r0 == 0) goto L_0x0049
            r0.getWindowVisibleDisplayFrame(r1)
        L_0x0049:
            int r0 = r1.bottom
            int r2 = r2 - r0
            if (r2 == 0) goto L_0x005a
        L_0x004e:
            com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity.super.onBackPressed()
        L_0x0051:
            androidx.fragment.app.Fragment r0 = r4.LIZIZ
            boolean r0 = r0 instanceof com.ss.android.ugc.aweme.im.sdk.group.feature.selector.ui.fragment.GroupMemberSelectFragment
            if (r0 == 0) goto L_0x0085
            goto L_0x007a
        L_0x0058:
            r2 = 0
            goto L_0x002f
        L_0x005a:
            X.Ilr r1 = r3.LIZ
            if (r1 != 0) goto L_0x0061
            kotlin.h.b.n.LIZIZ()
        L_0x0061:
            X.Frd r0 = r1.LJIILJJIL
            if (r0 == 0) goto L_0x0074
            X.Frd r0 = r1.LJIILJJIL
            if (r0 != 0) goto L_0x006c
            kotlin.h.b.n.LIZIZ()
        L_0x006c:
            boolean r0 = r0.LIZLLL
            if (r0 == 0) goto L_0x0074
            r1.LJIIJ()
            goto L_0x0051
        L_0x0074:
            android.app.Activity r0 = r1.LJIJ
            r0.finish()
            goto L_0x0051
        L_0x007a:
            com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity.super.onBackPressed()     // Catch:{ Exception -> 0x007e }
            return
        L_0x007e:
            r0 = move-exception
            X.3Q4.LIZ(r0)
            r4.finish()
        L_0x0085:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity.onBackPressed():void");
    }

    public static Bundle LIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    /* JADX WARNING: type inference failed for: r7v0, types: [com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity, X.1hK, X.SNU, android.app.Activity] */
    public final void onCreate(Bundle bundle) {
        4tr serializableExtra;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity", "onCreate", true);
        activityConfiguration(C1842Iob.LIZ);
        RelationSelectActivity.super.onCreate(bundle);
        setContentView(2131559871);
        C1103Icg.LIZJ().setupStatusBar(this);
        0AA supportFragmentManager = getSupportFragmentManager();
        0AP LIZ2 = supportFragmentManager.LIZ();
        n.LIZIZ(LIZ2, "");
        Fragment LIZ3 = supportFragmentManager.LIZ("relation_fragment_tag");
        this.LIZIZ = LIZ3;
        if (LIZ3 == null) {
            if (BGN.LIZ.LIZ() && (serializableExtra = getIntent().getSerializableExtra("member_select_config")) != null) {
                this.LIZIZ = new GroupMemberSelectFragment();
                Bundle bundle2 = new Bundle();
                bundle2.putSerializable("init_config", serializableExtra);
                Fragment fragment = this.LIZIZ;
                if (fragment != null) {
                    fragment.setArguments(bundle2);
                }
                LIZ2.LIZ(2130772011, 2130772013);
            }
            if (this.LIZIZ == null) {
                RelationSelectFragment relationSelectFragment = new RelationSelectFragment();
                this.LIZIZ = relationSelectFragment;
                relationSelectFragment.setArguments(LIZ(getIntent()));
            }
        }
        Fragment fragment2 = this.LIZIZ;
        if (fragment2 == null) {
            n.LIZIZ();
        }
        LIZ2.LIZIZ(2131364981, fragment2, "relation_fragment_tag");
        LIZ2.LIZJ();
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.im.sdk.relations.ui.activity.RelationSelectActivity", "onCreate", false);
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        RelationSelectActivity.super.onActivityResult(i, i2, intent);
        Fragment fragment = this.LIZIZ;
        if (fragment != null) {
            fragment.onActivityResult(i, i2, intent);
        }
    }
}
