正在查看: Tasker v6.6.3 应用的 LocSelect.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.6.3 应用的 LocSelect.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.ToggleButton;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.joaomgcd.taskerm.spawn.RFactory;
import cyanogenmod.alarmclock.ClockContract;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.dinglisch.android.taskerm.HTMLView;
import u9.c;
public class LocSelect extends MyActivity implements LocationListener, xf.a, ze.e {
private static final int[] O = {3, 0};
private ToggleButton B;
private ToggleButton C;
private Spinner D;
private Resources E;
private MapView F;
private u9.c G;
private TextView H;
private EditText I;
private EditText J;
pd v;
private LocationManager w;
private Location x = null;
private boolean y = false;
private Set<String> z = new HashSet();
private int[] A = new int[2];
private boolean K = false;
private Set<n7> L = new HashSet();
private n7 M = null;
private com.joaomgcd.taskerm.helper.h<LocSelect> N = new com.joaomgcd.taskerm.helper.h<>(this);
class a implements TextWatcher {
a() {
}
@Override
public void afterTextChanged(Editable editable) {
LocSelect.this.G0(editable.toString(), pp.m1(LocSelect.this.J));
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
class b implements TextWatcher {
b() {
}
@Override
public void afterTextChanged(Editable editable) {
LocSelect locSelect = LocSelect.this;
locSelect.G0(pp.m1(locSelect.I), editable.toString());
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
class c implements AdapterView.OnItemSelectedListener {
c() {
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
LocSelect locSelect = LocSelect.this;
pd pdVar = locSelect.v;
if (pdVar != null) {
pdVar.k(locSelect.E0(i));
}
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
class e implements com.joaomgcd.taskerm.util.f<Boolean> {
e() {
}
@Override
public void a(Boolean bool) {
String str;
LocSelect locSelect = LocSelect.this;
if (bool.booleanValue()) {
LocSelect.this.x0();
LocSelect locSelect2 = LocSelect.this;
locSelect2.R0(locSelect2.M);
xo.d(locSelect, 2131890909);
LocSelect.this.F.setVisibility(0);
LocSelect.this.H.setVisibility(8);
o7.f("LocSelect", "initialized map OK");
LocSelect.this.K = true;
return;
}
o7.f("LocSelect", "map init failed");
LocSelect.this.H.setVisibility(0);
LocSelect.this.F.setVisibility(8);
int f = com.google.android.gms.common.c.f(locSelect);
String valueOf = String.valueOf(f);
if (f == 0) {
str = oh.g(locSelect, 2131886894, new Object[0]);
} else if (f == 2) {
str = oh.g(locSelect, 2131890360, new Object[0]);
} else if (f == 1) {
str = oh.g(locSelect, 2131890359, new Object[0]);
} else {
str = oh.g(locSelect, 2131891186, new Object[0]) + " " + valueOf;
}
LocSelect.this.H.setText(oh.g(locSelect, 2131887285, str));
}
}
private void A0(boolean z) {
net.dinglisch.android.taskerm.c cVar = new net.dinglisch.android.taskerm.c(332);
cVar.o1(0, z);
ExecuteService.h6(this, new net.dinglisch.android.taskerm.c[]{cVar}, true);
this.y = z;
}
private void B0() {
Intent intent = new Intent();
intent.putExtra("scntxt", this.M.X(0).c0());
setResult(-1, intent);
finish();
}
private void C0(Location location) {
int i;
pd pdVar = this.v;
if (pdVar == null) {
MyActivity.L(this, "finishGrab mapItem null");
return;
}
if (location != null) {
pp.h0(this, 2131887805, Integer.valueOf(new Float(location.getAccuracy()).intValue()), location.getProvider());
pdVar.i(location.getLatitude(), location.getLongitude());
this.I.setText(String.valueOf(location.getLatitude()));
this.J.setText(String.valueOf(location.getLongitude()));
int[] intArray = this.E.getIntArray(RFactory.layout.scene_edit_element_event_filter_link_click);
int i2 = 0;
while (i2 < intArray.length - 1 && ((i = intArray[i2]) < 200 || i < location.getAccuracy() * 2.0f)) {
i2++;
}
this.D.setSelection(i2);
pdVar.k(i2);
}
}
public float E0(int i) {
if (i == -1) {
i = this.D.getSelectedItemPosition();
}
if (i != -1) {
return this.E.getIntArray(RFactory.layout.scene_edit_element_event_filter_link_click)[i];
}
o7.G("LocSelect", "getRadius: selected radius index -1");
return -1.0f;
}
@SuppressLint({"MissingPermission"})
private void F0() {
this.N.B2(com.joaomgcd.taskerm.util.ac.M0(this), new Runnable() {
@Override
public final void run() {
LocSelect.this.L0();
}
});
}
public void G0(String str, String str2) {
LatLng W0 = W0(str, str2);
if (W0 != null) {
y0(W0, 13.0f);
}
}
private boolean H0() {
u9.c cVar = this.G;
if (cVar == null) {
return false;
}
int d2 = cVar.d();
return d2 == 4 || d2 == 1;
}
private boolean I0() {
u9.c cVar = this.G;
if (cVar == null) {
return false;
}
int d2 = cVar.d();
return d2 == 4 || d2 == 2;
}
private void J0(final com.joaomgcd.taskerm.util.f<Boolean> fVar) {
this.F.a(new u9.e() {
public final void a(u9.c cVar) {
LocSelect.this.N0(fVar, cVar);
}
});
}
public void K0() {
LocationManager locationManager = this.w;
if (locationManager != null) {
locationManager.requestLocationUpdates("gps", 0L, 0.0f, this);
}
}
public void L0() {
if (this.w == null) {
pp.a0(this, 2131887719, new Object[0]);
return;
}
invalidateOptionsMenu();
this.z.clear();
this.x = null;
int[] iArr = this.A;
iArr[0] = 0;
boolean z = true;
iArr[1] = 0;
if (this.B.isChecked()) {
if (n7.s1(this.w, "gps")) {
z = false;
} else {
A0(true);
}
Runnable runnable = new Runnable() {
@Override
public final void run() {
LocSelect.this.K0();
}
};
if (z) {
this.B.postDelayed(runnable, 800L);
} else {
runnable.run();
}
this.z.add("gps");
}
if (this.C.isChecked() && n7.s1(this.w, "network") && pp.x1(this, -1)) {
this.w.requestLocationUpdates("network", 0L, 0.0f, this);
if (!this.z.contains("gps")) {
pp.j0(this, 2131887844, new Object[0]);
}
this.z.add("network");
}
if (this.z.size() == 0) {
pp.a0(this, 2131887852, new Object[0]);
}
}
public void M0(LatLng latLng) {
Y0();
Q0(latLng);
}
public void N0(com.joaomgcd.taskerm.util.f fVar, u9.c cVar) {
boolean z = false;
if (cVar != null) {
this.G = cVar;
S0(true, false);
cVar.l(new c.c() {
public final void a(LatLng latLng) {
LocSelect.this.M0(latLng);
}
});
z = true;
}
fVar.a(Boolean.valueOf(z));
}
private void O0() {
this.F = findViewById(2131297084);
this.H = (TextView) findViewById(2131297083);
this.I = (EditText) findViewById(2131297610);
this.J = (EditText) findViewById(2131297611);
this.I.setHint(oh.g(this, 2131889729, new Object[0]));
this.J.setHint(oh.g(this, 2131889754, new Object[0]));
this.I.addTextChangedListener(new a());
this.J.addTextChangedListener(new b());
Spinner spinner = (Spinner) findViewById(2131297299);
this.D = spinner;
spinner.setAdapter((SpinnerAdapter) pp.f1(this, RFactory.layout.scene_edit_element));
this.D.setOnItemSelectedListener(new c());
this.B = (ToggleButton) findViewById(2131296506);
List<String> allProviders = this.w.getAllProviders();
if (!allProviders.contains("gps")) {
this.B.setChecked(false);
this.B.setEnabled(false);
}
this.C = (ToggleButton) findViewById(2131296537);
if (!allProviders.contains("network")) {
this.C.setChecked(false);
this.C.setEnabled(false);
}
if (fp.e0()) {
findViewById(2131297037).setBackgroundColor(0);
findViewById(2131297042).setBackgroundColor(0);
findViewById(2131296953).setVisibility(0);
findViewById(2131296952).setVisibility(0);
findViewById(2131296953).setElevation(fp.w(this, 2131166027));
gp.D(findViewById(2131296440));
}
}
private boolean P0() {
if (!D0(true)) {
return false;
}
B0();
return true;
}
public void Q0(LatLng latLng) {
pd pdVar = this.v;
if (pdVar == null) {
return;
}
pdVar.j(latLng);
this.I.setText(String.valueOf(latLng.i));
this.J.setText(String.valueOf(latLng.q));
}
public void R0(n7 n7Var) {
if (this.G == null) {
return;
}
String name = this.M.H0() ? n7Var.getName() : null;
LatLng w1 = n7.w1(n7Var.h1(), n7Var.j1());
pd pdVar = new pd(w1, n7Var.m1(), pd.i, name, 2131230924);
this.v = pdVar;
pdVar.a(this.G);
this.v.w();
this.v.r();
this.G.n(new d());
if (n7Var.h1() == 0.0d || n7Var.j1() == 0.0d) {
return;
}
y0(w1, 13.0f);
}
private void S0(boolean z, boolean z2) {
u9.c cVar = this.G;
if (cVar == null) {
return;
}
cVar.h(ik.I4(z, z2));
}
private void T0() {
float E0 = E0(-1);
if (E0 != -1.0f) {
this.M.D1(E0);
}
}
private void U0(n7 n7Var, boolean z) {
ActionBar S;
if (this.B.isEnabled()) {
this.B.setChecked(n7Var.o1());
}
if (this.C.isEnabled()) {
this.C.setChecked(n7Var.p1());
}
if (n7Var.h1() != 0.0d) {
this.I.setText(String.valueOf(n7Var.h1()));
}
if (n7Var.h1() != 0.0d) {
this.J.setText(String.valueOf(n7Var.j1()));
}
this.D.setSelection(pp.J1((int) n7Var.m1(), this.E.getIntArray(RFactory.layout.scene_edit_element_event_filter_link_click)));
if (!this.M.H0() || (S = net.dinglisch.android.taskerm.a.S(this, "LocSelect/setUIFromLoc")) == null) {
return;
}
S.setSubtitle(n7Var.getName());
}
private void V0() {
LocationManager locationManager = this.w;
if (locationManager != null) {
locationManager.removeUpdates(this);
}
Set<String> set = this.z;
if (set != null) {
set.clear();
}
if (this.y) {
A0(false);
}
invalidateOptionsMenu();
}
private LatLng W0(String str, String str2) {
boolean isEmpty = TextUtils.isEmpty(str);
Float valueOf = Float.valueOf(0.0f);
if ((isEmpty ? valueOf : pp.D3(str)) != null) {
if (!TextUtils.isEmpty(str2)) {
valueOf = pp.D3(str2);
}
if (valueOf != null) {
return new LatLng(r5.floatValue(), valueOf.floatValue());
}
}
return null;
}
private void X0(List<String> list) {
if (list != null) {
for (int i = 0; i < list.size(); i++) {
this.L.add(new n7(new ii(list.get(i))));
}
}
}
public void Y0() {
if (pp.N3(this)) {
this.F.performHapticFeedback(0, 2);
}
}
public void x0() {
if (this.G == null) {
return;
}
for (n7 n7Var : this.L) {
if (!this.M.H0() || !n7Var.H0() || !this.M.getName().equals(n7Var.getName())) {
new pd(n7.w1(n7Var.h1(), n7Var.j1()), n7Var.m1(), pd.j, n7Var.H0() ? n7Var.getName() : null, 2131230924).a(this.G);
}
}
}
private void y0(LatLng latLng, float f) {
u9.c cVar = this.G;
if (cVar == null || this.F == null || cVar == null) {
return;
}
this.G.g(f == 0.0f ? u9.b.b(latLng) : u9.b.a(new CameraPosition.a().c(latLng).e(f).b()));
}
private void z0() {
if (pp.x1(this, -1)) {
startActivityForResult(new Intent(this, (Class<?>) GeoCoder.class), 1);
} else {
pp.n0(this, 2131891099, new Object[0]);
}
}
public boolean D0(boolean z) {
this.M.z1(this.B.isChecked());
this.M.C1(this.C.isChecked());
LatLng W0 = W0(pp.m1(this.I), pp.m1(this.J));
if (W0 != null) {
this.M.A1(W0.i);
this.M.B1(W0.q);
}
T0();
if (this.M.n1()) {
return true;
}
pp.a0(this, 2131887720, new Object[0]);
return false;
}
@Override
public void g(com.joaomgcd.taskerm.util.ac acVar, com.joaomgcd.taskerm.util.se seVar) {
finish();
}
public uk.n0 getCoroutineScope() {
return super.getCoroutineScope();
}
@Override
public com.joaomgcd.taskerm.helper.j getHelper() {
return this.N;
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
if (i == 1 && i2 == -1) {
Q0(n7.w1(intent.getDoubleExtra("lat", 0.0d), intent.getDoubleExtra("lng", 0.0d)));
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
t6.e(getBaseContext());
}
@Override
public void onCreate(Bundle bundle) {
Bundle bundle2;
ArrayList<String> stringArrayList;
setResult(0);
super.onCreate(bundle);
this.E = getResources();
this.w = (LocationManager) gi.d(this, "location", "LocSelect", "onCreate");
setContentView(2131493558);
if (this.w == null) {
pp.h0(this, 2131887719, new Object[0]);
finish();
} else {
O0();
StringBuilder sb = new StringBuilder();
sb.append("mapCreate: have resources: ");
sb.append(this.E != null);
o7.f("LocSelect", sb.toString());
MyMapView.l(this.F, this, bundle);
o7.f("LocSelect", "done map create");
net.dinglisch.android.taskerm.a.T(this, true).setTitle(oh.g(this, 2131886730, new Object[0]));
if (this.B.getVisibility() == 8 && this.C.getVisibility() == 8) {
pp.h0(this, 2131887721, new Object[0]);
finish();
} else {
if (bundle == null) {
Intent intent = getIntent();
bundle2 = intent.getBundleExtra("scntxt");
stringArrayList = intent.getStringArrayListExtra("olcntxt");
} else {
bundle2 = bundle.getBundle("tloc");
stringArrayList = bundle.getStringArrayList("oloc");
}
X0(stringArrayList);
if (bundle2 == null) {
this.M = new n7();
} else {
this.M = new n7(new ii(bundle2));
}
u9.d.a(this);
U0(this.M, true);
}
}
this.N.g0();
this.N.A2(com.joaomgcd.taskerm.util.ac.N0(this, 111));
}
@Override
public void onDestroy() {
super.onDestroy();
this.F.c();
this.w = null;
this.x = null;
this.z = null;
this.B = null;
this.C = null;
this.D = null;
this.E = null;
this.F = null;
this.v = null;
this.L = null;
this.H = null;
this.I = null;
this.J = null;
this.M = null;
this.N.h0();
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
return i == 4 ? !P0() : super.onKeyDown(i, keyEvent);
}
@Override
public void onLocationChanged(Location location) {
float accuracy = location.getAccuracy();
String provider = location.getProvider();
int i = !provider.equals("gps") ? 1 : 0;
Location location2 = this.x;
if (location2 == null || accuracy < location2.getAccuracy()) {
this.x = location;
} else {
int[] iArr = this.A;
iArr[i] = iArr[i] + 1;
}
int i2 = 1 - i;
int i3 = this.A[i];
int[] iArr2 = O;
if (i3 >= iArr2[i]) {
if (provider.equals("gps") || this.z.size() == 1 || this.A[i2] >= iArr2[i2]) {
V0();
C0(this.x);
}
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
MapView mapView = this.F;
if (mapView != null) {
mapView.d();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 3) {
HTMLView.G0(this, "index.html");
} else if (itemId == 4) {
HTMLView.H0(this, "activity_locselect.html", -1, HTMLView.g.Inform);
} else if (itemId != 16908332) {
switch (itemId) {
case ClockContract.InstancesColumns.MISSED_STATE:
Intent intent = new Intent("android.settings.LOCATION_SOURCE_SETTINGS");
intent.addFlags(1073741824);
if (!pp.l3(this, intent)) {
pp.a0(this, 2131887736, new Object[0]);
break;
}
break;
case 7:
HTMLView.G0(this, "loctears.html");
break;
case 8:
finish();
break;
case 9:
if (this.B.isChecked() && !pp.x1(this, -1)) {
pp.n0(this, 2131891095, new Object[0]);
}
F0();
break;
default:
switch (itemId) {
case 11:
V0();
C0(this.x);
break;
case 12:
S0(true, I0());
invalidateOptionsMenu();
break;
case 13:
S0(false, I0());
invalidateOptionsMenu();
break;
case 14:
S0(H0(), true);
invalidateOptionsMenu();
break;
case 15:
S0(H0(), false);
invalidateOptionsMenu();
break;
case 16:
z0();
break;
default:
return false;
}
}
} else {
P0();
}
return true;
}
@Override
public void onPause() {
if (this.y) {
A0(false);
}
V0();
super.onPause();
this.F.e();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.clear();
if (this.z.size() == 0) {
net.dinglisch.android.taskerm.a.u(this, 9, menu);
} else {
net.dinglisch.android.taskerm.a.Q(this, 11, menu);
}
menu.add(0, 16, 0, oh.g(this, 2131889449, new Object[0]));
if (this.G != null && this.F != null) {
if (H0()) {
menu.add(0, 13, 0, oh.g(this, 2131888894, new Object[0]));
} else {
menu.add(0, 12, 0, oh.g(this, 2131889024, new Object[0]));
}
if (I0()) {
menu.add(0, 15, 0, oh.g(this, 2131888895, new Object[0]));
} else {
menu.add(0, 14, 0, oh.g(this, 2131889025, new Object[0]));
}
}
net.dinglisch.android.taskerm.a.d(this, 8, menu);
menu.add(0, 6, 0, oh.g(this, 2131888918, new Object[0]));
menu.add(0, 7, 0, oh.g(this, 2131888922, new Object[0]));
pp.l(this, menu, 4, 3);
return true;
}
@Override
public void onProviderDisabled(String str) {
}
@Override
public void onProviderEnabled(String str) {
}
@Override
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
super.onRequestPermissionsResult(i, strArr, iArr);
this.N.x1(i, strArr, iArr);
}
@Override
public void onResume() {
super.onResume();
this.F.f();
o7.f("LocSelect", "onResume: map initialized: " + this.K);
if (this.K) {
return;
}
J0(new e());
}
@Override
protected void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
if (D0(false)) {
bundle.putBundle("tloc", this.M.X(0).c0());
}
this.F.g(bundle);
}
@Override
public void onStatusChanged(String str, int i, Bundle bundle) {
}
class d implements c.e {
d() {
}
public void a(w9.e eVar) {
LocSelect.this.Y0();
LocSelect.this.v.h();
}
public void b(w9.e eVar) {
LocSelect.this.Q0(eVar.a());
LocSelect.this.v.v();
}
public void c(w9.e eVar) {
}
}
}