APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Candyfloss
版本号:3.9.6
包名称:com.stark.candyfloss

MD5 校验值:5b5c91fb96bf669521c42e375c79f86c

反编译源代码说明

q50.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package o;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import candybar.lib.R;
import candybar.lib.utils.CandyBarGlideModule;
import candybar.lib.utils.views.HeaderView;
import com.afollestad.materialdialogs.c;
import com.google.android.material.card.MaterialCardView;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import me.grantland.widget.AutofitTextView;
import o.he;
import o.o50;
import o.q50;
import org.json.JSONArray;
import org.json.JSONObject;

public class q50 extends RecyclerView.h {
    public final Context d;
    public final List e;
    public final o50.a f;
    public int g = 1;
    public int h;
    public boolean i;
    public boolean j;
    public boolean k;

    public class a implements mz0 {
        public final d a;

        public a(d dVar) {
            this.a = dVar;
        }

        public final void b(Bitmap bitmap, d dVar) {
            v11 a = w11.a(q50.this.d.getResources(), bitmap);
            a.e(0.0f);
            dVar.v.setCompoundDrawablesWithIntrinsicBounds(xs.b(q50.this.d, a, 40.0f), (Drawable) null, (Drawable) null, (Drawable) null);
        }

        @Override
        public boolean c(s30 s30Var, Object obj, mc1 mc1Var, boolean z) {
            return true;
        }

        @Override
        public void citrus() {
        }

        @Override
        public boolean f(final Bitmap bitmap, Object obj, mc1 mc1Var, vo voVar, boolean z) {
            Handler handler = new Handler(Looper.getMainLooper());
            final d dVar = this.a;
            handler.post(new Runnable() {
                public void citrus() {
                }

                @Override
                public final void run() {
                    q50.a.this.b(bitmap, dVar);
                }
            });
            return true;
        }
    }

    public class b extends HashMap {
        public final int e;
        public final int f;
        public final int g;

        public b(int i, int i2, int i3) {
            this.e = i;
            this.f = i2;
            this.g = i3;
            put("section", "home");
            put("installed", Integer.valueOf(i));
            put("missed", Integer.valueOf(i2));
            put("themed", Integer.valueOf(i3));
        }
    }

    public static class c {
        public static final int[] a;

        static {
            int[] iArr = new int[o50.b.values().length];
            a = iArr;
            try {
                iArr[o50.b.APPLY.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[o50.b.DONATE.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[o50.b.ICONS.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[o50.b.DIMENSION.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
        }
    }

    public class d extends RecyclerView.g0 implements View.OnClickListener, View.OnLongClickListener {
        public final TextView u;
        public final AutofitTextView v;
        public final ProgressBar w;
        public final boolean x;

        public class a extends HashMap {
            public a() {
                put("section", "home");
                put("action", "navigate");
                put("item", "icon_apply");
            }
        }

        public class b extends HashMap {
            public b() {
                put("section", "home");
                put("action", "open_dialog");
                put("item", "donate");
            }
        }

        public class c extends HashMap {
            public c() {
                put("section", "home");
                put("action", "navigate");
                put("item", "icons");
            }
        }

        public d(View view) {
            super(view);
            LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.container);
            this.v = (AutofitTextView) view.findViewById(R.id.title);
            this.u = (TextView) view.findViewById(R.id.subtitle);
            this.w = (ProgressBar) view.findViewById(R.id.progressBar);
            boolean z = q50.this.d.getResources().getBoolean(R.bool.quick_apply);
            this.x = z;
            MaterialCardView materialCardView = (MaterialCardView) view.findViewById(R.id.card);
            if (he.b().m() == he.b.FLAT && (materialCardView.getLayoutParams() instanceof StaggeredGridLayoutManager.c)) {
                materialCardView.setRadius(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin);
                StaggeredGridLayoutManager.c cVar = (StaggeredGridLayoutManager.c) materialCardView.getLayoutParams();
                cVar.setMargins(0, 0, dimensionPixelSize, dimensionPixelSize);
                cVar.setMarginEnd(dimensionPixelSize);
            }
            if (q50.this.d.getResources().getBoolean(R.bool.use_flat_card)) {
                materialCardView.setStrokeWidth(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_stroke_width));
                materialCardView.setCardElevation(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize2 = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_top);
                ((StaggeredGridLayoutManager.c) materialCardView.getLayoutParams()).setMargins(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_left), dimensionPixelSize2, q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_right), q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_bottom));
            }
            if (!ju0.b(q50.this.d).q()) {
                materialCardView.setCardElevation(0.0f);
            }
            linearLayout.setOnClickListener(this);
            if (z) {
                linearLayout.setOnLongClickListener(this);
            }
        }

        @Override
        public void citrus() {
        }

        @Override
        public void onClick(View view) {
            int l;
            if (view.getId() == R.id.container && (l = l() - 1) >= 0 && l <= q50.this.e.size()) {
                int i = c.a[((o50) q50.this.e.get(l)).d().ordinal()];
                if (i != 1) {
                    if (i != 2) {
                        if (i != 3) {
                            if (i == 4) {
                                o50 o50Var = (o50) q50.this.e.get(l);
                                b70.r2(((g4) q50.this.d).P(), o50Var.c(), o50Var.a(), null);
                                return;
                            }
                            return;
                        }
                        he.b().d().b("click", new c());
                        ((ef) q50.this.d).h1(2);
                        return;
                    }
                    he.b().d().b("click", new b());
                    if (q50.this.d instanceof ef) {
                        if (he.b().i() != null) {
                            gs.m2(((g4) q50.this.d).P());
                            return;
                        } else {
                            ((ef) q50.this.d).j1();
                            return;
                        }
                    }
                    return;
                }
                he.b().d().b("click", new a());
                if (!this.x || !ue0.H(q50.this.d)) {
                    ((ef) q50.this.d).h1(1);
                }
            }
        }

        @Override
        public boolean onLongClick(View view) {
            int l;
            if (view.getId() != R.id.container || (l = l() - 1) < 0 || l > q50.this.e.size() || ((o50) q50.this.e.get(l)).d() != o50.b.APPLY) {
                return false;
            }
            ((ef) q50.this.d).h1(1);
            return true;
        }
    }

    public class e extends RecyclerView.g0 implements View.OnClickListener {

        public class a extends HashMap {
            public a() {
                put("section", "home");
                put("action", "open_dialog");
                put("item", "other_apps");
            }
        }

        public e(View view) {
            super(view);
            LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.container);
            TextView textView = (TextView) view.findViewById(R.id.title);
            MaterialCardView materialCardView = (MaterialCardView) view.findViewById(R.id.card);
            if (he.b().m() == he.b.FLAT && (materialCardView.getLayoutParams() instanceof StaggeredGridLayoutManager.c)) {
                materialCardView.setRadius(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin);
                StaggeredGridLayoutManager.c cVar = (StaggeredGridLayoutManager.c) materialCardView.getLayoutParams();
                cVar.setMargins(0, 0, dimensionPixelSize, dimensionPixelSize);
                cVar.setMarginEnd(dimensionPixelSize);
            }
            if (q50.this.d.getResources().getBoolean(R.bool.use_flat_card)) {
                materialCardView.setStrokeWidth(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_stroke_width));
                materialCardView.setCardElevation(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize2 = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_top);
                ((StaggeredGridLayoutManager.c) materialCardView.getLayoutParams()).setMargins(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_left), dimensionPixelSize2, q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_right), q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_bottom));
            }
            if (!ju0.b(q50.this.d).q()) {
                materialCardView.setCardElevation(0.0f);
            }
            textView.setCompoundDrawablesWithIntrinsicBounds(xs.c(q50.this.d, R.drawable.ic_google_play_more_apps, com.danimahardhika.android.helpers.core.a.a(q50.this.d, android.R.attr.textColorPrimary)), (Drawable) null, (Drawable) null, (Drawable) null);
            linearLayout.setOnClickListener(this);
        }

        @Override
        public void citrus() {
        }

        @Override
        public void onClick(View view) {
            if (view.getId() == R.id.container) {
                he.b().d().b("click", new a());
                if (he.b().q() != null) {
                    kr0.m2(((g4) q50.this.d).P());
                    return;
                }
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(q50.this.d.getResources().getString(R.string.google_play_dev)));
                intent.addFlags(4194304);
                q50.this.d.startActivity(intent);
            }
        }
    }

    public class f extends RecyclerView.g0 implements View.OnClickListener {
        public final HeaderView u;
        public final TextView v;
        public final TextView w;

        public class a extends HashMap {
            public a() {
                put("section", "home");
                put("action", "open_dialog");
                put("item", "rate_and_review");
            }
        }

        public class b extends HashMap {
            public b() {
                put("section", "home");
                put("action", "open_dialog");
                put("item", "share");
            }
        }

        public class c extends HashMap {
            public c() {
                put("section", "home");
                put("action", "open_dialog");
                put("item", "update");
            }
        }

        public f(View view) {
            super(view);
            HeaderView headerView = (HeaderView) view.findViewById(R.id.header_image);
            this.u = headerView;
            this.v = (TextView) view.findViewById(R.id.title);
            this.w = (TextView) view.findViewById(R.id.content);
            Button button = (Button) view.findViewById(R.id.rate);
            ImageView imageView = (ImageView) view.findViewById(R.id.share);
            ImageView imageView2 = (ImageView) view.findViewById(R.id.update);
            MaterialCardView materialCardView = (MaterialCardView) view.findViewById(R.id.card);
            if (he.b().m() == he.b.FLAT) {
                if (materialCardView.getLayoutParams() instanceof StaggeredGridLayoutManager.c) {
                    materialCardView.setRadius(0.0f);
                    materialCardView.setUseCompatPadding(false);
                    int dimensionPixelSize = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin);
                    StaggeredGridLayoutManager.c cVar = (StaggeredGridLayoutManager.c) materialCardView.getLayoutParams();
                    cVar.setMargins(0, 0, dimensionPixelSize, dimensionPixelSize);
                    cVar.setMarginEnd(dimensionPixelSize);
                } else if (materialCardView.getLayoutParams() instanceof LinearLayout.LayoutParams) {
                    materialCardView.setRadius(0.0f);
                    materialCardView.setUseCompatPadding(false);
                    int dimensionPixelSize2 = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin);
                    LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) materialCardView.getLayoutParams();
                    if (q50.this.f.b() == o50.a.EnumC0094a.LANDSCAPE || q50.this.f.b() == o50.a.EnumC0094a.SQUARE) {
                        layoutParams.setMargins(dimensionPixelSize2, q50.this.d.getResources().getDimensionPixelSize(R.dimen.content_padding_reverse), dimensionPixelSize2, dimensionPixelSize2);
                    }
                    layoutParams.setMarginEnd(dimensionPixelSize2);
                }
            }
            if (q50.this.d.getResources().getBoolean(R.bool.use_flat_card)) {
                materialCardView.setStrokeWidth(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_stroke_width));
                materialCardView.setCardElevation(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize3 = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_top);
                ((StaggeredGridLayoutManager.c) materialCardView.getLayoutParams()).setMargins(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_left), dimensionPixelSize3, q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_right), q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_bottom));
            }
            if (!ju0.b(q50.this.d).q()) {
                materialCardView.setCardElevation(0.0f);
            }
            if (q50.this.d.getResources().getString(R.string.rate_and_review_link).length() == 0) {
                button.setVisibility(8);
            }
            if (q50.this.d.getResources().getString(R.string.share_link).length() == 0) {
                imageView.setVisibility(8);
            }
            if (!q50.this.d.getResources().getBoolean(R.bool.enable_check_update) || he.b().g().a(q50.this.d).length() == 0) {
                imageView2.setVisibility(8);
            }
            int a2 = com.danimahardhika.android.helpers.core.a.a(q50.this.d, android.R.attr.textColorSecondary);
            button.setCompoundDrawablesWithIntrinsicBounds(xs.c(q50.this.d, R.drawable.ic_toolbar_rate, a2), (Drawable) null, (Drawable) null, (Drawable) null);
            imageView.setImageDrawable(xs.c(q50.this.d, R.drawable.ic_toolbar_share, a2));
            imageView2.setImageDrawable(xs.c(q50.this.d, R.drawable.ic_toolbar_update, a2));
            headerView.c(q50.this.f.a().x, q50.this.f.a().y);
            button.setOnClickListener(this);
            imageView.setOnClickListener(this);
            imageView2.setOnClickListener(this);
        }

        @Override
        public void citrus() {
        }

        @Override
        public void onClick(View view) {
            int id = view.getId();
            if (id == R.id.rate) {
                he.b().d().b("click", new a());
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(q50.this.d.getResources().getString(R.string.rate_and_review_link).replaceAll("\\{\\{packageName\\}\\}", q50.this.d.getPackageName())));
                intent.addFlags(4194304);
                q50.this.d.startActivity(intent);
                return;
            }
            if (id == R.id.share) {
                he.b().d().b("click", new b());
                Intent intent2 = new Intent("android.intent.action.SEND");
                intent2.setType("text/plain");
                intent2.putExtra("android.intent.extra.SUBJECT", q50.this.d.getResources().getString(R.string.share_app_title, q50.this.d.getResources().getString(R.string.app_name)));
                intent2.putExtra("android.intent.extra.TEXT", q50.this.d.getResources().getString(R.string.share_app_body, q50.this.d.getResources().getString(R.string.app_name), "\n" + q50.this.d.getResources().getString(R.string.share_link).replaceAll("\\{\\{packageName\\}\\}", q50.this.d.getPackageName())));
                q50.this.d.startActivity(Intent.createChooser(intent2, q50.this.d.getResources().getString(R.string.app_client)));
                return;
            }
            if (id == R.id.update) {
                he.b().d().b("click", new c());
                new h(q50.this, null).d();
            }
        }
    }

    public class g extends RecyclerView.g0 implements View.OnClickListener {
        public final TextView u;
        public final TextView v;
        public final TextView w;
        public final ProgressBar x;
        public final ProgressBar y;
        public final LinearLayout z;

        public class a extends HashMap {
            public a() {
                put("section", "home");
                put("action", "navigate");
                put("item", "icon_request");
            }
        }

        public g(View view) {
            super(view);
            TextView textView = (TextView) view.findViewById(R.id.title);
            this.u = (TextView) view.findViewById(R.id.installed_apps);
            this.w = (TextView) view.findViewById(R.id.missed_apps);
            this.v = (TextView) view.findViewById(R.id.themed_apps);
            ProgressBar progressBar = (ProgressBar) view.findViewById(R.id.progress);
            this.x = progressBar;
            LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.container);
            this.y = (ProgressBar) view.findViewById(R.id.progressBar);
            this.z = (LinearLayout) view.findViewById(R.id.dataContainer);
            MaterialCardView materialCardView = (MaterialCardView) view.findViewById(R.id.card);
            if (he.b().m() == he.b.FLAT && (materialCardView.getLayoutParams() instanceof StaggeredGridLayoutManager.c)) {
                materialCardView.setRadius(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin);
                StaggeredGridLayoutManager.c cVar = (StaggeredGridLayoutManager.c) materialCardView.getLayoutParams();
                cVar.setMargins(0, 0, dimensionPixelSize, dimensionPixelSize);
                cVar.setMarginEnd(dimensionPixelSize);
            }
            if (q50.this.d.getResources().getBoolean(R.bool.use_flat_card)) {
                materialCardView.setStrokeWidth(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_stroke_width));
                materialCardView.setCardElevation(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize2 = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_top);
                ((StaggeredGridLayoutManager.c) materialCardView.getLayoutParams()).setMargins(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_left), dimensionPixelSize2, q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_right), q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_bottom));
            }
            if (!ju0.b(q50.this.d).q()) {
                materialCardView.setCardElevation(0.0f);
            }
            textView.setCompoundDrawablesWithIntrinsicBounds(xs.c(q50.this.d, R.drawable.ic_toolbar_icon_request, com.danimahardhika.android.helpers.core.a.a(q50.this.d, android.R.attr.textColorPrimary)), (Drawable) null, (Drawable) null, (Drawable) null);
            progressBar.getProgressDrawable().setColorFilter(com.danimahardhika.android.helpers.core.a.a(q50.this.d, com.google.android.material.R.attr.colorSecondary), PorterDuff.Mode.SRC_IN);
            linearLayout.setOnClickListener(this);
        }

        @Override
        public void citrus() {
        }

        @Override
        public void onClick(View view) {
            if (view.getId() == R.id.container) {
                he.b().d().b("click", new a());
                ((ef) q50.this.d).h1(3);
            }
        }
    }

    public class h extends w7 {
        public com.afollestad.materialdialogs.c e;
        public String f;
        public String g;
        public String[] h;
        public boolean i;

        public h() {
        }

        @Override
        public void citrus() {
        }

        @Override
        public void k(boolean z) {
            this.e.dismiss();
            this.e = null;
            if (z) {
                c.d i = new c.d(q50.this.d).z(si1.b(q50.this.d), si1.c(q50.this.d)).i(R.layout.fragment_update, false);
                if (this.i) {
                    i.s(R.string.update).m(R.string.close).p(new c.g() {
                        @Override
                        public final void a(com.afollestad.materialdialogs.c cVar, gr grVar) {
                            q50.h.this.p(cVar, grVar);
                        }

                        @Override
                        public void citrus() {
                        }
                    });
                } else {
                    i.s(R.string.close);
                }
                com.afollestad.materialdialogs.c a = i.a();
                TextView textView = (TextView) a.findViewById(R.id.changelog_version);
                ListView listView = (ListView) a.findViewById(R.id.changelog_list);
                if (this.i) {
                    textView.setText(q50.this.d.getResources().getString(R.string.update_available) + "\n" + q50.this.d.getResources().getString(R.string.changelog_version) + " " + this.f);
                    listView.setAdapter((ListAdapter) new dg(q50.this.d, this.h));
                } else {
                    textView.setText(q50.this.d.getResources().getString(R.string.no_update_available));
                    listView.setVisibility(8);
                }
                a.show();
                return;
            }
            new c.d(q50.this.d).z(si1.b(q50.this.d), si1.c(q50.this.d)).e(R.string.unable_to_load_config).s(R.string.close).a().show();
        }

        @Override
        public void l() {
            com.afollestad.materialdialogs.c a = new c.d(q50.this.d).z(si1.b(q50.this.d), si1.c(q50.this.d)).e(R.string.checking_for_update).b(false).c(false).u(true, 0).v(true).a();
            this.e = a;
            a.show();
        }

        @Override
        public boolean m() {
            BufferedReader bufferedReader;
            JSONObject jSONObject;
            long j;
            long j2;
            BufferedReader bufferedReader2;
            boolean z = false;
            if (h()) {
                return false;
            }
            BufferedReader bufferedReader3 = null;
            BufferedReader bufferedReader4 = null;
            try {
                try {
                    bufferedReader = new BufferedReader(new InputStreamReader(new URL(he.b().g().a(q50.this.d)).openConnection().getInputStream()));
                } catch (Throwable th) {
                    th = th;
                }
            } catch (Exception e) {
                e = e;
            }
            try {
                StringBuilder sb = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    sb.append(readLine);
                }
                jSONObject = new JSONObject(sb.toString());
                this.f = jSONObject.getString("latestVersion");
                PackageInfo packageInfo = q50.this.d.getPackageManager().getPackageInfo(q50.this.d.getPackageName(), 0);
                if (jSONObject.isNull("url")) {
                    this.g = "https://play.google.com/store/apps/details?id=" + packageInfo.packageName;
                } else {
                    this.g = jSONObject.getString("url");
                }
                j = jSONObject.getLong("latestVersionCode");
                if (Build.VERSION.SDK_INT >= 28) {
                    j2 = packageInfo.getLongVersionCode();
                } else {
                    j2 = packageInfo.versionCode;
                }
                bufferedReader2 = jSONObject;
            } catch (Exception e2) {
                e = e2;
                bufferedReader4 = bufferedReader;
                xh0.b("Error loading Configuration JSON " + Log.getStackTraceString(e));
                bufferedReader3 = bufferedReader4;
                if (bufferedReader4 != null) {
                    try {
                        bufferedReader4.close();
                        bufferedReader3 = bufferedReader4;
                    } catch (IOException e3) {
                        xh0.b(Log.getStackTraceString(e3));
                        bufferedReader3 = bufferedReader4;
                    }
                }
                return z;
            } catch (Throwable th2) {
                th = th2;
                bufferedReader3 = bufferedReader;
                if (bufferedReader3 != null) {
                    try {
                        bufferedReader3.close();
                    } catch (IOException e4) {
                        xh0.b(Log.getStackTraceString(e4));
                    }
                }
                throw th;
            }
            if (j > j2) {
                this.i = true;
                JSONArray jSONArray = jSONObject.getJSONArray("releaseNotes");
                this.h = new String[jSONArray.length()];
                int i = 0;
                while (true) {
                    int length = jSONArray.length();
                    bufferedReader2 = length;
                    if (i < length) {
                        this.h[i] = jSONArray.getString(i);
                        i++;
                    }
                }
                bufferedReader.close();
                z = true;
                bufferedReader3 = bufferedReader2;
                return z;
            }
            bufferedReader.close();
            z = true;
            bufferedReader3 = bufferedReader2;
            return z;
        }

        public final void p(com.afollestad.materialdialogs.c cVar, gr grVar) {
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(this.g));
            intent.addFlags(4194304);
            q50.this.d.startActivity(intent);
        }

        public h(q50 q50Var, a aVar) {
            this();
        }
    }

    public class i extends RecyclerView.g0 implements View.OnClickListener {
        public final TextView u;

        public i(View view) {
            super(view);
            TextView textView = (TextView) view.findViewById(R.id.title);
            this.u = textView;
            TextView textView2 = (TextView) view.findViewById(R.id.muzei);
            MaterialCardView materialCardView = (MaterialCardView) view.findViewById(R.id.card);
            if (he.b().m() == he.b.FLAT && (materialCardView.getLayoutParams() instanceof StaggeredGridLayoutManager.c)) {
                materialCardView.setRadius(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin);
                StaggeredGridLayoutManager.c cVar = (StaggeredGridLayoutManager.c) materialCardView.getLayoutParams();
                cVar.setMargins(0, 0, dimensionPixelSize, dimensionPixelSize);
                cVar.setMarginEnd(dimensionPixelSize);
            }
            if (q50.this.d.getResources().getBoolean(R.bool.use_flat_card)) {
                materialCardView.setStrokeWidth(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_stroke_width));
                materialCardView.setCardElevation(0.0f);
                materialCardView.setUseCompatPadding(false);
                int dimensionPixelSize2 = q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_top);
                ((StaggeredGridLayoutManager.c) materialCardView.getLayoutParams()).setMargins(q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_left), dimensionPixelSize2, q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_right), q50.this.d.getResources().getDimensionPixelSize(R.dimen.card_margin_bottom));
            }
            if (!ju0.b(q50.this.d).q()) {
                materialCardView.setCardElevation(0.0f);
            }
            textView.setCompoundDrawablesWithIntrinsicBounds(xs.c(q50.this.d, R.drawable.ic_toolbar_wallpapers, com.danimahardhika.android.helpers.core.a.a(q50.this.d, android.R.attr.textColorPrimary)), (Drawable) null, (Drawable) null, (Drawable) null);
            textView2.setCompoundDrawablesWithIntrinsicBounds(xs.a(q50.this.d, R.drawable.ic_home_app_muzei), (Drawable) null, (Drawable) null, (Drawable) null);
            textView.setOnClickListener(this);
            textView2.setOnClickListener(this);
        }

        @Override
        public void citrus() {
        }

        @Override
        public void onClick(View view) {
            int id = view.getId();
            if (id == R.id.title) {
                ((ef) q50.this.d).h1(4);
            } else if (id == R.id.muzei) {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=net.nurik.roman.muzei"));
                intent.addFlags(4194304);
                q50.this.d.startActivity(intent);
            }
        }
    }

    public q50(Context context, List list, int i2) {
        this.d = context;
        this.e = list;
        this.h = i2;
        this.f = hm1.a(context.getResources().getString(R.string.home_image_style));
        if (ko1.f(context) == 1) {
            this.g++;
            this.i = true;
        }
        if (context.getResources().getBoolean(R.bool.enable_icon_request) || context.getResources().getBoolean(R.bool.enable_premium_request)) {
            this.g++;
            this.j = true;
        }
        if (context.getResources().getString(R.string.google_play_dev).length() > 0) {
            this.g++;
            this.k = true;
        }
    }

    public void D(o50 o50Var) {
        if (o50Var == null) {
            return;
        }
        this.e.add(o50Var);
        n(this.e.size());
    }

    public int E() {
        for (int i2 = 0; i2 < g(); i2++) {
            if (i(i2) == 1) {
                if (((o50) this.e.get(i2 - 1)).d() == o50.b.APPLY) {
                    return i2;
                }
            }
        }
        return -1;
    }

    public int F() {
        for (int i2 = 0; i2 < g(); i2++) {
            if (i(i2) == 1) {
                if (((o50) this.e.get(i2 - 1)).d() == o50.b.DIMENSION) {
                    return i2;
                }
            }
        }
        return -1;
    }

    public int G() {
        for (int i2 = 0; i2 < g(); i2++) {
            if (i(i2) == 2) {
                return i2;
            }
        }
        return -1;
    }

    public int H() {
        for (int i2 = 0; i2 < g(); i2++) {
            if (i(i2) == 1) {
                if (((o50) this.e.get(i2 - 1)).d() == o50.b.ICONS) {
                    return i2;
                }
            }
        }
        return -1;
    }

    public o50 I(int i2) {
        return (o50) this.e.get(i2 - 1);
    }

    public int J() {
        for (int i2 = 0; i2 < g(); i2++) {
            if (i(i2) == 3) {
                return i2;
            }
        }
        return -1;
    }

    public final boolean K(int i2) {
        if (i2 != 0) {
            return false;
        }
        if (this.h == 1) {
            return true;
        }
        return this.f.b() == o50.a.EnumC0094a.SQUARE || this.f.b() == o50.a.EnumC0094a.LANDSCAPE;
    }

    public void L(int i2) {
        this.h = i2;
        l();
    }

    @Override
    public void citrus() {
    }

    @Override
    public int g() {
        return this.e.size() + this.g;
    }

    @Override
    public int i(int i2) {
        if (i2 == 0) {
            return 0;
        }
        if (i2 == this.e.size() + 1 && this.j) {
            return 2;
        }
        if (i2 == g() - 2 && this.i && this.k) {
            return 3;
        }
        if (i2 == g() - 1) {
            if (this.k) {
                return 4;
            }
            if (this.i) {
                return 3;
            }
        }
        return 1;
    }

    @Override
    public void p(RecyclerView.g0 g0Var, int i2) {
        int size;
        pr prVar;
        try {
            View view = g0Var.a;
            if (view != null) {
                ((StaggeredGridLayoutManager.c) view.getLayoutParams()).f(K(g0Var.n()));
            }
        } catch (Exception e2) {
            xh0.a(Log.getStackTraceString(e2));
        }
        if (g0Var.n() == 0) {
            f fVar = (f) g0Var;
            String string = this.d.getResources().getString(R.string.home_title);
            if (string.length() > 0) {
                fVar.v.setText(string);
            } else {
                fVar.v.setVisibility(8);
            }
            fVar.w.setText(y50.a(this.d.getResources().getString(R.string.home_description), 63));
            fVar.w.setMovementMethod(LinkMovementMethod.getInstance());
            String string2 = this.d.getResources().getString(R.string.home_image);
            if (com.danimahardhika.android.helpers.core.a.e(string2)) {
                fVar.u.setBackgroundColor(Color.parseColor(string2));
                return;
            }
            if (!URLUtil.isValidUrl(string2)) {
                string2 = "drawable://" + ys.b(string2);
            }
            if (CandyBarGlideModule.d(this.d)) {
                cz0 cz0Var = (cz0) com.bumptech.glide.a.t(this.d).u(string2).F0(dt.j(300)).c0(true);
                if (string2.contains("drawable://")) {
                    prVar = pr.b;
                } else {
                    prVar = pr.d;
                }
                ((cz0) cz0Var.h(prVar)).u0(fVar.u);
                return;
            }
            return;
        }
        if (g0Var.n() == 1) {
            d dVar = (d) g0Var;
            int i3 = i2 - 1;
            int a2 = com.danimahardhika.android.helpers.core.a.a(this.d, android.R.attr.textColorPrimary);
            xh0.a("COLOR IS: " + Integer.toHexString(a2));
            if (((o50) this.e.get(i3)).a() != -1) {
                if (((o50) this.e.get(i3)).d() == o50.b.DIMENSION) {
                    if (CandyBarGlideModule.d(this.d)) {
                        ((cz0) ((cz0) com.bumptech.glide.a.t(this.d).f().y0("drawable://" + ((o50) this.e.get(i3)).a()).c0(true)).h(pr.b)).w0(new a(dVar)).D0();
                    }
                } else {
                    dVar.v.setCompoundDrawablesWithIntrinsicBounds(xs.c(this.d, ((o50) this.e.get(i3)).a(), a2), (Drawable) null, (Drawable) null, (Drawable) null);
                }
            }
            if (((o50) this.e.get(i3)).d() == o50.b.ICONS) {
                if (((o50) this.e.get(i3)).e() && ef.T == 0 && he.b().y()) {
                    dVar.w.setVisibility(0);
                    dVar.v.setVisibility(8);
                } else {
                    dVar.w.setVisibility(8);
                    dVar.v.setVisibility(0);
                }
                dVar.v.setSingleLine(true);
                dVar.v.setMaxLines(1);
                dVar.v.setTextSize(0, this.d.getResources().getDimension(R.dimen.text_max_size));
                dVar.v.setGravity(8388629);
                dVar.v.setIncludeFontPadding(false);
                dVar.v.setSizeToFit(true);
                dVar.u.setGravity(8388629);
            } else {
                dVar.v.setTextSize(0, this.d.getResources().getDimension(R.dimen.text_content_title));
            }
            dVar.v.setTypeface(si1.b(this.d));
            dVar.v.setText(((o50) this.e.get(i3)).c());
            if (((o50) this.e.get(i3)).b().length() > 0) {
                dVar.u.setText(((o50) this.e.get(i3)).b());
                dVar.u.setVisibility(0);
                return;
            }
            return;
        }
        if (g0Var.n() == 2) {
            g gVar = (g) g0Var;
            if (this.d.getResources().getBoolean(R.bool.hide_missing_app_count)) {
                gVar.z.setVisibility(8);
                gVar.y.setVisibility(8);
            } else if (ef.P == null) {
                gVar.z.setVisibility(8);
                gVar.y.setVisibility(0);
            } else {
                gVar.z.setVisibility(0);
                gVar.y.setVisibility(8);
            }
            int i4 = ef.S;
            List list = ef.P;
            if (list == null) {
                size = i4;
            } else {
                size = list.size();
            }
            int i5 = i4 - size;
            gVar.u.setText(this.d.getResources().getString(R.string.home_icon_request_installed_apps, Integer.valueOf(i4)));
            gVar.w.setText(this.d.getResources().getString(R.string.home_icon_request_missed_apps, Integer.valueOf(size)));
            gVar.v.setText(this.d.getResources().getString(R.string.home_icon_request_themed_apps, Integer.valueOf(i5)));
            he.b().d().b("stats", new b(i4, size, i5));
            gVar.x.setMax(i4);
            gVar.x.setProgress(i5);
            return;
        }
        if (g0Var.n() == 3) {
            ((i) g0Var).u.setText(this.d.getResources().getString(R.string.home_loud_wallpapers, Integer.valueOf(ju0.b(this.d).c())));
        }
    }

    @Override
    public RecyclerView.g0 r(ViewGroup viewGroup, int i2) {
        if (i2 == 0) {
            View inflate = LayoutInflater.from(this.d).inflate(R.layout.fragment_home_item_header, viewGroup, false);
            if (this.f.b() == o50.a.EnumC0094a.LANDSCAPE || this.f.b() == o50.a.EnumC0094a.SQUARE) {
                inflate = LayoutInflater.from(this.d).inflate(R.layout.fragment_home_item_header_alt, viewGroup, false);
            }
            return new f(inflate);
        }
        if (i2 == 1) {
            return new d(LayoutInflater.from(this.d).inflate(R.layout.fragment_home_item_content, viewGroup, false));
        }
        if (i2 == 2) {
            return new g(LayoutInflater.from(this.d).inflate(R.layout.fragment_home_item_icon_request, viewGroup, false));
        }
        if (i2 == 3) {
            return new i(LayoutInflater.from(this.d).inflate(R.layout.fragment_home_item_wallpapers, viewGroup, false));
        }
        return new e(LayoutInflater.from(this.d).inflate(R.layout.fragment_home_item_more_apps, viewGroup, false));
    }

    @Override
    public void w(RecyclerView.g0 g0Var) {
        super.w(g0Var);
        if (g0Var.n() == 1) {
            d dVar = (d) g0Var;
            dVar.v.setSingleLine(false);
            dVar.v.setMaxLines(10);
            dVar.v.setSizeToFit(false);
            dVar.v.setGravity(16);
            dVar.v.setIncludeFontPadding(true);
            dVar.v.setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, (Drawable) null, (Drawable) null);
            dVar.u.setVisibility(8);
            dVar.u.setGravity(16);
        }
    }
}