package androidx.leanback.app;

import android.os.Bundle;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.leanback.widget.L0;
import androidx.leanback.widget.M0;
import androidx.leanback.widget.N0;
import androidx.leanback.widget.TitleView;
import com.martsnew.tv.R;
import h0.ComponentCallbacksC1023x;
import q4.C1463c;

/* JADX INFO: loaded from: classes.dex */
public class h extends ComponentCallbacksC1023x {

    /* JADX INFO: renamed from: o0, reason: collision with root package name */
    public boolean f8220o0 = true;

    /* JADX INFO: renamed from: p0, reason: collision with root package name */
    public String f8221p0;
    public View q0;

    /* JADX INFO: renamed from: r0, reason: collision with root package name */
    public N0 f8222r0;

    /* JADX INFO: renamed from: s0, reason: collision with root package name */
    public C1463c f8223s0;

    @Override // h0.ComponentCallbacksC1023x
    public void J() {
        this.f13276V = true;
        this.f8223s0 = null;
        this.q0 = null;
        this.f8222r0 = null;
    }

    @Override // h0.ComponentCallbacksC1023x
    public final void O() {
        N0 n02 = this.f8222r0;
        if (n02 != null) {
            n02.a(false);
        }
        this.f13276V = true;
    }

    @Override // h0.ComponentCallbacksC1023x
    public void Q() {
        this.f13276V = true;
        N0 n02 = this.f8222r0;
        if (n02 != null) {
            n02.a(true);
        }
    }

    @Override // h0.ComponentCallbacksC1023x
    public void R(Bundle bundle) {
        bundle.putBoolean("titleShow", this.f8220o0);
    }

    @Override // h0.ComponentCallbacksC1023x
    public void S() {
        this.f13276V = true;
        if (this.f8222r0 != null) {
            i0(this.f8220o0);
            this.f8222r0.a(true);
        }
    }

    @Override // h0.ComponentCallbacksC1023x
    public void U(View view, Bundle bundle) {
        if (bundle != null) {
            this.f8220o0 = bundle.getBoolean("titleShow");
        }
        View view2 = this.q0;
        if (view2 == null || !(view instanceof ViewGroup)) {
            return;
        }
        C1463c c1463c = new C1463c((ViewGroup) view, view2);
        this.f8223s0 = c1463c;
        if (this.f8220o0) {
            TransitionManager.go((Scene) c1463c.f16266e, (Transition) c1463c.f16265d);
        } else {
            TransitionManager.go((Scene) c1463c.f16267f, (Transition) c1463c.f16264c);
        }
    }

    public final void f0(LayoutInflater layoutInflater, ViewGroup viewGroup) {
        TypedValue typedValue = new TypedValue();
        View viewInflate = layoutInflater.inflate((viewGroup == null || !viewGroup.getContext().getTheme().resolveAttribute(R.attr.browseTitleViewLayout, typedValue, true)) ? R.layout.lb_browse_title : typedValue.resourceId, viewGroup, false);
        if (viewInflate == null) {
            g0(null);
        } else {
            viewGroup.addView(viewInflate);
            g0(viewInflate.findViewById(R.id.browse_title_group));
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void g0(View view) {
        this.q0 = view;
        if (view == 0) {
            this.f8222r0 = null;
            this.f8223s0 = null;
            return;
        }
        N0 titleViewAdapter = ((M0) view).getTitleViewAdapter();
        this.f8222r0 = titleViewAdapter;
        ((L0) titleViewAdapter).f8469a.setTitle(this.f8221p0);
        ((L0) this.f8222r0).f8469a.setBadgeDrawable(null);
        View view2 = this.X;
        if (view2 instanceof ViewGroup) {
            this.f8223s0 = new C1463c((ViewGroup) view2, this.q0);
        }
    }

    public final void h0(int i) {
        N0 n02 = this.f8222r0;
        if (n02 != null) {
            TitleView titleView = ((L0) n02).f8469a;
            titleView.f8607t = i;
            if ((i & 2) == 2) {
                titleView.a();
            } else {
                titleView.f8604q.setVisibility(8);
                titleView.f8605r.setVisibility(8);
            }
            int i5 = 4;
            if (titleView.f8608u && (titleView.f8607t & 4) == 4) {
                i5 = 0;
            }
            titleView.f8606s.setVisibility(i5);
        }
        i0(true);
    }

    public final void i0(boolean z8) {
        if (z8 == this.f8220o0) {
            return;
        }
        this.f8220o0 = z8;
        C1463c c1463c = this.f8223s0;
        if (c1463c != null) {
            if (z8) {
                TransitionManager.go((Scene) c1463c.f16266e, (Transition) c1463c.f16265d);
            } else {
                TransitionManager.go((Scene) c1463c.f16267f, (Transition) c1463c.f16264c);
            }
        }
    }
}
