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


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

import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import androidx.cardview.widget.CardView;
import androidx.core.content.a;
import com.google.android.gms.ads.formats.UnifiedNativeAd;
import com.huawei.hms.support.api.push.pushselfshow.utils.CommFun;
import com.overlook.android.fing.R;
import com.overlook.android.fing.engine.l.u;
import com.overlook.android.fing.engine.model.internet.OutageInfo;
import com.overlook.android.fing.engine.model.internet.OutageLocation;
import com.overlook.android.fing.ui.ads.NativeAdView;
import com.overlook.android.fing.ui.ads.b;
import com.overlook.android.fing.ui.ads.d;
import com.overlook.android.fing.ui.ads.e;
import com.overlook.android.fing.ui.base.ServiceActivity;
import com.overlook.android.fing.vl.components.Header;
import com.overlook.android.fing.vl.components.IconView;
import com.overlook.android.fing.vl.components.MainButton;
import com.overlook.android.fing.vl.components.MarkerView;
import com.overlook.android.fing.vl.components.Pill;
import com.overlook.android.fing.vl.components.RatingIndicator;
import com.overlook.android.fing.vl.components.ScoreIndicator;
import com.overlook.android.fing.vl.components.Separator;
import com.overlook.android.fing.vl.components.Toolbar;
import e.f.a.a.b.j.j;
import e.f.a.a.b.j.k;
import e.f.a.a.b.j.l;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

public class OutageDetailsActivity extends ServiceActivity {
    private NativeAdView A;
    private UnifiedNativeAd B;
    private CardView C;
    private Header D;
    private Header E;
    private Separator F;
    private LinearLayout G;
    private LinearLayout H;
    private MainButton I;
    private String o;
    private OutageInfo p;
    private Toolbar q;
    private CardView t;
    private ScoreIndicator u;
    private IconView v;
    private Pill w;
    private MarkerView x;
    private MarkerView y;
    private MarkerView z;

    private String k1(long j, long j2, boolean z2) {
        ArrayList arrayList = new ArrayList();
        long abs = Math.abs(j2 - j);
        long j3 = (abs / 60000) % 60;
        long j4 = (abs / 3600000) % 24;
        long j5 = abs / CommFun.CLEAR_FILES_INTERVAL;
        if (j5 != 0) {
            if (j5 == 1) {
                arrayList.add(getString(R.string.dateformat_day_long, new Object[]{String.valueOf(j5)}));
            } else {
                arrayList.add(getString(R.string.dateformat_days_long, new Object[]{String.valueOf(j5)}));
            }
        }
        if (j4 != 0) {
            if (j4 == 1) {
                arrayList.add(getString(R.string.dateformat_hour_long, new Object[]{String.valueOf(j4)}));
            } else {
                arrayList.add(getString(R.string.dateformat_hours_long, new Object[]{String.valueOf(j4)}));
            }
        }
        if (j3 != 0) {
            if (j3 == 1) {
                arrayList.add(getString(R.string.dateformat_min_long, new Object[]{String.valueOf(j3)}));
            } else {
                arrayList.add(getString(R.string.dateformat_mins_long, new Object[]{String.valueOf(j3)}));
            }
        }
        if (z2) {
            return getString(R.string.isp_outage_lasting, new Object[]{TextUtils.join(" ", arrayList)});
        }
        return getString(R.string.isp_outage_lasted, new Object[]{TextUtils.join(" ", arrayList)});
    }

    /* access modifiers changed from: private */
    public void o1() {
        if (M0()) {
            e u0 = u0();
            d dVar = d.OUTAGE_DETAILS;
            u0.e(dVar);
            u0.h(dVar, new m3(this));
        }
    }

    private void p1(List<OutageLocation> list, LinearLayout linearLayout) {
        Resources resources = getResources();
        int dimensionPixelSize = resources.getDimensionPixelSize(R.dimen.spacing_small);
        int dimensionPixelSize2 = resources.getDimensionPixelSize(R.dimen.spacing_mini);
        linearLayout.removeAllViews();
        for (int i2 = 0; i2 < list.size(); i2++) {
            OutageLocation outageLocation = list.get(i2);
            RatingIndicator ratingIndicator = new RatingIndicator(this);
            ratingIndicator.b().setText(outageLocation.c());
            ratingIndicator.a().s(R.dimen.image_size_small);
            ratingIndicator.a().h(R.drawable.bolt_24);
            ratingIndicator.a().i(R.drawable.bolt_full_24);
            ratingIndicator.a().p(5);
            int ordinal = outageLocation.b().ordinal();
            if (ordinal == 0) {
                ratingIndicator.a().r(20.0d);
            } else if (ordinal == 1) {
                ratingIndicator.a().r(40.0d);
            } else if (ordinal == 2) {
                ratingIndicator.a().r(60.0d);
            } else if (ordinal == 3) {
                ratingIndicator.a().r(80.0d);
            } else if (ordinal == 4) {
                ratingIndicator.a().r(100.0d);
            }
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
            layoutParams.setMargins(0, dimensionPixelSize2, dimensionPixelSize, dimensionPixelSize2);
            linearLayout.addView(ratingIndicator, layoutParams);
        }
    }

    private void q1() {
        if (M0()) {
            e u0 = u0();
            if (this.p == null || this.B == null || u0.c(d.OUTAGE_DETAILS) != b.LOADED) {
                this.A.setVisibility(8);
                return;
            }
            this.A.b(this.B);
            this.A.setVisibility(0);
        }
    }

    /* access modifiers changed from: private */
    /* JADX WARNING: Removed duplicated region for block: B:53:0x01ad  */
    /* JADX WARNING: Removed duplicated region for block: B:58:0x01ed  */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x0218  */
    /* JADX WARNING: Removed duplicated region for block: B:65:0x0275  */
    public void r1() {
        String str;
        String str2;
        OutageInfo outageInfo = this.p;
        if (outageInfo != null) {
            int ordinal = outageInfo.i().ordinal();
            if (ordinal == 0) {
                this.q.c0(getString(R.string.isp_minor_outage));
            } else if (ordinal == 1) {
                this.q.c0(getString(R.string.isp_moderate_outage));
            } else if (ordinal == 2) {
                this.q.c0(getString(R.string.isp_considerable_outage));
            } else if (ordinal == 3) {
                this.q.c0(getString(R.string.isp_major_outage));
            } else if (ordinal == 4) {
                this.q.c0(getString(R.string.isp_critical_outage));
            }
        }
        OutageInfo outageInfo2 = this.p;
        int i2 = 8;
        if (outageInfo2 == null) {
            this.t.setVisibility(8);
        } else {
            int ordinal2 = outageInfo2.i().ordinal();
            if (ordinal2 == 0) {
                this.u.r(20.0d);
            } else if (ordinal2 == 1) {
                this.u.r(40.0d);
            } else if (ordinal2 == 2) {
                this.u.r(60.0d);
            } else if (ordinal2 == 3) {
                this.u.r(80.0d);
            } else if (ordinal2 == 4) {
                this.u.r(100.0d);
            }
            if (this.p.k() || this.p.b() == 0) {
                this.w.t(a.b(getContext(), R.color.danger100));
                this.w.p().setText(R.string.isp_outage_ongoing);
                this.w.p().setTextColor(-1);
            } else if (j.v(this.p.b(), System.currentTimeMillis())) {
                this.w.t(a.b(getContext(), R.color.warning100));
                this.w.p().setText(R.string.isp_outage_today);
                this.w.p().setTextColor(-1);
            } else {
                this.w.t(a.b(getContext(), R.color.green100));
                this.w.p().setText(R.string.generic_resolved);
                this.w.p().setTextColor(-1);
            }
            if (this.p.c() != null) {
                e.f.a.a.b.h.d u2 = e.f.a.a.b.h.d.u(this);
                u2.r(this.p.c());
                u2.s(this.v);
                u2.a();
            }
            int ordinal3 = this.p.a().ordinal();
            String str3 = null;
            if (ordinal3 != 0) {
                if (ordinal3 != 1) {
                    if (ordinal3 != 2) {
                        if (ordinal3 == 3) {
                            str3 = this.p.g();
                            str = this.p.f();
                        } else if (ordinal3 != 4) {
                            str = null;
                        }
                        if (TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str)) {
                            this.x.c().setImageResource(R.drawable.website_24);
                            IconView c2 = this.x.c();
                            int b = a.b(this, R.color.text100);
                            Objects.requireNonNull(c2);
                            e.e.a.a.a.a.j0(c2, b);
                            this.x.d().setText(String.format("%s • %s", str, str3));
                            this.x.setVisibility(0);
                        } else if (!TextUtils.isEmpty(str3)) {
                            this.x.c().setImageResource(R.drawable.pin_24);
                            IconView c3 = this.x.c();
                            int b2 = a.b(this, R.color.text100);
                            Objects.requireNonNull(c3);
                            e.e.a.a.a.a.j0(c3, b2);
                            this.x.d().setText(str3);
                            this.x.setVisibility(0);
                        } else if (!TextUtils.isEmpty(str)) {
                            this.x.c().setImageResource(R.drawable.website_24);
                            IconView c4 = this.x.c();
                            int b3 = a.b(this, R.color.text100);
                            Objects.requireNonNull(c4);
                            e.e.a.a.a.a.j0(c4, b3);
                            this.x.d().setText(str);
                            this.x.setVisibility(0);
                        } else {
                            this.x.setVisibility(8);
                        }
                        this.y.d().setText(getString(R.string.isp_outage_started, new Object[]{j.b(this.p.j(), k.DATE_AND_TIME, l.LONG)}));
                        if (!this.p.k() || this.p.b() == 0) {
                            this.z.d().setText(k1(this.p.j(), System.currentTimeMillis(), true));
                        } else {
                            this.z.d().setText(k1(this.p.j(), this.p.b(), false));
                        }
                        this.t.setVisibility(0);
                    } else {
                        str2 = this.p.g();
                    }
                }
                str3 = u.b(this.p.e());
                str = this.p.f();
                if (TextUtils.isEmpty(str3)) {
                }
                if (!TextUtils.isEmpty(str3)) {
                }
                this.y.d().setText(getString(R.string.isp_outage_started, new Object[]{j.b(this.p.j(), k.DATE_AND_TIME, l.LONG)}));
                if (!this.p.k()) {
                }
                this.z.d().setText(k1(this.p.j(), System.currentTimeMillis(), true));
                this.t.setVisibility(0);
            } else {
                str2 = u.b(this.p.e());
            }
            str3 = str2;
            str = null;
            if (TextUtils.isEmpty(str3)) {
            }
            if (!TextUtils.isEmpty(str3)) {
            }
            this.y.d().setText(getString(R.string.isp_outage_started, new Object[]{j.b(this.p.j(), k.DATE_AND_TIME, l.LONG)}));
            if (!this.p.k()) {
            }
            this.z.d().setText(k1(this.p.j(), System.currentTimeMillis(), true));
            this.t.setVisibility(0);
        }
        if (this.p == null) {
            this.C.setVisibility(8);
        } else {
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            for (OutageLocation outageLocation : this.p.d()) {
                if (outageLocation.a().equals("City")) {
                    arrayList.add(outageLocation);
                } else if (outageLocation.a().equals("Region")) {
                    arrayList2.add(outageLocation);
                }
            }
            if (arrayList.size() == 0) {
                this.G.removeAllViews();
                this.G.setVisibility(8);
                this.D.setVisibility(8);
            } else {
                p1(arrayList, this.G);
                this.G.setVisibility(0);
                this.D.setVisibility(0);
            }
            if (arrayList2.size() == 0) {
                this.H.removeAllViews();
                this.H.setVisibility(8);
                this.E.setVisibility(8);
            } else {
                p1(arrayList2, this.H);
                this.H.setVisibility(0);
                this.E.setVisibility(0);
            }
            Separator separator = this.F;
            if (!arrayList.isEmpty() && !arrayList2.isEmpty()) {
                i2 = 0;
            }
            separator.setVisibility(i2);
            this.C.setVisibility(0);
        }
        q1();
    }

    /* access modifiers changed from: protected */
    @Override // com.overlook.android.fing.ui.base.ServiceActivity
    public void b1(boolean z2) {
        super.b1(z2);
        if (M0() && this.p == null) {
            C0().p(this.o, new v4(this));
        }
        o1();
        scheduleJob(new l3(this), 60000, 4909);
        r1();
    }

    public /* synthetic */ void m1(View view) {
        j.x("Isp_Outage_Report_Open", Collections.singletonMap("Report_Id", this.p.h()));
        e.e.a.a.a.a.W(this, "https://app.fing.com/internet/outage/" + this.p.h());
    }

    @Override // com.overlook.android.fing.ui.ads.e.a, com.overlook.android.fing.ui.base.ServiceActivity
    public void n(b bVar, d dVar) {
        super.n(bVar, dVar);
        if (dVar != d.OUTAGE_DETAILS) {
            return;
        }
        if (bVar == b.DISABLED) {
            this.B = null;
            this.A.setVisibility(8);
        } else if (bVar == b.LOADED) {
            q1();
        }
    }

    public /* synthetic */ void n1(UnifiedNativeAd unifiedNativeAd) {
        this.B = unifiedNativeAd;
    }

    /* 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) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_outage_details);
        Intent intent = getIntent();
        if (intent.hasExtra("outage-id")) {
            this.o = intent.getStringExtra("outage-id");
        }
        if (intent.hasExtra("outage-info")) {
            this.p = (OutageInfo) intent.getParcelableExtra("outage-info");
        }
        this.t = (CardView) findViewById(R.id.connection_card);
        this.u = (ScoreIndicator) findViewById(R.id.score_indicator);
        this.w = (Pill) findViewById(R.id.status);
        this.v = (IconView) findViewById(R.id.map);
        this.x = (MarkerView) findViewById(R.id.info_where_marker);
        this.y = (MarkerView) findViewById(R.id.info_started_marker);
        this.z = (MarkerView) findViewById(R.id.info_duration_marker);
        this.C = (CardView) findViewById(R.id.impacted_areas_card);
        this.D = (Header) findViewById(R.id.cities_header);
        this.E = (Header) findViewById(R.id.regions_header);
        this.G = (LinearLayout) findViewById(R.id.cities_container);
        this.H = (LinearLayout) findViewById(R.id.regions_container);
        this.F = (Separator) findViewById(R.id.separator);
        MainButton mainButton = (MainButton) findViewById(R.id.full_report);
        this.I = mainButton;
        mainButton.setOnClickListener(new j3(this));
        this.A = (NativeAdView) findViewById(R.id.ad_view);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        this.q = toolbar;
        setSupportActionBar(toolbar);
        t0(true, bundle != null);
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.overlook.android.fing.ui.base.ServiceActivity
    public void onDestroy() {
        if (M0()) {
            u0().e(d.OUTAGE_DETAILS);
        }
        super.onDestroy();
    }

    @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, "Isp_Outage");
    }
}