Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9

以下内容为反编译后的 ExperimentsActivity.java 源代码,内容仅作参考


package com.picsart.analytics.debug.components.experiments;

import android.app.ActionBar;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import androidx.activity.ComponentActivity;
import com.google.gson.Gson;
import com.picsart.analytics.PAanalytics;
import com.picsart.analytics.debug.components.experiments.ExperimentsActivity;
import com.picsart.analytics.debug.components.experiments.SelectVariantActivity;
import com.picsart.analytics.util.VariantExperimentInstance;
import com.picsart.studio.R;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import kotlin.Metadata;
import kotlin.collections.c;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.d;
import myobfuscated.ax.f;
import myobfuscated.cx.a;
import myobfuscated.ds.b0;
import myobfuscated.ik2.h;
import myobfuscated.jy.e;
import myobfuscated.jy.i;
import myobfuscated.lx.j;
import myobfuscated.ot.g;
import myobfuscated.pn2.o0;
import myobfuscated.uw.b;
import okhttp3.k;
import org.jetbrains.annotations.NotNull;
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/picsart/analytics/debug/components/experiments/ExperimentsActivity;", "Landroidx/activity/ComponentActivity;", "<init>", "()V", "debug-components_release"}, k = 1, mv = {1, 8, 0})
public final class ExperimentsActivity extends ComponentActivity {
    public static final int h = 0;
    public myobfuscated.bx.a c;
    public b f;
    public myobfuscated.zw.a g;
    @NotNull
    public final h a = kotlin.a.b(new Function0<Gson>() {
        @Override
        @NotNull
        public final Gson invoke() {
            return new Gson();
        }
    });
    @NotNull
    public final h b = kotlin.a.b(new Function0<SharedPreferences>() {
        {
            super(0);
        }

        @Override
        public final SharedPreferences invoke() {
            return ExperimentsActivity.this.getSharedPreferences("experiments.preferences", 0);
        }
    });
    @NotNull
    public List<myobfuscated.cx.a> d = new ArrayList();
    public boolean e = true;

    @Metadata(d1 = {"\u0000\u0013\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000*\u0001\u0000\b\n\u0018\u00002\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u00020\u0001¨\u0006\u0004"}, d2 = {"com/picsart/analytics/debug/components/experiments/ExperimentsActivity$a", "Lmyobfuscated/tt/a;", "", "Lmyobfuscated/cx/a;", "debug-components_release"}, k = 1, mv = {1, 8, 0})
    public static final class a extends myobfuscated.tt.a<List<? extends myobfuscated.cx.a>> {
    }

    public final Gson G() {
        return (Gson) this.a.getValue();
    }

    public final SharedPreferences H() {
        Object value = this.b.getValue();
        Intrinsics.checkNotNullExpressionValue(value, "<get-preferences>(...)");
        return (SharedPreferences) value;
    }

    public final void I() {
        if (this.e) {
            myobfuscated.zw.a aVar = this.g;
            ProgressBar progressBar = aVar != null ? aVar.c : null;
            if (progressBar != null) {
                progressBar.setVisibility(0);
            }
            myobfuscated.zw.a aVar2 = this.g;
            ListView listView = aVar2 != null ? aVar2.b : null;
            if (listView != null) {
                listView.setVisibility(8);
            }
        }
        if (!e.i(getApplicationContext()) && this.e && !isFinishing()) {
            runOnUiThread(new myobfuscated.zu.a(this, 7));
        }
        String p = com.appsflyer.internal.h.p("https://settings.picsart.com/info/experiments?platform=android&app=", getApplicationContext().getPackageName());
        j jVar = new j(p);
        i.a.getClass();
        String a2 = i.a();
        Map<String, String> map = jVar.c;
        HashMap hashMap = (map == null || map.isEmpty()) ? new HashMap() : new HashMap(map);
        hashMap.put("language-code", a2);
        jVar.c = hashMap;
        Context applicationContext = getApplicationContext();
        if (myobfuscated.lx.i.c == null) {
            myobfuscated.lx.i.c = new myobfuscated.lx.i(applicationContext);
        }
        myobfuscated.lx.i iVar = myobfuscated.lx.i.c;
        myobfuscated.ax.h hVar = new myobfuscated.ax.h(this);
        iVar.getClass();
        k.a aVar3 = new k.a();
        aVar3.j(p);
        Map<String, String> map2 = jVar.c;
        if (map2 != null) {
            for (Map.Entry<String, String> entry : map2.entrySet()) {
                if (entry.getKey() != null && entry.getValue() != null) {
                    aVar3.a(entry.getKey(), entry.getValue());
                }
            }
        }
        aVar3.c(jVar.d);
        aVar3.f("GET", null);
        iVar.b.a(aVar3.b()).e(new myobfuscated.lx.h(iVar, hVar, jVar));
    }

    public final void J(List<myobfuscated.cx.a> list) {
        H().edit().putString("all_experiments", G().toJson(list, new a().getType())).apply();
    }

    public final void K(String str) {
        myobfuscated.bx.a aVar = this.c;
        if (aVar != null) {
            if (str == null || str.length() <= 0) {
                aVar.a = this.d;
            } else {
                ArrayList arrayList = new ArrayList();
                for (myobfuscated.cx.a aVar2 : this.d) {
                    String c = aVar2.c();
                    Intrinsics.e(c);
                    Locale locale = Locale.getDefault();
                    Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
                    String lowerCase = c.toLowerCase(locale);
                    Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(locale)");
                    Locale locale2 = Locale.getDefault();
                    Intrinsics.checkNotNullExpressionValue(locale2, "getDefault()");
                    String lowerCase2 = str.toLowerCase(locale2);
                    Intrinsics.checkNotNullExpressionValue(lowerCase2, "this as java.lang.String).toLowerCase(locale)");
                    if (!d.w(lowerCase, lowerCase2, false)) {
                        String b = aVar2.b();
                        Locale locale3 = Locale.getDefault();
                        Intrinsics.checkNotNullExpressionValue(locale3, "getDefault()");
                        String lowerCase3 = b.toLowerCase(locale3);
                        Intrinsics.checkNotNullExpressionValue(lowerCase3, "this as java.lang.String).toLowerCase(locale)");
                        Locale locale4 = Locale.getDefault();
                        Intrinsics.checkNotNullExpressionValue(locale4, "getDefault()");
                        String lowerCase4 = str.toLowerCase(locale4);
                        Intrinsics.checkNotNullExpressionValue(lowerCase4, "this as java.lang.String).toLowerCase(locale)");
                        if (d.w(lowerCase3, lowerCase4, false)) {
                        }
                    }
                    arrayList.add(aVar2);
                }
                aVar.a = arrayList;
            }
            aVar.notifyDataSetChanged();
        }
    }

    @Override
    public final void onActivityResult(int i, int i2, Intent intent) {
        myobfuscated.bx.a aVar;
        ArrayList arrayList;
        Set<Map.Entry<String, myobfuscated.ot.e>> entrySet;
        ArrayList arrayList2;
        String str;
        super.onActivityResult(i, i2, intent);
        if (i == 69 && i2 == -1 && intent != null) {
            int intExtra = intent.getIntExtra("index", 0);
            String stringExtra = intent.getStringExtra("variant");
            if (stringExtra == null || (aVar = this.c) == null) {
                return;
            }
            myobfuscated.cx.a settingsExperiment = aVar.a.get(intExtra);
            settingsExperiment.g(stringExtra);
            aVar.notifyDataSetChanged();
            Intrinsics.checkNotNullExpressionValue(settingsExperiment, "settingsExperiment");
            g e = settingsExperiment.e();
            if (e == null || (entrySet = e.a.entrySet()) == null) {
                arrayList = null;
            } else {
                arrayList2 = new ArrayList();
                Iterator<T> it = entrySet.iterator();
                while (it.hasNext()) {
                    try {
                        Set<String> keySet = ((myobfuscated.ot.e) ((Map.Entry) it.next()).getValue()).l().a.keySet();
                        Intrinsics.checkNotNullExpressionValue(keySet, "it.value.asJsonObject.keySet()");
                        str = (String) c.P(keySet);
                    } catch (Throwable unused) {
                    }
                }
                arrayList = arrayList2;
            }
            myobfuscated.sw.d dVar = new myobfuscated.sw.d(1, stringExtra, settingsExperiment.c(), null, arrayList);
            String string = H().getString("involved_experiments", "");
            List list = (List) G().fromJson(string != null ? string : "", new myobfuscated.ax.e().getType());
            if (list == null) {
                list = new ArrayList();
            }
            Iterator it2 = list.iterator();
            int i3 = 0;
            while (true) {
                if (!it2.hasNext()) {
                    i3 = -1;
                    break;
                } else if (Intrinsics.c(((myobfuscated.sw.d) it2.next()).b(), dVar.b())) {
                    break;
                } else {
                    i3++;
                }
            }
            Integer valueOf = Integer.valueOf(i3);
            if (valueOf.intValue() == -1) {
                valueOf = null;
            }
            if (valueOf != null) {
                myobfuscated.sw.d dVar2 = (myobfuscated.sw.d) list.remove(valueOf.intValue());
            }
            list.add(dVar);
            H().edit().putString("involved_experiments", G().toJson(list, new myobfuscated.ax.i().getType())).apply();
            PAanalytics pAanalytics = PAanalytics.INSTANCE;
            ArrayList arrayList3 = new ArrayList();
            int size = this.d.size();
            for (int i4 = 0; i4 < size; i4++) {
                myobfuscated.cx.a aVar2 = this.d.get(i4);
                List<a.C1000a> f = aVar2.f();
                Integer d = aVar2.d();
                Intrinsics.e(d);
                String b = f.get(d.intValue()).b();
                if (!Intrinsics.c("none", b)) {
                    arrayList3.add(new myobfuscated.sw.d(28, aVar2.c(), b));
                }
            }
            pAanalytics.setInvolvedExperiments(arrayList3, true);
            myobfuscated.bx.a aVar3 = this.c;
            if (aVar3 != null) {
                List<myobfuscated.cx.a> list2 = aVar3.a;
                Intrinsics.checkNotNullExpressionValue(list2, "adapter.data");
                J(list2);
            }
            kotlinx.coroutines.b.c(androidx.lifecycle.d.a(this), o0.c, null, new ExperimentsActivity$saveVariantSettings$1(settingsExperiment, stringExtra, this, null), 2);
            return;
        }
        return;
        str = null;
        if (str != null) {
            arrayList2.add(str);
        }
    }

    @Override
    public final void onCreate(Bundle bundle) {
        EditText editText;
        super.onCreate(bundle);
        View inflate = getLayoutInflater().inflate(R.layout.activity_experiments, (ViewGroup) null, false);
        int i = R.id.experimentsList;
        ListView listView = (ListView) b0.B(R.id.experimentsList, inflate);
        if (listView != null) {
            i = R.id.progressBar;
            ProgressBar progressBar = (ProgressBar) b0.B(R.id.progressBar, inflate);
            if (progressBar != null) {
                i = R.id.search;
                EditText editText2 = (EditText) b0.B(R.id.search, inflate);
                if (editText2 != null) {
                    RelativeLayout relativeLayout = (RelativeLayout) inflate;
                    this.g = new myobfuscated.zw.a(relativeLayout, listView, progressBar, editText2);
                    setContentView(relativeLayout);
                    this.f = (b) VariantExperimentInstance.c.a(this).b.getValue();
                    ActionBar actionBar = getActionBar();
                    if (actionBar != null) {
                        actionBar.setTitle("Experiments");
                    }
                    Context applicationContext = getApplicationContext();
                    final ?? baseAdapter = new BaseAdapter();
                    baseAdapter.a = new ArrayList();
                    baseAdapter.b = (LayoutInflater) applicationContext.getSystemService("layout_inflater");
                    this.c = baseAdapter;
                    myobfuscated.zw.a aVar = this.g;
                    if (aVar != null) {
                        ListView listView2 = aVar.b;
                        listView2.setAdapter((ListAdapter) baseAdapter);
                        listView2.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                            @Override
                            public final void onItemClick(AdapterView adapterView, View view, int i2, long j) {
                                int i3 = ExperimentsActivity.h;
                                ExperimentsActivity this$0 = ExperimentsActivity.this;
                                Intrinsics.checkNotNullParameter(this$0, "this$0");
                                myobfuscated.bx.a experimentAdapter = baseAdapter;
                                Intrinsics.checkNotNullParameter(experimentAdapter, "$experimentAdapter");
                                myobfuscated.cx.a aVar2 = experimentAdapter.a.get(i2);
                                Intrinsics.checkNotNullExpressionValue(aVar2, "experimentAdapter.data[position]");
                                myobfuscated.cx.a aVar3 = aVar2;
                                this$0.getClass();
                                Intent intent = new Intent(this$0.getApplicationContext(), SelectVariantActivity.class);
                                intent.putExtra("variants", this$0.G().toJson(aVar3.f()));
                                intent.putExtra("selected", aVar3.d());
                                intent.putExtra("index", i2);
                                this$0.startActivityForResult(intent, 69);
                            }
                        });
                        String string = H().getString("all_experiments", "");
                        String str = string != null ? string : "";
                        if (str.length() > 0) {
                            this.e = false;
                            Object fromJson = G().fromJson(str, new f().getType());
                            Intrinsics.checkNotNullExpressionValue(fromJson, "gson.fromJson(\n         …{}.type\n                )");
                            List<myobfuscated.cx.a> list = (List) fromJson;
                            this.d = list;
                            baseAdapter.a = list;
                            baseAdapter.notifyDataSetChanged();
                            listView2.setVisibility(0);
                            aVar.c.setVisibility(8);
                        }
                    }
                    I();
                    myobfuscated.zw.a aVar2 = this.g;
                    if (aVar2 == null || (editText = aVar2.d) == null) {
                        return;
                    }
                    editText.addTextChangedListener(new myobfuscated.ax.g(this));
                    if (bundle == null || !bundle.containsKey("search_state_text")) {
                        return;
                    }
                    String string2 = bundle.getString("search_state_text");
                    editText.setText(string2);
                    K(string2);
                    return;
                }
            }
        }
        throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
    }

    @Override
    public final void onSaveInstanceState(@NotNull Bundle outState) {
        EditText editText;
        Intrinsics.checkNotNullParameter(outState, "outState");
        super.onSaveInstanceState(outState);
        myobfuscated.zw.a aVar = this.g;
        if (aVar == null || (editText = aVar.d) == null) {
            return;
        }
        outState.putString("search_state_text", editText.getText().toString());
    }
}