Fing.apk(点击下载) / SpeedtestActivity.java


package com.overlook.android.fing.ui.speedtest;

import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.widget.CheckBox;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.m;
import androidx.transition.AutoTransition;
import androidx.transition.ChangeBounds;
import androidx.transition.h;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.LoadAdError;
import com.huawei.hms.api.ConnectionResult;
import com.overlook.android.fing.R;
import com.overlook.android.fing.engine.j.a.e.t.b;
import com.overlook.android.fing.engine.j.d.x;
import com.overlook.android.fing.engine.l.t;
import com.overlook.android.fing.engine.l.z;
import com.overlook.android.fing.engine.model.internet.IspInfo;
import com.overlook.android.fing.engine.model.net.CarrierInfo;
import com.overlook.android.fing.engine.model.net.GeoIpInfo;
import com.overlook.android.fing.engine.model.net.p;
import com.overlook.android.fing.engine.model.speedtest.InternetSpeedInfo;
import com.overlook.android.fing.engine.model.speedtest.InternetSpeedTestRecord;
import com.overlook.android.fing.engine.services.netbox.n0;
import com.overlook.android.fing.engine.services.wifi.WiFiConnectionInfo;
import com.overlook.android.fing.speedtest.NdtConfiguration;
import com.overlook.android.fing.ui.base.ServiceActivity;
import com.overlook.android.fing.ui.internet.ScoreboardActivity;
import com.overlook.android.fing.ui.internet.ScoreboardReport;
import com.overlook.android.fing.ui.internet.o4;
import com.overlook.android.fing.ui.internet.y4;
import com.overlook.android.fing.ui.mobiletools.speedtest.g;
import com.overlook.android.fing.ui.mobiletools.speedtest.i;
import com.overlook.android.fing.vl.components.HeaderWithScore;
import com.overlook.android.fing.vl.components.IconView;
import com.overlook.android.fing.vl.components.LineChart;
import com.overlook.android.fing.vl.components.MeasurementBadge;
import com.overlook.android.fing.vl.components.MeasurementCompact;
import com.overlook.android.fing.vl.components.MeasurementIndicator;
import com.overlook.android.fing.vl.components.Paragraph;
import com.overlook.android.fing.vl.components.ProgressIndicator;
import com.overlook.android.fing.vl.components.SectionFooter;
import com.overlook.android.fing.vl.components.Speedometer;
import e.f.a.a.b.c.e;
import e.f.a.a.b.f.f0;
import e.f.a.a.b.f.g0;
import e.f.a.a.b.j.j;
import e.f.a.a.b.j.q;
import e.f.a.a.b.j.r;
import e.f.a.a.b.j.s;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.Objects;

@SuppressLint({"DefaultLocale", "SetTextI18n"})
public class SpeedtestActivity extends ServiceActivity implements com.overlook.android.fing.engine.j.a.e.t.c {
    public static final /* synthetic */ int X = 0;
    private MeasurementCompact A;
    private MeasurementCompact B;
    private ProgressIndicator C;
    private LinearLayout D;
    private MeasurementIndicator E;
    private MeasurementIndicator F;
    private Speedometer G;
    private LineChart H;
    private ConstraintLayout I;
    private Paragraph J;
    private IconView K;
    private FrameLayout L;
    private AdView M;
    private CardView N;
    private CardView O;
    private HeaderWithScore P;
    private SectionFooter Q;
    private CardView R;
    private MeasurementBadge S;
    private MeasurementBadge T;
    private MeasurementBadge U;
    private MeasurementBadge V;
    private Menu W;
    private q o;
    private b p = b.MOBILE;
    private s q;
    private t t;
    private c u;
    private double v;
    private com.overlook.android.fing.engine.j.a.e.t.b w;
    private com.overlook.android.fing.engine.j.a.e.t.d x;
    private LinearLayout y;
    private MeasurementCompact z;

    /* access modifiers changed from: package-private */
    public class a extends AdListener {
        a() {
        }

        @Override // com.google.android.gms.ads.AdListener
        public void onAdFailedToLoad(LoadAdError loadAdError) {
            SpeedtestActivity.this.runOnUiThread(new e(this));
        }

        @Override // com.google.android.gms.ads.AdListener
        public void onAdLoaded() {
            SpeedtestActivity.this.runOnUiThread(new d(this));
        }
    }

    public enum b {
        MOBILE,
        FINGBOX
    }

    public enum c {
        STARTING_PING,
        PINGING,
        STARTING_DOWNLOAD,
        DOWNLOADING,
        STARTING_UPLOAD,
        UPLOADING,
        COMPLETED,
        RANKED;

        public static int a(c cVar, c cVar2) {
            if (cVar != null) {
                return Integer.compare(cVar.ordinal(), cVar2.ordinal());
            }
            return cVar == null ? -1 : 1;
        }
    }

    private class d extends LineChart.Adapter {
        d(a aVar) {
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public boolean animationEnabledForLineAtIndex(LineChart lineChart, int i2) {
            if (SpeedtestActivity.this.x != null && SpeedtestActivity.this.x.f14931a == b.EnumC0144b.RUNNING) {
                return true;
            }
            return false;
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public int colorForLineAtIndex(LineChart lineChart, int i2) {
            if (i2 == 0) {
                return androidx.core.content.a.b(SpeedtestActivity.this.getContext(), R.color.green100);
            }
            if (i2 == 1) {
                return androidx.core.content.a.b(SpeedtestActivity.this.getContext(), R.color.accent100);
            }
            return super.colorForLineAtIndex(lineChart, i2);
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public int numberOfLinesInLineChart(LineChart lineChart) {
            return 2;
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public int numberOfPointsForLineAtIndex(LineChart lineChart, int i2) {
            if (SpeedtestActivity.this.x == null) {
                return 0;
            }
            if (i2 == 0) {
                c cVar = SpeedtestActivity.this.u;
                c cVar2 = c.DOWNLOADING;
                if (cVar == cVar2) {
                    return Math.min(150, SpeedtestActivity.this.x.j.size());
                }
                return c.a(SpeedtestActivity.this.u, cVar2) > 0 ? 150 : 0;
            }
            if (i2 == 1) {
                c cVar3 = SpeedtestActivity.this.u;
                c cVar4 = c.UPLOADING;
                if (cVar3 == cVar4) {
                    return Math.min(150, SpeedtestActivity.this.x.k.size());
                }
                if (c.a(SpeedtestActivity.this.u, cVar4) > 0) {
                    return 150;
                }
            }
            return 0;
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public int numberOfPointsInLineChart(LineChart lineChart) {
            return 150;
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public int projectionColorForLineAtIndex(LineChart lineChart, int i2) {
            if (i2 == 0) {
                return androidx.core.content.a.b(SpeedtestActivity.this.getContext(), R.color.green20);
            }
            if (i2 == 1) {
                return androidx.core.content.a.b(SpeedtestActivity.this.getContext(), R.color.accent20);
            }
            return super.projectionColorForLineAtIndex(lineChart, i2);
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public boolean shouldDisplayLineAtIndex(LineChart lineChart, int i2) {
            if (SpeedtestActivity.this.x == null) {
                return false;
            }
            if (c.a(SpeedtestActivity.this.u, c.COMPLETED) >= 0 && SpeedtestActivity.this.x.l == null) {
                return false;
            }
            if (i2 == 0) {
                if (c.a(SpeedtestActivity.this.u, c.DOWNLOADING) >= 0) {
                    return true;
                }
                return false;
            } else if (i2 != 1 || c.a(SpeedtestActivity.this.u, c.UPLOADING) < 0) {
                return false;
            } else {
                return true;
            }
        }

        @Override // com.overlook.android.fing.vl.components.LineChart.Adapter
        public float valueForPointAtIndex(LineChart lineChart, int i2, int i3) {
            if (i3 == 0) {
                if (SpeedtestActivity.this.x.j.isEmpty()) {
                    return 0.0f;
                }
                if (i2 < SpeedtestActivity.this.x.j.size()) {
                    return SpeedtestActivity.this.x.j.get(i2).floatValue();
                }
                return SpeedtestActivity.this.x.j.get(SpeedtestActivity.this.x.j.size() - 1).floatValue();
            } else if (i3 != 1 || SpeedtestActivity.this.x.k.isEmpty()) {
                return 0.0f;
            } else {
                if (i2 < SpeedtestActivity.this.x.k.size()) {
                    return SpeedtestActivity.this.x.k.get(i2).floatValue();
                }
                return SpeedtestActivity.this.x.k.get(SpeedtestActivity.this.x.k.size() - 1).floatValue();
            }
        }
    }

    private void J1() {
        if (M0()) {
            if (u0().g(com.overlook.android.fing.ui.ads.d.SPEEDTEST, this.M) == com.overlook.android.fing.ui.ads.b.DISABLED) {
                this.L.setVisibility(8);
            } else {
                this.L.setVisibility(0);
            }
        }
    }

    private void L1() {
        p pVar = new p(this);
        if ((this.R.getVisibility() == 8 && this.N.getVisibility() == 8 && this.O.getVisibility() == 8 && this.G.getVisibility() == 0 && this.H.getVisibility() == 0 && this.D.getVisibility() == 8 && this.I.getVisibility() == 8) ? false : true) {
            ChangeBounds changeBounds = new ChangeBounds();
            changeBounds.K(200);
            changeBounds.M(new AccelerateInterpolator());
            changeBounds.a(new t(this, pVar));
            h.a(this.y, changeBounds);
        } else {
            pVar.run();
        }
        this.R.setVisibility(8);
        this.N.setVisibility(8);
        this.O.setVisibility(8);
        this.G.setVisibility(0);
        this.H.setVisibility(0);
        this.D.setVisibility(8);
        this.I.setVisibility(8);
    }

    /* access modifiers changed from: private */
    public void M1() {
        if (M0() && this.M != null) {
            boolean z2 = u0().c(com.overlook.android.fing.ui.ads.d.SPEEDTEST) == com.overlook.android.fing.ui.ads.b.LOADED;
            if (z2 && this.L.getChildCount() == 0) {
                AutoTransition autoTransition = new AutoTransition();
                autoTransition.X(200);
                h.a((ViewGroup) findViewById(R.id.container), autoTransition);
                this.L.addView(this.M);
                this.L.setVisibility(0);
            } else if (!z2 && this.L.getChildCount() > 0) {
                AutoTransition autoTransition2 = new AutoTransition();
                autoTransition2.X(200);
                h.a((ViewGroup) findViewById(R.id.container), autoTransition2);
                this.L.removeAllViews();
                this.L.setVisibility(8);
            }
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r4v8, resolved type: com.overlook.android.fing.ui.internet.ScoreboardReport */
    /* JADX DEBUG: Multi-variable search result rejected for r4v10, resolved type: com.overlook.android.fing.ui.internet.ScoreboardReport */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARNING: Removed duplicated region for block: B:117:0x033d  */
    /* JADX WARNING: Removed duplicated region for block: B:137:0x03ef  */
    /* JADX WARNING: Removed duplicated region for block: B:204:0x06aa  */
    /* JADX WARNING: Removed duplicated region for block: B:205:0x06af  */
    /* JADX WARNING: Removed duplicated region for block: B:208:0x06b5  */
    /* JADX WARNING: Removed duplicated region for block: B:209:0x06ba  */
    /* JADX WARNING: Removed duplicated region for block: B:212:0x06c0  */
    /* JADX WARNING: Removed duplicated region for block: B:213:0x06c5  */
    /* JADX WARNING: Removed duplicated region for block: B:216:0x06cb  */
    /* JADX WARNING: Removed duplicated region for block: B:217:0x06d0  */
    private void N1() {
        String str;
        int i2;
        int i3;
        ScoreboardReport scoreboardReport;
        ScoreboardReport.c cVar;
        o4 o4Var;
        String str2;
        String str3;
        String str4;
        String str5;
        double d2;
        String str6;
        g gVar;
        com.overlook.android.fing.ui.mobiletools.speedtest.h hVar;
        double d3;
        double d4;
        GeoIpInfo geoIpInfo;
        g gVar2;
        CarrierInfo carrierInfo;
        IspInfo ispInfo;
        com.overlook.android.fing.engine.j.a.e.t.d dVar;
        InternetSpeedInfo internetSpeedInfo;
        InternetSpeedInfo internetSpeedInfo2;
        Menu menu = this.W;
        if (menu != null) {
            onPrepareOptionsMenu(menu);
        }
        M1();
        Speedometer.a aVar = Speedometer.a.READY;
        c cVar2 = c.COMPLETED;
        c cVar3 = c.STARTING_UPLOAD;
        ProgressIndicator.a aVar2 = ProgressIndicator.a.IDLE;
        Speedometer.a aVar3 = Speedometer.a.ROTATING;
        com.overlook.android.fing.engine.j.a.e.t.d dVar2 = this.x;
        if (dVar2 == null || this.u == null) {
            this.z.p().setText("-");
            this.A.p().setText("-");
            this.B.p().setText("-");
            this.H.refresh();
            this.C.e(aVar2, false);
            this.C.f(0.0f, false);
        } else {
            InternetSpeedInfo internetSpeedInfo3 = dVar2.l;
            if (internetSpeedInfo3 == null || internetSpeedInfo3.e() < 0.0d) {
                this.z.p().setText("-");
            } else {
                TextView p2 = this.z.p();
                p2.setText(((int) this.x.l.e()) + "ms");
            }
            TextView p3 = this.A.p();
            com.overlook.android.fing.engine.j.a.e.t.d dVar3 = this.x;
            String e2 = (dVar3 == null || (internetSpeedInfo2 = dVar3.l) == null || internetSpeedInfo2.b() == null) ? null : this.x.l.b().e();
            if (!(!TextUtils.isEmpty(e2) || (dVar = this.x) == null || (internetSpeedInfo = dVar.l) == null || internetSpeedInfo.h() == null)) {
                e2 = this.x.l.h().e();
            }
            if (TextUtils.isEmpty(e2)) {
                e2 = "-";
            }
            p3.setText(e2);
            this.B.n().setImageResource(u1());
            IconView n = this.B.n();
            int b2 = androidx.core.content.a.b(this, R.color.text100);
            Objects.requireNonNull(n);
            e.e.a.a.a.a.j0(n, b2);
            TextView p4 = this.B.p();
            com.overlook.android.fing.engine.j.a.e.t.d dVar4 = this.x;
            if (dVar4 == null || (ispInfo = dVar4.m) == null || TextUtils.isEmpty(ispInfo.j())) {
                com.overlook.android.fing.engine.j.a.e.t.d dVar5 = this.x;
                if (dVar5 == null || !(dVar5 instanceof g) || (carrierInfo = (gVar2 = (g) dVar5).p) == null || TextUtils.isEmpty(carrierInfo.b())) {
                    com.overlook.android.fing.engine.j.a.e.t.d dVar6 = this.x;
                    if (dVar6 == null || (geoIpInfo = dVar6.n) == null || TextUtils.isEmpty(geoIpInfo.G())) {
                        str4 = "-";
                    } else {
                        str4 = this.x.n.G();
                    }
                } else {
                    str4 = gVar2.p.b();
                }
            } else {
                str4 = this.x.m.j();
            }
            p4.setText(str4);
            if (this.x.f14931a != b.EnumC0144b.READY) {
                this.C.e(ProgressIndicator.a.ACTIVE, true);
                ProgressIndicator progressIndicator = this.C;
                com.overlook.android.fing.engine.j.a.e.t.d dVar7 = this.x;
                progressIndicator.f(((float) (dVar7.f14932c + dVar7.f14933d)) / 200.0f, true);
                this.C.h(androidx.core.content.a.b(getContext(), c.a(this.u, cVar3) >= 0 ? R.color.accent100 : R.color.green100));
            } else {
                this.C.e(aVar2, true);
            }
            c cVar4 = this.u;
            if (cVar4 != c.STARTING_PING) {
                if (cVar4 != c.PINGING) {
                    if (cVar4 != c.STARTING_DOWNLOAD) {
                        str5 = "bps";
                        if (cVar4 == c.DOWNLOADING) {
                            this.G.q(androidx.core.content.a.b(this, R.color.green100));
                            this.G.s(aVar);
                            this.G.setVisibility(0);
                            if (!this.x.f14937h.isEmpty()) {
                                d4 = ((Double) e.a.a.a.a.h(this.x.f14937h, 1)).doubleValue() / 1000000.0d;
                                str6 = e.e.a.a.a.a.Z(((Double) e.a.a.a.a.h(this.x.f14937h, 1)).doubleValue(), 1000.0d, "%.02f");
                                String[] split = str6.split(" ");
                                if (split.length == 2) {
                                    str6 = split[0];
                                    str5 = e.a.a.a.a.z(new StringBuilder(), split[1], str5);
                                }
                                d3 = v1(d4);
                            }
                        } else if (cVar4 == cVar3) {
                            this.v = 0.0d;
                            this.G.q(androidx.core.content.a.b(this, R.color.accent100));
                            this.G.s(aVar3);
                            this.G.setVisibility(0);
                        } else if (cVar4 == c.UPLOADING) {
                            this.G.q(androidx.core.content.a.b(this, R.color.accent100));
                            this.G.s(aVar);
                            this.G.setVisibility(0);
                            if (!this.x.f14938i.isEmpty()) {
                                d4 = ((Double) e.a.a.a.a.h(this.x.f14938i, 1)).doubleValue() / 1000000.0d;
                                str6 = e.e.a.a.a.a.Z(((Double) e.a.a.a.a.h(this.x.f14938i, 1)).doubleValue(), 1000.0d, "%.02f");
                                String[] split2 = str6.split(" ");
                                if (split2.length == 2) {
                                    str6 = split2[0];
                                    str5 = e.a.a.a.a.z(new StringBuilder(), split2[1], str5);
                                }
                                d3 = v1(d4);
                            }
                        } else if (c.a(cVar4, cVar2) >= 0) {
                            this.v = 0.0d;
                            com.overlook.android.fing.engine.j.a.e.t.d dVar8 = this.x;
                            boolean z2 = (dVar8 instanceof g) && ((g) dVar8).o != null;
                            ChangeBounds changeBounds = new ChangeBounds();
                            changeBounds.K(200);
                            changeBounds.M(new AccelerateInterpolator());
                            h.a(this.y, changeBounds);
                            this.G.setVisibility(8);
                            this.H.setVisibility(z2 ? 8 : 0);
                            this.D.setVisibility(z2 ? 8 : 0);
                            this.I.setVisibility(!z2 ? 8 : 0);
                        }
                        d2 = d4 / d3;
                        this.G.o().setText(str6);
                        this.G.n().setText(str5);
                        this.G.r((float) d2);
                        this.H.refresh();
                        if (c.a(this.u, cVar2) >= 0) {
                            InternetSpeedInfo internetSpeedInfo4 = this.x.l;
                            if (internetSpeedInfo4 != null && internetSpeedInfo4.a() >= 0.0d) {
                                this.E.h().setText(e.e.a.a.a.a.w(this.x.l.a()));
                            } else if (!this.x.f14937h.isEmpty()) {
                                this.E.h().setText(e.e.a.a.a.a.w(((Double) e.a.a.a.a.h(this.x.f14937h, 1)).doubleValue()));
                            } else {
                                this.E.h().setText("-");
                            }
                            InternetSpeedInfo internetSpeedInfo5 = this.x.l;
                            if (internetSpeedInfo5 != null && internetSpeedInfo5.g() >= 0.0d) {
                                this.F.h().setText(e.e.a.a.a.a.w(this.x.l.g()));
                            } else if (!this.x.f14938i.isEmpty()) {
                                this.F.h().setText(e.e.a.a.a.a.w(((Double) e.a.a.a.a.h(this.x.f14938i, 1)).doubleValue()));
                            } else {
                                this.F.h().setText("-");
                            }
                        }
                        if (c.a(this.u, cVar2) >= 0) {
                            com.overlook.android.fing.engine.j.a.e.t.d dVar9 = this.x;
                            if ((dVar9 instanceof g) && (hVar = (gVar = (g) dVar9).o) != null) {
                                switch (hVar.ordinal()) {
                                    case 0:
                                        this.K.setImageResource(R.drawable.no_cellular_96);
                                        IconView iconView = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView, iconView);
                                        this.J.p().setText(R.string.minternetspeed_cellulartowifi_title);
                                        this.J.o().setText(R.string.minternetspeed_cellulartowifi_body);
                                        break;
                                    case 1:
                                    case 4:
                                    case 8:
                                    case 9:
                                    case 10:
                                    case 11:
                                    case 12:
                                    case 13:
                                    case 14:
                                        this.K.setImageResource(R.drawable.server_error_96);
                                        IconView iconView2 = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView2, iconView2);
                                        this.J.p().setText(R.string.minternetspeed_errorfallback_title);
                                        com.overlook.android.fing.vl.components.TextView o2 = this.J.o();
                                        o2.setText(getString(R.string.minternetspeed_errorfallback_bodyalt) + "\n(" + gVar.o.name() + ")");
                                        break;
                                    case 2:
                                        this.K.setImageResource(R.drawable.no_connectivity_96);
                                        IconView iconView3 = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView3, iconView3);
                                        this.J.p().setText(R.string.minternetspeed_lostsignal_title);
                                        this.J.o().setText(R.string.minternetspeed_lostsignal_body);
                                        break;
                                    case 3:
                                        this.K.setImageResource(R.drawable.no_connectivity_96);
                                        IconView iconView4 = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView4, iconView4);
                                        this.J.p().setText(R.string.generic_nointernetconnection);
                                        this.J.o().setText(R.string.generic_nointernetconnection_long);
                                        break;
                                    case 5:
                                        this.K.setImageResource(R.drawable.no_cellular_96);
                                        IconView iconView5 = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView5, iconView5);
                                        this.J.p().setText(R.string.minternetspeed_userterminated_title);
                                        this.J.o().setText(R.string.minternetspeed_userterminated_body);
                                        break;
                                    case 6:
                                        this.K.setImageResource(R.drawable.no_wifi_96);
                                        IconView iconView6 = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView6, iconView6);
                                        this.J.p().setText(R.string.minternetspeed_wifichanged_title);
                                        this.J.o().setText(R.string.minternetspeed_wifichanged_body);
                                        break;
                                    case 7:
                                        this.K.setImageResource(R.drawable.no_wifi_96);
                                        IconView iconView7 = this.K;
                                        e.a.a.a.a.K(getContext(), R.color.grey100, iconView7, iconView7);
                                        this.J.p().setText(R.string.minternetspeed_wifitocellular_title);
                                        this.J.o().setText(R.string.minternetspeed_wifitocellular_body);
                                        break;
                                }
                            }
                        }
                    } else {
                        this.v = 0.0d;
                        this.G.q(androidx.core.content.a.b(this, R.color.green100));
                        this.G.s(aVar3);
                        this.G.setVisibility(0);
                    }
                } else {
                    this.G.q(androidx.core.content.a.b(this, R.color.grey100));
                    this.G.s(aVar3);
                    this.G.setVisibility(0);
                }
            } else {
                this.v = 0.0d;
                this.G.q(androidx.core.content.a.b(this, R.color.grey100));
                this.G.s(aVar3);
                this.G.setVisibility(0);
            }
            str6 = null;
            d2 = 0.0d;
            str5 = null;
            this.G.o().setText(str6);
            this.G.n().setText(str5);
            this.G.r((float) d2);
            this.H.refresh();
            if (c.a(this.u, cVar2) >= 0) {
            }
            if (c.a(this.u, cVar2) >= 0) {
            }
        }
        if (!M0() || this.x == null || c.a(this.u, cVar2) < 0) {
            str = null;
            this.N.setVisibility(8);
        } else {
            if (((this.b != null && c.a(this.u, cVar2) >= 0) || y1()) && (o4Var = (o4) getSupportFragmentManager().T("speedtest-rating")) != null) {
                com.overlook.android.fing.engine.j.a.b bVar = this.b;
                if (bVar != null && bVar.r()) {
                    StringBuilder E2 = e.a.a.a.a.E("Working in FINGBOX mode using agent ");
                    E2.append(this.b.c());
                    E2.append(": user rating will match discovery state");
                    Log.d("fing:speedtest", E2.toString());
                    o4Var.t3(this.b.c());
                    o4Var.u3(false);
                } else if (this.f16557c != null) {
                    StringBuilder E3 = e.a.a.a.a.E("Working in FING mode using network ");
                    E3.append(this.f16557c.m);
                    E3.append(": user rating will match discovery state");
                    Log.d("fing:speedtest", E3.toString());
                    n0 n0Var = this.f16557c.f15879c;
                    o4Var.B3(n0Var != null ? n0Var.d() : null, this.f16557c.m);
                    o4Var.u3(false);
                } else {
                    com.overlook.android.fing.engine.j.a.e.t.d dVar10 = this.x;
                    if (dVar10 instanceof g) {
                        g gVar3 = (g) dVar10;
                        WiFiConnectionInfo wiFiConnectionInfo = gVar3.q;
                        if (wiFiConnectionInfo == null || wiFiConnectionInfo.a() == null) {
                            str3 = null;
                            o4Var.B3(null, null);
                        } else {
                            p y2 = x0().y(null, null, gVar3.q.a(), null, EnumSet.complementOf(x.v));
                            if (y2 != null) {
                                StringBuilder E4 = e.a.a.a.a.E("Found network ");
                                E4.append(y2.m);
                                E4.append(" using BSSID ");
                                E4.append(gVar3.q.a());
                                E4.append(": user rating will match discovery state");
                                Log.d("fing:speedtest", E4.toString());
                                n0 n0Var2 = y2.f15879c;
                                o4Var.B3(n0Var2 != null ? n0Var2.d() : null, y2.m);
                                str3 = null;
                            } else {
                                str3 = null;
                                o4Var.B3(null, null);
                            }
                        }
                        o4Var.u3(gVar3.p != null);
                        str2 = str3;
                        GeoIpInfo geoIpInfo2 = this.x.n;
                        o4Var.y3(geoIpInfo2 == null ? geoIpInfo2.u() : str2);
                        o4Var.w3(geoIpInfo2 == null ? geoIpInfo2.y() : str2);
                        o4Var.x3(geoIpInfo2 == null ? geoIpInfo2.B() : str2);
                        o4Var.v3(geoIpInfo2 == null ? geoIpInfo2.x() : str2);
                        o4Var.A3();
                        this.N.setVisibility(0);
                        str = str2;
                    }
                }
                str2 = null;
                GeoIpInfo geoIpInfo22 = this.x.n;
                o4Var.y3(geoIpInfo22 == null ? geoIpInfo22.u() : str2);
                o4Var.w3(geoIpInfo22 == null ? geoIpInfo22.y() : str2);
                o4Var.x3(geoIpInfo22 == null ? geoIpInfo22.B() : str2);
                o4Var.v3(geoIpInfo22 == null ? geoIpInfo22.x() : str2);
                o4Var.A3();
                this.N.setVisibility(0);
                str = str2;
            } else {
                str = null;
            }
        }
        ScoreboardReport.c cVar5 = ScoreboardReport.c.CITY;
        if (this.x == null || !y1()) {
            this.O.setVisibility(8);
        } else {
            g gVar4 = (g) this.x;
            InternetSpeedTestRecord internetSpeedTestRecord = gVar4.r;
            if (internetSpeedTestRecord == null) {
                this.O.setVisibility(8);
            } else {
                WiFiConnectionInfo wiFiConnectionInfo2 = gVar4.q;
                CarrierInfo carrierInfo2 = gVar4.p;
                GeoIpInfo geoIpInfo3 = gVar4.n;
                boolean z3 = internetSpeedTestRecord.l() != null && y4.b(internetSpeedTestRecord.l().c());
                boolean z4 = internetSpeedTestRecord.l() != null && y4.b(internetSpeedTestRecord.l().d());
                if (z3 || z4) {
                    if (z3) {
                        cVar = cVar5;
                    } else {
                        cVar = ScoreboardReport.c.COUNTRY;
                    }
                    scoreboardReport = y4.i(internetSpeedTestRecord, wiFiConnectionInfo2, carrierInfo2, geoIpInfo3, cVar);
                } else {
                    scoreboardReport = str;
                }
                if (scoreboardReport != 0) {
                    if (scoreboardReport.c() == cVar5) {
                        str = scoreboardReport.a();
                    }
                    String b3 = z.b(str, scoreboardReport.g(), scoreboardReport.b());
                    if (scoreboardReport.f() >= 50.0d) {
                        this.P.o().setText(getString(R.string.fboxinternetspeed_score_top_percentile, new Object[]{y4.g((int) (100.0d - scoreboardReport.f()), 5) + "%", b3}));
                    } else {
                        this.P.o().setText(getString(R.string.fboxinternetspeed_score_bottom_percentile, new Object[]{y4.g((int) scoreboardReport.f(), 5) + "%", b3}));
                    }
                    this.P.n().r(scoreboardReport.f());
                    this.O.setVisibility(0);
                } else {
                    this.O.setVisibility(8);
                }
            }
        }
        if (this.x != null && c.a(this.u, cVar2) >= 0) {
            com.overlook.android.fing.engine.j.a.e.t.d dVar11 = this.x;
            if (!((dVar11 instanceof g) && ((g) dVar11).o != null)) {
                InternetSpeedInfo internetSpeedInfo6 = dVar11.l;
                if (internetSpeedInfo6 == null || internetSpeedInfo6.a() < 0.0d) {
                    i2 = !this.x.f14937h.isEmpty() ? ((Double) e.a.a.a.a.h(this.x.f14937h, 1)).intValue() : 0;
                } else {
                    i2 = (int) this.x.l.a();
                }
                InternetSpeedInfo internetSpeedInfo7 = this.x.l;
                if (internetSpeedInfo7 == null || internetSpeedInfo7.g() < 0.0d) {
                    i3 = !this.x.f14938i.isEmpty() ? ((Double) e.a.a.a.a.h(this.x.f14938i, 1)).intValue() : 0;
                } else {
                    i3 = (int) this.x.l.g();
                }
                EnumSet<r> v2 = e.e.a.a.a.a.v((double) i2, (double) i3);
                if (i2 == 0 && i3 == 0) {
                    this.S.s().setText(R.string.generic_notavailable_long);
                    this.S.q().r(0.0d);
                    this.S.o().g(androidx.core.content.a.b(getContext(), R.color.grey20));
                    IconView o3 = this.S.o();
                    e.a.a.a.a.K(getContext(), R.color.grey50, o3, o3);
                } else {
                    if (v2.contains(r.VIDEO_8K)) {
                        this.S.s().setText(R.string.qos_video_8k);
                        this.S.q().r(100.0d);
                    } else if (v2.contains(r.VIDEO_4K)) {
                        this.S.s().setText(R.string.qos_video_4k);
                        this.S.q().r(75.0d);
                    } else if (v2.contains(r.VIDEO_HD)) {
                        this.S.s().setText(R.string.qos_video_hd);
                        this.S.q().r(50.0d);
                    } else if (v2.contains(r.VIDEO_SD)) {
                        this.S.s().setText(R.string.qos_video_sd);
                        this.S.q().r(25.0d);
                    } else if (v2.contains(r.VIDEO_BASIC)) {
                        this.S.s().setText(R.string.qos_video_basic);
                        this.S.q().r(5.0d);
                    }
                    this.S.o().g(androidx.core.content.a.b(getContext(), R.color.accent20));
                    IconView o4 = this.S.o();
                    e.a.a.a.a.K(getContext(), R.color.accent100, o4, o4);
                }
                if (i2 == 0 && i3 == 0) {
                    this.T.s().setText(R.string.generic_notavailable_long);
                    this.T.q().r(0.0d);
                    this.T.o().g(androidx.core.content.a.b(getContext(), R.color.grey20));
                    IconView o5 = this.T.o();
                    e.a.a.a.a.K(getContext(), R.color.grey50, o5, o5);
                } else {
                    if (v2.contains(r.CALL_WEBCAM_HD)) {
                        this.T.s().setText(R.string.qos_call_webcamhd);
                        this.T.q().r(100.0d);
                    } else if (v2.contains(r.CALL_WEBCAM_SD)) {
                        this.T.s().setText(R.string.qos_call_webcamsd);
                        this.T.q().r(50.0d);
                    } else if (v2.contains(r.CALL_AUDIO_ONLY)) {
                        this.T.s().setText(R.string.qos_call_webcamaudio);
                        this.T.q().r(25.0d);
                    } else if (v2.contains(r.CALL_LIMITED)) {
                        this.T.s().setText(R.string.qos_call_webcamlimited);
                        this.T.q().r(5.0d);
                    }
                    this.T.o().g(androidx.core.content.a.b(getContext(), R.color.accent20));
                    IconView o6 = this.T.o();
                    e.a.a.a.a.K(getContext(), R.color.accent100, o6, o6);
                }
                if (i2 == 0 && i3 == 0) {
                    this.U.s().setText(R.string.generic_notavailable_long);
                    this.U.q().r(0.0d);
                    this.U.o().g(androidx.core.content.a.b(getContext(), R.color.grey20));
                    IconView o7 = this.U.o();
                    e.a.a.a.a.K(getContext(), R.color.grey50, o7, o7);
                } else {
                    if (v2.contains(r.SOCIAL_HD)) {
                        this.U.s().setText(R.string.qos_social_videoandphotohd);
                        this.U.q().r(100.0d);
                    } else if (v2.contains(r.SOCIAL_SD)) {
                        this.U.s().setText(R.string.qos_social_videoandphoto);
                        this.U.q().r(50.0d);
                    } else if (v2.contains(r.SOCIAL_BASIC)) {
                        this.U.s().setText(R.string.qos_social_photo);
                        this.U.q().r(25.0d);
                    } else if (v2.contains(r.SOCIAL_LIMITED)) {
                        this.U.s().setText(R.string.qos_social_messaging);
                        this.U.q().r(5.0d);
                    }
                    this.U.o().g(androidx.core.content.a.b(getContext(), R.color.accent20));
                    IconView o8 = this.U.o();
                    e.a.a.a.a.K(getContext(), R.color.accent100, o8, o8);
                }
                if (i2 == 0 && i3 == 0) {
                    this.V.s().setText(R.string.generic_notavailable_long);
                    this.V.q().r(0.0d);
                    this.V.o().g(androidx.core.content.a.b(getContext(), R.color.grey20));
                    IconView o9 = this.V.o();
                    e.a.a.a.a.K(getContext(), R.color.grey50, o9, o9);
                } else {
                    if (v2.contains(r.WORK_TRANSFERS_LARGE)) {
                        this.V.s().setText(R.string.qos_work_largefiles);
                        this.V.q().r(100.0d);
                    } else if (v2.contains(r.WORK_TRANSFERS_MEDIUM)) {
                        this.V.s().setText(R.string.qos_work_largefiles);
                        this.V.q().r(75.0d);
                    } else if (v2.contains(r.WORK_TRANSFERS_SMALL)) {
                        this.V.s().setText(R.string.qos_work_smallfiles);
                        this.V.q().r(50.0d);
                    } else if (v2.contains(r.WORK_BROWSING_BASIC)) {
                        this.V.s().setText(R.string.qos_work_browsing);
                        this.V.q().r(25.0d);
                    } else if (v2.contains(r.WORK_BROWSING_LIMITED)) {
                        this.V.s().setText(R.string.qos_work_browsing_small);
                        this.V.q().r(5.0d);
                    }
                    this.V.o().g(androidx.core.content.a.b(getContext(), R.color.accent20));
                    IconView o10 = this.V.o();
                    e.a.a.a.a.K(getContext(), R.color.accent100, o10, o10);
                }
                this.R.setVisibility(0);
                return;
            }
        }
        this.R.setVisibility(8);
    }

    private int u1() {
        com.overlook.android.fing.engine.j.a.b bVar = this.b;
        if (bVar != null) {
            return j.d(bVar);
        }
        com.overlook.android.fing.engine.j.a.e.t.d dVar = this.x;
        if (dVar != null && (dVar instanceof g)) {
            g gVar = (g) dVar;
            if (gVar.q != null) {
                return R.drawable.btn_wifi;
            }
            if (gVar.p != null) {
                return R.drawable.btn_cellular;
            }
        }
        if (M0()) {
            com.overlook.android.fing.engine.e.h v0 = v0();
            if (!v0.t() && v0.s()) {
                return R.drawable.btn_cellular;
            }
        }
        return R.drawable.btn_wifi;
    }

    private double v1(double d2) {
        if (d2 < 100.0d && this.v <= 100.0d) {
            this.v = 100.0d;
        } else if (d2 < 250.0d && this.v <= 250.0d) {
            this.v = 250.0d;
        } else if (d2 >= 500.0d || this.v > 500.0d) {
            this.v = 1000.0d;
        } else {
            this.v = 500.0d;
        }
        return this.v;
    }

    private void w1() {
        FrameLayout frameLayout = (FrameLayout) findViewById(R.id.adview_container);
        this.L = frameLayout;
        frameLayout.removeAllViews();
        AdView adView = new AdView(this);
        this.M = adView;
        adView.setAdSize(e.e.a.a.a.a.x(this));
        this.M.setAdUnitId(com.overlook.android.fing.ui.ads.d.SPEEDTEST.a());
        this.M.setAdListener(new a());
    }

    private void x1() {
        if (!M0() || this.w != null) {
            return;
        }
        if (this.b == null || this.p != b.FINGBOX) {
            e j = e.j();
            i.a aVar = new i.a();
            aVar.a(NdtConfiguration.CONNECTION_TIMEOUT_KEY, 0);
            aVar.a(NdtConfiguration.SETUP_TIMEOUT_KEY, j.n());
            aVar.a(NdtConfiguration.SETUP_TIMEOUT_DOWNLOAD_KEY, j.k());
            aVar.a(NdtConfiguration.SETUP_TIMEOUT_UPLOAD_KEY, j.o());
            aVar.a(NdtConfiguration.POLLING_PERIOD_KEY, j.m());
            aVar.a(NdtConfiguration.TEST_DURATION_KEY, j.q());
            aVar.a(NdtConfiguration.NEUBOT_PORT_KEY, j.l());
            aVar.a(NdtConfiguration.NDT_PORT_KEY, j.p());
            i iVar = new i(this, F0(), aVar);
            this.w = iVar;
            iVar.d(this);
            return;
        }
        com.overlook.android.fing.engine.j.a.e.t.b K2 = ((com.overlook.android.fing.engine.j.a.e.r) A0()).K(this.b);
        this.w = K2;
        K2.d(this);
    }

    private boolean y1() {
        com.overlook.android.fing.engine.j.a.e.t.d dVar = this.x;
        if (dVar == null || !(dVar instanceof g) || ((g) dVar).r == null) {
            return false;
        }
        return true;
    }

    public /* synthetic */ void A1(View view) {
        com.overlook.android.fing.engine.j.a.e.t.d dVar = this.x;
        if (dVar != null && (dVar instanceof g)) {
            g gVar = (g) dVar;
            if (gVar.r != null) {
                Intent intent = new Intent(getContext(), ScoreboardActivity.class);
                ArrayList<ScoreboardReport> e2 = y4.e(gVar.r, gVar.q, gVar.p, gVar.n, ScoreboardReport.c.CITY);
                ArrayList<ScoreboardReport> e3 = y4.e(gVar.r, gVar.q, gVar.p, gVar.n, ScoreboardReport.c.COUNTRY);
                if (y4.c(e3)) {
                    intent.putParcelableArrayListExtra("scoreboard-country-extra", e3);
                }
                if (y4.c(e2)) {
                    intent.putParcelableArrayListExtra("scoreboard-city-extra", e2);
                }
                startActivity(intent);
            }
        }
    }

    public void B1(t tVar) {
        this.t = tVar;
        s sVar = new s(this);
        this.q = sVar;
        sVar.e(new u(this));
        this.q.d(new String[]{"android.permission.ACCESS_FINE_LOCATION"}, ConnectionResult.RESOLUTION_REQUIRED);
    }

    public /* synthetic */ void C1(CheckBox checkBox, t tVar, DialogInterface dialogInterface, int i2) {
        dialogInterface.dismiss();
        if (checkBox.isChecked()) {
            com.overlook.android.fing.engine.d.a.s(getContext(), true);
        }
        tVar.c(0);
    }

    public /* synthetic */ void D1(androidx.appcompat.app.g gVar) {
        com.overlook.android.fing.engine.d.a.e(getContext());
    }

    public void E1(t tVar) {
        if (com.overlook.android.fing.engine.d.a.j(getContext())) {
            tVar.c(1);
        } else {
            g0.d(this, true, new i(tVar), new n(this, tVar));
        }
    }

    public void F1(t tVar, com.overlook.android.fing.engine.j.a.e.t.d dVar) {
        int i2 = 0;
        if (getContext().getSharedPreferences("uiprefs", 0).getBoolean("cellular_speedtest_prompt_disabled", false)) {
            tVar.c(0);
        } else if (!(dVar instanceof g)) {
            tVar.c(0);
        } else {
            g gVar = (g) dVar;
            boolean z2 = getContext().getSharedPreferences("uiprefs", 0).getLong("cellular_speedtest_prompt_count", 0) >= 2;
            View inflate = LayoutInflater.from(this).inflate(R.layout.dialog_cellular_permissions, (ViewGroup) null);
            TextView textView = (TextView) inflate.findViewById(R.id.dialog_body);
            Object[] objArr = new Object[1];
            CarrierInfo carrierInfo = gVar.p;
            objArr[0] = carrierInfo != null ? carrierInfo.b() : "<?>";
            textView.setText(getString(R.string.minternetspeed_cellular_permission_body, objArr));
            CheckBox checkBox = (CheckBox) inflate.findViewById(R.id.checkbox);
            if (!z2) {
                i2 = 8;
            }
            checkBox.setVisibility(i2);
            f0 f0Var = new f0(getContext());
            f0Var.d(true);
            f0Var.K(R.string.minternetspeed_cellular_permission_title);
            f0Var.s(inflate);
            f0Var.z(R.string.minternetspeed_cellular_permission_deny, new h(tVar));
            f0Var.G(R.string.minternetspeed_cellular_permission_accept, new o(this, checkBox, tVar));
            f0Var.D(new r(tVar));
            f0Var.F(new g(this));
            f0Var.M();
        }
    }

    public /* synthetic */ void G1(com.overlook.android.fing.engine.j.a.e.t.d dVar) {
        K1(dVar);
        N1();
    }

    public /* synthetic */ void H1(com.overlook.android.fing.engine.j.a.e.t.d dVar, b.a aVar) {
        K1(dVar);
        N1();
        int ordinal = aVar.ordinal();
        if (ordinal == 0) {
            showToast(R.string.fboxgeneric_engine_nostart, new Object[0]);
        } else if (ordinal == 1) {
            showToast(R.string.fboxgeneric_engine_noprogress, new Object[0]);
        } else if (ordinal == 2) {
            showToast(R.string.fboxgeneric_engine_nostop, new Object[0]);
        }
    }

    public /* synthetic */ void I1() {
        if (this.w != null) {
            com.overlook.android.fing.engine.j.a.e.t.d dVar = this.x;
            if (dVar == null || dVar.f14931a == b.EnumC0144b.READY) {
                j.w(this.b != null ? "Speedtest_Refresh" : "Mobile_Speedtest_Start");
                this.u = c.STARTING_PING;
                N1();
                this.w.start();
            }
        }
    }

    public void K1(com.overlook.android.fing.engine.j.a.e.t.d dVar) {
        this.x = dVar;
        if (dVar.b >= 100 && y1()) {
            this.u = c.RANKED;
        } else if (dVar.b >= 100) {
            this.u = c.COMPLETED;
        } else {
            int i2 = dVar.f14934e;
            if (i2 <= 0 || i2 >= 100) {
                int i3 = dVar.f14932c;
                if (i3 == 0 && i2 >= 100) {
                    this.u = c.STARTING_DOWNLOAD;
                } else if (i3 < 0 || i3 >= 100 || dVar.f14937h.isEmpty()) {
                    int i4 = dVar.f14933d;
                    if (i4 == 0 && dVar.f14932c >= 100) {
                        this.u = c.STARTING_UPLOAD;
                    } else if (i4 >= 0 && i4 < 100 && !dVar.f14938i.isEmpty()) {
                        this.u = c.UPLOADING;
                    }
                } else {
                    this.u = c.DOWNLOADING;
                }
            } else {
                this.u = c.PINGING;
            }
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.overlook.android.fing.ui.base.ServiceActivity
    public void b1(boolean z2) {
        super.b1(z2);
        x1();
        J1();
        if (this.x == null) {
            Log.i("fing:speedtest", "Automatically starting internet speedtest");
            L1();
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.overlook.android.fing.ui.base.ServiceActivity
    public void d1() {
        super.d1();
        x1();
        J1();
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity
    public void onActivityResult(int i2, int i3, Intent intent) {
        q qVar;
        super.onActivityResult(i2, i3, intent);
        if (i2 == 8001 && (qVar = this.o) != null) {
            qVar.e(i2);
        }
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity
    public void onConfigurationChanged(Configuration configuration) {
        super.onConfigurationChanged(configuration);
        w1();
        if (M0()) {
            u0().e(com.overlook.android.fing.ui.ads.d.SPEEDTEST);
        }
        M1();
        J1();
    }

    /* access modifiers changed from: protected */
    @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.overlook.android.fing.ui.base.BaseActivity, com.overlook.android.fing.ui.base.ServiceActivity
    public void onCreate(Bundle bundle) {
        b bVar;
        super.onCreate(bundle);
        setContentView(R.layout.activity_speedtest);
        Intent intent = getIntent();
        if (intent.hasExtra("configuration") && (bVar = (b) intent.getSerializableExtra("configuration")) != null) {
            this.p = bVar;
        }
        w1();
        this.y = (LinearLayout) findViewById(R.id.test_layout);
        this.z = (MeasurementCompact) findViewById(R.id.meas_ping);
        this.A = (MeasurementCompact) findViewById(R.id.meas_location);
        MeasurementCompact measurementCompact = (MeasurementCompact) findViewById(R.id.meas_provider);
        this.B = measurementCompact;
        measurementCompact.n().setImageResource(u1());
        ProgressIndicator progressIndicator = (ProgressIndicator) findViewById(R.id.progress_indicator);
        this.C = progressIndicator;
        boolean z2 = false;
        progressIndicator.f(0.0f, false);
        this.D = (LinearLayout) findViewById(R.id.test_meas);
        this.E = (MeasurementIndicator) findViewById(R.id.meas_down);
        this.F = (MeasurementIndicator) findViewById(R.id.meas_up);
        Speedometer speedometer = (Speedometer) findViewById(R.id.test_meter);
        this.G = speedometer;
        speedometer.p(0.5f);
        this.G.o().setText("0");
        this.G.n().setText("Mbps");
        LineChart lineChart = (LineChart) findViewById(R.id.line_chart);
        this.H = lineChart;
        lineChart.setEnableBezierCurve(true);
        this.H.setEnableTouchReport(false);
        this.H.setEnableLegend(false);
        this.H.setEnableProgressiveReference(true);
        this.H.setLineWidth(e.e.a.a.a.a.s(2.0f));
        this.H.setLineColor(androidx.core.content.a.b(this, R.color.text100));
        this.H.setProjectionLineColor(androidx.core.content.a.b(this, R.color.text50));
        this.H.setNumberOfHorizontalReferences(0);
        this.H.setNumberOfVerticalReferences(4);
        this.H.setTypeOfVerticalReferences(LineChart.ReferenceType.LINE);
        this.H.setAdapter(new d(null));
        this.I = (ConstraintLayout) findViewById(R.id.error_container);
        this.J = (Paragraph) findViewById(R.id.error_paragraph);
        this.K = (IconView) findViewById(R.id.error_image);
        this.R = (CardView) findViewById(R.id.qos_card);
        MeasurementBadge measurementBadge = (MeasurementBadge) findViewById(R.id.qos_video);
        this.S = measurementBadge;
        measurementBadge.s().setText(R.string.generic_detecting);
        this.S.r().setText(R.string.generic_video);
        this.S.q().setVisibility(0);
        this.S.q().s(R.dimen.image_size_mini);
        this.S.q().h(R.drawable.btn_star);
        this.S.q().j(R.drawable.btn_star_half);
        this.S.q().i(R.drawable.btn_star_full);
        this.S.q().p(5);
        IconView o2 = this.S.o();
        int i2 = androidx.core.content.a.b;
        o2.setImageDrawable(getDrawable(R.drawable.videocam_24));
        this.S.o().setScaleType(ImageView.ScaleType.CENTER);
        IconView o3 = this.S.o();
        int b2 = androidx.core.content.a.b(this, R.color.accent100);
        Objects.requireNonNull(o3);
        e.e.a.a.a.a.j0(o3, b2);
        this.S.o().g(androidx.core.content.a.b(this, R.color.accent20));
        this.S.o().h(androidx.core.content.a.b(this, R.color.accent20));
        MeasurementBadge measurementBadge2 = (MeasurementBadge) findViewById(R.id.qos_call);
        this.T = measurementBadge2;
        measurementBadge2.s().setText(R.string.generic_detecting);
        this.T.r().setText(R.string.generic_call);
        this.T.q().setVisibility(0);
        this.T.q().s(R.dimen.image_size_mini);
        this.T.q().h(R.drawable.btn_star);
        this.T.q().j(R.drawable.btn_star_half);
        this.T.q().i(R.drawable.btn_star_full);
        this.T.q().p(5);
        this.T.o().setImageDrawable(getDrawable(R.drawable.phone_24));
        this.T.o().setScaleType(ImageView.ScaleType.CENTER);
        IconView o4 = this.T.o();
        int b3 = androidx.core.content.a.b(this, R.color.accent100);
        Objects.requireNonNull(o4);
        e.e.a.a.a.a.j0(o4, b3);
        this.T.o().g(androidx.core.content.a.b(this, R.color.accent20));
        this.T.o().h(androidx.core.content.a.b(this, R.color.accent20));
        MeasurementBadge measurementBadge3 = (MeasurementBadge) findViewById(R.id.qos_social);
        this.U = measurementBadge3;
        measurementBadge3.s().setText(R.string.generic_detecting);
        this.U.r().setText(R.string.generic_social);
        this.U.q().setVisibility(0);
        this.U.q().s(R.dimen.image_size_mini);
        this.U.q().h(R.drawable.btn_star);
        this.U.q().j(R.drawable.btn_star_half);
        this.U.q().i(R.drawable.btn_star_full);
        this.U.q().p(5);
        this.U.o().setImageDrawable(getDrawable(R.drawable.social_24));
        this.U.o().setScaleType(ImageView.ScaleType.CENTER);
        IconView o5 = this.U.o();
        int b4 = androidx.core.content.a.b(this, R.color.accent100);
        Objects.requireNonNull(o5);
        e.e.a.a.a.a.j0(o5, b4);
        this.U.o().g(androidx.core.content.a.b(this, R.color.accent20));
        this.U.o().h(androidx.core.content.a.b(this, R.color.accent20));
        MeasurementBadge measurementBadge4 = (MeasurementBadge) findViewById(R.id.qos_work);
        this.V = measurementBadge4;
        measurementBadge4.s().setText(R.string.generic_detecting);
        this.V.r().setText(R.string.generic_work);
        this.V.q().setVisibility(0);
        this.V.q().s(R.dimen.image_size_mini);
        this.V.q().h(R.drawable.btn_star);
        this.V.q().j(R.drawable.btn_star_half);
        this.V.q().i(R.drawable.btn_star_full);
        this.V.q().p(5);
        this.V.o().setImageDrawable(getDrawable(R.drawable.work_24));
        this.V.o().setScaleType(ImageView.ScaleType.CENTER);
        IconView o6 = this.V.o();
        int b5 = androidx.core.content.a.b(this, R.color.accent100);
        Objects.requireNonNull(o6);
        e.e.a.a.a.a.j0(o6, b5);
        this.V.o().g(androidx.core.content.a.b(this, R.color.accent20));
        this.V.o().h(androidx.core.content.a.b(this, R.color.accent20));
        this.N = (CardView) findViewById(R.id.rate_card);
        m supportFragmentManager = getSupportFragmentManager();
        if (supportFragmentManager.T("speedtest-rating") == null) {
            Bundle bundle2 = new Bundle();
            bundle2.putSerializable("configuration", o4.c.SPEEDTEST);
            Intent intent2 = getIntent();
            bundle2.putString("agentId", intent2.getStringExtra("agentId"));
            bundle2.putString("syncId", intent2.getStringExtra("syncId"));
            bundle2.putString("networkId", intent2.getStringExtra("networkId"));
            o4 o4Var = new o4();
            o4Var.S1(bundle2);
            androidx.fragment.app.s h2 = supportFragmentManager.h();
            h2.b(R.id.rate_card, o4Var, "speedtest-rating");
            h2.e();
        }
        this.O = (CardView) findViewById(R.id.score_card);
        this.P = (HeaderWithScore) findViewById(R.id.score_header);
        SectionFooter sectionFooter = (SectionFooter) findViewById(R.id.score_footer);
        this.Q = sectionFooter;
        sectionFooter.t(new f(this));
        ((LinearLayout) findViewById(R.id.mlab)).setOnClickListener(new q(this));
        setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
        if (bundle != null) {
            z2 = true;
        }
        t0(true, z2);
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        menu.clear();
        getMenuInflater().inflate(R.menu.tool_menu, menu);
        e.e.a.a.a.a.g0(this, R.string.generic_start, menu.findItem(R.id.action_start));
        this.W = menu;
        return super.onCreateOptionsMenu(menu);
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.overlook.android.fing.ui.base.ServiceActivity
    public void onDestroy() {
        com.overlook.android.fing.engine.j.a.e.t.b bVar = this.w;
        if (bVar != null) {
            bVar.a();
            this.w.b();
            this.w = null;
            if (this.p == b.FINGBOX) {
                ((com.overlook.android.fing.engine.j.a.e.r) A0()).n0();
            }
        }
        super.onDestroy();
    }

    @Override // com.overlook.android.fing.ui.base.BaseActivity
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() != R.id.action_start) {
            return super.onOptionsItemSelected(menuItem);
        }
        com.overlook.android.fing.engine.j.a.e.t.d dVar = this.x;
        if (dVar != null && dVar.f14931a != b.EnumC0144b.READY) {
            return true;
        }
        L1();
        return true;
    }

    public boolean onPrepareOptionsMenu(Menu menu) {
        menu.findItem(R.id.action_start).setVisible(c.a(this.u, c.COMPLETED) >= 0);
        return super.onPrepareOptionsMenu(menu);
    }

    @Override // androidx.fragment.app.FragmentActivity, androidx.core.app.a.c
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        s sVar = this.q;
        if (sVar != null) {
            sVar.c(i2, strArr);
        }
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity, com.overlook.android.fing.ui.base.BaseActivity, com.overlook.android.fing.ui.base.ServiceActivity
    public void onResume() {
        super.onResume();
        j.y(this, "Speedtest");
        J1();
    }

    public /* synthetic */ void z1(View view) {
        com.overlook.android.fing.engine.j.a.e.t.d dVar = this.x;
        if (dVar != null && dVar.f14931a == b.EnumC0144b.READY) {
            e.e.a.a.a.a.W(this, "https://www.measurementlab.net/");
        }
    }
}