导航菜单

页面标题

页面副标题

Tasker v6.6.3 - TimeSelect.java 源代码

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

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


package net.dinglisch.android.taskerm;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.InputFilter;
import android.text.format.DateFormat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.ToggleButton;
import java.util.ArrayList;
import java.util.Calendar;
import net.dinglisch.android.taskerm.HTMLView;

public class TimeSelect extends MyActivity implements CompoundButton.OnCheckedChangeListener, xf.a, ze.e {
    private static final int[] L = {2131297633, 2131297635};
    private static final int[] M = {2131297685, 2131297690};
    private static final int[] N = {2131296920, 2131297644};
    private static final int[] O = {2131297688, 2131297689};
    private static final int[] P = {2131297686, 2131297687};
    private static final int[] Q = {2131297543, 2131297544};
    private ToggleButton B;
    private ToggleButton C;
    private ToggleButton D;
    private Spinner E;
    private EditText F;
    private ImageView x;
    private ImageButton[] v = new ImageButton[2];
    private TimePicker[] w = new TimePicker[2];
    private EditText[] y = new EditText[2];
    private ViewGroup[] z = new ViewGroup[2];
    private View[] A = new View[2];
    private TextView[] G = new TextView[2];
    private wo H = null;
    protected ArrayList<String> I = null;
    private boolean J = false;
    public com.joaomgcd.taskerm.helper.j K = new com.joaomgcd.taskerm.helper.j(this);

    class a implements View.OnClickListener {
        a() {
        }

        @Override
        public void onClick(View view) {
            TimeSelect timeSelect = TimeSelect.this;
            timeSelect.A0(0, true, timeSelect.z[0].getVisibility() == 0, true);
            TimeSelect timeSelect2 = TimeSelect.this;
            timeSelect2.C0(timeSelect2.y[0]);
        }
    }

    class b implements View.OnClickListener {
        b() {
        }

        @Override
        public void onClick(View view) {
            TimeSelect timeSelect = TimeSelect.this;
            timeSelect.A0(1, true, timeSelect.z[1].getVisibility() == 0, true);
            TimeSelect timeSelect2 = TimeSelect.this;
            timeSelect2.C0(timeSelect2.y[1]);
        }
    }

    class c implements View.OnClickListener {
        final int i;

        c(int i) {
            this.i = i;
        }

        @Override
        public void onClick(View view) {
            TimeSelect.this.D0(this.i);
        }
    }

    class d extends qg {
        final int b;
        final View c;

        d(int i, View view) {
            this.b = i;
            this.c = view;
        }

        @Override
        public void e() {
            int i = this.b;
            if (i != 0) {
                this.c.setVisibility(i);
            }
        }
    }

    class e extends Handler {
        final EditText a;

        e(EditText editText) {
            this.a = editText;
        }

        @Override
        public void handleMessage(Message message) {
            if (message.what == 1) {
                String string = message.getData().getString("text");
                if (!string.startsWith("%")) {
                    string = ji.r(string);
                }
                EditText editText = this.a;
                if (editText == null) {
                    o7.k("TS", "no text focus on return from variable select");
                } else {
                    pp.W2(editText, string);
                }
            }
        }
    }

    public void A0(int i, boolean z, boolean z2, boolean z3) {
        int i2;
        int i3 = 0;
        if (z3 && !Settings.N3(this)) {
            z3 = false;
        }
        int i4 = 8;
        int i5 = 4;
        if (z) {
            if (z2) {
                i5 = 0;
                i2 = 8;
            } else {
                if (this.y[i].length() == 0) {
                    pp.W2(this.y[i], "%");
                }
                i2 = 0;
            }
            if (Settings.j1(pp.R0(this))) {
                i3 = 8;
            }
        } else {
            i2 = 8;
            i4 = 0;
            i3 = 8;
        }
        B0(this.w[i], i5, z3);
        B0(this.z[i], i2, z3);
        B0(this.v[i], i3, z3);
        B0(this.G[i], i4, z3);
    }

    private void B0(View view, int i, boolean z) {
        if (view.getVisibility() != i) {
            if (!z) {
                view.setVisibility(i);
                return;
            }
            if (i == 0) {
                view.setVisibility(i);
            }
            qg.i(this, view, i == 0 ? 2130772001 : 2130772003, 0L, 300L, new d(i, view));
        }
    }

    public void C0(EditText editText) {
        if (editText.getVisibility() == 0) {
            editText.requestFocus();
        }
    }

    public void D0(int i) {
        ArrayList<String> a0 = wp.a0(this, this.I);
        if (a0.size() == 0) {
            pp.j0(this, 2131887865, new Object[0]);
            return;
        }
        fj D = fj.D(this, new e(this.y[i]), 2131887571);
        D.G(a0);
        D.C(this);
    }

    private boolean E0(String str, String str2) {
        if (!wp.K(str2)) {
            return pp.b0(this, str + ": " + oh.g(this, 2131887788, new Object[0]), new Object[0]);
        }
        if (!wp.L1(str2)) {
            return pp.a0(this, 2131887773, str);
        }
        if (!wp.S0(str2)) {
            return true;
        }
        return pp.b0(this, str + ": " + oh.g(this, 2131890322, new Object[0]), new Object[0]);
    }

    private boolean F0() {
        return li.d(getPackageManager());
    }

    private void n0(int i) {
        for (int i2 = 0; i2 < 2; i2++) {
            this.w[i].clearFocus();
        }
    }

    public static Intent o0(wo woVar) {
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(mh.B(), TimeSelect.class.getName()));
        if (woVar != null) {
            intent.putExtra("sTsc", woVar.X(0).c0());
        }
        return intent;
    }

    private void q0(int i, ToggleButton toggleButton, boolean z, int i2, int i3) {
        if (z) {
            this.w[i].setCurrentHour(Integer.valueOf(i2));
            this.w[i].setCurrentMinute(Integer.valueOf(i3));
        }
    }

    public void r0(View view) {
        this.K.p0(com.joaomgcd.taskerm.dialog.a.m4(this, 2131887673, 2131887353));
    }

    private void s0() {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        v0(bundle);
        intent.putExtras(bundle);
        setResult(-1, intent);
    }

    private void t0() {
        setContentView(2131494253);
        for (int i = 0; i < 2; i++) {
            TimePicker timePicker = (TimePicker) findViewById(L[i]);
            this.w[i] = timePicker;
            timePicker.setIs24HourView(Boolean.valueOf(DateFormat.is24HourFormat(this)));
            this.y[i] = (EditText) findViewById(M[i]);
            this.v[i] = (ImageButton) findViewById(Q[i]);
            this.A[i] = findViewById(O[i]);
            this.z[i] = (ViewGroup) findViewById(P[i]);
            this.G[i] = (TextView) findViewById(N[i]);
            this.A[i].setOnClickListener(new c(i));
            if (fp.e0()) {
                gp.v(timePicker);
            }
            pp.T2(this.v[i], 2131891300, true);
        }
        this.F = (EditText) findViewById(2131297311);
        Spinner spinner = (Spinner) findViewById(2131297310);
        this.E = spinner;
        spinner.setAdapter((SpinnerAdapter) pp.f1(this, 2130903175));
        ToggleButton toggleButton = (ToggleButton) findViewById(2131296607);
        this.B = toggleButton;
        toggleButton.setOnCheckedChangeListener(this);
        ToggleButton toggleButton2 = (ToggleButton) findViewById(2131296609);
        this.C = toggleButton2;
        toggleButton2.setOnCheckedChangeListener(this);
        pp.M2(this, 2131296920, 2131891218);
        pp.M2(this, 2131297644, 2131891218);
        ToggleButton toggleButton3 = (ToggleButton) findViewById(2131296611);
        this.D = toggleButton3;
        toggleButton3.setOnCheckedChangeListener(this);
        this.x = new ImageView(this);
    }

    private void v0(Bundle bundle) {
        p0(this.H);
        bundle.putBundle("sTsc", this.H.X(0).c0());
    }

    private void x0() {
        int i = !this.B.isChecked() ? 2131890845 : 2131890844;
        this.B.setText(oh.g(this, 2131890841, new Object[0]));
        this.B.setTextOn(oh.g(this, 2131890841, new Object[0]));
        this.B.setTextOff(oh.g(this, 2131890841, new Object[0]));
        this.D.setText(oh.g(this, i, new Object[0]));
        this.D.setTextOn(oh.g(this, i, new Object[0]));
        this.D.setTextOff(oh.g(this, i, new Object[0]));
        this.C.setText(oh.g(this, 2131890843, new Object[0]));
        this.C.setTextOn(oh.g(this, 2131890843, new Object[0]));
        this.C.setTextOff(oh.g(this, 2131890843, new Object[0]));
        this.C.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                TimeSelect.this.r0(view);
            }
        });
    }

    private void y0() {
        wo woVar = new wo();
        this.w[0].setCurrentHour(Integer.valueOf(woVar.i1()));
        this.w[0].setCurrentMinute(Integer.valueOf(woVar.j1()));
        this.w[1].setCurrentHour(Integer.valueOf(woVar.t1()));
        this.w[1].setCurrentMinute(Integer.valueOf(woVar.u1()));
        xo.a(this, 0, 2131890978, 1);
        x0();
    }

    private void z0(boolean z) {
        this.E.setVisibility(z ? 0 : 4);
        this.F.setVisibility(z ? 0 : 4);
    }

    @Override
    public void g(com.joaomgcd.taskerm.util.ac acVar, com.joaomgcd.taskerm.util.se seVar) {
    }

    public uk.n0 getCoroutineScope() {
        return super.getCoroutineScope();
    }

    @Override
    public com.joaomgcd.taskerm.helper.j getHelper() {
        return this.K;
    }

    @Override
    public void onBackPressed() {
        u0();
    }

    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
        int U;
        int U2;
        if (this.J) {
            if (compoundButton.equals(this.B)) {
                if (z) {
                    if (this.D.isChecked() && this.w[1].getVisibility() == 0) {
                        n0(1);
                        U2 = ug.U(this.w[1].getCurrentHour().intValue(), this.w[1].getCurrentMinute().intValue());
                    } else {
                        Calendar x = ug.x();
                        U2 = ug.U(x.get(11), x.get(12));
                    }
                    this.w[0].setCurrentHour(Integer.valueOf(U2 / 60));
                    this.w[0].setCurrentMinute(Integer.valueOf(U2 % 60));
                }
                A0(0, z, true, true);
            } else if (compoundButton.equals(this.D)) {
                if (z) {
                    if (this.B.isChecked() && this.w[0].getVisibility() == 0) {
                        n0(0);
                        U = ug.U(this.w[0].getCurrentHour().intValue(), this.w[0].getCurrentMinute().intValue());
                    } else {
                        Calendar x2 = ug.x();
                        U = ug.U(x2.get(11), x2.get(12));
                    }
                    this.w[1].setCurrentHour(Integer.valueOf(U / 60));
                    this.w[1].setCurrentMinute(Integer.valueOf(U % 60));
                }
                A0(1, z, true, true);
            } else {
                z0(z);
                if (z) {
                    this.F.requestFocus();
                }
            }
            x0();
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        net.dinglisch.android.taskerm.a.T(this, true).setTitle(oh.g(this, 2131886737, new Object[0]));
        t0();
        this.v[0].setOnClickListener(new a());
        this.v[1].setOnClickListener(new b());
        if (bundle == null) {
            bundle = getIntent().getExtras();
        }
        this.I = (bundle == null || !bundle.containsKey("dvn")) ? new ArrayList<>() : bundle.getStringArrayList("dvn");
        w0((bundle == null || !bundle.containsKey("sTsc")) ? null : new wo(new ii(bundle.getBundle("sTsc"))));
        x0();
        this.J = true;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.x = null;
        this.G = null;
        this.w = null;
        this.y = null;
        this.A = null;
        this.z = null;
        this.B = null;
        this.C = null;
        this.D = null;
        this.E = null;
        this.F = null;
        this.I = null;
        this.H = null;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        int itemId = menuItem.getItemId();
        if (itemId == 1) {
            finish();
        } else if (itemId != 16908332) {
            switch (itemId) {
                case 10:
                    y0();
                    break;
                case 11:
                    HTMLView.G0(this, "index.html");
                    break;
                case 12:
                    HTMLView.H0(this, "timecontext.html", -1, HTMLView.g.Inform);
                    break;
            }
        } else {
            u0();
        }
        return true;
    }

    @Override
    public boolean onPrepareOptionsMenu(Menu menu) {
        super.onPrepareOptionsMenu(menu);
        menu.clear();
        if (F0()) {
            net.dinglisch.android.taskerm.a.J(this, 8, this.x, menu);
        }
        net.dinglisch.android.taskerm.a.F(this, 10, menu);
        net.dinglisch.android.taskerm.a.d(this, 1, menu);
        pp.l(this, menu, 12, 11);
        return true;
    }

    @Override
    public void onSaveInstanceState(Bundle bundle) {
        super.onSaveInstanceState(bundle);
        v0(bundle);
        bundle.putStringArrayList("dvn", this.I);
    }

    public boolean p0(wo woVar) {
        boolean z;
        boolean z2;
        boolean z3 = true;
        if (this.B.isChecked()) {
            n0(0);
            if (this.z[0].getVisibility() == 0) {
                String m1 = pp.m1(this.y[0]);
                if (E0(this.B.getText().toString(), m1)) {
                    woVar.E1(m1);
                    z2 = true;
                } else {
                    z2 = false;
                }
                z = true;
            } else {
                woVar.D1(this.w[0].getCurrentHour().intValue(), this.w[0].getCurrentMinute().intValue());
                z2 = true;
                z = true;
            }
        } else {
            woVar.b1();
            z = false;
            z2 = true;
        }
        if (this.D.isChecked()) {
            n0(1);
            if (this.z[1].getVisibility() == 0) {
                String m12 = pp.m1(this.y[1]);
                if (E0(this.D.getText().toString(), m12)) {
                    woVar.H1(m12);
                } else {
                    z2 = false;
                }
            } else {
                woVar.G1(this.w[1].getCurrentHour().intValue(), this.w[1].getCurrentMinute().intValue());
            }
            z = true;
        } else {
            woVar.c1();
        }
        if (this.C.isChecked()) {
            int i = this.E.getSelectedItemPosition() == 0 ? 1 : 2;
            if (this.F.length() == 0) {
                z2 = pp.a0(this, 2131890837, new Object[0]);
            } else {
                int intValue = new Integer(pp.m1(this.F)).intValue();
                if (i == 1) {
                    if (intValue < 1 || intValue > 12) {
                        z2 = pp.a0(this, 2131890835, new Object[0]);
                    } else {
                        woVar.F1(i, intValue);
                    }
                } else if (intValue < 2) {
                    z2 = pp.a0(this, 2131890836, new Object[0]);
                } else {
                    woVar.F1(i, intValue);
                }
            }
        } else {
            woVar.F1(0, 1);
            z3 = z;
        }
        return !z3 ? pp.a0(this, 2131890838, new Object[0]) : z2;
    }

    public boolean u0() {
        if (!p0(this.H)) {
            return false;
        }
        s0();
        finish();
        return true;
    }

    public void w0(wo woVar) {
        if (woVar == null) {
            woVar = new wo();
        }
        this.B.setChecked(woVar.w1());
        this.D.setChecked(woVar.y1());
        if (woVar.f1()) {
            pp.W2(this.y[0], woVar.k1());
        } else {
            q0(0, this.B, woVar.w1(), woVar.i1(), woVar.j1());
        }
        if (woVar.I1()) {
            pp.W2(this.y[1], woVar.v1());
        } else {
            q0(1, this.D, woVar.y1(), woVar.t1(), woVar.u1());
        }
        if (woVar.x1()) {
            this.C.setChecked(true);
            this.F.setFilters(new InputFilter[]{new InputFilter.LengthFilter(woVar.q1() == 1 ? 2 : 3)});
            this.F.setText(Integer.toString(woVar.r1()));
            this.E.setSelection(woVar.q1() == 1 ? 0 : 1);
        } else {
            this.C.setChecked(false);
        }
        z0(woVar.x1());
        x0();
        this.H = woVar;
        if (woVar.H0()) {
            getActionBar().setSubtitle(this.H.getName());
        }
        if (F0()) {
            this.H.W0(this, this.x);
        }
        A0(0, this.H.w1(), !this.H.f1(), false);
        A0(1, this.H.y1(), !this.H.I1(), false);
    }
}