导航菜单

页面标题

页面副标题

Tasker v6.6.3 - StateEdit.java 源代码

正在查看: Tasker v6.6.3 应用的 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.ji;
import net.dinglisch.android.taskerm.ud;

public class StateEdit extends HasArgsEdit implements xf.a {
    private ToggleButton o0;
    private CheckBox p0;
    private bn 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 yf.u0 v0 = new yf.u0(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) {
                pp.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) {
                o7.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 != 2131887406) {
                    StateEdit stateEdit = StateEdit.this;
                    pp.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;
                    pp.p(stateEdit.v[stateEdit.D], this.b == 2131887429 ? scanResult.BSSID : scanResult.SSID);
                }
            }
        }
    }

    class h extends Handler {
        h() {
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                StateEdit stateEdit = StateEdit.this;
                pp.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 xm q;

        j(View view, xm xmVar) {
            this.i = view;
            this.q = xmVar;
        }

        @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) {
                o7.G("StateEdit", "phoneStateHandler: handleMessage: no activity");
                return;
            }
            int i = message.what;
            if (i == 0) {
                o7.f("StateEdit", "--- listener sent ss");
                stateEdit.s0 = message.arg1;
                stateEdit.l3();
            } else if (i == 1) {
                o7.f("StateEdit", "--- listener sent loc");
                stateEdit.l3();
            } else {
                if (i != 3) {
                    return;
                }
                o7.f("StateEdit", "--- listener sent info");
                stateEdit.l3();
            }
        }
    }

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

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

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

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

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

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

    private void U2(int i2) {
        this.v[i2].requestFocus();
        String I = an.I(this.u0.j(), i2);
        if (I.equals("cloc")) {
            this.D = i2;
            e3(2131887407, ug.B(getContentResolver(), O2()), 2131891097);
        } 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(2131887405);
        } else if (I.equals("bta")) {
            this.D = i2;
            c2(2131887404);
        } else if (I.equals("btc")) {
            this.D = i2;
            d3();
        } else if (I.equals("ssid")) {
            this.D = i2;
            h3(2131887430);
        } else if (I.equals("mac")) {
            this.D = i2;
            h3(2131887429);
        } else if (I.equals("p") || I.equals("sms")) {
            xg.w(this, this.v[i2], true);
            this.D = i2;
        } else if (I.equals("ctit")) {
            this.D = i2;
            e3(2131887408, ug.K(getContentResolver(), O2()), 2131891097);
        } else if (this.u0.j() == 7) {
            this.D = i2;
            g3();
        } else if (I.equals("mattdevi")) {
            this.v0.i2(this.v, i2);
        } else if (I.equals("ccal")) {
            this.D = i2;
            e3(2131887406, pp.y3(ug.u(getContentResolver(), -1, true, true).keySet()), 2131891098);
        } else if (this.u0.j() == 186) {
            this.v0.o4(this.V, this.v);
        }
        if (this.v0.Y3(i2)) {
            this.v0.O3(new yf.b(i2, this.u0));
        }
    }

    public void V2(int i2) {
        if (i2 != -1) {
            this.v0.T3(i2);
            this.v0.C3(i2);
            com.joaomgcd.taskerm.util.t9.g0(this, i2);
            bn bnVar = this.u0;
            if (bnVar == null) {
                this.u0 = new bn(i2);
            } else {
                bnVar.M1(i2);
            }
            invalidateOptionsMenu();
            if (i2 == 5) {
                xo.d(this, 2131890873);
            } else if (i2 == 170) {
                xo.d(this, 2131890986);
            } else if (i2 == 165) {
                this.u0.p(new r1(new q1()));
            } else if (this.v0.E3(i2)) {
                this.v0.K3(this.u0);
            }
            c3(-1);
            this.v0.L3(this.u0, null);
        }
        e2();
    }

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

    public void Y2() {
        this.q0.clear();
        this.r0.clear();
        bn.K1(pp.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();
            bn bnVar = this.u0;
            if (bnVar != null) {
                if ((bnVar.j() == 170 && pp.S1() && "6.0".equals(Build.VERSION.RELEASE) && !n7.x1(this)) || ((this.u0.j() == 170 || this.u0.j() == 160) && ((pp.g() >= 27 || mh.u(this) >= 23) && !n7.x1(this)))) {
                    TextBoxDialogFragment.F(this, new c(), 2131887512, oh.g(this, 2131887271, new Object[0]), 2131886894, 2131886892, -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.T()) {
                        if (!com.joaomgcd.taskerm.util.ac.H0(this)) {
                            return false;
                        }
                        BluetoothAdapter h2 = i1.h(this);
                        if (h2 != null && h2.isEnabled()) {
                            Iterator<BluetoothDevice> it = h2.getBondedDevices().iterator();
                            while (it.hasNext()) {
                                if (this.u0.b1(this, it.next())) {
                                }
                            }
                            gi.i(this, 2131891305, 2131887148, new d());
                            return false;
                        }
                    }
                } else if (this.u0.j() == 105 && com.joaomgcd.taskerm.util.r.s() && !com.joaomgcd.taskerm.util.ac.O0(this).i0()) {
                    this.v0.p0(com.joaomgcd.taskerm.dialog.a.d3(this));
                    return false;
                }
            }
            N2();
            return true;
        } catch (NullPointerException unused) {
            o7.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() {
        fj.D(this, new h(), 2131889757).I(i1.m(getResources())).C(this);
    }

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

    private void f3() {
        View findViewById = findViewById(2131296768);
        xm xmVar = new xm(this);
        bn bnVar = this.u0;
        if (bnVar != null) {
            xmVar.A(bnVar.j());
        }
        xmVar.x(true);
        xmVar.setOnDismissListener(new j(findViewById, xmVar));
        xmVar.setOnCancelListener(new a(findViewById));
        findViewById.setVisibility(4);
        this.v0.U3();
        xmVar.show();
        this.z = xmVar;
    }

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

    private void h3(int i2) {
        List<ScanResult> P2 = P2();
        if (P2.size() == 0) {
            this.v0.q2();
            pp.j0(this, 2131888725, new Object[0]);
            return;
        }
        String[] strArr = new String[P2.size()];
        for (int i3 = 0; i3 < P2.size(); i3++) {
            strArr[i3] = com.joaomgcd.taskerm.util.b7.b4(P2.get(i3));
        }
        fj.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) gi.d(this, "sensor", "StateEdit", "ssmfm");
        if (sensorManager == null) {
            o7.G("StateEdit", "no sensor manager");
            return;
        }
        Sensor defaultSensor = sensorManager.getDefaultSensor(2);
        if (defaultSensor == null) {
            o7.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 {
                o7.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.q2();
            if (!z2) {
                z = false;
            }
            pp.h0(this, 2131891108, new Object[0]);
        } else {
            z2 = true;
        }
        TelephonyManager telephonyManager = (TelephonyManager) gi.d(this, "phone", "StateEdit", "sspsm");
        if (telephonyManager == null) {
            pp.a0(this, 2131887728, new Object[0]);
        } else if (z) {
            if (this.m0 == null) {
                PhoneStateListenerCommon phoneStateListenerCommon = PhoneStateListenerCommon.getInstance(this);
                this.m0 = phoneStateListenerCommon;
                if (phoneStateListenerCommon == null) {
                    o7.G("StateEdit", "no phone state listener");
                } else {
                    Y2();
                    this.v[0].setEnabled(false);
                    this.m0.setHandler(new k(this));
                    if (PhoneStateListenerCommon.isNewInstance(this.m0)) {
                        o7.f("StateEdit", "is new instance, use cell info");
                        i2 = 1280;
                    } else {
                        i2 = 272;
                    }
                    telephonyManager.listen(this.m0, i2);
                    gi.m();
                    this.o0.setChecked(true);
                }
                er.c(this, "StateEdit", false, false);
            } else {
                o7.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;
            er.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(" <");
            }
        }
        pp.W2(this.v[0], sb.toString());
    }

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

    private boolean n3() {
        char c2;
        int j2 = this.u0.j();
        if (!m3()) {
            return false;
        }
        if (j2 == 5) {
            String m1 = pp.m1(this.v[4]);
            if (!TextUtils.isEmpty(m1)) {
                if (m1.charAt(0) == '!') {
                    m1 = m1.substring(1);
                }
                String[] split = ug.O(m1) ? new String[]{m1} : m1.split(Pattern.quote("/"));
                for (int i2 = 0; i2 < split.length; i2++) {
                    String trim = split[i2].trim();
                    if (!wp.K(trim)) {
                        String c3 = ug.c(trim);
                        int b2 = ug.b(trim);
                        o7.f("StateEdit", "spec *" + i2 + "* trim *" + trim + "* calName *" + c3 + "* source *" + b2);
                        if (c3 == null) {
                            return pp.a0(this, 2131887697, new Object[0]);
                        }
                        if (b2 == -1) {
                            return pp.b0(this, oh.g(this, 2131887741, new Object[0]) + " " + trim, new Object[0]);
                        }
                        Iterator<String> it = ug.u(getContentResolver(), b2, true, false).keySet().iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                pp.b0(this, oh.g(this, 2131887740, new Object[0]) + " " + trim, new Object[0]);
                                break;
                            }
                            if (ug.a(c3, it.next())) {
                                break;
                            }
                        }
                    }
                }
            }
        }
        if (j2 == 4 && !this.U[3].isChecked() && !this.U[4].isChecked()) {
            return pp.a0(this, 2131887899, oh.g(this, 2131889982, new Object[0]), oh.g(this, 2131889732, new Object[0]));
        }
        char c4 = 2;
        if (j2 == 110 && !this.U[0].isChecked() && !this.U[1].isChecked() && !this.U[2].isChecked() && !this.U[3].isChecked() && !this.U[4].isChecked()) {
            return pp.a0(this, 2131887707, new Object[0]);
        }
        for (int i3 = 0; i3 < this.u0.e0(); i3++) {
            String str = pp.m1(this.Q[i3]) + " ";
            EditText editText = this.v[i3];
            int t0 = this.u0.t0(i3);
            if (t0 != 0) {
                if (t0 == 1) {
                    String m12 = pp.m1(editText);
                    if (editText.length() == 0) {
                        if (an.d(j2, i3)) {
                            return pp.a0(this, 2131887932, str);
                        }
                    } else if (j2 == 7 && !bn.K1(m12, null)) {
                        return pp.a0(this, 2131887819, new Object[0]);
                    }
                } else if (t0 == 3) {
                    continue;
                } else if (t0 != 5) {
                    o7.k("StateEdit", "validateUIValues: bad arg type");
                } else if (!this.u0.a(i3).z()) {
                    return pp.a0(this, 2131887858, new Object[0]);
                }
            } else if (an.L(j2, i3, this.v0.h4(i3))) {
                this.P[i3].getProgress();
            } else if (an.M(this.x, j2, i3, this.u0) != null) {
                continue;
            } else if (editText.length() != 0) {
                String m13 = pp.m1(editText);
                if (!wp.K(m13)) {
                    new Integer(m13);
                }
            } else if (an.t(j2, i3)) {
                return pp.a0(this, 2131887931, str);
            }
        }
        if (j2 == 140 || j2 == 145 || j2 == 103 || j2 == 104 || j2 == 106 || j2 == 185 || j2 == 180 || j2 == 182) {
            if (j2 == 106) {
                c2 = 1;
            } else {
                c2 = 0;
                c4 = 1;
            }
            if (this.P[c2].getProgress() > this.P[c4].getProgress()) {
                return pp.a0(this, 2131887704, new Object[0]);
            }
        }
        return this.v0.k4();
    }

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

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

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

    public boolean X2() {
        eh.e z1;
        bn bnVar = this.u0;
        if (bnVar == null || (z1 = bnVar.z1()) == null) {
            return false;
        }
        return z1.E(this);
    }

    @Override
    public void g(com.joaomgcd.taskerm.util.ac acVar, com.joaomgcd.taskerm.util.se seVar) {
        if (this.v0.R3(acVar, seVar)) {
            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 (xg.l(i2)) {
            if (xg.n(i2, i3, intent, getContentResolver(), this.v[this.D], 2, false)) {
                return;
            }
            pp.n0(this, 2131887780, new Object[0]);
            return;
        }
        if (i2 == 2) {
            N2();
            return;
        }
        if (i2 == 1) {
            this.D = 0;
            if (i3 != -1) {
                if (i3 == 0) {
                    o7.f("StateEdit", "Cancelled");
                    return;
                }
                o7.f("StateEdit", "R: " + i3);
                return;
            }
            Bundle s = ji.s(intent);
            if (s != null) {
                if (!ji.i0(s)) {
                    pp.a0(this, 2131887886, new Object[0]);
                    return;
                }
                this.u0.O1(0, s);
                bn bnVar = this.u0;
                ji.f0(bnVar, bnVar.j(), ji.c.Condition);
                c3(this.D);
                c3(2);
                c3(1);
            }
        }
    }

    @Override
    public void onClick(View view) {
        bn bnVar = this.u0;
        if (bnVar == null) {
            MyActivity.L(this, "onClick tState null");
            return;
        }
        int j2 = bnVar.j();
        if (super.o1(view, bnVar)) {
            if (this.J.equals(view)) {
                r2(2131887428, false, bnVar, null, this.v0.D3(N0(bnVar)) ? this.v0.z3(bnVar.z1()) : null);
            }
            if (this.K.equals(view)) {
                this.v0.Z1(N0(bnVar));
                return;
            }
            return;
        }
        if (this.o0.equals(view)) {
            boolean isChecked = this.o0.isChecked();
            if (j2 == 106) {
                i3(isChecked);
                return;
            }
            if (this.v0.g4()) {
                if (this.v0.i4(isChecked)) {
                    return;
                }
                this.o0.setChecked(!isChecked);
                return;
            }
            try {
                if (j3(isChecked)) {
                    return;
                }
                this.o0.setChecked(!isChecked);
                return;
            } catch (SecurityException e2) {
                pp.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.c4(bnVar, i2);
            }
            if (view == this.c0[i2]) {
                this.D = 0;
                Intent G = ji.G(this, ji.c.Condition, bnVar.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()) {
                    xo.e(this, 1, 2131890871, 1);
                }
            }
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.p1(bundle, 2131494242);
        G1(true, 2131891300, 2131890068);
        setTitle(oh.g(this, 2131886735, new Object[0]));
        this.p0 = (CheckBox) findViewById(2131297009);
        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);
        pp.M2(this, 2131297711, 2131891207);
        Bundle bundleExtra = bundle == null ? getIntent().getBundleExtra("scntxt") : bundle.getBundle("tst");
        if (bundleExtra != null) {
            this.u0 = new bn(new ii(bundleExtra));
            c3(-1);
            if (this.u0.j() == 7) {
                xo.d(this, 2131890875);
            }
        } else if (bundle == null) {
            a1();
            f3();
        }
        this.v0.g0();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        net.dinglisch.android.taskerm.a.M(this, 8, 2131891273, menu);
        bn bnVar = this.u0;
        if (bnVar != null && bnVar.A1() != null) {
            net.dinglisch.android.taskerm.a.v(this, 7777, menu);
        }
        return super.r1(menu, 2131888892, 2131889054);
    }

    @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.h0();
    }

    @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.A1()), -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();
        bn bnVar = this.u0;
        if (bnVar != null) {
            int j2 = bnVar.j();
            if (j2 == 7) {
                j3(false);
            } else if (j2 == 106) {
                i3(false);
            } else if (this.v0.E3(j2)) {
                this.v0.i4(false);
            }
        }
        this.o0.setChecked(false);
        this.v0.Q3();
    }

    @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(an.A(this.x, this.u0.j(), i3, seekBar.getProgress()));
                    break;
                }
                i3++;
            }
        }
        for (int i4 = 0; i4 < this.u0.e0(); i4++) {
            this.v0.a3(i4, i2);
        }
    }

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

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

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        if (this.u0 != null) {
            b3();
            bundle.putBundle("tst", this.u0.X(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.p3();
    }
}