package com.ss.android.ugc.aweme.profile.ui;

import X.0AP;
import X.0CH;
import X.3i8;
import X.4TL;
import X.8gF;
import X.BRl;
import X.C4154EcQ;
import X.C6253FOn;
import X.C6255FOp;
import X.M12;
import X.Ryq;
import X.S1r;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.fragment.app.Fragment;
import com.bytedance.apm.agent.v2.instrumentation.ActivityAgent;
import com.bytedance.covode.number.Covode;
import com.bytedance.sysoptimizer.EnterTransitionCrashOptimizer;

public class ProfileEditActivity extends C6253FOn {
    public BRl<MusProfileEditFragment> LIZ;

    static {
        Covode.recordClassIndex(99050);
    }

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

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

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

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

    public void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.profile.ui.ProfileEditActivity", "onWindowFocusChanged", true);
        ProfileEditActivity.super.onWindowFocusChanged(z);
    }

    public void onBackPressed() {
        ((ProfileEditFragment) this.LIZ.get()).LJIIJJI();
    }

    /* JADX WARNING: type inference failed for: r1v0, types: [X.SNU, com.ss.android.ugc.aweme.profile.ui.ProfileEditActivity, android.app.Activity] */
    public void onStop() {
        8gF.LIZLLL(this);
        ProfileEditActivity.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:13:0x0057, code lost:
        if (r11.getY() < ((float) r5)) goto L_0x0072;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:17:0x006f, code lost:
        if (r1.hideSoftInputFromWindow(r3.getWindowToken(), 2) == false) goto L_0x0072;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public boolean dispatchTouchEvent(android.view.MotionEvent r11) {
        /*
            r10 = this;
            X.BRl<com.ss.android.ugc.aweme.profile.ui.MusProfileEditFragment> r0 = r10.LIZ
            java.lang.Object r4 = r0.get()
            androidx.fragment.app.Fragment r4 = (androidx.fragment.app.Fragment) r4
            int r0 = r11.getAction()
            r9 = 1
            r8 = 0
            if (r0 != 0) goto L_0x0072
            X.1hK r0 = r4.getActivity()
            android.view.View r3 = r0.getCurrentFocus()
            r2 = 2
            if (r3 == 0) goto L_0x0072
            boolean r0 = r3 instanceof android.widget.EditText
            if (r0 == 0) goto L_0x0072
            int[] r1 = new int[r2]
            r1 = {0, 0} // fill-array
            r3.getLocationInWindow(r1)
            r0 = r1[r8]
            r7 = r1[r9]
            int r5 = r3.getHeight()
            int r5 = r5 + r7
            int r6 = r3.getWidth()
            int r6 = r6 + r0
            float r1 = r11.getX()
            float r0 = (float) r0
            int r0 = (r1 > r0 ? 1 : (r1 == r0 ? 0 : -1))
            if (r0 <= 0) goto L_0x0059
            float r1 = r11.getX()
            float r0 = (float) r6
            int r0 = (r1 > r0 ? 1 : (r1 == r0 ? 0 : -1))
            if (r0 >= 0) goto L_0x0059
            float r1 = r11.getY()
            float r0 = (float) r7
            int r0 = (r1 > r0 ? 1 : (r1 == r0 ? 0 : -1))
            if (r0 <= 0) goto L_0x0059
            float r1 = r11.getY()
            float r0 = (float) r5
            int r0 = (r1 > r0 ? 1 : (r1 == r0 ? 0 : -1))
            if (r0 < 0) goto L_0x0072
        L_0x0059:
            X.1hK r1 = r4.getActivity()
            java.lang.String r0 = "input_method"
            java.lang.Object r1 = com.ss.android.ugc.aweme.profile.ui.ProfileEditFragment.LIZ((android.content.Context) r1, (java.lang.String) r0)
            android.view.inputmethod.InputMethodManager r1 = (android.view.inputmethod.InputMethodManager) r1
            if (r1 == 0) goto L_0x0072
            android.os.IBinder r0 = r3.getWindowToken()
            boolean r0 = r1.hideSoftInputFromWindow(r0, r2)
            if (r0 == 0) goto L_0x0072
        L_0x0071:
            return r9
        L_0x0072:
            boolean r0 = super.dispatchTouchEvent(r11)
            if (r0 == 0) goto L_0x0079
            goto L_0x0071
        L_0x0079:
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: com.ss.android.ugc.aweme.profile.ui.ProfileEditActivity.dispatchTouchEvent(android.view.MotionEvent):boolean");
    }

    /* JADX WARNING: type inference failed for: r9v0, types: [X.FOn, X.0CH, X.1hK, X.SNU, java.lang.Object, com.ss.android.ugc.aweme.profile.ui.ProfileEditActivity, android.app.Activity] */
    public void onCreate(Bundle bundle) {
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.profile.ui.ProfileEditActivity", "onCreate", true);
        4TL r1 = new 4TL((byte) 0);
        r1.LIZ = true;
        r1.LJII = 2131099659;
        activityConfiguration(new C6255FOp(r1));
        super.onCreate(bundle);
        setContentView(2131558942);
        0AP LIZ2 = getSupportFragmentManager().LIZ();
        if (!((MusProfileEditFragment) this.LIZ.get()).LJIILJJIL) {
            Fragment fragment = (Fragment) this.LIZ.get();
            Bundle bundle2 = new Bundle();
            if (getIntent() != null) {
                bundle2.putInt("jump_school_edit", getIntent().getIntExtra("jump_school_edit", 0));
                if (TextUtils.equals(LIZ(getIntent(), "enter_from"), "message")) {
                    bundle2.putInt("need_focus_id_input", 3);
                } else {
                    bundle2.putInt("need_focus_id_input", getIntent().getIntExtra("need_focus_id_input", 0));
                }
                bundle2.putInt("need_focus_id_input", getIntent().getIntExtra("need_focus_id_input", 0));
                bundle2.putString("enter_from", LIZ(getIntent(), "enter_from"));
                bundle2.putString("enter_method", LIZ(getIntent(), "enter_method"));
                bundle2.putBoolean("change_to_ba", getIntent().getBooleanExtra("change_to_ba", false));
                getIntent();
            }
            fragment.setArguments(bundle2);
            LIZ2.LIZIZ(2131365158, (Fragment) this.LIZ.get(), "user_profile_edit_fragment");
            LIZ2.LIZIZ();
        }
        if (Ryq.LIZ()) {
            Ryq.LIZJ.LIZ((0CH) this);
            M12.LIZ(this);
            S1r.LIZ.LIZ().LIZIZ(new C4154EcQ(this));
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.profile.ui.ProfileEditActivity", "onCreate", false);
    }

    public static String LIZ(Intent intent, String str) {
        try {
            return intent.getStringExtra(str);
        } catch (Exception unused) {
            return null;
        }
    }

    public static void LIZ(Activity activity, Intent intent) {
        3i8.LIZ(intent, activity);
        activity.startActivity(intent);
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        ProfileEditActivity.super.onActivityResult(i, i2, intent);
        ((Fragment) this.LIZ.get()).onActivityResult(i, i2, intent);
    }
}
