package com.ss.android.ugc.aweme.kids.choosemusic.activity;

import X.0AA;
import X.0AP;
import X.4TL;
import X.8gF;
import X.C5095LuY;
import X.OUh;
import X.SNU;
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;
import com.bytedance.vcloud.abrmodule.ABRConfig;
import com.ss.android.ugc.aweme.kids.choosemusic.fragment.HotMusicListFragment;
import com.ss.android.ugc.aweme.kids.choosemusic.fragment.MusicSheetFragment;

public class MusicDetailListActivity extends SNU {
    static {
        Covode.recordClassIndex(89201);
    }

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

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

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

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

    public void onWindowFocusChanged(boolean z) {
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.kids.choosemusic.activity.MusicDetailListActivity", "onWindowFocusChanged", true);
        MusicDetailListActivity.super.onWindowFocusChanged(z);
    }

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

    /* JADX WARNING: type inference failed for: r13v0, types: [X.1hK, com.ss.android.ugc.aweme.kids.choosemusic.activity.MusicDetailListActivity, X.SNU, android.app.Activity] */
    public void onCreate(Bundle bundle) {
        int intExtra;
        String str;
        8gF.LIZ(this, bundle);
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.kids.choosemusic.activity.MusicDetailListActivity", "onCreate", true);
        4TL r1 = new 4TL((byte) 0);
        r1.LIZ = true;
        r1.LJII = 2131099659;
        activityConfiguration(new C5095LuY(r1));
        MusicDetailListActivity.super.onCreate(bundle);
        setContentView(2131560273);
        if (getIntent() != null) {
            String LIZ = LIZ(getIntent(), "cid");
            int intExtra2 = getIntent().getIntExtra("music_class_level", 0);
            if (!TextUtils.isEmpty(LIZ)) {
                intExtra = 2;
            } else {
                intExtra = getIntent().getIntExtra("music_type", 1);
            }
            if (intExtra2 != 1) {
                switch (intExtra) {
                    case 1:
                        str = "hot_music_list";
                        break;
                    case 2:
                        str = "music_class_sheet";
                        break;
                    case 3:
                        str = "local_music_list";
                        break;
                    case 4:
                        str = "tag_music_sheet";
                        break;
                    case 5:
                        str = "local_music_list_shoot";
                        break;
                    case ABRConfig.ABR_PLAYER_DISPLAY_WIDTH_KEY:
                        str = "local_music_list_edit";
                        break;
                    case ABRConfig.ABR_PLAYER_DISPLAY_HEIGHT_KEY:
                        break;
                    default:
                        str = "";
                        break;
                }
            } else {
                intExtra = 7;
            }
            str = "local_second_level_music_list_edit";
            0AA supportFragmentManager = getSupportFragmentManager();
            Fragment LIZ2 = supportFragmentManager.LIZ(str);
            if (LIZ2 == null) {
                Intent intent = getIntent();
                if (intExtra != 1) {
                    if (intExtra != 2) {
                        if (intExtra == 4) {
                            int intExtra3 = intent.getIntExtra("com.ss.android.ugc.aweme.intent.extra.EXTRA_MUSIC_TYPE", 1);
                            LIZ2 = new MusicSheetFragment();
                            Bundle bundle2 = new Bundle();
                            bundle2.putInt("com.ss.android.ugc.aweme.intent.extra.EXTRA_MUSIC_TYPE", intExtra3);
                            LIZ2.setArguments(bundle2);
                        } else if (intExtra != 7) {
                            LIZ2 = HotMusicListFragment.LIZ(intent.getIntExtra("com.ss.android.ugc.aweme.intent.extra.EXTRA_MUSIC_TYPE", 1));
                        }
                    }
                    LIZ2 = OUh.LIZ(intent);
                } else {
                    LIZ2 = HotMusicListFragment.LIZ(intent.getIntExtra("com.ss.android.ugc.aweme.intent.extra.EXTRA_MUSIC_TYPE", 1));
                }
            }
            0AP LIZ3 = supportFragmentManager.LIZ();
            LIZ3.LIZIZ(2131365158, LIZ2, str);
            LIZ3.LIZJ();
        }
        ActivityAgent.onTrace("com.ss.android.ugc.aweme.kids.choosemusic.activity.MusicDetailListActivity", "onCreate", false);
    }

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