导航菜单

页面标题

页面副标题

Tasker v6.5.11 - ActivityPickLocation.java 源代码

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

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


package com.joaomgcd.taskerm.location;

import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.model.LatLng;
import com.joaomgcd.taskerm.location.ActivityPickLocation;
import com.joaomgcd.taskerm.util.e5;
import com.joaomgcd.taskerm.util.s6;
import com.joaomgcd.taskerm.util.t6;
import com.joaomgcd.taskerm.util.x2;
import com.joaomgcd.taskerm.util.z2;
import java.util.ArrayList;
import ji.r;
import kotlin.collections.l;
import lj.e0;
import lj.j;
import lj.k;
import net.dinglisch.android.taskerm.MyActivity;
import net.dinglisch.android.taskerm.dq;
import pg.w0;
import w9.c;
import yj.f0;
import yj.p;
import yj.q;
import zf.d0;
import zf.m;
import zf.n;

public final class ActivityPickLocation extends MyActivity implements pf.a {
    private Location A;
    private Integer B;
    private final j v = k.b(new c());
    private final j w = k.b(new f());
    private final j x = k.b(new b());
    private final j y = k.b(new a());
    private final j z = k.b(new g());
    private int C = 10;

    static final class a extends q implements xj.a<zf.g> {
        a() {
            super(0);
        }

        @Override
        public final zf.g invoke() {
            String stringExtra = ActivityPickLocation.this.getIntent().getStringExtra("args");
            if (stringExtra != null) {
                return (zf.g) wf.c.a().h(stringExtra, zf.g.class);
            }
            return null;
        }
    }

    static final class b extends q implements xj.a<uk.a> {
        b() {
            super(0);
        }

        @Override
        public final uk.a invoke() {
            return uk.a.c(ActivityPickLocation.this.getLayoutInflater());
        }
    }

    static final class c extends q implements xj.a<zf.k> {
        c() {
            super(0);
        }

        @Override
        public final zf.k invoke() {
            return new zf.k(ActivityPickLocation.this);
        }
    }

    static final class d extends q implements xj.a<e0> {

        static final class a extends q implements xj.a<e0> {
            final ActivityPickLocation i;
            final w9.c q;

            a(ActivityPickLocation activityPickLocation, w9.c cVar) {
                super(0);
                this.i = activityPickLocation;
                this.q = cVar;
            }

            public final void a() {
                MapType d;
                zf.g x0 = this.i.x0();
                if (x0 == null || (d = x0.d()) == null) {
                    return;
                }
                this.q.h(d.getTypeValue());
            }

            @Override
            public e0 invoke() {
                a();
                return e0.a;
            }
        }

        static final class b extends q implements xj.a<e0> {
            final w9.c i;
            final m q;
            final Location r;
            final ActivityPickLocation s;
            final Integer[] t;
            final w9.c u;

            public static final class a implements AdapterView.OnItemSelectedListener {
                final f0 i;
                final ActivityPickLocation q;
                final Integer[] r;
                final w9.c s;

                a(f0 f0Var, ActivityPickLocation activityPickLocation, Integer[] numArr, w9.c cVar) {
                    this.i = f0Var;
                    this.q = activityPickLocation;
                    this.r = numArr;
                    this.s = cVar;
                }

                @Override
                public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
                    Integer num;
                    f0 f0Var = this.i;
                    if (!f0Var.i) {
                        f0Var.i = true;
                        return;
                    }
                    Location location = this.q.A;
                    if (location == null || (num = this.q.B) == null) {
                        return;
                    }
                    int G0 = this.q.G0(num.intValue());
                    this.q.C = this.r[i].intValue();
                    m mVar = new m(location, Integer.valueOf(this.q.F0(G0)));
                    ActivityPickLocation activityPickLocation = this.q;
                    w9.c cVar = this.s;
                    p.h(cVar, "$map");
                    activityPickLocation.R0(cVar, mVar);
                    ActivityPickLocation activityPickLocation2 = this.q;
                    activityPickLocation2.S0(activityPickLocation2.I0().getProgress());
                }

                @Override
                public void onNothingSelected(AdapterView<?> adapterView) {
                }
            }

            b(w9.c cVar, m mVar, Location location, ActivityPickLocation activityPickLocation, Integer[] numArr, w9.c cVar2) {
                super(0);
                this.i = cVar;
                this.q = mVar;
                this.r = location;
                this.s = activityPickLocation;
                this.t = numArr;
                this.u = cVar2;
            }

            public static final void d(ActivityPickLocation activityPickLocation, w9.c cVar, LatLng latLng) {
                p.i(activityPickLocation, "this$0");
                p.i(latLng, "it");
                Location f = d0.f(latLng);
                Integer num = activityPickLocation.B;
                int intValue = num != null ? num.intValue() : activityPickLocation.F0(10);
                p.f(cVar);
                activityPickLocation.R0(cVar, new m(f, Integer.valueOf(intValue)));
            }

            public final void c() {
                this.i.i(true);
                this.i.e().b(true);
                m mVar = this.q;
                if (mVar != null) {
                    ActivityPickLocation activityPickLocation = this.s;
                    w9.c cVar = this.u;
                    p.f(cVar);
                    activityPickLocation.R0(cVar, mVar);
                }
                Location location = this.r;
                if (location != null) {
                    w9.c cVar2 = this.i;
                    p.f(cVar2);
                    d0.m(cVar2, new n(location, 16.0f));
                }
                w9.c cVar3 = this.i;
                final ActivityPickLocation activityPickLocation2 = this.s;
                final w9.c cVar4 = this.u;
                cVar3.k(new c.b() {
                    public final void a(LatLng latLng) {
                        ActivityPickLocation.d.b.d(ActivityPickLocation.this, cVar4, latLng);
                    }
                });
                Spinner K0 = this.s.K0();
                ActivityPickLocation activityPickLocation3 = this.s;
                Integer[] numArr = this.t;
                ArrayList arrayList = new ArrayList(numArr.length);
                for (Integer num : numArr) {
                    arrayList.add(String.valueOf(num.intValue()));
                }
                K0.setAdapter((SpinnerAdapter) dq.h1(activityPickLocation3, (String[]) arrayList.toArray(new String[0])));
                this.s.K0().setSelection(l.c0(this.t, Integer.valueOf(this.s.C)));
                this.s.K0().setOnItemSelectedListener(new a(new f0(), this.s, this.t, this.u));
            }

            @Override
            public e0 invoke() {
                c();
                return e0.a;
            }
        }

        d() {
            super(0);
        }

        public final void a() {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.location.ActivityPickLocation.d.a():void");
        }

        @Override
        public e0 invoke() {
            a();
            return e0.a;
        }
    }

    public static final class e implements SeekBar.OnSeekBarChangeListener {
        e() {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int i, boolean z) {
            if (z) {
                ActivityPickLocation.this.S0(i);
            }
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    }

    static final class f extends q implements xj.a<com.joaomgcd.taskerm.location.c> {
        f() {
            super(0);
        }

        @Override
        public final com.joaomgcd.taskerm.location.c invoke() {
            return new com.joaomgcd.taskerm.location.c(ActivityPickLocation.this);
        }
    }

    static final class g extends q implements xj.a<Boolean> {
        g() {
            super(0);
        }

        @Override
        public final Boolean invoke() {
            Boolean b;
            zf.g x0 = ActivityPickLocation.this.x0();
            return Boolean.valueOf((x0 == null || (b = x0.b()) == null) ? false : b.booleanValue());
        }
    }

    private final Button A0() {
        Button button = y0().c;
        p.h(button, "buttonOk");
        return button;
    }

    public final r<w9.c> B0() {
        return d0.c(E0());
    }

    private final zf.k C0() {
        return (zf.k) this.v.getValue();
    }

    public final com.joaomgcd.taskerm.location.c D0() {
        return (com.joaomgcd.taskerm.location.c) this.w.getValue();
    }

    private final MapView E0() {
        MapView mapView = y0().d;
        p.h(mapView, "mapview");
        return mapView;
    }

    public final int F0(int i) {
        return i * this.C;
    }

    public final int G0(int i) {
        return i / this.C;
    }

    private final LinearLayout H0() {
        LinearLayout linearLayout = y0().e;
        p.h(linearLayout, "radiusSelection");
        return linearLayout;
    }

    public final SeekBar I0() {
        SeekBar seekBar = y0().f;
        p.h(seekBar, "seekRadius");
        return seekBar;
    }

    public final Spinner K0() {
        Spinner spinner = y0().g;
        p.h(spinner, "spinnerRadius");
        return spinner;
    }

    public static final void M0(ActivityPickLocation activityPickLocation, View view) {
        p.i(activityPickLocation, "this$0");
        Location location = activityPickLocation.A;
        if (location == null) {
            z2.M0("Please pick a location", activityPickLocation);
            return;
        }
        Intent intent = new Intent();
        intent.putExtra("location", location);
        intent.putExtra("radius", activityPickLocation.B);
        e0 e0Var = e0.a;
        activityPickLocation.setResult(-1, intent);
        activityPickLocation.finish();
    }

    public static final void N0(ActivityPickLocation activityPickLocation, View view) {
        p.i(activityPickLocation, "this$0");
        activityPickLocation.setResult(0);
        activityPickLocation.finish();
    }

    private final void O0(Integer num) {
        H0().setVisibility(J0() ? 0 : 8);
        if (J0()) {
            I0().setProgress(num != null ? num.intValue() : 10);
        }
    }

    public static final void P0(ActivityPickLocation activityPickLocation, s6 s6Var) {
        p.i(activityPickLocation, "this$0");
        if (s6Var.b()) {
            activityPickLocation.L0();
        } else {
            activityPickLocation.finish();
        }
    }

    public static final void Q0(ActivityPickLocation activityPickLocation, Throwable th2) {
        p.i(activityPickLocation, "this$0");
        activityPickLocation.finish();
    }

    public final void R0(w9.c cVar, m mVar) {
        this.A = mVar.c();
        d0.l(cVar, mVar.c());
        Integer f2 = mVar.f();
        int intValue = f2 != null ? f2.intValue() : F0(10);
        this.B = Integer.valueOf(intValue);
        if (J0()) {
            d0.j(cVar, new zf.j(mVar.c(), intValue));
        }
        A0().setEnabled(true);
        O0(Integer.valueOf(G0(intValue)));
    }

    public static final void T0(ActivityPickLocation activityPickLocation, int i, Location location, w9.c cVar) {
        p.i(activityPickLocation, "this$0");
        p.i(location, "$location");
        int F0 = activityPickLocation.F0(i);
        zf.j jVar = new zf.j(location, F0);
        p.f(cVar);
        d0.j(cVar, jVar);
        activityPickLocation.B = Integer.valueOf(F0);
        d0.s(cVar, jVar.b());
    }

    private final uk.a y0() {
        return (uk.a) this.x.getValue();
    }

    private final Button z0() {
        Button button = y0().b;
        p.h(button, "buttonCancel");
        return button;
    }

    public final boolean J0() {
        return ((Boolean) this.z.getValue()).booleanValue();
    }

    public final void L0() {
        String Q4;
        zf.g x0 = x0();
        if (x0 == null || (Q4 = x0.c()) == null) {
            Q4 = x2.Q4(2131889420, this, new Object[0]);
        }
        setTitle(Q4);
        A0().setEnabled(false);
        w0.m0(new d());
        A0().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ActivityPickLocation.M0(ActivityPickLocation.this, view);
            }
        });
        z0().setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ActivityPickLocation.N0(ActivityPickLocation.this, view);
            }
        });
        I0().setOnSeekBarChangeListener(new e());
    }

    public final void S0(final int i) {
        final Location location;
        if (J0() && (location = this.A) != null) {
            C0().R(B0(), new oi.d() {
                @Override
                public final void accept(Object obj) {
                    ActivityPickLocation.T0(ActivityPickLocation.this, i, location, (w9.c) obj);
                }
            });
        }
    }

    @Override
    public void g(e5 e5Var, t6 t6Var) {
        p.i(e5Var, "permissions");
        p.i(t6Var, "result");
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(y0().b());
        E0().b(bundle);
        e5 S0 = e5.a.S0(e5.f, this, 0, 2, null);
        if (S0.B()) {
            L0();
        } else {
            C0().X(e5.y0(S0, this, null, 2, null), new oi.d() {
                @Override
                public final void accept(Object obj) {
                    ActivityPickLocation.P0(ActivityPickLocation.this, (s6) obj);
                }
            }, new oi.d() {
                @Override
                public final void accept(Object obj) {
                    ActivityPickLocation.Q0(ActivityPickLocation.this, (Throwable) obj);
                }
            });
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        E0().c();
        d0.b(E0());
    }

    @Override
    public void onLowMemory() {
        super.onLowMemory();
        E0().d();
    }

    @Override
    protected void onPause() {
        super.onPause();
        E0().e();
    }

    @Override
    protected void onResume() {
        super.onResume();
        E0().f();
    }

    @Override
    protected void onSaveInstanceState(Bundle bundle) {
        p.i(bundle, "outState");
        super.onSaveInstanceState(bundle);
        E0().g(bundle);
    }

    @Override
    protected void onStart() {
        super.onStart();
        E0().h();
    }

    @Override
    public void onStop() {
        super.onStop();
        E0().i();
    }

    public final zf.g x0() {
        return (zf.g) this.y.getValue();
    }
}