导航菜单

页面标题

页面副标题

Tasker v6.5.11 - StateEdit.java 源代码

正在查看: Tasker v6.5.11 应用的 StateEdit.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package net.dinglisch.android.taskerm;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.DialogInterface;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.telephony.NeighboringCellInfo;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.ToggleButton;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Pattern;
import net.dinglisch.android.taskerm.HTMLView;
import net.dinglisch.android.taskerm.ri;
import net.dinglisch.android.taskerm.yd;

public class StateEdit extends HasArgsEdit implements pf.a {
    private ToggleButton o0;
    private CheckBox p0;
    private pn u0;
    private PhoneStateListenerCommon m0 = null;
    private SensorEventListener n0 = null;
    private List<String> q0 = new ArrayList();
    private List<Integer> r0 = new ArrayList();
    private int s0 = 0;
    private String t0 = "";
    public qf.m v0 = new qf.m(this);

    class a implements DialogInterface.OnCancelListener {
        final View i;

        a(View view) {
            this.i = view;
        }

        @Override
        public void onCancel(DialogInterface dialogInterface) {
            if (StateEdit.this.u0 == null) {
                StateEdit.this.finish();
            } else {
                this.i.setVisibility(0);
            }
            StateEdit.this.z = null;
        }
    }

    class b extends Handler {
        final int a;

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

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                dq.p(StateEdit.this.v[this.a], message.getData().getString("text"));
            }
        }
    }

    class c extends Handler {
        c() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 0) {
                StateEdit.this.startActivityForResult(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"), 2);
            } else {
                StateEdit.this.N2();
            }
        }
    }

    class d extends Handler {
        d() {
        }

        @Override
        public void handleMessage(Message message) {
            StateEdit.this.N2();
        }
    }

    class e implements SensorEventListener {
        e() {
        }

        @Override
        public void onAccuracyChanged(Sensor sensor, int i) {
        }

        @Override
        public void onSensorChanged(SensorEvent sensorEvent) {
            try {
                float[] fArr = sensorEvent.values;
                float f = fArr[0];
                float f2 = fArr[1];
                float f3 = fArr[2];
                StateEdit.this.R[0].setText(String.valueOf(Math.abs(f) + Math.abs(f2) + Math.abs(f3)));
            } catch (Exception e) {
                r7.H("StateEdit", "onSensorChanged (magnet)", e);
            }
        }
    }

    class f extends Handler {
        final int a;

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

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                String string = message.getData().getString("text");
                if (this.a != 2131887399) {
                    StateEdit stateEdit = StateEdit.this;
                    dq.W2(stateEdit.v[stateEdit.D], string);
                    return;
                }
                StateEdit stateEdit2 = StateEdit.this;
                EditText editText = stateEdit2.v[stateEdit2.D];
                if (editText.length() > 0) {
                    editText.append("/");
                }
                editText.append(string.replace("/+", "+"));
            }
        }
    }

    class g extends Handler {
        final List a;
        final int b;

        g(List list, int i) {
            this.a = list;
            this.b = i;
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                int i = message.getData().getInt("index");
                if (this.a.size() > 0) {
                    ScanResult scanResult = (ScanResult) this.a.get(i);
                    StateEdit stateEdit = StateEdit.this;
                    dq.p(stateEdit.v[stateEdit.D], this.b == 2131887422 ? scanResult.BSSID : scanResult.SSID);
                }
            }
        }
    }

    class h extends Handler {
        h() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                StateEdit stateEdit = StateEdit.this;
                dq.p(stateEdit.v[stateEdit.D], message.getData().getString("text"));
            }
        }
    }

    class i extends Handler {
        i() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                String[] split = message.getData().getString("text").split(" ");
                StateEdit stateEdit = StateEdit.this;
                int i = stateEdit.D;
                if (i != 1) {
                    stateEdit.Y2();
                    StateEdit.this.Z2(split[1], 0);
                    StateEdit.this.k3();
                } else {
                    stateEdit.v[i].append("\n" + split[1]);
                }
            }
        }
    }

    class j implements DialogInterface.OnDismissListener {
        final View i;
        final ln q;

        j(View view, ln lnVar) {
            this.i = view;
            this.q = lnVar;
        }

        @Override
        public void onDismiss(DialogInterface dialogInterface) {
            this.i.setVisibility(0);
            StateEdit.this.V2(this.q.w());
            StateEdit.this.z = null;
        }
    }

    private static class k extends Handler {
        WeakReference<StateEdit> a;

        k(StateEdit stateEdit) {
            this.a = new WeakReference<>(stateEdit);
        }

        @Override
        public void handleMessage(Message message) {
            StateEdit stateEdit = this.a.get();
            if (stateEdit == null) {
                r7.G("StateEdit", "phoneStateHandler: handleMessage: no activity");
                return;
            }
            int i = message.what;
            if (i == 0) {
                r7.f("StateEdit", "--- listener sent ss");
                stateEdit.s0 = message.arg1;
                stateEdit.l3();
            } else if (i == 1) {
                r7.f("StateEdit", "--- listener sent loc");
                stateEdit.l3();
            } else {
                if (i != 3) {
                    return;
                }
                r7.f("StateEdit", "--- listener sent info");
                stateEdit.l3();
            }
        }
    }

    public void N2() {
        Intent intent = new Intent();
        intent.putExtra("scntxt", this.u0.U(0).c0());
        setResult(-1, intent);
        finish();
    }

    private String O2() {
        return dq.m1(this.v[4]);
    }

    private List<ScanResult> P2() {
        List<ScanResult> scanResults;
        WifiManager wifiManager = (WifiManager) oi.d(this, "wifi", "StateEdit", "getScanRes");
        if (wifiManager == null) {
            r7.G("StateEdit", vh.g(this, 2131887723, new Object[0]));
            scanResults = null;
        } else {
            scanResults = wifiManager.getScanResults();
        }
        return scanResults == null ? new ArrayList() : scanResults;
    }

    private void R2() {
        Object k2 = xo.k(this);
        if (k2 == null) {
            r7.f("StateEdit", "grabCUrrentCell: null cur cell location");
            return;
        }
        String f2 = xo.f(k2);
        if (f2 == null) {
            r7.G("StateEdit", "grabCurrentCell: unknown cell ID");
            return;
        }
        r7.f("StateEdit", "grabCurrentCell: " + f2 + ": " + this.s0);
        if (Z2(f2, this.s0)) {
            dq.M3(this, 100L, true);
        }
        this.t0 = f2;
    }

    private void S2() {
        List<Object> a2 = yd.q0.a(xo.p(this));
        boolean z = false;
        if (a2 == null) {
            r7.f("StateEdit", "grabInfoCells: null info list");
        } else {
            r7.f("StateEdit", "grabInfoCells: " + a2.size() + " cells");
            for (Object obj : a2) {
                String f2 = xo.f(obj);
                if (f2 != null) {
                    int q = xo.q(obj);
                    r7.f("StateEdit", "grabInfoCells: " + f2 + " ss " + q);
                    if (Z2(f2, q)) {
                        z = true;
                    }
                }
            }
        }
        if (z) {
            dq.M3(this, 100L, true);
        }
    }

    private void T2() {
        TelephonyManager telephonyManager = (TelephonyManager) oi.d(this, "phone", "StateEdit", "gn");
        r7.f("StateEdit", "grabNeighbourCells");
        List<NeighboringCellInfo> b2 = nf.i.b(telephonyManager);
        boolean z = false;
        if (!dq.F(b2)) {
            for (NeighboringCellInfo neighboringCellInfo : b2) {
                String h2 = xo.h(neighboringCellInfo);
                if (h2 != null) {
                    r7.f("StateEdit", "grabNeighbourCells: " + h2);
                    if (Z2(h2, xo.r(neighboringCellInfo))) {
                        z = true;
                    }
                }
            }
        }
        if (z) {
            dq.M3(this, 100L, true);
        }
    }

    private void U2(int i2) {
        this.v[i2].requestFocus();
        String I = on.I(this.u0.j(), i2);
        if (I.equals("cloc")) {
            this.D = i2;
            e3(2131887400, bh.B(getContentResolver(), O2()), 2131891075);
        } else if (I.equals("m")) {
            o2(new b(i2), L0());
        } else if (I.equals("prof")) {
            m2(i2, true);
        } else if (I.equals("btn")) {
            this.D = i2;
            c2(2131887398);
        } else if (I.equals("bta")) {
            this.D = i2;
            c2(2131887397);
        } else if (I.equals("btc")) {
            this.D = i2;
            d3();
        } else if (I.equals("ssid")) {
            this.D = i2;
            h3(2131887423);
        } else if (I.equals("mac")) {
            this.D = i2;
            h3(2131887422);
        } else if (I.equals("p") || I.equals("sms")) {
            eh.w(this, this.v[i2], true);
            this.D = i2;
        } else if (I.equals("ctit")) {
            this.D = i2;
            e3(2131887401, bh.K(getContentResolver(), O2()), 2131891075);
        } else if (this.u0.j() == 7) {
            this.D = i2;
            g3();
        } else if (I.equals("mattdevi")) {
            this.v0.V0(this.v, i2);
        } else if (I.equals("ccal")) {
            this.D = i2;
            e3(2131887399, dq.y3(bh.u(getContentResolver(), -1, true, true).keySet()), 2131891076);
        } else if (this.u0.j() == 186) {
            this.v0.Q2(this.V, this.v);
        }
        if (this.v0.D2(i2)) {
            this.v0.t2(new qf.b(i2, this.u0));
        }
    }

    public void V2(int i2) {
        if (i2 != -1) {
            this.v0.y2(i2);
            this.v0.h2(i2);
            com.joaomgcd.taskerm.util.k4.Z(this, i2);
            pn pnVar = this.u0;
            if (pnVar == null) {
                this.u0 = new pn(i2);
            } else {
                pnVar.I1(i2);
            }
            invalidateOptionsMenu();
            if (i2 == 5) {
                lp.d(this, 2131890854);
            } else if (i2 == 170) {
                lp.d(this, 2131890967);
            } else if (i2 == 165) {
                this.u0.o(new s1(new r1()));
            } else if (this.v0.j2(i2)) {
                this.v0.p2(this.u0);
            }
            c3(-1);
            this.v0.q2(this.u0, null);
        }
        e2();
    }

    private void W2(int i2) {
        this.v[i2].requestFocus();
        p2(2131887420, false, this.u0, null);
    }

    public void Y2() {
        this.q0.clear();
        this.r0.clear();
        pn.G1(dq.m1(this.v[0]), this.q0);
        for (int i2 = 0; i2 < this.q0.size(); i2++) {
            this.r0.add(0);
        }
    }

    public boolean Z2(String str, int i2) {
        List<String> list = this.q0;
        List<Integer> list2 = this.r0;
        if (list == null || list2 == null) {
            MyActivity.L(this, "putCellValue seenCellIDs or seenCellRSSI null");
            return false;
        }
        for (int i3 = 0; i3 < list.size(); i3++) {
            if (list.get(i3).equals(str)) {
                list2.set(i3, Integer.valueOf(i2));
                return false;
            }
        }
        list.add(str);
        list2.add(Integer.valueOf(i2));
        return true;
    }

    private boolean a3() {
        try {
            if (!n3()) {
                return false;
            }
            b3();
            pn pnVar = this.u0;
            if (pnVar != null) {
                if ((pnVar.j() == 170 && dq.S1() && "6.0".equals(Build.VERSION.RELEASE) && !q7.t1(this)) || ((this.u0.j() == 170 || this.u0.j() == 160) && ((dq.g() >= 27 || th.u(this) >= 23) && !q7.t1(this)))) {
                    TextBoxDialogFragment.F(this, new c(), 2131887505, vh.g(this, 2131887265, new Object[0]), 2131886891, 2131886889, -1, 0).E(this);
                    return false;
                }
                if (this.u0.j() == 4) {
                    net.dinglisch.android.taskerm.e i2 = this.u0.i(5);
                    if (i2 != null && !i2.R()) {
                        if (!com.joaomgcd.taskerm.util.e5.c0(this)) {
                            return false;
                        }
                        BluetoothAdapter h2 = j1.h(this);
                        if (h2 != null && h2.isEnabled()) {
                            Iterator<BluetoothDevice> it = h2.getBondedDevices().iterator();
                            while (it.hasNext()) {
                                if (this.u0.X0(this, it.next())) {
                                }
                            }
                            oi.i(this, 2131891282, 2131887142, new d());
                            return false;
                        }
                    }
                } else if (this.u0.j() == 105 && com.joaomgcd.taskerm.util.k.r() && !com.joaomgcd.taskerm.util.e5.i0(this).B()) {
                    this.v0.Q(com.joaomgcd.taskerm.dialog.a.z0(this));
                    return false;
                }
            }
            N2();
            return true;
        } catch (NullPointerException unused) {
            r7.f("StateEdit", "saveAndExit: npe");
            return false;
        }
    }

    private void b3() {
        throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.StateEdit.b3():void");
    }

    private void c3(int r21) {
        throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.StateEdit.c3(int):void");
    }

    private void d3() {
        wj.D(this, new h(), 2131889743).I(j1.m(getResources())).C(this);
    }

    private void e3(int i2, List<String> list, int i3) {
        if (list.size() == 0) {
            dq.n0(this, i3, new Object[0]);
        } else {
            wj.D(this, new f(i2), i2).G(list).b0().C(this);
        }
    }

    private void f3() {
        View findViewById = findViewById(2131296767);
        ln lnVar = new ln(this);
        pn pnVar = this.u0;
        if (pnVar != null) {
            lnVar.A(pnVar.j());
        }
        lnVar.x(true);
        lnVar.setOnDismissListener(new j(findViewById, lnVar));
        lnVar.setOnCancelListener(new a(findViewById));
        findViewById.setVisibility(4);
        this.v0.z2();
        lnVar.show();
        this.z = lnVar;
    }

    private void g3() {
        List<String> d4 = MonitorService.d4();
        if (d4.size() == 0) {
            dq.j0(this, 2131887852, new Object[0]);
            return;
        }
        ArrayList arrayList = new ArrayList();
        Iterator<String> it = d4.iterator();
        while (it.hasNext()) {
            arrayList.add(Integer.valueOf(tp.J(this, this.q0.contains(it.next().split("\\s+")[1]) ? 2130969152 : 2130969168)));
        }
        wj.D(this, new i(), 2131887525).F(getResources(), d4, arrayList).C(this);
    }

    private void h3(int i2) {
        List<ScanResult> P2 = P2();
        if (P2.size() == 0) {
            this.v0.d1();
            dq.j0(this, 2131888713, new Object[0]);
            return;
        }
        String[] strArr = new String[P2.size()];
        for (int i3 = 0; i3 < P2.size(); i3++) {
            strArr[i3] = com.joaomgcd.taskerm.util.x2.N2(P2.get(i3));
        }
        wj.D(this, new g(P2, i2), i2).I(strArr).C(this);
    }

    private void i3(boolean z) {
        this.R[0].setVisibility(8);
        this.O[0].setVisibility(8);
        SensorManager sensorManager = (SensorManager) oi.d(this, "sensor", "StateEdit", "ssmfm");
        if (sensorManager == null) {
            r7.G("StateEdit", "no sensor manager");
            return;
        }
        Sensor defaultSensor = sensorManager.getDefaultSensor(2);
        if (defaultSensor == null) {
            r7.G("StateEdit", "no sensor");
            return;
        }
        SensorEventListener sensorEventListener = this.n0;
        if (sensorEventListener != null) {
            sensorManager.unregisterListener(sensorEventListener);
            this.n0 = null;
        }
        if (z) {
            e eVar = new e();
            this.n0 = eVar;
            if (sensorManager.registerListener(eVar, defaultSensor, 1)) {
                this.R[0].setVisibility(0);
                this.O[0].setVisibility(0);
            } else {
                r7.k("StateEdit", "no magnetic sensor, or couldn't enable");
                this.n0 = null;
            }
        }
    }

    private boolean j3(boolean z) {
        boolean z2;
        int i2;
        if (z) {
            z2 = this.v0.d1();
            if (!z2) {
                z = false;
            }
            dq.h0(this, 2131891086, new Object[0]);
        } else {
            z2 = true;
        }
        TelephonyManager telephonyManager = (TelephonyManager) oi.d(this, "phone", "StateEdit", "sspsm");
        if (telephonyManager == null) {
            dq.a0(this, 2131887721, new Object[0]);
        } else if (z) {
            if (this.m0 == null) {
                PhoneStateListenerCommon phoneStateListenerCommon = PhoneStateListenerCommon.getInstance(this);
                this.m0 = phoneStateListenerCommon;
                if (phoneStateListenerCommon == null) {
                    r7.G("StateEdit", "no phone state listener");
                } else {
                    Y2();
                    this.v[0].setEnabled(false);
                    this.m0.setHandler(new k(this));
                    if (PhoneStateListenerCommon.isNewInstance(this.m0)) {
                        r7.f("StateEdit", "is new instance, use cell info");
                        i2 = 1280;
                    } else {
                        i2 = 272;
                    }
                    telephonyManager.listen(this.m0, i2);
                    oi.m();
                    this.o0.setChecked(true);
                }
                zq.c(this, "StateEdit", false, false);
            } else {
                r7.G("StateEdit", "phone state monitor already started");
            }
        } else if (this.m0 != null) {
            this.v[0].setEnabled(true);
            telephonyManager.listen(this.m0, 0);
            this.m0 = null;
            zq.k(this, "StateEdit");
        }
        return z2;
    }

    public void k3() {
        StringBuilder sb = new StringBuilder();
        for (int i2 = 0; i2 < this.q0.size(); i2++) {
            String str = this.q0.get(i2);
            int intValue = this.r0.get(i2).intValue();
            if (i2 > 0) {
                sb.append("\n");
            }
            sb.append(str);
            sb.append(" / ");
            sb.append(intValue);
            if (str.equals(this.t0)) {
                sb.append(" <");
            }
        }
        dq.W2(this.v[0], sb.toString());
    }

    public void l3() {
        r7.f("StateEdit", "update cells: start");
        if (PhoneStateListenerCommon.wantAndHaveNewAPI(this)) {
            r7.f("StateEdit", "updateCells: use new API");
            S2();
        } else {
            r7.f("StateEdit", "updateCells: use old API");
            try {
                T2();
            } catch (NullPointerException e2) {
                r7.H("StateEdit", "updateCells:grabNeighbour", e2);
            }
            try {
                R2();
            } catch (NullPointerException e3) {
                r7.H("StateEdit", "updateCells:grabCurrent", e3);
            }
        }
        try {
            k3();
        } catch (NullPointerException e4) {
            r7.H("StateEdit", "updateCells:updateDisplay", e4);
        }
        r7.f("StateEdit", "update cells: done");
    }

    private boolean n3() {
        char c2;
        char c3 = 2;
        int j2 = this.u0.j();
        if (!m3()) {
            return false;
        }
        if (j2 == 5) {
            String m1 = dq.m1(this.v[4]);
            if (!TextUtils.isEmpty(m1)) {
                if (m1.charAt(0) == '!') {
                    m1 = m1.substring(1);
                }
                String[] split = bh.O(m1) ? new String[]{m1} : m1.split(Pattern.quote("/"));
                for (int i2 = 0; i2 < split.length; i2++) {
                    String trim = split[i2].trim();
                    if (!kq.K(trim)) {
                        String c4 = bh.c(trim);
                        int b2 = bh.b(trim);
                        r7.f("StateEdit", "spec *" + i2 + "* trim *" + trim + "* calName *" + c4 + "* source *" + b2);
                        if (c4 == null) {
                            return dq.a0(this, 2131887690, new Object[0]);
                        }
                        if (b2 == -1) {
                            return dq.b0(this, vh.g(this, 2131887734, new Object[0]) + " " + trim, new Object[0]);
                        }
                        Iterator<String> it = bh.u(getContentResolver(), b2, true, false).keySet().iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                dq.b0(this, vh.g(this, 2131887733, new Object[0]) + " " + trim, new Object[0]);
                                break;
                            }
                            if (bh.a(c4, it.next())) {
                                break;
                            }
                        }
                    }
                }
            }
        }
        if (j2 == 4 && !this.U[3].isChecked() && !this.U[4].isChecked()) {
            return dq.a0(this, 2131887892, vh.g(this, 2131889968, new Object[0]), vh.g(this, 2131889718, new Object[0]));
        }
        if (j2 == 110 && !this.U[0].isChecked() && !this.U[1].isChecked() && !this.U[2].isChecked() && !this.U[3].isChecked() && !this.U[4].isChecked()) {
            return dq.a0(this, 2131887700, new Object[0]);
        }
        for (int i3 = 0; i3 < this.u0.Y(); i3++) {
            String str = dq.m1(this.Q[i3]) + " ";
            EditText editText = this.v[i3];
            int p0 = this.u0.p0(i3);
            if (p0 != 0) {
                if (p0 == 1) {
                    String m12 = dq.m1(editText);
                    if (editText.length() == 0) {
                        if (on.d(j2, i3)) {
                            return dq.a0(this, 2131887925, str);
                        }
                    } else if (j2 == 7 && !pn.G1(m12, null)) {
                        return dq.a0(this, 2131887812, new Object[0]);
                    }
                } else if (p0 == 3) {
                    continue;
                } else if (p0 != 5) {
                    r7.k("StateEdit", "validateUIValues: bad arg type");
                } else if (!this.u0.a(i3).y()) {
                    return dq.a0(this, 2131887851, new Object[0]);
                }
            } else if (on.L(j2, i3, this.v0.J2(i3))) {
                this.P[i3].getProgress();
            } else if (on.M(this.x, j2, i3, this.u0) != null) {
                continue;
            } else if (editText.length() != 0) {
                String m13 = dq.m1(editText);
                if (!kq.K(m13)) {
                    new Integer(m13);
                }
            } else if (on.t(j2, i3)) {
                return dq.a0(this, 2131887924, str);
            }
        }
        if (j2 == 140 || j2 == 145 || j2 == 103 || j2 == 104 || j2 == 106 || j2 == 185 || j2 == 180 || j2 == 182) {
            if (j2 == 106) {
                c2 = 1;
            } else {
                c3 = 1;
                c2 = 0;
            }
            if (this.P[c2].getProgress() > this.P[c3].getProgress()) {
                return dq.a0(this, 2131887697, new Object[0]);
            }
        }
        return this.v0.M2();
    }

    @Override
    public b5 O0() {
        return Q2();
    }

    public pn Q2() {
        return this.u0;
    }

    @Override
    public void U1(int i2) {
        c3(i2);
    }

    public boolean X2() {
        vg.e v1;
        pn pnVar = this.u0;
        if (pnVar == null || (v1 = pnVar.v1()) == null) {
            return false;
        }
        return v1.B(this);
    }

    @Override
    public void g(com.joaomgcd.taskerm.util.e5 e5Var, com.joaomgcd.taskerm.util.t6 t6Var) {
        if (this.v0.w2(e5Var, t6Var)) {
            return;
        }
        f3();
    }

    protected boolean m3() {
        if (Z0()) {
            return super.C2(!X2(), false, true);
        }
        return true;
    }

    @Override
    public void onActivityResult(int i2, int i3, Intent intent) {
        super.onActivityResult(i2, i3, intent);
        if (eh.l(i2)) {
            if (eh.n(i2, i3, intent, getContentResolver(), this.v[this.D], 2, false)) {
                return;
            }
            dq.n0(this, 2131887773, new Object[0]);
            return;
        }
        if (i2 == 2) {
            N2();
            return;
        }
        if (i2 == 1) {
            this.D = 0;
            if (i3 != -1) {
                if (i3 == 0) {
                    r7.f("StateEdit", "Cancelled");
                    return;
                }
                r7.f("StateEdit", "R: " + i3);
                return;
            }
            Bundle s = ri.s(intent);
            if (s != null) {
                if (!ri.i0(s)) {
                    dq.a0(this, 2131887879, new Object[0]);
                    return;
                }
                this.u0.K1(0, s);
                pn pnVar = this.u0;
                ri.f0(pnVar, pnVar.j(), ri.c.Condition);
                c3(this.D);
                c3(2);
                c3(1);
            }
        }
    }

    @Override
    public void onClick(View view) {
        pn pnVar = this.u0;
        if (pnVar == null) {
            MyActivity.L(this, "onClick tState null");
            return;
        }
        int j2 = pnVar.j();
        if (super.o1(view, pnVar)) {
            if (this.J.equals(view)) {
                r2(2131887421, false, pnVar, null, this.v0.i2(N0(pnVar)) ? this.v0.e2(pnVar.v1()) : null);
            }
            if (this.K.equals(view)) {
                this.v0.R0(N0(pnVar));
                return;
            }
            return;
        }
        if (this.o0.equals(view)) {
            boolean isChecked = this.o0.isChecked();
            if (j2 == 106) {
                i3(isChecked);
                return;
            }
            if (this.v0.I2()) {
                if (this.v0.K2(isChecked)) {
                    return;
                }
                this.o0.setChecked(!isChecked);
                return;
            }
            try {
                if (j3(isChecked)) {
                    return;
                }
                this.o0.setChecked(!isChecked);
                return;
            } catch (SecurityException e2) {
                dq.b0(this, e2.getMessage(), new Object[0]);
                this.o0.setChecked(false);
                return;
            }
        }
        for (int i2 = 0; i2 < 7; i2++) {
            if (view == this.Z[i2]) {
                this.v0.F2(pnVar, i2);
            }
            if (view == this.c0[i2]) {
                this.D = 0;
                Intent G = ri.G(this, ri.c.Condition, pnVar.a(0), j2, null);
                if (G != null) {
                    startActivityForResult(G, 1);
                }
            } else if (view == this.a0[i2]) {
                this.P[i2].incrementProgressBy(1);
                SeekBar seekBar = this.P[i2];
                onProgressChanged(seekBar, seekBar.getProgress(), true);
            } else if (view == this.b0[i2]) {
                this.P[i2].incrementProgressBy(-1);
                SeekBar seekBar2 = this.P[i2];
                onProgressChanged(seekBar2, seekBar2.getProgress(), true);
            } else if (view == this.e0[i2]) {
                U2(i2);
            } else if (view == this.f0[i2]) {
                W2(i2);
            } else {
                MyCheckBox myCheckBox = this.U[i2];
                if (view == myCheckBox && j2 == 4 && i2 == 4 && myCheckBox.isChecked()) {
                    lp.e(this, 1, 2131890852, 1);
                }
            }
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.p1(bundle, 2131494242);
        G1(true, 2131891277, 2131890053);
        setTitle(vh.g(this, 2131886732, new Object[0]));
        this.p0 = (CheckBox) findViewById(2131297008);
        t1(7, this.B ? 114667 : 81899);
        for (int i2 = 0; i2 < 7; i2++) {
            this.Z[i2].setOnClickListener(this);
            this.a0[i2].setOnClickListener(this);
            this.b0[i2].setOnClickListener(this);
            this.U[i2].setOnClickListener(this);
            this.c0[i2].setOnClickListener(this);
        }
        ToggleButton toggleButton = (ToggleButton) findViewById(2131296509);
        this.o0 = toggleButton;
        toggleButton.setOnClickListener(this);
        q1(false);
        dq.M2(this, 2131297708, 2131891185);
        Bundle bundleExtra = bundle == null ? getIntent().getBundleExtra("scntxt") : bundle.getBundle("tst");
        if (bundleExtra != null) {
            this.u0 = new pn(new qi(bundleExtra));
            c3(-1);
            if (this.u0.j() == 7) {
                lp.d(this, 2131890856);
            }
        } else if (bundle == null) {
            a1();
            f3();
        }
        this.v0.I();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        net.dinglisch.android.taskerm.a.M(this, 8, 2131891251, menu);
        pn pnVar = this.u0;
        if (pnVar != null && pnVar.w1() != null) {
            net.dinglisch.android.taskerm.a.v(this, 7777, menu);
        }
        return super.r1(menu, 2131888880, 2131889042);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.m0 = null;
        this.n0 = null;
        this.o0 = null;
        this.p0 = null;
        this.q0 = null;
        this.r0 = null;
        this.u0 = null;
        this.v0.J();
    }

    @Override
    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (i2 != 4 || a3()) {
            return super.onKeyDown(i2, keyEvent);
        }
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 6) {
            finish();
            return true;
        }
        if (itemId == 8) {
            f3();
            return true;
        }
        if (itemId == 7777) {
            HTMLView.H0(this, HasArgsEdit.P0("sh", this.u0.w1()), -1, HTMLView.g.Inform);
            return true;
        }
        if (itemId != 16908332) {
            return s1(menuItem, "help/sh_index.html", "activity_stateedit.html");
        }
        a3();
        return true;
    }

    @Override
    public void onPause() {
        super.onPause();
        pn pnVar = this.u0;
        if (pnVar != null) {
            int j2 = pnVar.j();
            if (j2 == 7) {
                j3(false);
            } else if (j2 == 106) {
                i3(false);
            } else if (this.v0.j2(j2)) {
                this.v0.K2(false);
            }
        }
        this.o0.setChecked(false);
        this.v0.v2();
    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int i2, boolean z) {
        if (z) {
            seekBar.requestFocus();
            int i3 = 0;
            while (true) {
                if (i3 >= 7) {
                    break;
                }
                if (seekBar.equals(this.P[i3])) {
                    this.R[i3].setText(on.A(this.x, this.u0.j(), i3, seekBar.getProgress()));
                    break;
                }
                i3++;
            }
        }
        for (int i4 = 0; i4 < this.u0.Y(); i4++) {
            this.v0.G1(i4, i2);
        }
    }

    @Override
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i2, strArr, iArr);
        this.v0.A0(i2, strArr, iArr);
    }

    @Override
    protected void onResume() {
        super.onResume();
        this.v0.x2();
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        if (this.u0 != null) {
            b3();
            bundle.putBundle("tst", this.u0.U(0).c0());
        }
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
        EditText N0 = N0(this.u0);
        if (D2(N0)) {
            N0.clearFocus();
        }
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    }

    @Override
    public boolean y0() {
        return this.v0.V1();
    }
}