package com.martsnew.tv.ui.continuewatch;

import A5.f;
import A5.g;
import A5.h;
import A6.k;
import C5.a;
import C5.b;
import C5.i;
import C5.o;
import C5.p;
import C5.q;
import K2.e;
import P6.n;
import U.c;
import Z6.AbstractC0385z;
import Z6.r0;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.leanback.widget.AbstractC0458c0;
import androidx.leanback.widget.C0468h0;
import androidx.leanback.widget.X;
import androidx.lifecycle.P;
import com.google.android.gms.internal.measurement.AbstractC0707u1;
import com.martsnew.domain.model.Movie;
import com.martsnew.tv.R;
import java.lang.reflect.InvocationTargetException;
import k5.C1101a;
import n4.u0;
import r5.C1505j;
import u5.C0;
import u5.K0;
import y5.InterfaceC1762g;

/* JADX INFO: loaded from: classes.dex */
public final class TvContinueWatchFragment extends a implements InterfaceC1762g {

    /* JADX INFO: renamed from: M1, reason: collision with root package name */
    public static final /* synthetic */ int f11137M1 = 0;

    /* JADX INFO: renamed from: I1, reason: collision with root package name */
    public final e f11138I1;

    /* JADX INFO: renamed from: J1, reason: collision with root package name */
    public final k f11139J1;

    /* JADX INFO: renamed from: K1, reason: collision with root package name */
    public K0 f11140K1;

    /* JADX INFO: renamed from: L1, reason: collision with root package name */
    public C0 f11141L1;

    public TvContinueWatchFragment() {
        A6.e eVarJ = AbstractC0707u1.j(new f(5, new f(4, this)));
        this.f11138I1 = new e(n.a(q.class), new g(eVarJ, 4), new h(this, eVarJ, 2), new g(eVarJ, 5));
        this.f11139J1 = new k(new b(0));
    }

    @Override // y5.AbstractC1757b, androidx.leanback.app.r, h0.ComponentCallbacksC1023x
    public final View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        View view;
        ImageView imageView;
        View view2;
        P6.g.e(layoutInflater, "inflater");
        View viewG = super.G(layoutInflater, viewGroup, bundle);
        int i = C0.f17523M;
        C0 c02 = (C0) c.b(layoutInflater, R.layout.layout_button_back, viewGroup, false);
        this.f11141L1 = c02;
        if (c02 != null && (view2 = c02.f6656z) != null) {
            ViewGroup.LayoutParams layoutParams = view2.getLayoutParams();
            if (layoutParams == null) {
                throw new NullPointerException("null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
            }
            FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
            layoutParams2.width = s().getDimensionPixelSize(R.dimen.dp_60);
            layoutParams2.height = s().getDimensionPixelSize(R.dimen.dp_60);
            view2.setLayoutParams(layoutParams2);
        }
        C0 c03 = this.f11141L1;
        if (c03 != null && (imageView = c03.f17524K) != null) {
            imageView.setOnClickListener(new C5.c(0, this));
        }
        K0 k0M = K0.M(layoutInflater, viewGroup);
        this.f11140K1 = k0M;
        if (k0M != null && (view = k0M.f6656z) != null) {
            ViewGroup.LayoutParams layoutParams3 = view.getLayoutParams();
            if (layoutParams3 == null) {
                throw new NullPointerException("null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
            }
            FrameLayout.LayoutParams layoutParams4 = (FrameLayout.LayoutParams) layoutParams3;
            layoutParams4.width = -1;
            layoutParams4.height = -1;
            view.setLayoutParams(layoutParams4);
        }
        C0 c04 = this.f11141L1;
        W2.g.H(viewG, c04 != null ? c04.f6656z : null);
        return viewG;
    }

    @Override // y5.AbstractC1757b
    public final void H0() {
        AbstractC0385z.r(P.f(this), null, new i(this, null), 3);
    }

    @Override // y5.AbstractC1757b
    public final boolean L0() {
        return false;
    }

    @Override // y5.AbstractC1757b, androidx.leanback.widget.T
    /* JADX INFO: renamed from: N0 */
    public final void e(X x8, Object obj, C0468h0 c0468h0, AbstractC0458c0 abstractC0458c0) throws IllegalAccessException, InvocationTargetException {
        Movie movie;
        super.e(x8, obj, c0468h0, abstractC0458c0);
        if (!(obj instanceof C1101a) || (movie = ((C1101a) obj).f13952k) == null) {
            return;
        }
        q qVarY0 = Y0();
        r0 r0Var = qVarY0.i;
        if (r0Var != null) {
            r0Var.b(null);
        }
        qVarY0.i = qVarY0.e(false, new p(qVarY0, movie, null));
    }

    @Override // y5.AbstractC1757b
    public final void O0(Movie movie) {
        P6.g.e(movie, "movie");
        u0.s(this).j(new C1505j(movie));
    }

    @Override // y5.AbstractC1757b
    public final void P0() throws IllegalAccessException, InvocationTargetException {
        W0(true);
        V0(true);
        U0(false);
        q qVarY0 = Y0();
        r0 r0Var = qVarY0.f1371j;
        if (r0Var != null) {
            r0Var.b(null);
        }
        qVarY0.f1371j = qVarY0.e(true, new o(qVarY0, null));
    }

    public final q Y0() {
        return (q) this.f11138I1.getValue();
    }

    @Override // y5.InterfaceC1762g
    public final void i() {
        C0 c02;
        ImageView imageView;
        ImageView imageView2;
        if (y()) {
            return;
        }
        C0 c03 = this.f11141L1;
        if ((c03 != null && (imageView2 = c03.f17524K) != null && imageView2.isFocused()) || (c02 = this.f11141L1) == null || (imageView = c02.f17524K) == null) {
            return;
        }
        imageView.requestFocus();
    }
}
