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

应用版本信息
应用名称:CycleView
版本号:4.40
包名称:com.esd.laundrylink.cycleview

MD5 校验值:230b791cc707d42fd585468f66a30851

反编译源代码说明

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


package com.esd.laundrylink.activities;

import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.f;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.navigation.fragment.NavHostFragment;
import c.s.f0.c;
import c.s.i;
import c.s.s;
import com.esd.laundrylink.SharedApplication;
import com.esd.laundrylink.barcodescanner.activities.BarcodeScannerActivity;
import com.esd.laundrylink.c;
import com.esd.laundrylink.cycleview.R;
import com.esd.laundrylink.defs.Machine;
import com.esd.laundrylink.e0;
import com.esd.laundrylink.f0;
import com.esd.laundrylink.l0.j;
import com.esd.laundrylink.notification.BroadcastReceivers.UploadOfflineVendsBroadcastReceiver;
import com.esd.laundrylink.p0.s;
import com.google.android.material.navigation.NavigationView;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Objects;
import java.util.Set;

public class MainActivity extends com.esd.laundrylink.activities.a implements DrawerLayout.e, NavigationView.c, i.c, DialogInterface.OnClickListener, com.esd.laundrylink.p0.e, com.esd.laundrylink.p0.f, com.esd.laundrylink.p0.p, com.esd.laundrylink.p0.w, com.esd.laundrylink.p0.j, com.esd.laundrylink.p0.b, com.esd.laundrylink.p0.d, com.esd.laundrylink.notification.a.b, com.esd.laundrylink.p0.o, com.esd.laundrylink.p0.r, com.esd.laundrylink.p0.q {
    private UploadOfflineVendsBroadcastReceiver S;
    private c.s.f0.c V;
    private int W;
    private String X;
    private androidx.appcompat.app.f Y;
    private com.esd.laundrylink.c Z;
    private boolean Q = false;
    private o0 R = new o0(2, null);
    private androidx.activity.result.c<Intent> T = null;
    private androidx.activity.result.c<Intent> U = null;

    public class a implements View.OnTouchListener {

        class RunnableC0140a implements Runnable {
            final View p;

            RunnableC0140a(View view) {
                this.p = view;
            }

            @Override
            public void run() {
                MainActivity.this.W = R.id.fragmentAccount;
                if (com.esd.laundrylink.e0.b().a == 1) {
                    MainActivity.this.W = R.id.fragmentMachines;
                }
                MainActivity.this.onDrawerClosed(this.p);
            }
        }

        a() {
        }

        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            if (motionEvent.getAction() != 0) {
                return false;
            }
            com.esd.laundrylink.c0.b(new RunnableC0140a(view));
            return true;
        }
    }

    public class a0 implements DialogInterface.OnClickListener {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                MainActivity.this.Q1(true);
            }
        }

        a0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.y2(new a());
        }
    }

    public class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            if (MainActivity.this.isDestroyed()) {
                return;
            }
            int i = MainActivity.this.R.a;
            a aVar = null;
            int i2 = 1;
            if (i == 10) {
                MainActivity.this.P0();
                MainActivity.this.R = new o0(i2, aVar);
                MainActivity.this.O1(false);
            } else if (i == 12) {
                MainActivity.this.P0();
                MainActivity.this.R = new o0(i2, aVar);
                MainActivity.this.Q1(false);
            } else if (i == 14) {
                MainActivity.this.R = new o0(i2, aVar);
            } else {
                com.google.firebase.crashlytics.g.a().d(new Exception(String.format(Locale.US, "executeRefreshVTMs - Unknown activity state (%s)", MainActivity.this.R)));
            }
        }
    }

    public class b0 implements DialogInterface.OnClickListener {

        class a implements Runnable {
            a() {
            }

            @Override
            public void run() {
                MainActivity.this.D1();
            }
        }

        b0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.y2(new a());
        }
    }

    public class c implements DialogInterface.OnClickListener {
        final Machine p;

        c(Machine machine) {
            this.p = machine;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(1, null);
            MainActivity.this.X = null;
            MainActivity.this.Y = null;
            MainActivity.this.M1(this.p);
        }
    }

    public class c0 extends Thread {

        class a implements Runnable {
            final boolean p;

            a(boolean z) {
                this.p = z;
            }

            @Override
            public void run() {
                MainActivity.this.P0();
                if (this.p) {
                    MainActivity.this.invalidateOptionsMenu();
                }
            }
        }

        c0(String str) {
            super(str);
        }

        @Override
        public void run() {
            boolean e2 = com.esd.laundrylink.notification.b.e();
            if (e2) {
                Iterator<com.esd.laundrylink.p0.s> it = SharedApplication.G().F().iterator();
                while (it.hasNext()) {
                    it.next().w(new s.a(1));
                }
            }
            com.esd.laundrylink.c0.b(new a(e2));
        }
    }

    public class d implements DialogInterface.OnClickListener {
        d() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(1, null);
            MainActivity.this.X = null;
            MainActivity.this.Y = null;
        }
    }

    public class d0 extends Thread {
        d0(String str) {
            super(str);
        }

        @Override
        public void run() {
            SharedApplication.G().P();
        }
    }

    public class e implements DialogInterface.OnClickListener {
        e() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(1, null);
            MainActivity.this.Y = null;
        }
    }

    public class e0 implements DialogInterface.OnClickListener {

        class a extends Thread {

            class RunnableC0141a implements Runnable {
                final boolean p;

                RunnableC0141a(boolean z) {
                    this.p = z;
                }

                @Override
                public void run() {
                    f.a aVar = new f.a(MainActivity.this);
                    if (this.p) {
                        aVar.q(R.string.password_recovery).g(R.string.password_recovery_description).d(false).n(R.string.theme_ok, null);
                    } else {
                        aVar.q(R.string.password_recovery_unavailable).g(R.string.password_recovery_unavailable_description).d(false).n(R.string.theme_ok, null);
                    }
                    aVar.s();
                }
            }

            a(String str) {
                super(str);
            }

            @Override
            public void run() {
                boolean o = SharedApplication.G().H().o();
                MainActivity.this.P0();
                com.esd.laundrylink.c0.a(MainActivity.this, new RunnableC0141a(o));
            }
        }

        e0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.S0();
            new a("Change Password Request Thread").start();
        }
    }

    public class f implements DialogInterface.OnClickListener {
        f() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(4, null);
            MainActivity.this.Y = null;
            MainActivity.this.i2();
        }
    }

    public class f0 implements DialogInterface.OnClickListener {
        f0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.Y = null;
            MainActivity.this.z1();
        }
    }

    public class g implements DialogInterface.OnClickListener {
        g() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(7, null);
            MainActivity.this.Y = null;
            MainActivity.this.i2();
        }
    }

    class g0 implements androidx.activity.result.b<androidx.activity.result.a> {
        g0() {
        }

        @Override
        public void a(androidx.activity.result.a aVar) {
            Machine b2;
            if (aVar.b() == -1) {
                Intent a = aVar.a();
                Objects.requireNonNull(a);
                String stringExtra = a.getStringExtra("SCAN_RESULT");
                Intent a2 = aVar.a();
                Objects.requireNonNull(a2);
                String stringExtra2 = a2.getStringExtra("SCAN_RESULT_FORMAT");
                d.b.b.e eVar = new d.b.b.e();
                d.b.b.e eVar2 = new d.b.b.e();
                d.b.b.e eVar3 = new d.b.b.e();
                if (com.esd.laundrylink.w.a() != null && stringExtra2.equalsIgnoreCase(com.esd.laundrylink.k0.a.CODE_128.toString()) && (b2 = com.esd.laundrylink.f0.b(stringExtra)) != null) {
                    MainActivity.this.z2(SharedApplication.G().H().e0(), stringExtra, b2.s);
                } else if (!stringExtra2.equalsIgnoreCase(com.esd.laundrylink.k0.a.QR_CODE.toString()) || !com.esd.laundrylink.n0.a.a(MainActivity.this, stringExtra, eVar, eVar2, eVar3)) {
                    MainActivity.this.R = new o0(16, null);
                    MainActivity.this.E1();
                } else {
                    MainActivity.this.z2(eVar.toString(), eVar2.toString(), eVar3.toString());
                }
            }
        }
    }

    public class h implements DialogInterface.OnClickListener {
        h() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(1, null);
            MainActivity.this.Y = null;
        }
    }

    public class h0 implements DialogInterface.OnClickListener {
        h0() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.Y = null;
            MainActivity.this.y1();
        }
    }

    public class i extends Thread {
        final SharedApplication p;
        final boolean q;

        class a implements Runnable {
            final boolean p;

            a(boolean z) {
                this.p = z;
            }

            @Override
            public void run() {
                MainActivity.this.P0();
                if (!this.p) {
                    MainActivity.this.F1();
                    return;
                }
                Intent launchIntentForPackage = MainActivity.this.getBaseContext().getPackageManager().getLaunchIntentForPackage(MainActivity.this.getBaseContext().getPackageName());
                if (launchIntentForPackage != null) {
                    launchIntentForPackage.addFlags(67108864);
                    launchIntentForPackage.putExtra("EXIT", true);
                    MainActivity.this.startActivity(launchIntentForPackage);
                    MainActivity.this.finish();
                }
            }
        }

        i(String str, SharedApplication sharedApplication, boolean z) {
            super(str);
            this.p = sharedApplication;
            this.q = z;
        }

        @Override
        public void run() {
            if (com.esd.laundrylink.w.a() instanceof com.esd.laundrylink.p0.g) {
                ((com.esd.laundrylink.p0.g) com.esd.laundrylink.w.a()).a();
            }
            com.esd.laundrylink.notification.b.e();
            boolean D1 = this.p.H().D1();
            if (this.q) {
                D1 = true;
            }
            com.esd.laundrylink.c0.b(new a(D1));
        }
    }

    class i0 implements c.a0 {
        i0() {
        }

        @Override
        public boolean a() {
            return false;
        }

        @Override
        public int b(c.a0.a aVar) {
            if (aVar == c.a0.a.BluetoothConnectToEnableBluetoothPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_connect_to_enable_bluetooth_permissions_required_description;
            }
            if (aVar == c.a0.a.BluetoothEnabledRequired) {
                return R.string.transfer_machine_bluetooth_enabled_required_description;
            }
            if (aVar == c.a0.a.BluetoothLocationEnabledRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_location_enabled_required_description;
            }
            if (aVar == c.a0.a.BluetoothLocationPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_location_permissions_required_description;
            }
            if (aVar == c.a0.a.BluetoothFineLocationPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_fine_location_permissions_required_description;
            }
            if (aVar == c.a0.a.BluetoothScanPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_scan_permissions_required_description;
            }
            if (aVar == c.a0.a.BluetoothConnectPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_connect_permissions_required_description;
            }
            if (aVar == c.a0.a.BluetoothGpsTurnedOff) {
                return R.string.droid_only_transfer_machine_bluetooth_gps_turned_off_prompt_to_turn_on;
            }
            if (aVar == c.a0.a.BluetoothNotSupported) {
                return R.string.droid_only_transfer_machine_bluetooth_not_supported;
            }
            if (aVar == c.a0.a.BluetoothUnavailable) {
                return R.string.droid_only_transfer_machine_bluetooth_unavailable;
            }
            if (aVar == c.a0.a.BluetoothTurnedOff) {
                return R.string.droid_only_transfer_machine_bluetooth_turned_off_prompt_to_turn_on;
            }
            com.google.firebase.crashlytics.g.a().d(new Exception(String.format(Locale.US, "provideTitleStringResource - Unknown bluetooth activity mediator message type (%s)", aVar)));
            return R.string.droid_only_empty;
        }

        @Override
        public int c(c.a0.b bVar) {
            if (bVar == c.a0.b.BluetoothConnectToEnableBluetoothPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_connect_to_enable_bluetooth_permissions_required;
            }
            if (bVar == c.a0.b.BluetoothEnabledRequired) {
                return R.string.transfer_machine_bluetooth_enabled_required;
            }
            if (bVar == c.a0.b.BluetoothLocationEnabledRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_location_enabled_required;
            }
            if (bVar == c.a0.b.BluetoothLocationPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_location_permissions_required;
            }
            if (bVar == c.a0.b.BluetoothFineLocationPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_fine_location_permissions_required;
            }
            if (bVar == c.a0.b.BluetoothScanPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_scan_permissions_required;
            }
            if (bVar == c.a0.b.BluetoothConnectPermissionsRequired) {
                return R.string.droid_only_transfer_machine_bluetooth_connect_permissions_required;
            }
            com.google.firebase.crashlytics.g.a().d(new Exception(String.format(Locale.US, "provideTitleStringResource - Unknown bluetooth activity mediator title type (%s)", bVar)));
            return R.string.droid_only_empty;
        }

        @Override
        public void d() {
            MainActivity.this.i2();
        }
    }

    public class j extends Thread {
        final Runnable p;

        j(String str, Runnable runnable) {
            super(str);
            this.p = runnable;
        }

        @Override
        public void run() {
            MainActivity.this.d2(this.p);
        }
    }

    class j0 extends Thread {
        final SharedApplication p;
        final Machine q;
        final f0.a r;
        final f0.b s;

        j0(String str, SharedApplication sharedApplication, Machine machine, f0.a aVar, f0.b bVar) {
            super(str);
            this.p = sharedApplication;
            this.q = machine;
            this.r = aVar;
            this.s = bVar;
        }

        @Override
        public void run() {
            SharedApplication sharedApplication = this.p;
            sharedApplication.M(this.q, this.r, this.s, sharedApplication.H().y0());
        }
    }

    public class k implements Runnable {
        final boolean p;
        final Runnable q;

        k(boolean z, Runnable runnable) {
            this.p = z;
            this.q = runnable;
        }

        @Override
        public void run() {
            if (MainActivity.this.isDestroyed()) {
                return;
            }
            MainActivity.this.P0();
            if (this.p) {
                Runnable runnable = this.q;
                if (runnable != null) {
                    runnable.run();
                    return;
                }
                return;
            }
            f.a aVar = new f.a(MainActivity.this);
            aVar.q(R.string.cannot_upload_offline_vends);
            aVar.g(R.string.cannot_upload_offline_vends_description);
            aVar.d(true);
            aVar.n(R.string.theme_ok, null);
            aVar.s();
        }
    }

    class k0 extends Thread {
        k0(String str) {
            super(str);
        }

        @Override
        public void run() {
            SharedApplication.G().S(null);
        }
    }

    public class l implements DialogInterface.OnClickListener {
        final c.s.i p;

        l(c.s.i iVar) {
            this.p = iVar;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            this.p.L(R.id.changeLocationActivity);
        }
    }

    public class l0 extends Thread {
        final SharedApplication p;
        final Menu q;

        class a implements Runnable {
            final int p;

            a(int i) {
                this.p = i;
            }

            @Override
            public void run() {
                if (MainActivity.this.isDestroyed()) {
                    return;
                }
                MenuItem findItem = l0.this.q.findItem(R.id.menu_clear_notifications);
                int i = this.p;
                if (i > 0) {
                    findItem.setTitle(MainActivity.this.getString(R.string.nav_menu_clear_notifications_with_count, new Object[]{Integer.valueOf(i)}));
                } else {
                    findItem.setTitle(MainActivity.this.getString(R.string.nav_menu_clear_notifications));
                }
            }
        }

        l0(String str, SharedApplication sharedApplication, Menu menu) {
            super(str);
            this.p = sharedApplication;
            this.q = menu;
        }

        @Override
        public void run() {
            com.esd.laundrylink.c0.a(MainActivity.this, new a(com.esd.laundrylink.notification.b.m(this.p.H().u0()).size()));
        }
    }

    public class m implements DialogInterface.OnClickListener {
        final c.s.i p;

        m(c.s.i iVar) {
            this.p = iVar;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            this.p.L(R.id.linkAccountToLocationActivity);
        }
    }

    public class m0 implements Runnable {
        final SharedApplication p;
        final boolean q;

        m0(SharedApplication sharedApplication, boolean z) {
            this.p = sharedApplication;
            this.q = z;
        }

        @Override
        public void run() {
            if (MainActivity.this.isDestroyed()) {
                return;
            }
            MainActivity.this.P0();
            a aVar = null;
            if (this.p.H().i1() && !this.q) {
                MainActivity.this.R = new o0(6, aVar);
                MainActivity.this.K1();
            } else {
                MainActivity.this.R = new o0(7, aVar);
                MainActivity.this.i2();
            }
        }
    }

    public class n implements DialogInterface.OnClickListener {
        final SharedApplication p;

        n(SharedApplication sharedApplication) {
            this.p = sharedApplication;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            ArrayList<com.esd.laundrylink.defs.e> a0 = this.p.H().a0();
            a aVar = null;
            if (a0.size() > 0) {
                MainActivity.this.R = new o0(20, aVar);
                MainActivity.this.A1(a0);
            } else {
                MainActivity.this.R = new o0(1, aVar);
            }
        }
    }

    public class n0 implements Runnable {
        final j.t p;
        final boolean q;
        final boolean r;

        n0(j.t tVar, boolean z, boolean z2) {
            this.p = tVar;
            this.q = z;
            this.r = z2;
        }

        @Override
        public void run() {
            if (MainActivity.this.isDestroyed()) {
                return;
            }
            int i = MainActivity.this.R.a;
            a aVar = null;
            int i2 = 1;
            if (i == 10) {
                MainActivity.this.P0();
                MainActivity.this.R = new o0(i2, aVar);
                j.t tVar = this.p;
                if (tVar == j.t.BluetoothTurnedOn) {
                    if (!this.q) {
                        MainActivity.this.V1();
                        return;
                    } else if (this.r) {
                        MainActivity.this.O1(false);
                        return;
                    } else {
                        MainActivity.this.U1();
                        return;
                    }
                }
                if (tVar == j.t.BluetoothTurnedOff) {
                    MainActivity.this.S1();
                    return;
                }
                if (tVar == j.t.BluetoothUnavailable) {
                    MainActivity.this.T1();
                    return;
                } else if (tVar == j.t.BluetoothNotSupported) {
                    MainActivity.this.R1();
                    return;
                } else {
                    MainActivity.this.T1();
                    return;
                }
            }
            if (i != 12) {
                if (i == 14) {
                    MainActivity.this.R = new o0(i2, aVar);
                    return;
                } else {
                    com.google.firebase.crashlytics.g.a().d(new Exception(String.format(Locale.US, "executeRefreshVTMs - Unknown activity state (%s)", MainActivity.this.R)));
                    return;
                }
            }
            MainActivity.this.P0();
            MainActivity.this.R = new o0(i2, aVar);
            j.t tVar2 = this.p;
            if (tVar2 == j.t.BluetoothTurnedOn) {
                if (!this.q) {
                    MainActivity.this.V1();
                    return;
                } else if (this.r) {
                    MainActivity.this.Q1(false);
                    return;
                } else {
                    MainActivity.this.U1();
                    return;
                }
            }
            if (tVar2 == j.t.BluetoothTurnedOff) {
                MainActivity.this.S1();
                return;
            }
            if (tVar2 == j.t.BluetoothUnavailable) {
                MainActivity.this.T1();
            } else if (tVar2 == j.t.BluetoothNotSupported) {
                MainActivity.this.R1();
            } else {
                MainActivity.this.T1();
            }
        }
    }

    public class o implements DialogInterface.OnClickListener {
        o() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(1, null);
        }
    }

    public static class o0 {
        private final int a;

        o0(int i, a aVar) {
            this(i);
        }

        public String toString() {
            int i = this.a;
            switch (i) {
                case 1:
                    return "RUN";
                case 2:
                    return "CHECK_FOR_LOW_BALANCE";
                case 3:
                    return "SHOWING_LOW_BALANCE";
                case 4:
                    return "CHECK_MAX_OFFLINE_VENDS";
                case 5:
                    return "EXECUTING_MAX_OFFLINE_VENDS";
                case 6:
                    return "SHOWING_MAX_OFFLINE_VENDS";
                case 7:
                    return "CHECK_NEEDS_VTM_REFRESH";
                case 8:
                    return "FORCE_VTM_REFRESH";
                case 9:
                    return "EXECUTE_VTM_REFRESH_TRANSFER_CASH";
                case 10:
                    return "EXECUTING_VTM_REFRESH_TRANSFER_CASH";
                case 11:
                    return "EXECUTE_VTM_REFRESH_TRANSFER_MONEY_CARD";
                case 12:
                    return "EXECUTING_VTM_REFRESH_TRANSFER_MONEY_CARD";
                case 13:
                    return "EXECUTE_VTM_REFRESH";
                case 14:
                    return "EXECUTING_VTM_REFRESH";
                case 15:
                    return "VEND_MACHINE_QR_CODE_SCAN";
                case 16:
                    return "SHOWING_INVALID_QR_CODE";
                case 17:
                    return "SHOWING_VEND_MACHINE_FOUND";
                case 18:
                    return "SHOWING_VEND_MACHINE_NOT_FOUND";
                case 19:
                    return "SHOWING_STORE_MESSAGE";
                case 20:
                    return "SHOWING_BALANCE_ADJUSTMENT";
                case 21:
                    return "SHOWING_TRANSFER_CASH_MAX_BALANCE";
                case 22:
                    return "EXECUTING_BLUETOOTH_MEDIATOR_TRANSFER_CASH";
                case 23:
                    return "EXECUTING_BLUETOOTH_MEDIATOR_TRANSFER_MONEY_CARD";
                default:
                    return String.format(Locale.US, "%d", Integer.valueOf(i));
            }
        }

        private o0(int i) {
            this.a = i;
        }
    }

    public class p implements DialogInterface.OnClickListener {
        p() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.R = new o0(1, null);
        }
    }

    public class q extends Thread {
        q(String str) {
            super(str);
        }

        @Override
        public void run() {
            MainActivity.this.a2();
        }
    }

    public class r extends Thread {
        r(String str) {
            super(str);
        }

        @Override
        public void run() {
            MainActivity.this.b2();
        }
    }

    public class s extends Thread {
        s(String str) {
            super(str);
        }

        @Override
        public void run() {
            MainActivity.this.b2();
        }
    }

    public class t extends Thread {
        t(String str) {
            super(str);
        }

        @Override
        public void run() {
            MainActivity.this.b2();
        }
    }

    public class u extends Thread {
        u() {
        }

        @Override
        public void run() {
            MainActivity.this.c2();
        }
    }

    class v implements androidx.activity.result.b<androidx.activity.result.a> {
        v() {
        }

        @Override
        public void a(androidx.activity.result.a aVar) {
            if (aVar.b() == -1) {
                Intent a = aVar.a();
                Objects.requireNonNull(a);
                String stringExtra = a.getStringExtra("DatabaseId");
                Intent a2 = aVar.a();
                Objects.requireNonNull(a2);
                String stringExtra2 = a2.getStringExtra("SerialNumber");
                Intent a3 = aVar.a();
                Objects.requireNonNull(a3);
                MainActivity.this.z2(stringExtra, stringExtra2, a3.getStringExtra("Label"));
            }
        }
    }

    public class w implements Runnable {
        w() {
        }

        @Override
        public void run() {
            if (MainActivity.this.isDestroyed()) {
                return;
            }
            MainActivity.this.i2();
        }
    }

    public class x implements DialogInterface.OnClickListener {
        x() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            MainActivity.this.O1(true);
        }
    }

    public class y implements DialogInterface.OnClickListener {
        final c.s.i p;

        y(c.s.i iVar) {
            this.p = iVar;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            this.p.L(R.id.addValueActivity);
        }
    }

    public class z implements DialogInterface.OnDismissListener {
        z() {
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            MainActivity.this.a();
        }
    }

    public void A1(ArrayList<com.esd.laundrylink.defs.e> arrayList) {
        f.a aVar = new f.a(this);
        Iterator<com.esd.laundrylink.defs.e> it = arrayList.iterator();
        double d2 = 0.0d;
        while (it.hasNext()) {
            d2 += d.b.b.h.A(it.next().v.replace("$", ""), 0.0d);
        }
        aVar.q(R.string.main_balance_adjustment);
        aVar.h(getString(R.string.main_balance_adjustment_description, new Object[]{d.b.b.h.i(d2)}));
        aVar.n(R.string.theme_ok, new o());
        aVar.d(false);
        this.Y = aVar.s();
    }

    private void B1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.unsupported_contact_location_email);
        aVar.g(R.string.unsupported_contact_location_email_description);
        aVar.d(false);
        aVar.n(R.string.theme_ok, null);
        aVar.s();
    }

    private void C1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.unsupported_contact_location_phone);
        aVar.g(R.string.unsupported_contact_location_phone_description);
        aVar.d(false);
        aVar.n(R.string.theme_ok, null);
        aVar.s();
    }

    public void D1() {
        SharedApplication G = SharedApplication.G();
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        if (G.H().f0()) {
            b2.L(R.id.changeLocationActivity);
            return;
        }
        f.a aVar = new f.a(this);
        aVar.g(R.string.change_location_method_description);
        aVar.q(R.string.change_location_method);
        aVar.n(R.string.continue_with_map, new l(b2));
        aVar.i(R.string.scan_qr_code, new m(b2));
        aVar.d(true);
        aVar.a().show();
    }

    public void E1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.theme_invalid_qr_code_message);
        aVar.d(false);
        aVar.i(R.string.theme_ok, new h());
        this.Y = aVar.s();
    }

    public void F1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.main_log_out_failed);
        aVar.g(R.string.main_log_out_failed_description);
        aVar.i(R.string.theme_ok, null);
        aVar.d(false);
        aVar.s();
    }

    private void G1() {
        c.s.x.b(this, R.id.nav_host_fragment).L(R.id.dialogFragmentMachineAvailability);
    }

    private void H1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.action_cannot_be_performed_in_offline_mode_description);
        aVar.q(R.string.action_cannot_be_performed_in_offline_mode);
        aVar.i(R.string.theme_ok, null);
        aVar.d(true);
        aVar.a().show();
    }

    private void I1() {
        c.s.x.b(this, R.id.nav_host_fragment).L(R.id.dialogFragmentRatePrompt);
    }

    private void J1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.low_account_balance);
        aVar.g(R.string.low_account_balance_description);
        aVar.d(false);
        aVar.i(R.string.theme_ok, new f());
        this.Y = aVar.s();
    }

    public void K1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.max_offline_vends_reached);
        aVar.g(R.string.max_offline_vends_reached_description);
        aVar.d(false);
        aVar.i(R.string.theme_ok, new g());
        this.Y = aVar.s();
    }

    private void L1() {
        SharedApplication G = SharedApplication.G();
        com.esd.laundrylink.defs.o a1 = G.H().a1();
        String a2 = d.b.a.c.a(a1.p);
        a aVar = null;
        if (!TextUtils.isEmpty(a1.p) && !a2.equalsIgnoreCase(a1.q)) {
            a1.q = d.b.a.c.a(a1.p);
            SharedApplication.G().H().L1(a1);
            this.R = new o0(19, aVar);
            N1(a1.p);
            return;
        }
        ArrayList<com.esd.laundrylink.defs.e> h02 = G.H().h0();
        if (h02.size() > 0) {
            this.R = new o0(20, aVar);
            A1(h02);
        } else {
            this.R = new o0(1, aVar);
        }
    }

    public void M1(Machine machine) {
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        Bundle bundle = new Bundle();
        bundle.putParcelable("machine", machine);
        b2.M(R.id.dialogFragmentStartMachine, bundle);
    }

    private void N1(String str) {
        f.a aVar = new f.a(this);
        SharedApplication G = SharedApplication.G();
        aVar.q(R.string.main_system_message);
        aVar.h(getString(R.string.main_system_message_description, new Object[]{str}));
        aVar.n(R.string.theme_ok, new n(G));
        aVar.d(false);
        this.Y = aVar.s();
    }

    public void O1(boolean z2) {
        ArrayList<Machine> e2 = e2();
        SharedApplication G = SharedApplication.G();
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        Bundle bundle = new Bundle();
        a aVar = null;
        if (e2.size() > 0) {
            if (G.H().d0() != null && G.H().d0().r == 99.99d) {
                this.R = new o0(21, aVar);
                P1();
                return;
            } else {
                bundle.putParcelableArrayList("machinearraylist", e2);
                b2.M(R.id.dialogFragmentTransferFunds, bundle);
                return;
            }
        }
        if (z2) {
            if (this.R.a != 1) {
                if (this.R.a == 14) {
                    W1();
                    return;
                } else {
                    W1();
                    com.google.firebase.crashlytics.g.a().d(new Exception(String.format(Locale.US, "displayTransferCash - Unknown activity state (%s)", this.R)));
                    return;
                }
            }
            this.Z.P();
            this.R = new o0(22, aVar);
            u2();
            return;
        }
        W1();
    }

    private void P1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.transfer_machine_add_funds_max_balance).g(R.string.transfer_machine_add_funds_max_balance_description).d(false).n(R.string.theme_ok, new p());
        aVar.s();
    }

    public void Q1(boolean z2) {
        ArrayList<Machine> e2 = e2();
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        Bundle bundle = new Bundle();
        if (e2.size() > 0) {
            bundle.putParcelableArrayList("machinearraylist", e2);
            b2.M(R.id.dialogFragmentTransferMoneyCard, bundle);
            return;
        }
        if (z2) {
            if (this.R.a != 1) {
                if (this.R.a == 14) {
                    W1();
                    return;
                } else {
                    W1();
                    com.google.firebase.crashlytics.g.a().d(new Exception(String.format(Locale.US, "displayTransferMoneyCard - Unknown activity state (%s)", this.R)));
                    return;
                }
            }
            this.Z.P();
            this.R = new o0(23, null);
            u2();
            return;
        }
        W1();
    }

    public void R1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.droid_only_transfer_machine_bluetooth_not_supported).d(false).n(R.string.theme_ok, null);
        aVar.s();
    }

    public void S1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.droid_only_transfer_machine_bluetooth_turned_off).d(false).n(R.string.theme_ok, null);
        aVar.s();
    }

    public void T1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.droid_only_transfer_machine_bluetooth_unavailable).d(false).n(R.string.theme_ok, null);
        aVar.s();
    }

    public void U1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.droid_only_transfer_machine_bluetooth_gps_turned_off).d(false).n(R.string.theme_ok, null);
        aVar.s();
    }

    public void V1() {
        f.a aVar = new f.a(this);
        aVar.g(R.string.droid_only_transfer_machine_bluetooth_gps_not_supported).d(false).n(R.string.theme_ok, null);
        aVar.s();
    }

    private void W1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.main_transfer_machine_not_found).g(R.string.main_transfer_machine_not_found_description).d(false).n(R.string.theme_ok, null);
        aVar.s();
    }

    private void X1(Machine machine) {
        f.a aVar = new f.a(this);
        aVar.q(R.string.vend_machine_found);
        aVar.h(getResources().getString(R.string.vend_machine_found_description, machine.s));
        aVar.d(false);
        aVar.n(R.string.theme_yes, new c(machine));
        aVar.i(R.string.theme_no, new d());
        this.Y = aVar.s();
    }

    private void Y1() {
        f.a aVar = new f.a(this);
        aVar.q(R.string.vend_machine_not_found);
        aVar.g(R.string.vend_machine_not_found_description);
        aVar.d(false);
        aVar.i(R.string.theme_ok, new e());
        this.Y = aVar.s();
    }

    private void Z1(boolean z2) {
        SharedApplication G = SharedApplication.G();
        S0();
        new i("End Session Thread", G, z2).start();
    }

    public void a2() {
        SharedApplication G = SharedApplication.G();
        com.esd.laundrylink.c0.a(this, new m0(G, G.H().n()));
    }

    public void b2() {
        SharedApplication G = SharedApplication.G();
        Date date = new Date();
        ArrayList<com.esd.laundrylink.l0.o> arrayList = new ArrayList<>();
        com.esd.laundrylink.defs.a aVar = new com.esd.laundrylink.defs.a();
        j.t d02 = com.esd.laundrylink.l0.j.d0(this);
        boolean hasSystemFeature = G.getPackageManager().hasSystemFeature("android.hardware.location.gps");
        aVar.p = date;
        boolean isProviderEnabled = hasSystemFeature ? G.E().isProviderEnabled("gps") : false;
        if (!h2().isEmpty() && d02 == j.t.BluetoothTurnedOn && hasSystemFeature && isProviderEnabled) {
            if (G.D().q0(1000, this, arrayList)) {
                Iterator<com.esd.laundrylink.l0.o> it = arrayList.iterator();
                while (it.hasNext()) {
                    aVar.q.add(it.next().a());
                }
            }
            G.H().H1(aVar);
            com.esd.laundrylink.c0.c(this, new b());
            return;
        }
        G.H().H1(aVar);
        com.esd.laundrylink.c0.c(this, new n0(d02, hasSystemFeature, isProviderEnabled));
    }

    public void c2() {
        com.esd.laundrylink.c0.b(new w());
    }

    public void d2(Runnable runnable) {
        com.esd.laundrylink.c0.a(this, new k(SharedApplication.G().H().X1(), runnable));
    }

    private static ArrayList<Machine> e2() {
        SharedApplication G = SharedApplication.G();
        ArrayList<Machine> arrayList = new ArrayList<>();
        com.esd.laundrylink.defs.a c02 = G.H().c0();
        Iterator<Machine> it = G.H().u0().iterator();
        while (it.hasNext()) {
            Machine next = it.next();
            if (com.esd.laundrylink.v.b(next.r)) {
                if (c02.q.contains(com.esd.laundrylink.e.a(Integer.parseInt(next.t)))) {
                    arrayList.add(next);
                }
            }
        }
        return arrayList;
    }

    private Fragment f2() {
        NavHostFragment navHostFragment = (NavHostFragment) o0().d0(R.id.nav_host_fragment);
        if (navHostFragment != null) {
            return navHostFragment.q0().w0();
        }
        return null;
    }

    private String g2() {
        String b1 = SharedApplication.G().H().b1();
        if (TextUtils.isEmpty(b1)) {
            b1 = getString(R.string.welcome);
        }
        return b1 == null ? "" : b1;
    }

    private static ArrayList<Machine> h2() {
        SharedApplication G = SharedApplication.G();
        ArrayList<Machine> arrayList = new ArrayList<>();
        Iterator<Machine> it = G.H().u0().iterator();
        while (it.hasNext()) {
            Machine next = it.next();
            if (com.esd.laundrylink.v.b(next.r) && com.esd.laundrylink.g0.a(next.K)) {
                arrayList.add(next);
            }
        }
        return arrayList;
    }

    public void i2() {
        SharedApplication G = SharedApplication.G();
        int i2 = 9;
        int i3 = 1;
        a aVar = null;
        if (this.R.a == 22) {
            if (this.Z.R()) {
                return;
            }
            if (this.Z.N()) {
                this.R = new o0(i2, aVar);
            } else {
                this.R = new o0(i3, aVar);
            }
        }
        int i4 = 11;
        if (this.R.a == 23) {
            if (this.Z.R()) {
                return;
            }
            if (this.Z.N()) {
                this.R = new o0(i4, aVar);
            } else {
                this.R = new o0(i3, aVar);
            }
        }
        int i5 = 3;
        if (this.R.a == 3 && this.Y == null) {
            J1();
        }
        if (this.R.a == 6 && this.Y == null) {
            K1();
        }
        if (this.R.a == 19 && this.Y == null) {
            L1();
        }
        int i6 = 7;
        if (this.R.a == 20 && this.Y == null) {
            ArrayList<com.esd.laundrylink.defs.e> a02 = G.H().a0();
            if (a02.size() > 0) {
                A1(a02);
            } else {
                this.R = new o0(i6, aVar);
            }
        }
        if (this.R.a == 16 && this.Y == null) {
            E1();
        }
        if (this.R.a == 17 && this.Y == null) {
            ArrayList<Machine> e2 = com.esd.laundrylink.f0.e(this.X);
            if (e2.size() == 1) {
                X1(e2.get(0));
            } else {
                this.R = new o0(i3, aVar);
            }
        }
        if (this.R.a == 18 && this.Y == null) {
            Y1();
        }
        int i7 = 4;
        if (this.R.a == 2) {
            if (G.H().x0() || G.H().d0() == null || d.b.b.h.C(G.H().d0().q, 0) <= 0) {
                this.R = new o0(i7, aVar);
            } else if (G.H().d0().r < 10.0d) {
                this.R = new o0(i5, aVar);
                J1();
            } else {
                this.R = new o0(i7, aVar);
            }
        }
        if (this.R.a == 4) {
            this.R = new o0(5, aVar);
            S0();
            new q("Offline Vends Thread").start();
        }
        int i8 = 13;
        if (this.R.a == 7) {
            if (d.b.b.h.z(G.H().c0().p, new Date()) >= 15) {
                this.R = new o0(i8, aVar);
            } else {
                this.R = new o0(i3, aVar);
            }
        }
        if (this.R.a == 8) {
            this.R = new o0(i8, aVar);
        }
        if (this.R.a == 13) {
            this.R = new o0(14, aVar);
            new r("Refresh VTMs Thread").start();
        }
        if (this.R.a == 9) {
            this.R = new o0(10, aVar);
            S0();
            new s("Refresh VTMs Thread").start();
        }
        if (this.R.a == 11) {
            this.R = new o0(12, aVar);
            S0();
            new t("Refresh VTMs Thread").start();
        }
    }

    private void j2() {
        SharedApplication G = SharedApplication.G();
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        ArrayList<Machine> h2 = h2();
        if (G.H().y0()) {
            if (!h2.isEmpty() && (h2.isEmpty() || G.H().J0())) {
                O1(true);
                return;
            } else {
                H1();
                return;
            }
        }
        if (!h2.isEmpty() && (h2.isEmpty() || G.H().J0())) {
            f.a aVar = new f.a(this);
            aVar.q(R.string.transfer_machine_add_funds);
            aVar.g(R.string.transfer_machine_add_funds_description);
            aVar.n(R.string.transfer_machine_add_funds_with_cash, new x());
            aVar.i(R.string.transfer_machine_add_funds_with_credit_card, new y(b2));
            aVar.l(new z());
            aVar.d(true);
            c();
            aVar.s();
            return;
        }
        b2.L(R.id.addValueActivity);
    }

    private void k2() {
        SharedApplication G = SharedApplication.G();
        if (G.H().y0()) {
            H1();
            return;
        }
        if (G.H().k0()) {
            f.a aVar = new f.a(this);
            aVar.q(R.string.change_location_cannot_change_location_have_offline_vends);
            aVar.g(R.string.change_location_cannot_change_location_have_offline_vends_description);
            aVar.d(false);
            aVar.n(R.string.theme_yes, new b0());
            aVar.i(R.string.theme_no, null);
            aVar.s();
            return;
        }
        D1();
    }

    private void l2() {
        if (SharedApplication.G().H().y0()) {
            H1();
            return;
        }
        f.a aVar = new f.a(this);
        aVar.g(R.string.change_password_confirm_description);
        aVar.q(R.string.change_password_confirm);
        aVar.n(R.string.theme_ok, new e0());
        aVar.i(R.string.theme_cancel, null);
        aVar.d(true);
        aVar.a().show();
    }

    private void m2() {
        S0();
        new c0("Clear Notifications Thread").start();
    }

    private void n2() {
        SharedApplication G = SharedApplication.G();
        f.a aVar = new f.a(this);
        aVar.g(R.string.contact_method_description);
        aVar.q(R.string.contact_method);
        if (!TextUtils.isEmpty(G.H().d1())) {
            aVar.n(R.string.contact_method_phone_number, new f0());
        }
        if (!TextUtils.isEmpty(G.H().X0())) {
            aVar.i(R.string.contact_method_email, new h0());
        }
        aVar.d(true);
        this.Y = aVar.s();
    }

    private void o2() {
        Z1(false);
    }

    private void p2() {
        c.s.x.b(this, R.id.nav_host_fragment).L(R.id.referralCodeActivity);
    }

    private void q2() {
        new d0("Refresh Thread").start();
    }

    private void r2() {
        SharedApplication G = SharedApplication.G();
        if (G.H().y0()) {
            H1();
            return;
        }
        if (G.H().k0()) {
            f.a aVar = new f.a(this);
            aVar.q(R.string.transfer_machine_cannot_transfer_money_card_have_offline_vends);
            aVar.g(R.string.transfer_machine_cannot_transfer_money_card_have_offline_vends_description);
            aVar.d(false);
            aVar.n(R.string.theme_yes, new a0());
            aVar.i(R.string.theme_no, null);
            aVar.s();
            return;
        }
        Q1(true);
    }

    private void s2() {
        SharedApplication G = SharedApplication.G();
        if (G.H().y0()) {
            H1();
        } else if (G.H().V0()) {
            this.T.a(new Intent(this, (Class<?>) ScanMachineActivity.class));
        } else {
            t2();
        }
    }

    private void t2() {
        Intent intent = new Intent(this, (Class<?>) BarcodeScannerActivity.class);
        StringBuilder sb = new StringBuilder();
        sb.append(com.esd.laundrylink.k0.a.QR_CODE);
        if (com.esd.laundrylink.w.a() != null) {
            sb.append(",");
            sb.append(com.esd.laundrylink.k0.a.CODE_128);
        }
        intent.putExtra("SCAN_FORMATS", sb.toString());
        intent.putExtra("BEEP_ENABLED", true);
        intent.putExtra("BACKGROUND_IMAGE_ID", R.drawable.activity_background_waves2_light);
        this.R = new o0(15, null);
        this.U.a(intent);
    }

    private void u2() {
        u uVar = new u();
        uVar.setName("Resume Thread");
        uVar.start();
    }

    private void w2(NavigationView navigationView) {
        SharedApplication G = SharedApplication.G();
        View[] viewArr = {navigationView.g(0), findViewById(R.id.navViewHeader)};
        d.b.b.f fVar = new d.b.b.f("");
        d.b.b.f fVar2 = new d.b.b.f("");
        d.b.b.f fVar3 = new d.b.b.f("");
        d.b.b.f fVar4 = new d.b.b.f("");
        StringBuilder sb = new StringBuilder();
        String E = d.b.b.h.E(G.H().d1());
        String X0 = G.H().X0();
        com.esd.laundrylink.f0.p(G.H().W0(), fVar, fVar2, fVar3, fVar4);
        if (!TextUtils.isEmpty((CharSequence) fVar2.a())) {
            sb.append((String) fVar2.a());
        }
        if (!TextUtils.isEmpty((CharSequence) fVar3.a())) {
            if (sb.length() > 0) {
                sb.append(", ");
            }
            sb.append((String) fVar3.a());
        }
        if (!TextUtils.isEmpty((CharSequence) fVar4.a())) {
            if (sb.length() > 0) {
                sb.append(" ");
            }
            sb.append((String) fVar4.a());
        }
        int i2 = 0;
        for (int i3 = 2; i2 < i3; i3 = 2) {
            View view = viewArr[i2];
            TextView textView = (TextView) view.findViewById(R.id.textViewLocationName);
            TextView textView2 = (TextView) view.findViewById(R.id.textViewLocationAddress);
            TextView textView3 = (TextView) view.findViewById(R.id.textViewLocationCityStateZip);
            TextView textView4 = (TextView) view.findViewById(R.id.textViewLocationPhoneNumber);
            TextView textView5 = (TextView) view.findViewById(R.id.textViewLocationEmail);
            textView.setText(G.H().b1());
            textView2.setText((CharSequence) fVar.a());
            textView3.setText(sb);
            if (!TextUtils.isEmpty(E)) {
                Objects.requireNonNull(E);
                textView4.setText(getString(R.string.nav_header_location_phone_number, new Object[]{d.b.b.h.k(E)}));
            } else {
                textView4.setVisibility(8);
            }
            if (!TextUtils.isEmpty(X0)) {
                textView5.setText(getString(R.string.nav_header_location_email_address, new Object[]{X0}));
            } else {
                textView5.setVisibility(8);
            }
            i2++;
        }
    }

    private void x1(NavigationView navigationView, Set<Integer> set) {
        SharedApplication G = SharedApplication.G();
        if (com.esd.laundrylink.e0.b().a == 0) {
            set.add(Integer.valueOf(R.id.fragmentAccount));
        }
        set.add(Integer.valueOf(R.id.fragmentMachines));
        if (com.esd.laundrylink.e0.b().a == 0) {
            set.add(Integer.valueOf(R.id.fragmentHistory));
        }
        if (!G.H().N0()) {
            set.add(Integer.valueOf(R.id.fragmentLocation));
        } else {
            navigationView.getMenu().removeItem(R.id.fragmentLocation);
        }
        if (com.esd.laundrylink.w.a() != null) {
            set.add(Integer.valueOf(R.id.fragmentManagement));
        }
    }

    private void x2(Menu menu) {
        SharedApplication G = SharedApplication.G();
        new l0("Update Clear Notifications Menu Item Thread", G, menu).start();
        if (com.esd.laundrylink.e0.b().a == 0) {
            boolean z2 = false;
            if (G.H().M0()) {
                menu.findItem(R.id.menu_log_out).setTitle(getString(R.string.nav_menu_log_out_with_email, new Object[]{G.H().s0()}));
            }
            menu.findItem(R.id.menu_referral_code).setVisible(G.H().U0());
            MenuItem findItem = menu.findItem(R.id.menu_transfer_money_card);
            if (G.H().T0() && !h2().isEmpty()) {
                z2 = true;
            }
            findItem.setVisible(z2);
        }
    }

    public void y1() {
        String X0 = SharedApplication.G().H().X0();
        Intent intent = new Intent("android.intent.action.SENDTO");
        this.R = new o0(1, null);
        intent.setData(Uri.parse(String.format("mailto:%s", X0)));
        intent.putExtra("android.intent.extra.EMAIL", X0);
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        } else {
            B1();
        }
    }

    public void y2(Runnable runnable) {
        T0(R.string.uploading_offline_vends);
        new j("Upload Offline Vends Thread", runnable).start();
    }

    public void z1() {
        String E = d.b.b.h.E(SharedApplication.G().H().d1());
        Intent intent = new Intent("android.intent.action.DIAL");
        this.R = new o0(1, null);
        intent.setData(Uri.parse(String.format("tel:%s", E)));
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivity(intent);
        } else {
            C1();
        }
    }

    public void z2(String str, String str2, String str3) {
        int parseInt;
        String str4;
        boolean z2;
        if (!TextUtils.isEmpty(str2)) {
            try {
                parseInt = Integer.parseInt(str2);
            } catch (NumberFormatException e2) {
                e2.printStackTrace();
            }
            int i2 = 1;
            if (parseInt <= 0) {
                str4 = str3;
            } else {
                if (TextUtils.isEmpty(str3)) {
                    str4 = str3;
                    z2 = false;
                    int i3 = 18;
                    a aVar = null;
                    if (!z2) {
                        this.R = new o0(i3, aVar);
                        Y1();
                        return;
                    }
                    if (parseInt > 0) {
                        Machine b2 = com.esd.laundrylink.f0.b(str2);
                        if (b2 != null) {
                            this.R = new o0(i2, aVar);
                            M1(b2);
                            return;
                        } else {
                            this.R = new o0(i3, aVar);
                            Y1();
                            return;
                        }
                    }
                    ArrayList<Machine> e3 = com.esd.laundrylink.f0.e(str4);
                    if (e3.size() == 1) {
                        this.R = new o0(17, aVar);
                        this.X = str4;
                        X1(e3.get(0));
                        return;
                    } else if (e3.size() == 0) {
                        this.R = new o0(i3, aVar);
                        Y1();
                        return;
                    } else {
                        this.R = new o0(i2, aVar);
                        w1(str3);
                        return;
                    }
                }
                str4 = v2(str3);
            }
            z2 = true;
            int i32 = 18;
            a aVar2 = null;
            if (!z2) {
            }
        }
        parseInt = 0;
        int i22 = 1;
        if (parseInt <= 0) {
        }
        z2 = true;
        int i322 = 18;
        a aVar22 = null;
        if (!z2) {
        }
    }

    @Override
    public void D() {
        new k0("Upload Offline Vends Thread").start();
    }

    @Override
    public void G() {
        j2();
    }

    @Override
    public void I(c.s.i iVar, c.s.n nVar, Bundle bundle) {
    }

    @Override
    public void K() {
        androidx.savedstate.e f2 = f2();
        if (f2 instanceof com.esd.laundrylink.p0.r) {
            ((com.esd.laundrylink.p0.r) f2).K();
        }
    }

    @Override
    public boolean K0() {
        return c.s.f0.d.c(c.s.x.b(this, R.id.nav_host_fragment), this.V) || super.K0();
    }

    @Override
    public void M() {
        k2();
    }

    @Override
    public void Q() {
        q2();
    }

    @Override
    public void S() {
        I1();
    }

    @Override
    public void V(String str) {
        z2(SharedApplication.G().H().e0(), "0", str);
    }

    @Override
    public void a() {
        this.Q = false;
    }

    @Override
    public void b() {
        androidx.savedstate.e f2 = f2();
        if (f2 instanceof com.esd.laundrylink.p0.r) {
            ((com.esd.laundrylink.p0.r) f2).b();
        }
    }

    @Override
    public void c() {
        this.Q = true;
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent motionEvent) {
        if (this.Q) {
            return true;
        }
        try {
            return super.dispatchTouchEvent(motionEvent);
        } catch (Exception e2) {
            com.google.firebase.crashlytics.g.a().d(e2);
            return true;
        }
    }

    @Override
    public void g(androidx.fragment.app.n nVar) {
        SharedApplication G = SharedApplication.G();
        if (com.esd.laundrylink.f0.j()) {
            Machine g2 = com.esd.laundrylink.f0.g();
            f0.a k2 = com.esd.laundrylink.f0.k();
            f0.b l2 = com.esd.laundrylink.f0.l();
            com.esd.laundrylink.f0.q(false);
            new j0("Refresh and Track Machine Thread", G, g2, k2, l2).start();
        }
    }

    @Override
    public void j(int i2) {
    }

    @Override
    public boolean l(MenuItem menuItem) {
        DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayoutMain);
        this.W = menuItem.getItemId();
        drawerLayout.g();
        return true;
    }

    @Override
    public void m() {
        s2();
    }

    @Override
    public void n() {
        androidx.savedstate.e f2 = f2();
        SharedApplication G = SharedApplication.G();
        com.esd.laundrylink.defs.o a1 = G.H().a1();
        String a2 = d.b.a.c.a(a1.p);
        if (f2 instanceof com.esd.laundrylink.p0.r) {
            ((com.esd.laundrylink.p0.r) f2).n();
        }
        a aVar = null;
        if (!TextUtils.isEmpty(a1.p) && !a2.equalsIgnoreCase(a1.q)) {
            a1.q = d.b.a.c.a(a1.p);
            G.H().L1(a1);
            this.R = new o0(19, aVar);
            N1(a1.p);
        } else {
            ArrayList<com.esd.laundrylink.defs.e> a02 = G.H().a0();
            if (a02.size() > 0) {
                this.R = new o0(20, aVar);
                A1(a02);
            }
        }
        invalidateOptionsMenu();
    }

    @Override
    public void onBackPressed() {
        androidx.savedstate.e f2 = f2();
        if (this.R.a != 1) {
            if (this.R.a == 7 || this.R.a == 5 || this.R.a == 22 || this.R.a == 23 || this.R.a == 10 || this.R.a == 12 || this.R.a == 14 || this.R.a == 8 || this.R.a == 15 || this.R.a == 16 || this.R.a == 17 || this.R.a == 18 || this.R.a == 19 || this.R.a == 20 || this.R.a == 21) {
                return;
            }
            com.google.firebase.crashlytics.g.a().d(new RuntimeException(String.format(Locale.US, "Unknown main activity state of %s", this.R.toString())));
            return;
        }
        if (!(f2 instanceof com.esd.laundrylink.p0.c) || ((com.esd.laundrylink.p0.c) f2).Q()) {
            moveTaskToBack(true);
        }
    }

    @Override
    public void onClick(DialogInterface dialogInterface, int i2) {
        a aVar = null;
        if (i2 == -2) {
            this.R = new o0(7, aVar);
        } else if (i2 == -1) {
            this.R = new o0(1, aVar);
        }
        onResume();
    }

    @Override
    public void onCreate(Bundle bundle) {
        SharedApplication G = SharedApplication.G();
        super.onCreate(bundle);
        c.s.i iVar = null;
        Object[] objArr = 0;
        Object[] objArr2 = 0;
        if (bundle != null) {
            this.W = bundle.getInt("SelectedMenuItemId", 0);
            this.R = new o0(bundle.getInt("ActivityState", 7), objArr2 == true ? 1 : 0);
            this.X = bundle.getString("MachineStartLabel", "");
        }
        setContentView(R.layout.activity_main);
        int i2 = 1;
        if (G.H().x0()) {
            com.esd.laundrylink.e0.a(new e0.a(1));
            if (bundle == null) {
                this.R = new o0(i2, objArr == true ? 1 : 0);
            }
        } else {
            com.esd.laundrylink.e0.a(new e0.a(0));
        }
        setTitle(g2());
        Set<Integer> hashSet = new HashSet<>();
        DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayoutMain);
        NavHostFragment navHostFragment = (NavHostFragment) o0().d0(R.id.nav_host_fragment);
        if (navHostFragment != null) {
            iVar = navHostFragment.M2();
            if (com.esd.laundrylink.e0.b().a == 1) {
                iVar.h0(R.navigation.navigation_machine_monitoring_main);
            }
        }
        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarMain);
        if (com.esd.laundrylink.e0.b().a == 1) {
            navigationView.getMenu().clear();
            navigationView.j(R.menu.menu_machine_monitoring_main_drawer);
        } else if (com.esd.laundrylink.w.a() != null) {
            navigationView.getMenu().clear();
            navigationView.j(R.menu.menu_management_main_drawer);
        }
        x1(navigationView, hashSet);
        this.V = new c.a(hashSet).b(drawerLayout).a();
        M0(toolbar);
        navigationView.setNavigationItemSelectedListener(this);
        drawerLayout.b(this);
        if (iVar != null) {
            iVar.o(this);
            w2(navigationView);
            c.s.f0.d.d(toolbar, iVar, this.V);
            navigationView.bringToFront();
            toolbar.setOnTouchListener(new a());
        }
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(getString(R.string.upload_offline_vends_intent_filter_name));
        UploadOfflineVendsBroadcastReceiver uploadOfflineVendsBroadcastReceiver = new UploadOfflineVendsBroadcastReceiver(this);
        this.S = uploadOfflineVendsBroadcastReceiver;
        registerReceiver(uploadOfflineVendsBroadcastReceiver, intentFilter);
        this.T = l0(new androidx.activity.result.f.d(), new v());
        this.U = l0(new androidx.activity.result.f.d(), new g0());
        com.esd.laundrylink.c cVar = new com.esd.laundrylink.c(this, new i0());
        this.Z = cVar;
        if (bundle != null) {
            cVar.Q(bundle);
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.menu_main_toolbar, menu);
        return true;
    }

    @Override
    public void onDestroy() {
        NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
        DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayoutMain);
        NavHostFragment navHostFragment = (NavHostFragment) o0().d0(R.id.nav_host_fragment);
        ((Toolbar) findViewById(R.id.toolbarMain)).setOnTouchListener(null);
        if (navHostFragment != null) {
            navHostFragment.M2().d0(this);
        }
        navigationView.setNavigationItemSelectedListener(null);
        drawerLayout.L(this);
        super.onDestroy();
        this.V = null;
        P0();
        UploadOfflineVendsBroadcastReceiver uploadOfflineVendsBroadcastReceiver = this.S;
        if (uploadOfflineVendsBroadcastReceiver != null) {
            uploadOfflineVendsBroadcastReceiver.a();
            unregisterReceiver(this.S);
            this.S = null;
        }
        this.T = null;
        this.U = null;
        this.Z = null;
    }

    @Override
    public void onDrawerClosed(View view) {
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        int i2 = this.W;
        if (i2 == R.id.fragmentAccount || i2 == R.id.fragmentMachines || i2 == R.id.fragmentHistory || i2 == R.id.fragmentLocation || i2 == R.id.fragmentManagement) {
            b2.T();
            b2.N(this.W, null, new s.a().d(true).a());
            return;
        }
        if (i2 == R.id.menu_log_out) {
            o2();
            return;
        }
        if (i2 == R.id.menu_scan_qr) {
            s2();
            return;
        }
        if (i2 == R.id.menu_change_location) {
            k2();
            return;
        }
        if (i2 == R.id.menu_clear_notifications) {
            m2();
            return;
        }
        if (i2 == R.id.menu_change_password) {
            l2();
            return;
        }
        if (i2 == R.id.menu_add_funds) {
            j2();
            return;
        }
        if (i2 == R.id.menu_transfer_money_card) {
            r2();
            return;
        }
        if (i2 == R.id.menu_contact) {
            n2();
            return;
        }
        if (i2 == R.id.refresh_btn) {
            q2();
        } else if (i2 == R.id.menu_referral_code) {
            p2();
        } else if (i2 != -1) {
            com.google.firebase.crashlytics.g.a().d(new RuntimeException(String.format(Locale.US, "Unsupported menu item id (%d)", Integer.valueOf(this.W))));
        }
    }

    @Override
    public void onDrawerOpened(View view) {
        this.W = -1;
        x2(((NavigationView) view).getMenu());
        R0();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == R.id.menu_add_funds) {
            j2();
        } else if (menuItem.getItemId() == R.id.refresh_btn) {
            q2();
        }
        return super.onOptionsItemSelected(menuItem);
    }

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        if (com.esd.laundrylink.e0.b().a == 1) {
            menu.removeItem(R.id.menu_add_funds);
        }
        return super.onPrepareOptionsMenu(menu);
    }

    @Override
    public void onResume() {
        super.onResume();
        i2();
        this.Q = false;
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        bundle.putInt("SelectedMenuItemId", this.W);
        bundle.putInt("ActivityState", this.R.a);
        bundle.putString("MachineStartLabel", this.X);
        this.Z.S(bundle);
    }

    @Override
    public void p() {
        G1();
    }

    @Override
    public void u(View view, float f2) {
    }

    public String v2(String str) {
        int i2 = SharedApplication.G().H().z0().a;
        if (i2 == 0) {
            return str;
        }
        if (i2 == 1) {
            StringBuilder sb = new StringBuilder(3);
            for (int i3 = 0; i3 < str.length(); i3++) {
                if (Character.isDigit(str.charAt(i3))) {
                    sb.append(str.charAt(i3));
                }
            }
            while (sb.length() < 3) {
                sb.insert(0, '0');
            }
            return sb.toString();
        }
        throw new RuntimeException("Unknown QR Filter Matching Mode");
    }

    public void w1(String str) {
        c.s.i b2 = c.s.x.b(this, R.id.nav_host_fragment);
        Bundle bundle = new Bundle();
        bundle.putString("filter", str);
        b2.T();
        b2.N(R.id.fragmentMachines, bundle, new s.a().d(true).a());
    }
}