package com.ss.android.ugc.aweme.watch.history.ui;

import X.070;
import X.0EG;
import X.78T;
import X.7he;
import X.9Y3;
import X.AnonymousClass4PQ;
import X.AnonymousClass4PR;
import X.AnonymousClass4PS;
import X.AnonymousClass4PT;
import X.AnonymousClass4PU;
import X.AnonymousClass4PV;
import X.C57674e7;
import X.C58044ei;
import X.Crj;
import X.Da2;
import X.DaP;
import X.DdD;
import X.DdJ;
import X.DdL;
import X.DdP;
import X.DdQ;
import X.FjH;
import X.M12;
import X.OQZ;
import X.PMk;
import X.PMp;
import X.Ql4;
import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.ies.powerlist.footer.PowerLoadingCell;
import java.util.Objects;
import kotlin.h.b.n;

public final class WatchHistoryFooterCell extends PowerLoadingCell {
    public static final /* synthetic */ PMp[] LIZ = {new PMk(WatchHistoryFooterCell.class, "control", "getControl()Lcom/ss/android/ugc/aweme/watch/history/ui/IFooterControl;", 0)};
    public AnonymousClass4PV LIZIZ;
    public TextView LJIIIZ;
    public TextView LJIIJ;
    public OQZ LJIIJJI;
    public final 78T LJIIL = new C57674e7(this);
    public final Crj LJIILIIL = 7he.LIZ(new AnonymousClass4PR(this));
    public final Crj LJIILJJIL = 7he.LIZ(new AnonymousClass4PS(this));

    public final AnonymousClass4PQ LIZLLL() {
        return (AnonymousClass4PQ) this.LJIIL.LIZ(this, LIZ[0]);
    }

    public final void LIZJ() {
        OQZ oqz = this.LJIIJJI;
        if (oqz != null) {
            oqz.LIZLLL();
        }
        OQZ oqz2 = this.LJIIJJI;
        if (oqz2 != null) {
            oqz2.LJFF();
        }
    }

    static {
        Covode.recordClassIndex(124110);
    }

    public final void bD_() {
        WatchHistoryFooterCell.super.bD_();
        OQZ oqz = this.itemView;
        Objects.requireNonNull(oqz, "null cannot be cast to non-null type com.bytedance.ies.dmt.ui.widget.DmtStatusView");
        this.LJIIJJI = oqz;
        OQZ oqz2 = this.itemView;
        n.LIZIZ(oqz2, "");
        Context context = oqz2.getContext();
        n.LIZIZ(context, "");
        int dimensionPixelSize = context.getResources().getDimensionPixelSize(2131165496);
        OQZ oqz3 = this.LJIIJJI;
        if (oqz3 != null) {
            oqz3.setLayoutParams(new 0EG(-1, dimensionPixelSize));
        }
        OQZ oqz4 = this.itemView;
        n.LIZIZ(oqz4, "");
        TextView textView = (TextView) LIZ(LayoutInflater.from(oqz4.getContext()), 2131562295);
        this.LJIIIZ = textView;
        if (textView != null) {
            textView.setGravity(17);
        }
        TextView textView2 = this.LJIIIZ;
        if (textView2 != null) {
            textView2.setText(2131826713);
        }
        TextView textView3 = this.LJIIIZ;
        if (textView3 != null) {
            OQZ oqz5 = this.itemView;
            n.LIZIZ(oqz5, "");
            textView3.setTextColor(070.LIZJ(oqz5.getContext(), 2131099750));
        }
        OQZ oqz6 = this.itemView;
        n.LIZIZ(oqz6, "");
        TextView textView4 = (TextView) LIZ(LayoutInflater.from(oqz6.getContext()), 2131562296);
        this.LJIIJ = textView4;
        if (textView4 != null) {
            textView4.setText(2131826712);
        }
        TextView textView5 = this.LJIIJ;
        if (textView5 != null) {
            textView5.setGravity(17);
        }
        TextView textView6 = this.LJIIJ;
        if (textView6 != null) {
            OQZ oqz7 = this.itemView;
            n.LIZIZ(oqz7, "");
            textView6.setTextColor(070.LIZJ(oqz7.getContext(), 2131099750));
        }
        OQZ oqz8 = this.LJIIJJI;
        if (oqz8 != null) {
            OQZ oqz9 = this.itemView;
            n.LIZIZ(oqz9, "");
            FjH LIZ2 = FjH.LIZ(oqz9.getContext());
            LIZ2.LIZIZ(this.LJIIIZ);
            LIZ2.LIZJ(this.LJIIJ);
            oqz8.setBuilder(LIZ2);
        }
        TextView textView7 = this.LJIIJ;
        if (textView7 != null) {
            textView7.setOnClickListener(new AnonymousClass4PT(this));
        }
    }

    public final /* bridge */ /* synthetic */ void LIZ(DaP daP) {
        LIZ((Da2) daP);
    }

    public final View LIZ(ViewGroup viewGroup) {
        M12.LIZ(viewGroup);
        return new OQZ(viewGroup.getContext());
    }

    public final void LIZ(Da2 da2) {
        RecyclerView recyclerView;
        CharSequence charSequence;
        TextView textView;
        M12.LIZ(da2);
        DdD ddD = da2.LIZ.LIZIZ;
        if (ddD instanceof DdQ) {
            LIZJ();
        } else if (ddD instanceof DdJ) {
            DdL ddL = ddD.LIZ;
            M12.LIZ(ddL);
            if (C58044ei.LIZ[ddL.ordinal()] == 1 && (recyclerView = (RecyclerView) this.LJIILIIL.getValue()) != null) {
                OQZ oqz = this.itemView;
                Objects.requireNonNull(oqz, "null cannot be cast to non-null type com.bytedance.ies.dmt.ui.widget.DmtStatusView");
                OQZ oqz2 = oqz;
                TextView textView2 = this.LJIIJ;
                if (textView2 != null) {
                    charSequence = textView2.getText();
                } else {
                    charSequence = null;
                }
                OQZ oqz3 = this.itemView;
                n.LIZIZ(oqz3, "");
                if (!TextUtils.equals(charSequence, oqz3.getResources().getString(2131831176)) && (textView = this.LJIIJ) != null) {
                    textView.setText(2131831176);
                }
                oqz2.LJII();
                if (this.LIZIZ == null) {
                    this.LIZIZ = new AnonymousClass4PV(recyclerView, (AnonymousClass4PU) this.LJIILJJIL.getValue());
                }
                AnonymousClass4PV r0 = this.LIZIZ;
                if (r0 != null) {
                    r0.LIZ = true;
                }
            }
        } else if (ddD instanceof DdP) {
            DdL ddL2 = ddD.LIZIZ;
            if (ddL2 == null || ddL2 == DdL.Refresh) {
                OQZ oqz4 = this.LJIIJJI;
                if (oqz4 != null) {
                    oqz4.LIZLLL();
                    return;
                }
                return;
            }
            OQZ oqz5 = this.LJIIJJI;
            if (oqz5 != null) {
                oqz5.LJI();
            }
        }
    }

    public static View LIZ(LayoutInflater layoutInflater, int i) {
        MethodCollector.i(1866);
        if (9Y3.LIZ(9Y3.LIZ(), true, "tiktok_tux_text_view_opt", false) && layoutInflater != null && layoutInflater.getFactory() == null && layoutInflater.getFactory2() == null) {
            try {
                layoutInflater.setFactory(new Ql4());
            } catch (Exception unused) {
                View inflate = layoutInflater.inflate(i, (ViewGroup) null);
                MethodCollector.o(1866);
                return inflate;
            }
        }
        View inflate2 = layoutInflater.inflate(i, (ViewGroup) null);
        MethodCollector.o(1866);
        return inflate2;
    }
}
