package com.ss.android.ugc.aweme.commercialize.adsetting;

import X.070;
import X.AnonymousClass3S0;
import X.AnonymousClass3S1;
import X.AnonymousClass3S2;
import X.AnonymousClass3S3;
import X.AnonymousClass3S4;
import X.AnonymousClass3S5;
import X.C08862ha;
import X.C27553Rz;
import X.M12;
import X.Qeg;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RadioGroup;
import com.bytedance.covode.number.Covode;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import kotlin.h.b.n;

public final class AdAuthorizationDialog extends AdBaseDialogFragment {
    public static final AnonymousClass3S2 LJFF = new AnonymousClass3S2((byte) 0);
    public String LIZ = "";
    public AnonymousClass3S5 LIZIZ;
    public long LIZJ = 30;
    public long LIZLLL;
    public long LJ;
    public HashMap LJI;

    static {
        Covode.recordClassIndex(58255);
    }

    public final int LIZ(long j) {
        if (j == 7) {
            return 0;
        }
        if (j == 30) {
            return 1;
        }
        if (j == 60) {
            return 2;
        }
        return j == 365 ? 3 : -1;
    }

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

    public final void LIZ() {
        HashMap hashMap = this.LJI;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        LIZ();
    }

    private final void LIZ(View view, int i) {
        ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
        if (!(layoutParams instanceof ViewGroup.MarginLayoutParams)) {
            layoutParams = null;
        }
        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
        if (marginLayoutParams != null) {
            marginLayoutParams.topMargin = i;
            view.setLayoutParams(marginLayoutParams);
        }
    }

    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        Qeg LIZ2 = LIZ(2131372426);
        n.LIZIZ(LIZ2, "");
        LIZ2.setText(this.LIZ);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.getDefault());
        if (this.LIZLLL != 0) {
            Qeg LIZ3 = LIZ(2131372152);
            n.LIZIZ(LIZ3, "");
            LIZ3.setVisibility(0);
            long j = this.LJ + (this.LIZJ * 24 * 60 * 60);
            Qeg LIZ4 = LIZ(2131372152);
            n.LIZIZ(LIZ4, "");
            LIZ4.setText(getResources().getString(2131821754) + ":\n" + simpleDateFormat.format(Long.valueOf(this.LIZLLL * 1000)) + " - " + simpleDateFormat.format(new Date(j * 1000)));
            LIZ(2131371805).setOnClickListener(new AnonymousClass3S1(this));
            LIZ(2131371776).setOnClickListener(new AnonymousClass3S4(this));
            Qeg LIZ5 = LIZ(2131371805);
            n.LIZIZ(LIZ5, "");
            LIZ5.setText(getResources().getString(2131831186));
            Qeg LIZ6 = LIZ(2131371776);
            n.LIZIZ(LIZ6, "");
            LIZ6.setText(getResources().getString(2131832302));
            Qeg LIZ7 = LIZ(2131371776);
            n.LIZIZ(LIZ7, "");
            LIZ(2131371776).setTextColor(070.LIZJ(LIZ7.getContext(), 2131099731));
            Qeg LIZ8 = LIZ(2131371776);
            n.LIZIZ(LIZ8, "");
            LIZ8.setGravity(17);
            Qeg LIZ9 = LIZ(2131371805);
            n.LIZIZ(LIZ9, "");
            LIZ(LIZ9, C08862ha.LIZ(6.0d));
            Qeg LIZ10 = LIZ(2131371776);
            n.LIZIZ(LIZ10, "");
            LIZ(LIZ10, C08862ha.LIZ(12.0d));
        } else {
            Qeg LIZ11 = LIZ(2131372152);
            n.LIZIZ(LIZ11, "");
            LIZ11.setVisibility(8);
            LIZ(2131371805).setOnClickListener(new AnonymousClass3S0(this));
            Qeg LIZ12 = LIZ(2131371805);
            n.LIZIZ(LIZ12, "");
            LIZ12.setText(getResources().getString(2131821737));
            Qeg LIZ13 = LIZ(2131371776);
            n.LIZIZ(LIZ13, "");
            LIZ13.setText(getResources().getString(2131823745));
            Qeg LIZ14 = LIZ(2131371776);
            n.LIZIZ(LIZ14, "");
            LIZ(2131371776).setTextColor(070.LIZJ(LIZ14.getContext(), 2131099758));
            Qeg LIZ15 = LIZ(2131371776);
            n.LIZIZ(LIZ15, "");
            LIZ15.setGravity(8388611);
            Qeg LIZ16 = LIZ(2131371805);
            n.LIZIZ(LIZ16, "");
            LIZ(LIZ16, C08862ha.LIZ(16.0d));
            Qeg LIZ17 = LIZ(2131371776);
            n.LIZIZ(LIZ17, "");
            LIZ(LIZ17, C08862ha.LIZ(16.0d));
        }
        ((RadioGroup) LIZ(2131369569)).setOnCheckedChangeListener(new C27553Rz(this, simpleDateFormat));
        ((ImageView) view.findViewById(2131366353)).setOnClickListener(new AnonymousClass3S3(this));
    }
}
