package com.bytedance.ies.uikit.recyclerview;

import X.9Y3;
import X.OhZ;
import X.Ql4;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;

public class LoadingStatusView$Builder {
    public Context mContext;
    public View mEmptyView;
    public View mErrorView;
    public View mLoadingView;

    static {
        Covode.recordClassIndex(31208);
    }

    private OhZ createProgressView() {
        return INVOKEVIRTUAL_com_bytedance_ies_uikit_recyclerview_LoadingStatusView$Builder_com_ss_android_ugc_aweme_memory_MemoryCacheManager_inflateLancet(LayoutInflater.from(this.mContext), 2131560572, (ViewGroup) null);
    }

    public LoadingStatusView$Builder setEmptyView(View view) {
        this.mEmptyView = view;
        return this;
    }

    public LoadingStatusView$Builder setErrorView(View view) {
        this.mErrorView = view;
        return this;
    }

    public LoadingStatusView$Builder setLoadingView(View view) {
        this.mLoadingView = view;
        return this;
    }

    public LoadingStatusView$Builder(Context context) {
        if (context != null) {
            this.mContext = context;
            return;
        }
        throw new IllegalArgumentException("LoadingStatusView.Builder:Context can not be null");
    }

    public LoadingStatusView$Builder setLoadingText(int i) {
        setLoadingView(createDefaultView(i));
        return this;
    }

    public static LoadingStatusView$Builder createDefaultBuilder(Context context) {
        LoadingStatusView$Builder loadingStatusView$Builder = new LoadingStatusView$Builder(context);
        loadingStatusView$Builder.setEmptyText(2131826713);
        loadingStatusView$Builder.setLoadingText(2131826715);
        loadingStatusView$Builder.setErrorText(2131826714, (View.OnClickListener) null);
        return loadingStatusView$Builder;
    }

    private View createDefaultView(int i) {
        TextView textView = (TextView) INVOKEVIRTUAL_com_bytedance_ies_uikit_recyclerview_LoadingStatusView$Builder_com_ss_android_ugc_aweme_memory_MemoryCacheManager_inflateLancet(LayoutInflater.from(this.mContext), 2131560573, (ViewGroup) null);
        textView.setText(i);
        return textView;
    }

    public LoadingStatusView$Builder setEmptyText(int i) {
        TextView textView = (TextView) INVOKEVIRTUAL_com_bytedance_ies_uikit_recyclerview_LoadingStatusView$Builder_com_ss_android_ugc_aweme_memory_MemoryCacheManager_inflateLancet(LayoutInflater.from(this.mContext), 2131562295, (ViewGroup) null);
        textView.setText(i);
        setEmptyView(textView);
        return this;
    }

    public LoadingStatusView$Builder setUseProgressBar(int i) {
        OhZ createProgressView = createProgressView();
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.height = i;
        layoutParams.width = i;
        layoutParams.gravity = 17;
        createProgressView.setLayoutParams(layoutParams);
        setLoadingView(createProgressView);
        return this;
    }

    public LoadingStatusView$Builder setErrorText(int i, View.OnClickListener onClickListener) {
        View createDefaultView = createDefaultView(i);
        createDefaultView.setOnClickListener(onClickListener);
        setErrorView(createDefaultView);
        return this;
    }

    public static View INVOKEVIRTUAL_com_bytedance_ies_uikit_recyclerview_LoadingStatusView$Builder_com_ss_android_ugc_aweme_memory_MemoryCacheManager_inflateLancet(LayoutInflater layoutInflater, int i, ViewGroup viewGroup) {
        MethodCollector.i(15532);
        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);
                MethodCollector.o(15532);
                return inflate;
            }
        }
        View inflate2 = layoutInflater.inflate(i, viewGroup);
        MethodCollector.o(15532);
        return inflate2;
    }
}
