正在查看: Tasker v6.6.3 应用的 RunLog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.6.3 应用的 RunLog.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.R;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
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.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.ToggleButton;
import cyanogenmod.app.ProfileManager;
import java.io.File;
import java.util.Calendar;
import java.util.List;
import java.util.regex.Pattern;
import net.dinglisch.android.taskerm.HTMLView;
import net.dinglisch.android.taskerm.c;
import net.dinglisch.android.taskerm.fh;
import net.dinglisch.android.taskerm.fn;
import net.dinglisch.android.taskerm.io;
public class RunLog extends MyActivity {
private static final int[] C = {2131891244, 2131891281, 2131891137};
private static final int[] D = {2131297649, 2131297651, 2131297650};
private static final String[] E = {"runlogProfs", "runlogTasks", "runlogActions", "runlogMonStatus", "runlogExeStatus"};
private static final boolean[] F = {true, true, true, true, true};
private static final Object G = new Object();
public static char[] H = {'P', 'T', 'A', 'M', 'E'};
public static char I = ' ';
private static int J = -1;
private static int K = -1;
private static c.b L = null;
private EditText A;
private ToggleButton[] B = new ToggleButton[h.values().length];
private FileView v;
private SharedPreferences w;
private Switch x;
private View y;
private ImageView z;
class a extends Handler {
a() {
}
@Override
public void handleMessage(Message message) {
if (message.what == 1) {
RunLog.this.S0();
}
}
}
class b implements AdapterView.OnItemLongClickListener {
b() {
}
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) {
RunLog runLog = RunLog.this;
runLog.B0(i, runLog.v.s(i), RunLog.this.v.p(i), view);
return true;
}
}
class c implements View.OnClickListener {
final int i;
c(int i) {
this.i = i;
}
@Override
public void onClick(View view) {
h hVar = h.values()[this.i];
boolean isChecked = RunLog.this.B[this.i].isChecked();
RunLog.this.v.setWantEntry(hVar, isChecked, true);
RunLog.this.w.edit().putBoolean(RunLog.E[this.i], isChecked).commit();
}
}
class d implements TextWatcher {
d() {
}
@Override
public void afterTextChanged(Editable editable) {
RunLog.this.v.setFilter(editable.toString(), true);
}
@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 e implements fh.f {
final int a;
final String b;
e(int i, String str) {
this.a = i;
this.b = str;
}
@Override
public void a(fh fhVar) {
if (fhVar.v()) {
return;
}
int ordinal = g.values()[fhVar.A()].ordinal();
if (ordinal == 0) {
RunLog.this.A.setText(this.b);
} else {
if (ordinal != 1) {
return;
}
RunLog.this.A0(this.a, true);
}
}
}
class f implements PopupMenu.OnMenuItemClickListener {
f() {
}
@Override
public boolean onMenuItemClick(MenuItem menuItem) {
return RunLog.this.onOptionsItemSelected(menuItem);
}
}
private enum g {
FilterSimilar,
GoTo
}
public enum h {
Profile,
Task,
Action,
MonitorStatus,
ExeStatus
}
public enum i {
Start,
StartFail,
Restart,
Stop
}
public boolean A0(int i2, boolean z) {
Integer E3;
Integer num;
String t = this.v.t(i2);
o7.f("RLV", "goToItem: position " + i2 + " id " + t);
if (t == null) {
return false;
}
h u = this.v.u(i2);
Integer num2 = null;
if (t.contains(".")) {
String[] split = t.split(Pattern.quote("."));
if (split.length == 2) {
E3 = pp.E3(split[0]);
num = pp.E3(split[1]);
} else {
num = null;
E3 = null;
}
} else {
E3 = pp.E3(t);
num = null;
}
fo j2 = fo.j2(this);
String s = this.v.s(i2);
o7.f("RLV", "goToItem: id: " + E3 + " sid " + num + " descr: " + s);
int ordinal = u.ordinal();
if (ordinal != 0) {
if (ordinal != 1) {
if (ordinal != 2) {
return false;
}
if (s.indexOf(46) > 0) {
s = s.split("\\.")[0];
}
}
r9 = s != null ? j2.n(s) : -1;
if (!C0(E3) || !j2.U(E3.intValue())) {
E3 = Integer.valueOf(r9);
}
if (!C0(E3) || !j2.U(E3.intValue())) {
if (!z) {
return false;
}
pp.a0(this, 2131887920, new Object[0]);
return false;
}
if (z) {
v0(u.name(), E3, num);
}
} else {
if (s != null) {
List<Integer> F2 = j2.F(s);
if (F2.size() == 1) {
r9 = F2.get(0).intValue();
}
}
if (C0(E3) && j2.V(E3.intValue())) {
num2 = num;
} else {
E3 = Integer.valueOf(r9);
}
if (!C0(E3) || !j2.V(E3.intValue())) {
if (!z) {
return false;
}
pp.a0(this, 2131887916, new Object[0]);
return false;
}
if (z) {
v0(u.name(), E3, num2);
}
}
return true;
}
public void B0(int i2, String str, boolean z, View view) {
fh fhVar = new fh(this, view);
fhVar.n(g.FilterSimilar.ordinal(), oh.g(this, 2131888874, str), 2130969267);
if (z && A0(i2, false)) {
fhVar.k(g.GoTo.ordinal(), 2131888845, 2130969197);
}
fhVar.F(new e(i2, str)).show();
}
private boolean C0(Integer num) {
return num != null && num.intValue() >= 0;
}
private void D0() {
synchronized (G) {
try {
File z0 = z0();
if (E0(this) && z0 != null && !z0.exists()) {
pp.o2(z0.getParentFile());
pp.K(z0);
if (z0.exists()) {
o7.f("RLV", "exists");
pp.C3("\n", z0, false);
o7.f("RLV", "wrte file");
}
}
FileView fileView = this.v;
if (fileView == null) {
u0(false);
return;
}
fileView.setFile(z0);
fileView.setHandler(new a());
fileView.A(true);
} catch (Throwable th2) {
throw th2;
}
}
}
public static boolean E0(Context context) {
return pp.R0(context).getBoolean("lpa", false);
}
public void F0(com.joaomgcd.taskerm.util.pe peVar) throws Exception {
if (peVar.b()) {
xo.e(this, 1, 2131890948, 1);
D0();
} else {
this.x.setChecked(false);
pp.o0(this, "Can't enable without storage permissions", new Object[0]);
}
}
public void G0(Throwable th2) throws Exception {
xg.e2.R1(this, th2);
}
public void H0(CompoundButton compoundButton, boolean z) {
this.w.edit().putBoolean("lpa", z).commit();
if (z) {
com.joaomgcd.taskerm.util.ac.e0(this).X(this).B(vi.a.b()).I(new yi.d() {
@Override
public final void accept(Object obj) {
RunLog.this.F0((com.joaomgcd.taskerm.util.pe) obj);
}
}, new yi.d() {
@Override
public final void accept(Object obj) {
RunLog.this.G0((Throwable) obj);
}
});
}
}
private void J0() {
this.v = (FileView) findViewById(2131296897);
this.y = findViewById(2131297643);
ImageView imageView = (ImageView) findViewById(2131297252);
this.z = imageView;
gp.x(this, imageView, fp.L(this));
this.v.setOnItemLongClickListener(new b());
for (h hVar : h.values()) {
int ordinal = hVar.ordinal();
boolean z = this.w.getBoolean(E[ordinal], F[ordinal]);
this.v.setWantEntry(hVar, z, false);
if (hVar != h.MonitorStatus && hVar != h.ExeStatus) {
this.B[ordinal] = (ToggleButton) findViewById(D[ordinal]);
String g2 = oh.g(this, C[ordinal], new Object[0]);
this.B[ordinal].setTextOn(g2);
this.B[ordinal].setTextOff(g2);
this.B[ordinal].setChecked(z);
this.B[ordinal].setOnClickListener(new c(ordinal));
}
}
EditText editText = (EditText) findViewById(2131297652);
this.A = editText;
editText.setHint(oh.g(this, 2131888239, new Object[0]));
this.A.addTextChangedListener(new d());
Switch r1 = new Switch(this);
this.x = r1;
r1.setChecked(E0(this));
this.x.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z2) {
RunLog.this.H0(compoundButton, z2);
}
});
this.x.setPadding(0, 0, 20, 0);
try {
ColorStateList n = fp.n(this);
if (n != null) {
dr.i(this.x, n);
}
} catch (Exception e2) {
o7.H("RLV", "setTrackTintList", e2);
}
pp.M2(this, 2131297640, 2131890374);
TextView textView = (TextView) findViewById(2131297634);
if (textView != null) {
String g3 = oh.g(this, 2131890029, new Object[0]);
if (g3.length() < 8) {
int length = 8 - g3.length();
for (int i2 = 0; i2 < length; i2++) {
g3 = g3 + " ";
}
}
textView.setText(g3);
}
pp.M2(this, 2131297528, 2131889988);
pp.M2(this, 2131296988, 2131889679);
pp.M2(this, 2131297165, 2131889575);
if (fp.e0()) {
findViewById(2131296877).setBackgroundColor(0);
findViewById(2131297643).setBackgroundColor(0);
findViewById(2131296953).setVisibility(0);
findViewById(2131296952).setVisibility(0);
findViewById(2131296953).setElevation(fp.w(this, 2131166027));
gp.D(findViewById(2131296440));
}
}
public static void K0(Context context, SharedPreferences sharedPreferences, io.a aVar, io ioVar) {
s0(context, sharedPreferences, h.Profile, aVar.name(), ioVar.C0(), Integer.MIN_VALUE, Integer.MIN_VALUE, ioVar.x() ? ioVar.getName() : ioVar.v0(context, true, false, false));
}
private void L0() {
o7.f("RLV", "recordPosStatic " + this.v.getFirstVisiblePosition() + " count " + this.v.getCount());
O0(this, this.v.getFirstVisiblePosition(), this.v.getCount());
}
public static void M0(Context context, SharedPreferences sharedPreferences, i iVar) {
s0(context, sharedPreferences, h.ExeStatus, iVar.toString(), 0, 0, 0, "TaskService");
}
public static void N0(Context context, SharedPreferences sharedPreferences, i iVar) {
s0(context, sharedPreferences, h.MonitorStatus, iVar.toString(), 0, 0, 0, "Monitor");
}
private static void O0(Context context, int i2, int i3) {
o7.f("RLV", "recordPosStatic " + i2 + " count " + i3);
SharedPreferences.Editor edit = pp.S0(context).edit();
edit.putInt("runlogLast", i2);
edit.putInt("runlogLastCount", i3);
edit.commit();
o7.f("RLV", "record entry id " + i2 + " count " + i3);
}
private void P0() {
int i2 = pp.S0(this).getInt("runlogLast", -1);
o7.f("RLV", "restorePos: " + i2 + " count " + pp.S0(this).getInt("runlogLastCount", 0) + ", have " + this.v.getCount());
if (i2 != -1) {
this.v.setSelection(i2);
}
}
public static void Q0(Context context, SharedPreferences sharedPreferences, fn.e eVar, fn fnVar) {
s0(context, sharedPreferences, h.Task, eVar.name(), fnVar.P0(), fnVar.K0(), Integer.MIN_VALUE, fnVar.x() ? fnVar.getName() : "");
}
private void R0(boolean z, boolean z2) {
this.v.setForward(z, z2);
}
public void S0() {
FileView fileView;
ImageView imageView = this.z;
if (imageView == null || (fileView = this.v) == null) {
return;
}
imageView.setImageResource(fp.J(this, fileView.w() ? 2130969231 : 2130969230));
}
private void T0(View view) {
PopupMenu popupMenu = new PopupMenu(this, view);
I0(popupMenu.getMenu());
popupMenu.setOnMenuItemClickListener(new f());
popupMenu.show();
}
private static void s0(Context context, SharedPreferences sharedPreferences, h hVar, String str, int i2, int i3, int i4, String str2) {
synchronized (G) {
try {
if (sharedPreferences.getBoolean("lpa", false) && pp.q3()) {
if (pp.k1() == null) {
o7.G("RLV", "failed to write activation data, no storage card");
} else {
File l1 = pp.l1("log", true);
if (l1 != null) {
File file = new File(l1, "runlog.txt");
Calendar x = ug.x();
String G2 = ug.G(x);
String r = ug.r(x, true);
StringBuilder sb = new StringBuilder();
sb.append(G2);
sb.append(I);
sb.append(r);
sb.append(I);
sb.append(H[hVar.ordinal()]);
sb.append(I);
sb.append(String.format("%-8s", str));
sb.append(" ID");
String valueOf = String.valueOf(i2);
if (i3 != Integer.MIN_VALUE && i3 != 1) {
valueOf = valueOf + ':' + String.valueOf(i3);
}
if (i4 != Integer.MIN_VALUE) {
valueOf = valueOf + "." + String.valueOf(i4);
}
String g2 = TextUtils.isEmpty(str2) ? i2 < 0 ? oh.g(context, 2131887011, new Object[0]) : hVar.equals(h.Task) ? oh.g(context, 2131891146, new Object[0]) : "?" : str2.replace('\n', ' ');
sb.append(String.format("%-6s", valueOf));
sb.append(I);
sb.append(g2);
sb.append("\n");
String sb2 = sb.toString();
o7.C(file, sb2.length() + sharedPreferences.getLong("aSize", 1262144L));
pp.C3(sb2, file, true);
}
}
}
} catch (Throwable th2) {
throw th2;
}
}
}
public static void t0(Context context) {
o7.f("RLV", "clearPos");
O0(context, -1, 0);
}
private void u0(boolean z) {
if (z) {
L0();
} else {
t0(this);
}
finish();
}
private void v0(String str, Integer num, Integer num2) {
Intent intent = new Intent();
intent.putExtra(ProfileManager.EXTRA_PROFILE_NAME, str);
intent.putExtra("ID", num);
if (num2 != null) {
intent.putExtra("subID", num2);
}
setResult(-1, intent);
u0(true);
}
public static void w0(Context context, SharedPreferences sharedPreferences, fn fnVar, int i2, net.dinglisch.android.taskerm.c cVar, String str, c.b bVar) {
int j = cVar.j();
int K0 = fnVar.K0();
if ((j != 30 && j != 35) || K != K0 || J != i2 || bVar != L) {
String replace = cVar.getName().replace("Variable", "Var");
String N = cVar.S0() ? wp.N(context, cVar.v0(), fnVar.l()) : null;
if (N == null && str != null) {
N = replace + ", " + str;
}
if (N == null) {
for (int i3 = 0; i3 < cVar.e0(); i3++) {
if (cVar.t0(i3) == 1 && "uvar".equals(z0.D0(cVar.j(), i3))) {
String w = cVar.N(i3).w();
if (!TextUtils.isEmpty(w)) {
if (N == null) {
N = replace;
}
String N2 = wp.N(context, w, fnVar.l());
if (N2 == null) {
N2 = "";
} else if (N2.length() > 20) {
N2 = N2.substring(0, 18) + "..";
}
N = N + ", " + w + "=" + N2;
}
}
}
}
if (N != null) {
replace = N.replace("\n", " ");
}
s0(context, sharedPreferences, h.Action, bVar.name(), fnVar.P0(), K0, i2 + 1, (fnVar.x() ? fnVar.getName() : oh.g(context, 2131891146, new Object[0])) + "." + replace);
}
K = K0;
J = i2;
L = bVar;
}
public static int x0(Context context, h hVar) {
int ordinal = hVar.ordinal();
return fp.C(context, ordinal != 0 ? ordinal != 1 ? (ordinal == 3 || ordinal == 4) ? R.attr.colorForeground : 2130968872 : 2130968882 : 2130968879, "RLV/gebc");
}
public static Intent y0(Context context) {
Intent intent = new Intent();
intent.setComponent(new ComponentName(context, (Class<?>) RunLog.class));
return intent;
}
public static File z0() {
File k1 = pp.k1();
if (k1 != null) {
return new File(new File(k1, "log"), "runlog.txt");
}
return null;
}
public void I0(Menu menu) {
menu.add(0, 3, 0, oh.g(this, 2131888873, new Object[0]));
menu.add(0, 2, 0, oh.g(this, 2131889084, new Object[0]));
menu.add(0, 1, 0, oh.g(this, 2131888801, new Object[0]));
pp.l(this, menu, 7, 6);
}
@Override
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
if (keyEvent.getKeyCode() != 82) {
return super.dispatchKeyEvent(keyEvent);
}
if (keyEvent.getAction() == 1) {
T0(this.B[1]);
}
return true;
}
@Override
public void onBackPressed() {
u0(false);
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setResult(0);
this.w = pp.R0(this);
setContentView(2131494210);
net.dinglisch.android.taskerm.a.T(this, true);
setTitle(oh.g(this, 2131889099, new Object[0]));
J0();
R0(this.w.getBoolean("runlogDir", false), false);
D0();
S0();
P0();
}
@Override
public void onDestroy() {
super.onDestroy();
FileView fileView = this.v;
if (fileView != null) {
fileView.setHandler(null);
}
synchronized (G) {
this.v.A(false);
}
FileView fileView2 = this.v;
if (fileView2 != null) {
fileView2.y();
this.v = null;
}
this.w = null;
this.x = null;
this.y = null;
this.z = null;
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 1) {
synchronized (G) {
try {
File z0 = z0();
if (z0 != null && z0.exists() && z0.length() > 0) {
z0.delete();
D0();
}
} catch (Throwable th2) {
throw th2;
}
}
} else if (itemId != 2) {
if (itemId == 3) {
com.joaomgcd.taskerm.util.ph.a1(z0(), this);
} else if (itemId == 5) {
T0(this.x);
} else if (itemId == 6) {
HTMLView.G0(this, "index.html");
} else if (itemId == 7) {
HTMLView.H0(this, "activity_runlog.html", -1, HTMLView.g.Inform);
} else if (itemId == 16908332) {
u0(false);
}
} else if (this.y.getVisibility() == 0) {
this.y.setVisibility(8);
} else {
this.y.setVisibility(0);
}
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.clear();
net.dinglisch.android.taskerm.a.q(this, 0, this.x, menu);
I0(menu);
return true;
}
}