package com.ss.android.ugc.aweme.search.feedback.single.ui;

import X.070;
import X.0HH;
import X.2Pr;
import X.2uR;
import X.3YD;
import X.3cA;
import X.3cC;
import X.3cI;
import X.C4527LlO;
import X.C4765LpE;
import X.C4766LpF;
import X.C4767LpG;
import X.C4768LpH;
import X.C4769LpI;
import X.C4797Lpk;
import X.C4939Ls2;
import X.CbG;
import X.M12;
import X.Qeg;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import androidx.fragment.app.Fragment;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.discover.model.FeedbackMultipleChoice;
import java.util.Map;
import kotlin.h.b.n;

public final class SearchFeedbackOtherFragment extends Fragment implements 3YD {
    public static final C4769LpI LJIIIIZZ = new C4769LpI((byte) 0);
    public View LIZ;
    public int LIZIZ = -1;
    public int LIZJ = -1;
    public FeedbackMultipleChoice LIZLLL;
    public Map<String, String> LJ;
    public int LJFF = -1;
    public C4939Ls2<2Pr> LJI;
    public int LJII = -1;
    public ViewTreeObserver.OnGlobalLayoutListener LJIIIZ;
    public SparseArray LJIIJ;

    static {
        Covode.recordClassIndex(104135);
    }

    public final View LIZ(int i) {
        if (this.LJIIJ == null) {
            this.LJIIJ = new SparseArray();
        }
        View view = (View) this.LJIIJ.get(i);
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJIIJ.put(i, findViewById);
        return findViewById;
    }

    public final /* synthetic */ void onDestroyView() {
        SearchFeedbackOtherFragment.super.onDestroyView();
        SparseArray sparseArray = this.LJIIJ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

    public final void onPause() {
        SearchFeedbackOtherFragment.super.onPause();
        View view = this.LIZ;
        if (view == null) {
            n.LIZ("");
        }
        view.getViewTreeObserver().removeOnGlobalLayoutListener(this.LJIIIZ);
    }

    public final void onResume() {
        SearchFeedbackOtherFragment.super.onResume();
        View view = this.LIZ;
        if (view == null) {
            n.LIZ("");
        }
        view.getViewTreeObserver().addOnGlobalLayoutListener(this.LJIIIZ);
    }

    public final 2uR ch_() {
        String str;
        Resources resources;
        2uR r5 = new 2uR();
        3cC r3 = new 3cC();
        Context context = getContext();
        if (context == null || (resources = context.getResources()) == null || (str = resources.getString(2131820914)) == null) {
            str = "";
        }
        n.LIZIZ(str, "");
        r3.LIZ(str);
        r5.LIZ(r3);
        3cA r1 = new 3cA();
        r1.LIZ(2131755735);
        r1.LIZ(new C4768LpH(this));
        r5.LIZIZ(new 3cI[]{r1});
        3cA r12 = new 3cA();
        r12.LIZ(2131755248);
        r12.LIZ(new C4767LpG(this));
        r5.LIZ(new 3cI[]{r12});
        return r5;
    }

    public final View LIZ(View view, int i) {
        ViewGroup.MarginLayoutParams marginLayoutParams = null;
        if (view == null) {
            return null;
        }
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
            marginLayoutParams = layoutParams;
        }
        ViewGroup.MarginLayoutParams marginLayoutParams2 = marginLayoutParams;
        if (marginLayoutParams2 != null) {
            marginLayoutParams2.bottomMargin = i;
        }
        view.requestLayout();
        return view;
    }

    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ((Object) view);
        SearchFeedbackOtherFragment.super.onViewCreated(view, bundle);
        View view2 = this.LIZ;
        if (view2 == null) {
            n.LIZ("");
        }
        view2.getLayoutParams().height = this.LIZIZ;
        CbG LIZ2 = LIZ(2131369918);
        n.LIZIZ(LIZ2, "");
        LIZ2.setEnabled(false);
        LIZ(2131369918).setOnClickListener(new C4765LpE(this));
        ((C4797Lpk) LIZ(2131369914)).addTextChangedListener(new C4766LpF(this));
        Context context = getContext();
        if (context != null) {
            n.LIZIZ(context, "");
            String string = context.getResources().getString(2131820915);
            n.LIZIZ(string, "");
            SpannableString spannableString = new SpannableString(string + " *");
            spannableString.setSpan(new ForegroundColorSpan(070.LIZJ(context, 2131100277)), spannableString.length() + -1, spannableString.length(), 33);
            Qeg LIZ3 = LIZ(2131369917);
            n.LIZIZ(LIZ3, "");
            LIZ3.setText(spannableString);
        }
        this.LJIIIZ = new C4527LlO(this);
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ((Object) layoutInflater);
        View LIZ2 = 0HH.LIZ(layoutInflater, 2131561203, viewGroup, false);
        n.LIZIZ(LIZ2, "");
        this.LIZ = LIZ2;
        if (LIZ2 == null) {
            n.LIZ("");
        }
        return LIZ2;
    }
}
