package com.ss.android.ugc.aweme.setting.page.datasave.zerorating;

import X.AnonymousClass367;
import X.AnonymousClass4S6;
import X.AnonymousClass4S7;
import X.AnonymousClass4S8;
import X.C03012Pr;
import X.C16832uR;
import X.C30953c7;
import X.CZv;
import X.DZp;
import X.Ls2;
import X.M12;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.api.IZeroRatingService;
import com.ss.android.ugc.aweme.setting.page.BasePage;
import com.ss.android.ugc.aweme.zerorating.ZeroRatingServiceImpl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
import kotlin.h.b.n;

@CZv
public final class FreeDataPage extends BasePage {
    public SparseArray LJ;

    static {
        Covode.recordClassIndex(105990);
    }

    public final int LIZ() {
        return 2131561242;
    }

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

    public final void LJI() {
        SparseArray sparseArray = this.LJ;
        if (sparseArray != null) {
            sparseArray.clear();
        }
    }

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

    public static Bundle LIZ(Intent intent) {
        try {
            return intent.getExtras();
        } catch (Exception unused) {
            return null;
        }
    }

    public final void LIZ(Activity activity) {
        String str;
        M12.LIZ(activity);
        C16832uR r2 = new C16832uR();
        String string = activity.getString(2131823660);
        n.LIZIZ(string, "");
        AnonymousClass367.LIZ(r2, string, (Ls2<C03012Pr>) new AnonymousClass4S7(this));
        ((C30953c7) activity.findViewById(2131371289)).setNavActions(r2);
        activity.findViewById(2131367123).LIZ(new Class[]{FreeDataCell.class});
        Intent intent = activity.getIntent();
        n.LIZIZ(intent, "");
        Bundle LIZ = LIZ(intent);
        if (LIZ != null) {
            Serializable serializable = LIZ.getSerializable("list");
            if (serializable != null) {
                n.LIZIZ(serializable, "");
                Objects.requireNonNull(serializable, "null cannot be cast to non-null type kotlin.collections.ArrayList<com.bytedance.sdk.mobiledata.entity.DataPlanInfo.DataPlanEntity> /* = java.util.ArrayList<com.bytedance.sdk.mobiledata.entity.DataPlanInfo.DataPlanEntity> */");
                Iterator it = ((ArrayList) serializable).iterator();
                str = "";
                while (it.hasNext()) {
                    AnonymousClass4S8 r0 = (AnonymousClass4S8) it.next();
                    n.LIZIZ(r0, "");
                    String title = r0.getTitle();
                    n.LIZIZ(title, "");
                    String content = r0.getContent();
                    n.LIZIZ(content, "");
                    String iconUrl = r0.getIconUrl();
                    n.LIZIZ(iconUrl, "");
                    String planId = r0.getPlanId();
                    n.LIZIZ(planId, "");
                    String url = r0.getUrl();
                    n.LIZIZ(url, "");
                    AnonymousClass4S6 r6 = new AnonymousClass4S6(title, content, iconUrl, planId, url);
                    str = str + r0.getPlanId() + ",";
                    DZp findViewById = activity.findViewById(2131367123);
                    n.LIZIZ(findViewById, "");
                    findViewById.getState().LIZ(r6);
                }
            } else {
                return;
            }
        } else {
            str = "";
        }
        IZeroRatingService LJFF = ZeroRatingServiceImpl.LJFF();
        n.LIZIZ(LJFF, "");
        LJFF.LIZJ().LIZIZ(str);
    }
}
