正在查看: Tasker v6.5.11 应用的 TaskerAppWidgetConfigure.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 TaskerAppWidgetConfigure.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.app.Activity;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import cyanogenmod.alarmclock.ClockContract;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import net.dinglisch.android.taskerm.HTMLView;
import net.dinglisch.android.taskerm.MacroEditView;
import net.dinglisch.android.taskerm.co;
import net.dinglisch.android.taskerm.to;
public class TaskerAppWidgetConfigure extends Activity implements View.OnClickListener {
public static long w = -1;
private Button i;
private int q;
private MacroEditView s;
private SharedPreferences v;
private co r = new co();
private int t = 0;
protected boolean u = false;
class a implements MacroEditView.k {
a() {
}
@Override
public void a() {
}
@Override
public void b() {
TaskerAppWidgetConfigure.this.p();
}
@Override
public void onCancel() {
TaskerAppWidgetConfigure.this.p();
}
}
class b extends Handler {
b() {
}
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
TaskerAppWidgetConfigure.this.r = new co(new qi(message.getData().getBundle("timer")));
TaskerAppWidgetConfigure.this.i.setText(TaskerAppWidgetConfigure.this.r.G());
}
}
}
class c extends Handler {
c() {
}
@Override
public void handleMessage(Message message) {
if (message.what != 0) {
TaskerAppWidgetConfigure.this.p();
}
}
}
static class d {
static final int[] a;
static {
int[] iArr = new int[co.b.values().length];
a = iArr;
try {
iArr[co.b.Update.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[co.b.End.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[co.b.Pause.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[co.b.Resume.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[co.b.Reset.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[co.b.SetTime.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
}
}
public static synchronized boolean e(Context context, String str, String str2, g gVar) {
boolean z;
synchronized (TaskerAppWidgetConfigure.class) {
try {
AppWidgetManager k = k(context);
z = false;
if (k != null) {
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
int intValue = new Integer(it.next()).intValue();
tn j = j(context, intValue);
if (j.u() && j.getName().equals(str)) {
if (str2 != null) {
j.y2(str2);
x(context, intValue, j);
}
if (gVar != null) {
j.u2(gVar);
x(context, intValue, j);
}
TaskerAppWidgetProvider.j(context, k, intValue, j);
}
}
z = true;
}
} finally {
}
}
return z;
}
private void f() {
this.i = null;
this.r = null;
MacroEditView macroEditView = this.s;
if (macroEditView != null) {
macroEditView.M0();
this.s = null;
}
this.v = null;
}
private boolean g() {
tn tnVar;
Bitmap bitmap;
int i;
if (this.s.n1(false)) {
tn selected = this.s.getSelected();
g icon = selected.getIcon();
if (this.s.getSelectedNoActions() == 0) {
dq.a0(this, 2131888038, new Object[0]);
return false;
}
if (icon.g0()) {
dq.a0(this, 2131887703, new Object[0]);
this.s.k0();
return false;
}
boolean u = selected.u();
if (this.s.t0()) {
u = false;
} else {
this.s.f0(0);
}
w = -1L;
Intent intent = new Intent();
if (u) {
net.dinglisch.android.taskerm.c cVar = new net.dinglisch.android.taskerm.c(130);
cVar.k0(0, selected.getName());
cVar.m1(5, true);
cVar.s1(1, selected.m1());
tnVar = to.X1();
tnVar.a0(cVar);
tnVar.u2(selected.getIcon());
tnVar.G2(2);
tnVar.G(selected.getName());
tnVar.D2(selected.m1());
} else {
tnVar = selected;
}
if (this.q == 1) {
intent.putExtra("appWidgetId", this.t);
if (this.u) {
if (this.r.m() > 0) {
this.r.C();
}
tnVar.N2(this.r);
co.w(this, tnVar, co.a.Started);
}
x(this, this.t, tnVar);
AppWidgetManager k = k(this);
if (k != null) {
TaskerAppWidgetProvider.j(this, k, this.t, tnVar);
}
} else {
intent.putExtra("android.intent.extra.shortcut.INTENT", new fh.a(this).g(selected, tnVar));
intent.putExtra("android.intent.extra.shortcut.NAME", selected.u() ? selected.getName() : selected.A0(0).getName());
if (icon.f0() && icon.T() == 0 && !icon.Y()) {
i = icon.I(this);
} else {
int Y = tp.Y(48);
try {
bitmap = icon.z(this, Y, Y, "TaskerAppWidgetConfigure", true);
} catch (Exception e) {
r7.H("TaskerAppWidgetConfigure", "create shortcut", e);
bitmap = null;
}
if (bitmap == null) {
i = 2131230944;
} else {
intent.putExtra("android.intent.extra.shortcut.ICON", bitmap);
i = -1;
}
}
if (i != -1) {
intent.putExtra("android.intent.extra.shortcut.ICON_RESOURCE", Intent.ShortcutIconResource.fromContext(this, i));
}
}
setResult(-1, intent);
MonitorService.D8(this);
p();
}
return true;
}
public static synchronized boolean h(Context context, co.b bVar, String str, int[] iArr) {
boolean z;
co.a aVar;
boolean z2;
synchronized (TaskerAppWidgetConfigure.class) {
try {
AppWidgetManager k = k(context);
z = false;
if (k != null) {
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
boolean z3 = false;
while (it.hasNext()) {
int intValue = new Integer(it.next()).intValue();
tn j = j(context, intValue);
if (str != null) {
if (j.u() && j.getName().equals(str)) {
}
}
co y1 = j.y1();
if (y1 != null) {
switch (d.a[bVar.ordinal()]) {
case 1:
z2 = true;
aVar = null;
break;
case 2:
boolean r = y1.r();
y1.x();
if (r) {
TaskerAppWidgetProvider.f(context, j, intValue);
}
aVar = co.a.Stopped;
z2 = true;
break;
case 3:
if (y1.r()) {
y1.E();
aVar = co.a.Paused;
z2 = true;
break;
}
z2 = false;
aVar = null;
break;
case 4:
if (!y1.r() && y1.m() > 0) {
aVar = y1.q() ? co.a.Restarted : co.a.Started;
y1.C();
z2 = true;
break;
}
z2 = false;
aVar = null;
break;
case 5:
y1.v();
aVar = co.a.Reset;
z2 = true;
break;
case ClockContract.InstancesColumns.MISSED_STATE:
y1.y(iArr[0], iArr[1], iArr[2], iArr[3]);
y1.z(iArr[0], iArr[1], iArr[2], iArr[3]);
z2 = true;
aVar = null;
break;
default:
z2 = false;
aVar = null;
break;
}
if (z2) {
x(context, intValue, j);
TaskerAppWidgetProvider.j(context, k, intValue, j);
}
if (aVar != null) {
co.w(context, j, aVar);
}
}
z3 = true;
}
z = z3;
}
} catch (Throwable th2) {
throw th2;
}
}
return z;
}
public static int i(Context context) {
return dq.R0(context).getInt("wtp", 7);
}
public static synchronized tn j(Context context, int i) {
tn tnVar;
synchronized (TaskerAppWidgetConfigure.class) {
String string = context.getSharedPreferences(g6.o, 0).getString(Integer.toString(i), null);
tnVar = string != null ? new tn(new qi(string)) : null;
}
return tnVar;
}
public static AppWidgetManager k(Context context) {
try {
return AppWidgetManager.getInstance(context);
} catch (Exception e) {
r7.l("TaskerAppWidgetConfigure", "getManagerSafe", e);
return null;
}
}
public static synchronized Set<String> l(Context context) {
HashSet hashSet;
synchronized (TaskerAppWidgetConfigure.class) {
try {
hashSet = new HashSet();
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
Integer num = new Integer(it.next());
tn j = j(context, num.intValue());
if (j == null) {
r7.G("TaskerAppWidgetConfigure", "scanForVars: ignoring null mac, ID " + num);
} else {
for (net.dinglisch.android.taskerm.c cVar : j.D0()) {
if (cVar.j() == 130) {
hashSet.add(cVar.N(0).w());
}
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
return hashSet;
}
public static synchronized int m(Context context, String str) {
int i;
co y1;
synchronized (TaskerAppWidgetConfigure.class) {
if (k(context) != null) {
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
tn j = j(context, new Integer(it.next()).intValue());
if (j.u() && j.getName().equals(str) && (y1 = j.y1()) != null) {
i = y1.m();
break;
}
}
}
i = -1;
}
return i;
}
public static synchronized List<String> n(Context context, boolean z) {
ArrayList arrayList;
synchronized (TaskerAppWidgetConfigure.class) {
try {
arrayList = new ArrayList();
AppWidgetManager k = k(context);
if (k != null) {
ArrayList arrayList2 = new ArrayList();
for (String str : context.getSharedPreferences(g6.o, 0).getAll().keySet()) {
Integer num = new Integer(str);
int intValue = num.intValue();
if (k.getAppWidgetInfo(intValue) == null) {
r7.f("TaskerAppWidgetConfigure", "getWidgetNameList: remove task for unknown widget ID " + str);
arrayList2.add(num);
} else {
tn j = j(context, intValue);
if (j.u() && (!z || j.D1())) {
arrayList.add(j.getName());
}
}
}
Iterator it = arrayList2.iterator();
while (it.hasNext()) {
r(context, ((Integer) it.next()).intValue());
}
}
} catch (Throwable th2) {
throw th2;
}
}
return arrayList;
}
public static synchronized boolean o(Context context, int i) {
synchronized (TaskerAppWidgetConfigure.class) {
try {
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
Integer num = new Integer(it.next());
tn j = j(context, num.intValue());
if (j == null) {
r7.G("TaskerAppWidgetConfigure", "haveActionCode: ignoring null mac, ID " + num);
} else {
Iterator<net.dinglisch.android.taskerm.c> it2 = j.D0().iterator();
while (it2.hasNext()) {
if (it2.next().j() == i) {
return true;
}
}
}
}
return false;
} catch (Throwable th2) {
throw th2;
}
}
}
public void p() {
to J2 = to.J2(to.g.Passive, this, false);
if (J2 != null) {
J2.B4(this, this.v, getResources(), w, false, true);
}
sp.o0("TaskerAppWidgetConfigure lockAndFinish");
finish();
}
public static synchronized void q(Context context) {
synchronized (TaskerAppWidgetConfigure.class) {
AppWidgetManager k = k(context);
if (k != null) {
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
int intValue = new Integer(it.next()).intValue();
tn j = j(context, intValue);
if (j.getIcon().c0()) {
TaskerAppWidgetProvider.j(context, k, intValue, j);
}
}
}
}
}
public static synchronized void r(Context context, int i) {
synchronized (TaskerAppWidgetConfigure.class) {
String num = Integer.toString(i);
SharedPreferences sharedPreferences = context.getSharedPreferences(g6.o, 0);
if (sharedPreferences.contains(num)) {
sharedPreferences.edit().remove(num).commit();
}
}
}
public static synchronized void s(Context context, Set<Integer> set) {
synchronized (TaskerAppWidgetConfigure.class) {
if (k(context) != null) {
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
tn j = j(context, new Integer(it.next()).intValue());
if (j != null) {
to.H4(j, set);
}
}
}
}
}
public static synchronized Set<String> t(Context context, boolean z) {
HashSet hashSet;
synchronized (TaskerAppWidgetConfigure.class) {
try {
hashSet = new HashSet();
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
Integer num = new Integer(it.next());
tn j = j(context, num.intValue());
if (j == null) {
r7.G("TaskerAppWidgetConfigure", "scanForVars: ignoring null mac, ID " + num);
} else {
for (net.dinglisch.android.taskerm.c cVar : j.D0()) {
if (z) {
kq.u(cVar, false);
} else {
kq.n(cVar, hashSet, false, false);
}
if (cVar.j() == 130) {
hashSet.add(cVar.N(0).w());
}
if (cVar.H()) {
Iterator<r1> it2 = cVar.Q().iterator();
while (it2.hasNext()) {
r1 next = it2.next();
String f = next.f();
if (z) {
kq.s(f, false);
} else {
kq.k(f, hashSet, false, false);
}
if (Expr.e(next.g())) {
String j2 = next.j();
if (z) {
kq.s(j2, false);
} else {
kq.k(j2, hashSet, false, false);
}
}
}
}
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
return hashSet;
}
private void u() {
Button button = (Button) findViewById(2131296518);
this.i = button;
if (button == null) {
r7.k("TaskerAppWidgetConfigure", "onCreate: no countdown button");
return;
}
button.setOnClickListener(this);
this.i.setText(this.r.G());
this.i.setVisibility(0);
}
private void v() {
t1.j(this, new b(), null, this.r, true).i(this);
}
private void w() {
sp.t0(this, new c()).E(this);
}
public static synchronized void x(Context context, int i, tn tnVar) {
synchronized (TaskerAppWidgetConfigure.class) {
try {
String num = Integer.toString(i);
String e0 = tnVar.U(0).e0(0);
if (e0 == null) {
dq.a0(context, 2131891083, new Object[0]);
} else {
context.getSharedPreferences(g6.o, 0).edit().putString(num, e0).commit();
}
} catch (Throwable th2) {
throw th2;
}
}
}
public static synchronized void y(Context context, String str, String str2) {
String str3;
String str4;
synchronized (TaskerAppWidgetConfigure.class) {
try {
AppWidgetManager k = k(context);
if (k == null) {
return;
}
PackageManager packageManager = context.getPackageManager();
Iterator<String> it = context.getSharedPreferences(g6.o, 0).getAll().keySet().iterator();
while (it.hasNext()) {
int intValue = new Integer(it.next()).intValue();
tn j = j(context, intValue);
g icon = j.getIcon();
File t0 = ImageSelect.t0();
File file = null;
File file2 = t0 == null ? null : new File(t0, str2);
if (icon.c0()) {
File file3 = new File(j.getIcon().H());
str4 = file3.getParentFile().getName();
str3 = file3.getName();
} else if (icon.e0()) {
str4 = w5.i(icon.O());
str3 = icon.getName();
} else {
str3 = null;
str4 = null;
}
if (str4 != null) {
if (file2 != null) {
file = new File(file2, str3);
}
if (!str4.equals("Samples") && (str.length() == 0 || str4.equals(str))) {
if (!str4.equals(str2)) {
if (dq.v3(str2, w5.f()) != -1 && w5.l(packageManager, w5.h(packageManager, str2), str3) != -1) {
icon.u0(w5.h(packageManager, str2), str3);
} else if (file != null && file.exists() && file.isFile()) {
r7.f("TaskerAppWidgetConfigure", "to " + str2 + " is file, new path " + file);
icon.q0(file.toString());
} else {
r7.G("TaskerAppWidgetConfigure", "icon " + str3 + " not found in new set " + str2);
}
x(context, intValue, j);
TaskerAppWidgetProvider.j(context, k, intValue, j);
}
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
@Override
protected void onActivityResult(int i, int i2, Intent intent) {
this.s.L0(i, i2, intent);
}
@Override
public void onBackPressed() {
g();
}
@Override
public void onClick(View view) {
if (this.i.equals(view)) {
v();
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setResult(0);
StringBuilder sb = new StringBuilder();
sb.append("oncreate: icicle ");
sb.append(bundle != null);
r7.f("TaskerAppWidgetConfigure", sb.toString());
s5.v(this, "TaskerAppWidgetConfigure.onCreate");
w5.j(this, false);
sp.o0("TaskerAppWidgetConfigure onCreate");
MyActivity.a0(this);
try {
w6.e(getBaseContext());
if (bundle == null && to.S2()) {
dq.c0(this, 2131887833, new Object[0]);
finish();
return;
}
if (!dq.h(this)) {
dq.a0(this, 2131887757, new Object[0]);
p();
return;
}
tp.b0(this);
MacroEditView macroEditView = new MacroEditView(this);
this.s = macroEditView;
macroEditView.setId(2131297324);
setContentView(this.s);
net.dinglisch.android.taskerm.a.T(this, true);
up.t(this);
up.u(this);
this.v = dq.R0(this);
Intent intent = getIntent();
tn tnVar = null;
this.q = !"android.intent.action.CREATE_SHORTCUT".equals(intent == null ? null : intent.getAction()) ? 1 : 0;
if (bundle != null) {
this.t = bundle.getInt("sdataw", 0);
if (bundle.containsKey("ssat")) {
Bundle bundle2 = bundle.getBundle("ssat");
if (bundle2 == null) {
r7.G("TaskerAppWidgetConfigure", "restore bundle null");
} else {
tnVar = new tn(new qi(bundle2));
}
}
} else if (intent == null) {
r7.k("TaskerAppWidgetConfigure", "null icicle, no intent");
} else {
Bundle extras = intent.getExtras();
if (extras != null) {
this.t = extras.getInt("appWidgetId", 0);
}
}
if (this.q == 1 && this.t == 0) {
dq.a0(this, 2131891102, new Object[0]);
p();
}
if (this.u) {
this.s.setDefaultIconResource(tp.J(this, 2130969295));
}
MacroEditView macroEditView2 = this.s;
a aVar = new a();
int i = this.q;
macroEditView2.s0(this, aVar, i == 1 ? 2131886735 : 2131886731, (i == 1 ? 2 : 0) | 44, true);
this.s.setTaskIconImageSelectFlags(479);
this.s.setTask(tnVar, -1);
if (this.u) {
u();
}
Intent intent2 = new Intent();
if (this.q == 1) {
intent2.putExtra("appWidgetId", this.t);
}
setResult(0, intent2);
if (sp.q0(this) || sp.s0(this)) {
w();
}
} catch (NullPointerException unused) {
dq.a0(this, 2131889311, new Object[0]);
p();
} catch (OutOfMemoryError unused2) {
dq.a0(this, 2131889311, new Object[0]);
p();
}
}
@Override
public void onDestroy() {
r7.f("TaskerAppWidgetConfigure", "onDestroy");
super.onDestroy();
f();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 1) {
p();
} else if (menuItem.getItemId() == 2) {
HTMLView.H0(this, "activity_widget_configure.html", -1, HTMLView.g.Inform);
} else {
if (menuItem.getItemId() != 16908332) {
return this.s.N0(menuItem, "activity_widget_configure.html");
}
g();
}
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.clear();
this.s.P0(menu);
net.dinglisch.android.taskerm.a.v(this, 2, menu);
net.dinglisch.android.taskerm.a.d(this, 1, menu);
return true;
}
@Override
protected void onResume() {
super.onResume();
if (w == -1) {
w = System.currentTimeMillis();
}
}
@Override
protected void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
r7.f("TaskerAppWidgetConfigure", "OSIS");
bundle.putInt("sdataw", this.t);
if (this.s.getSelected() == null) {
r7.f("TaskerAppWidgetConfigure", "store null");
bundle.putBundle("ssat", null);
} else {
r7.f("TaskerAppWidgetConfigure", "store non-null");
bundle.putBundle("ssat", this.s.getSelected().U(0).c0());
}
}
}