ComeetChat v1.866866806590版本的 MD5 值为:4a7461802cd62adce19de75377dd7ca7
以下内容为反编译后的 Main.java 源代码,内容仅作参考
package net.dinglisch.android.taskerm;
import android.app.ActionBar;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.app.backup.RestoreObserver;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.text.Editable;
import android.text.Html;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.style.ForegroundColorSpan;
import android.view.ActionMode;
import android.view.DragEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.ToggleButton;
import androidx.annotation.Keep;
import androidx.core.app.NotificationCompat;
import androidx.legacy.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.gms.maps.g;
import com.joaomgcd.taskerm.backup.GenericActionBackupToGoogleDrive;
import com.joaomgcd.taskerm.backup.GenericActionBackupToGoogleDriveWhenConnectedAndCharging;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityConfigureNotificationChannel;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityDisableBatteryOptimizations;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestCallScreeningAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestManageExternalStorageAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestMissingPermissions;
import com.joaomgcd.taskerm.genericaction.GenericActionSendEmailToSupport;
import com.joaomgcd.taskerm.helper.q;
import com.joaomgcd.taskerm.rx.EventBusRxSubscription;
import cyanogenmod.alarmclock.ClockContract;
import cyanogenmod.app.ProfileManager;
import java.io.File;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import net.danlew.android.joda.R;
import net.dinglisch.android.taskerm.ActionEdit;
import net.dinglisch.android.taskerm.FileSelect;
import net.dinglisch.android.taskerm.HTMLView;
import net.dinglisch.android.taskerm.Main;
import net.dinglisch.android.taskerm.MonitorService;
import net.dinglisch.android.taskerm.RunLog;
import net.dinglisch.android.taskerm.ai;
import net.dinglisch.android.taskerm.bh;
import net.dinglisch.android.taskerm.bw;
import net.dinglisch.android.taskerm.cc;
import net.dinglisch.android.taskerm.cl;
import net.dinglisch.android.taskerm.cw;
import net.dinglisch.android.taskerm.dh;
import net.dinglisch.android.taskerm.di;
import net.dinglisch.android.taskerm.dj;
import net.dinglisch.android.taskerm.dl;
import net.dinglisch.android.taskerm.dr;
import net.dinglisch.android.taskerm.dt;
import net.dinglisch.android.taskerm.fa;
import net.dinglisch.android.taskerm.ft;
import net.dinglisch.android.taskerm.fy;
import net.dinglisch.android.taskerm.gb;
import net.dinglisch.android.taskerm.go;
import net.dinglisch.android.taskerm.gw;
public class Main extends MyActivity implements View.OnClickListener, com.joaomgcd.taskerm.helper.b, dl.a, dl.b, dl.c, dl.d {
private RelativeLayout A;
private View B;
private cw C;
private cw D;
private ImageView E;
private SharedPreferences F;
private SharedPreferences G;
private Resources H;
private ViewPager I;
private i J;
private int P;
private int Q;
private ai.a T;
public fa f11314e;
public EditText g;
private ViewGroup y;
private RelativeLayout z;
private static final String[] j = {"tsIndexed", "tsEmpty", "tsRef"};
private static final boolean[] k = {true, true, true};
private static final int[] l = {R.string.bl_indexed, R.string.bl_empty, R.string.bl_referenced};
private static final int[] m = {R.id.tool_button_one, R.id.tool_button_two, R.id.tool_button_three};
public static String f11310a = "startWithTaskName";
public static String f11311b = "startWithTaskId";
public static String f11312c = "startWithSceneName";
public static String f11313d = "startWithSubspec";
private static boolean n = false;
private static long o = -1;
private static boolean p = false;
private static long q = -1;
private static boolean r = false;
com.joaomgcd.taskerm.util.bw f11315f = null;
private dl s = null;
private ev t = null;
private fu u = null;
private gw v = null;
private ToggleButton[] w = new ToggleButton[gw.a.values().length];
private Handler x = null;
private boolean K = false;
public fy h = new fy();
private int L = 0;
private gb M = null;
private String O = null;
private dg R = null;
private fy S = null;
private int U = -2;
private String V = "";
private cu W = null;
private MonitorService.c X = null;
public com.joaomgcd.taskerm.helper.q i = new com.joaomgcd.taskerm.helper.q(this);
private boolean Y = true;
public enum a {
Add,
Delete,
Name,
Clone
}
public enum b {
Disable,
Enable
}
public enum c {
ClearAll,
SetSort,
Import,
ToggleTools
}
public enum d {
AsApp,
DescrToClip,
DescrToEmail,
XmlToEmail,
XmlToClip,
XmlToSD,
ToLink,
ToUri
}
public enum g {
DeleteContents,
KeepContents
}
public enum h {
Add,
Delete,
Export,
Import,
Lock,
Rename,
SetIcon,
ShiftLeft,
ShiftRight,
Unlock,
SelectProject,
Properties
}
public enum j {
ProfileReselect,
ProfileAddOfType
}
public enum k {
AddEnter,
AddExit,
Add,
Name,
Unlink,
Reselect,
MoveToEnter,
MoveToExit
}
public int B(int i2) {
return i2;
}
private int X() {
return 1;
}
public static void a(Object obj) throws Exception {
}
private void aC() {
}
public static boolean d(View view) {
return true;
}
private int g(int i2) {
return i2;
}
@Override
protected boolean M_() {
return false;
}
@Override
public void a(com.joaomgcd.taskerm.util.bw bwVar, com.joaomgcd.taskerm.util.cs csVar) {
}
public static boolean a() {
return r;
}
public static void a(String str, boolean z) {
n = z;
}
@EventBusRxSubscription
@Keep
public void onTaskerEnabledChange(com.joaomgcd.taskerm.helper.y yVar) {
a((Activity) this);
}
private static void a(Activity activity) {
if (go.a()) {
String a2 = ct.a(activity, R.string.word_off, new Object[0]);
SpannableString spannableString = new SpannableString(a2);
spannableString.setSpan(new ForegroundColorSpan(gp.f(activity)), 0, a2.length(), 0);
ActionBar actionBar = activity.getActionBar();
if (actionBar != null) {
if (MonitorService.a((Context) activity)) {
spannableString = null;
}
actionBar.setSubtitle(spannableString);
}
}
}
public static ActionBar a(Activity activity, ImageView imageView) {
ActionBar actionBar = activity.getActionBar();
if (go.a()) {
a(activity);
} else {
if (imageView != null) {
imageView.setPadding(0, 0, go.a(17), 0);
}
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayOptions(2);
}
return actionBar;
}
public static boolean a(Context context) {
return !Settings.c(gs.g(context));
}
public static Intent b(Context context) {
Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS");
intent.setData(Uri.parse("package:" + context.getPackageName()));
return intent;
}
private void a(boolean z, String str) {
boolean z2 = r;
r = z;
bo.b("T", "setInstanceFlag: was " + z2 + "now: " + r);
}
@Override
public void onCreate(Bundle bundle) {
this.i.g();
a(true, "onCreate");
a("oncreate", false);
this.G = gs.h(this);
this.F = gs.g(this);
super.onCreate(bundle);
}
@Override
protected com.joaomgcd.taskerm.util.b<Bundle> N_() {
return new com.joaomgcd.taskerm.util.b() {
@Override
public final void call(Object obj) {
Main.this.c((Bundle) obj);
}
};
}
public void c(Bundle bundle) {
this.i.n();
SharedPreferences sharedPreferences = this.G;
if (sharedPreferences == null) {
d(this, "onAfterBackgroundInit state null");
return;
}
bo.e("T", "onCreate start");
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.cf();
}
}).b();
b(bundle);
final boolean n2 = n();
int b2 = cr.b(this);
final boolean e2 = cr.e(this);
a(n2, bundle);
c(n2);
if (bundle == null && !p()) {
if (as()) {
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.ce();
}
}).b();
} else if (!this.V.equals("disclaimer")) {
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.c(n2, e2);
}
}).b();
}
try {
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.bl();
}
}).b();
} catch (Exception e3) {
bo.b("T", "onCreate:bindMonitor", e3);
}
}
sharedPreferences.edit().putInt("lvc", b2).commit();
this.i.h();
bo.e("T", "onCreate end");
}
public void cf() {
c((Activity) this);
}
public void ce() {
k(false);
}
private void b(Bundle bundle) {
this.K = true;
gs.c((Context) this, true);
this.H = getResources();
if (bundle == null) {
gn.b("Main onCreatePartOne icicle null");
}
bb.a((Context) this, false);
cy.a(this, "T");
}
private boolean n() {
SharedPreferences sharedPreferences = this.G;
if (sharedPreferences == null) {
return false;
}
long j2 = sharedPreferences.getLong(bh.o.f12242b, -1L);
long j3 = sharedPreferences.getLong(bh.o.f12241a, -1L);
long currentTimeMillis = System.currentTimeMillis();
if (j2 > currentTimeMillis || j2 == -1) {
sharedPreferences.edit().putLong(bh.o.f12242b, currentTimeMillis).commit();
j2 = currentTimeMillis;
}
if (j3 != -1 && j2 > j3) {
bo.d("T", "validated date < install date, remove");
sharedPreferences.edit().remove(bh.o.f12241a).commit();
}
String string = sharedPreferences.getString("lvn", "none");
bo.b("T", "v: 6.1.32 date " + currentTimeMillis + " lv: " + string + " date: " + sharedPreferences.getLong("lvd", currentTimeMillis));
boolean contains = sharedPreferences.contains("dscl");
if (!string.equals("6.1.32")) {
bo.b("T", "versionchange, " + string + " -> 6.1.32");
sharedPreferences.edit().putString("lvn", "6.1.32").putLong("lvd", currentTimeMillis).commit();
Settings.a(this.F, sharedPreferences);
bo.h();
gx.a(this, "%QTIME");
}
return contains;
}
private void a(boolean z, Bundle bundle) {
dh a2;
fy.g();
if (bundle == null) {
bo.b("T", "onCreate: no icicle");
System.gc();
e("fresh");
if (!z) {
this.h.t();
}
bo.b("T", "loaded data, proj " + this.h.A());
e((File) null);
bo.b("T", "import and delete, proj " + this.h.A());
ap();
bo.b("T", "done init, proj " + this.h.A());
this.h.v();
bo.b("T", "check delete disabled");
u(2);
return;
}
bo.b("T", "onCreate: from icicle");
e("icicle");
f();
this.L = bundle.getInt("ssf", 0);
if (bundle.containsKey("sspid")) {
int i2 = bundle.getInt("sspid", -1);
if (this.h.l(i2)) {
this.M = this.h.k(i2);
} else {
this.M = null;
if (i2 != -1) {
bo.c("T", "null editing profile pid " + i2);
}
}
}
this.P = bundle.getInt("sset", 0);
if (bundle.containsKey("eent")) {
this.T = ai.a.valueOf(bundle.getString("eent"));
}
this.Q = bundle.getInt("etab", 0);
this.O = bundle.getString("sspn");
if (bundle.containsKey("ssed")) {
this.S = new fy();
this.S.a((Context) this, "onCreate/icicle", "ssed", true);
}
if (bundle.containsKey("sseo") && (a2 = dh.a((Context) this, "sseo", true)) != null) {
if (a2.e().equals(ft.a())) {
ft ftVar = new ft(a2);
if (this.h.i(ftVar.G())) {
this.R = this.h.j(ftVar.G());
} else {
this.R = ftVar;
}
} else if (a2.e().equals(dm.a())) {
dm dmVar = new dm(a2);
if (this.h.r(dmVar.m())) {
this.R = this.h.p(dmVar.m());
} else {
this.R = dmVar;
}
} else if (a2.m("Profile")) {
gb gbVar = new gb(this, a2, -1);
int K = gbVar.K();
if (this.h.l(K)) {
this.R = this.h.k(K);
} else {
this.R = gbVar;
}
}
}
this.V = bundle.getString("etag");
}
private void c(boolean z) {
fy fyVar = this.h;
if (fyVar == null) {
d(this, "onCreatePartFour data null");
return;
}
bo.b(gs.l());
PackageManager packageManager = getPackageManager();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.cd();
}
}).b();
SharedPreferences sharedPreferences = this.F;
if (sharedPreferences == null) {
d(this, "onCreatePartFour prefs null");
return;
}
if (aQ()) {
if (fyVar.A() > 1) {
sharedPreferences.edit().putBoolean("beginnerMode", false).commit();
}
} else if (!z) {
sharedPreferences.edit().putBoolean("beginnerMode", true).commit();
}
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.aE();
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.cc();
}
}).b();
fyVar.a(packageManager);
fyVar.i();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.cb();
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.T();
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.h();
}
}).b();
SharedPreferences sharedPreferences2 = this.G;
if (sharedPreferences2 == null) {
d(this, "onCreatePartFour state null");
return;
}
final int i2 = sharedPreferences2.getInt("ent", bh.o.a.f12245a.ordinal());
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.H(i2);
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.ca();
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.bZ();
}
}).b();
fyVar.a(packageManager, ai.a.values());
aJ();
final cw cwVar = this.D;
final ViewPager viewPager = this.I;
if (cwVar == null || viewPager == null) {
d(this, "onCreatePartFour entityTabs or mViewPager null");
return;
}
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.a(cw.this, i2, viewPager);
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.bY();
}
}).b();
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.bg();
}
}).b();
}
public void cd() {
setContentView(R.layout.main);
}
public void cc() {
a((Activity) this, (ImageView) findViewById(android.R.id.home));
}
public void cb() {
aA();
ax();
az();
ay();
}
public void H(int i2) {
e(ai.a.values()[i2]);
aM();
}
public void ca() {
aR();
f(j());
}
public void bZ() {
g(true);
}
public static void a(cw cwVar, int i2, ViewPager viewPager) {
cwVar.d(i2);
viewPager.setCurrentItem(i2);
}
public void bY() {
a(aN() == ai.a.Variable && o(), false, true, true);
}
@Override
public void X_() {
super.X_();
}
public boolean o() {
SharedPreferences sharedPreferences = this.G;
if (sharedPreferences == null) {
d(this, "wantEntityTools state null");
return false;
}
return sharedPreferences.getBoolean("lastVT", true);
}
public void d(boolean z) {
this.G.edit().putBoolean("lastVT", z).commit();
}
private boolean p() {
boolean z;
boolean z2;
boolean z3;
final String stringExtra;
fy fyVar = this.h;
if (fyVar == null) {
d(this, "handleStartEntity data null");
return false;
}
Intent intent = getIntent();
if (intent != null) {
String stringExtra2 = intent.getStringExtra(f11310a);
Integer valueOf = Integer.valueOf(intent.getIntExtra(f11311b, -1));
if (stringExtra2 == null && valueOf.intValue() == -1) {
z = false;
z2 = false;
} else {
bo.b("T", "start with taskName " + stringExtra2 + " and id " + valueOf);
final int intValue = valueOf.intValue() != -1 ? valueOf.intValue() : fyVar.A(stringExtra2);
if (intValue == -1) {
bo.d("T", "handleStartEntity: unknown task: " + stringExtra2);
z = false;
z2 = true;
} else {
String stringExtra3 = intent.getStringExtra(f11313d);
final int intValue2 = !TextUtils.isEmpty(stringExtra3) ? gs.c(stringExtra3).intValue() : -1;
bo.b("T", "action: " + intValue2);
ft j2 = fyVar.j(intValue);
if (j2 == null) {
bo.d("T", "handleStartEntity: unknown task ID " + intValue + " for " + stringExtra2);
} else if (gn.d(this) && j2.i()) {
bo.d("T", "handleStartEntity: task is locked or implicity locked: " + stringExtra2);
} else if (intValue2 != -1 && intValue2 >= j2.E()) {
bo.d("T", "handleStartEntity: task " + stringExtra2 + " doesn't have " + intValue2 + " actions ");
} else {
a(new Runnable() {
@Override
public final void run() {
Main.this.d(intValue, intValue2);
}
});
z3 = false;
z2 = z3;
z = true;
}
z3 = true;
z2 = z3;
z = true;
}
}
if (!z && (stringExtra = intent.getStringExtra(f11312c)) != null) {
final String stringExtra4 = intent.getStringExtra(f11313d);
bo.b("T", "start with scene " + stringExtra + " / " + stringExtra4);
dt u = fyVar.u(stringExtra);
if (u == null) {
bo.d("T", "handleStartEntity: unknown scene " + stringExtra);
} else if (!TextUtils.isEmpty(stringExtra4) && !u.k(stringExtra4)) {
bo.d("T", "handleStartEntity: scene " + stringExtra + " has no element " + stringExtra4);
} else if (gn.d(this) && u.i()) {
bo.d("T", "handleStartEntity: scene is locked or implicity locked: " + stringExtra);
} else {
a(new Runnable() {
@Override
public final void run() {
Main.this.a(stringExtra, stringExtra4);
}
});
z = true;
}
z2 = true;
z = true;
}
} else {
z = false;
z2 = false;
}
if (!z2) {
return z;
}
b(false, "handleStartEntity");
return true;
}
public void d(int i2, int i3) {
a(i2, i3, (String) null, 31);
}
public void a(String str, String str2) {
a(str, str2, 31);
}
private void a(final Runnable runnable) {
this.Y = false;
if (!gn.d(this)) {
runnable.run();
} else {
this.i.a(com.joaomgcd.taskerm.dialog.y.m(this), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(runnable, (com.joaomgcd.taskerm.dialog.x) obj);
}
});
}
}
public void a(Runnable runnable, com.joaomgcd.taskerm.dialog.x xVar) throws Exception {
this.Y = true;
if (!xVar.d()) {
b(false, "wrong lock code from shortcut");
} else {
runnable.run();
}
}
public i e() {
return this.J;
}
public boolean c(boolean z, boolean z2) {
if (this.F == null) {
d(this, "showStartupDialogs prefs null");
return true;
}
boolean e2 = e(z);
if (!e2) {
e2 = F();
}
if (!e2) {
e2 = this.i.a(R.string.dc_battery_optimized_vendors, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bX;
bX = Main.bX();
return bX;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.bW();
}
});
}
if (!e2) {
e2 = G();
}
if (!e2) {
e2 = B();
}
if (!e2) {
e2 = D();
}
if (!e2) {
e2 = E();
}
if (!e2) {
e2 = A();
}
if (!e2) {
e2 = J();
}
if (!e2) {
e2 = I();
}
if (!e2) {
e2 = K();
}
if (!e2) {
e2 = H();
}
if (!z2 && !e2 && !e2) {
int[] iArr = {7, 6, 5};
int[] iArr2 = {R.string.dc_changes_for_nougat, R.string.dc_changes_for_marshmallow, R.string.dc_changes_for_lollipop};
int i2 = 0;
while (true) {
if (i2 >= iArr.length) {
break;
}
if (gs.l() >= iArr[i2]) {
gi.c(this, iArr2[i2]);
gi.b(this, iArr2[i2]);
break;
}
i2++;
}
}
if (!e2) {
e2 = S();
}
if (!e2) {
e2 = R();
}
if (!e2) {
e2 = gi.b(this, 0, R.string.tip_click_title_bar, 2);
}
if (!e2) {
e2 = gi.b(this, 0, R.string.tip_menu_help, 2);
}
if (!e2) {
e2 = gi.b(this, 0, R.string.tip_support, 5);
}
if (!e2) {
e2 = gi.b(this, 0, R.string.tip_appcreation, 15);
}
if (!e2) {
e2 = r();
}
return !e2 ? Q() : e2;
}
public static Boolean bX() {
return true;
}
public void bW() {
com.joaomgcd.taskerm.util.al.i(this, "https://tasker.joaoapps.com/userguide/en/faqs/faq-problem.html#00");
}
public b.a.b a(final String str, final String str2, final String str3) {
bo.b("T", "Launching app factory");
final com.joaomgcd.taskerm.dialog.ac a2 = com.joaomgcd.taskerm.dialog.ac.a(this, R.string.dc_preparing_app_factory);
return com.joaomgcd.taskerm.rx.h.b(new Runnable() {
@Override
public final void run() {
Main.this.b(str, str2, str3);
}
}).c(new b.a.d.a() {
@Override
public final void run() {
com.joaomgcd.taskerm.dialog.ac.this.c();
}
});
}
public void b(String str, String str2, String str3) {
final Intent intent;
cj.h(this);
fi.b(this);
bo.b("T", "Checking spawn version");
if (fi.a((Activity) this)) {
try {
intent = fi.a(this, this.S, str, str2, "Cert", str3);
} catch (NullPointerException e2) {
bo.b("T", "launchFactory", e2);
intent = null;
}
com.joaomgcd.taskerm.rx.h.d(new Runnable() {
@Override
public final void run() {
Main.this.i(intent);
}
}).b();
}
}
public void i(Intent intent) {
if (intent == null) {
gs.d(this, R.string.f_export_failed, new Object[0]);
} else {
if (b(intent, 16)) {
return;
}
a("launchFactory");
gs.d(this, R.string.f_no_app_found, ct.a(this, R.string.app_factory_name, new Object[0]));
}
}
private void a(ft ftVar) {
bo.b("T", "etaa");
fy a2 = fi.a(this, this.h, (dm) null, ftVar);
if (a(a2)) {
if (!ftVar.z()) {
this.i.a(R.string.err_need_icon);
} else {
a(a2, ftVar);
}
}
}
private void a(dm dmVar) {
fy a2 = fi.a(this, this.h, dmVar, (ft) null);
if (a(a2)) {
if (!dmVar.b(this)) {
this.i.a(R.string.f_project_needs_icon);
} else if (a2.b(0, ft.c.Alpha).size() == 0) {
this.i.a(R.string.f_need_launch_task);
} else {
a(a2, dmVar);
}
}
}
private void a(fy fyVar, dg dgVar) {
this.S = fyVar;
this.R = dgVar;
if (this.G.contains("dsclk")) {
q();
} else {
c("kidDisclaimer", true);
HTMLView.a(this, "disclaimer_kid.html", 19, HTMLView.c.Confirm);
}
}
private void q() {
if (this.S != null) {
dm a2 = this.S.a(0, "skk");
bi C = a2.C();
if (C != null) {
C.s();
}
if (aQ() && a2.D() == 1) {
if (C == null) {
C = new bi();
C.a();
C.b(a2.q().get(0).intValue());
}
C.t();
a(C);
return;
}
Intent putExtra = new Intent(this, (Class<?>) KidConfig.class).putExtra("d", hi.a(this.S.a(0).b(0)));
com.joaomgcd.taskerm.util.aa.a(putExtra);
b(putExtra, 15);
}
}
private boolean a(fy fyVar) {
boolean z = false;
net.dinglisch.android.taskerm.g n2 = fyVar.a(0, "eaaa").n();
fyVar.l();
if (!fi.a((Context) this)) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
Main.this.a("getFactoryGooglePlay", new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=net.dinglisch.android.appfactory")));
}
}, R.string.dt_missing_app, ct.a(this, R.string.dc_missing_component_can_download, ct.a(this, R.string.word_application, new Object[0]).toLowerCase(), "Tasker App Factory"), R.string.button_label_ok, R.string.button_label_cancel, -1, 196).a(this);
} else if (cr.k(getPackageManager(), "net.dinglisch.android.appfactory") < 5) {
gs.d(this, R.string.f_version_too_low, "Tasker App Factory");
} else if (fyVar.e(134)) {
gs.d(this, R.string.f_kid_disallowed_action, n.u(134));
} else if (fyVar.a(getPackageManager(), true).size() > 0) {
gs.d(this, R.string.f_export_failed_missing_plugin, new Object[0]);
} else if (!n2.c() && n2.n() && ct.a(n2.d(this))) {
gs.d(this, R.string.f_export_disallowed_icon, new Object[0]);
} else {
z = true;
}
bo.b("T", "eaaa: " + z);
return z;
}
@Override
public void onConfigurationChanged(Configuration configuration) {
if (gs.l() < 16) {
a("configChange", false);
}
super.onConfigurationChanged(configuration);
if (gs.l() < 16) {
new Handler() {
@Override
public void handleMessage(Message message) {
Main.a("configChange", true);
}
}.sendEmptyMessageDelayed(0, 300L);
}
bo.b("T", "config change done");
}
public void f() {
fy fyVar = this.h;
if (fyVar == null) {
d(this, "setDataDirtyWrapper data null");
} else {
fyVar.t();
invalidateOptionsMenu();
}
}
private void a(gb gbVar) {
if (gbVar.S()) {
if (gbVar.C()) {
gs.d(this, R.string.edit_err_deleteondisable, new Object[0]);
} else {
gbVar.j(true);
gbVar.p(0);
}
} else {
gbVar.j(false);
}
this.h.a((ai) gbVar);
invalidateOptionsMenu();
}
private boolean e(boolean z) {
if (z) {
return false;
}
c("disclaimer", true);
HTMLView.a(this, "disclaimer.html", 9, HTMLView.c.Confirm);
return true;
}
private boolean r() {
if (this.h.y() <= 3) {
return false;
}
if (Settings.c(this.F)) {
return gi.a(this, R.string.tip_beginner_mode);
}
return gi.a(this, R.string.tip_views);
}
private boolean A() {
return this.i.a(R.string.tip_beginner_profiles_video, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bV;
bV = Main.this.bV();
return bV;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.L();
}
});
}
public Boolean bV() {
return Boolean.valueOf(this.h.y() == 0);
}
private boolean B() {
return this.i.a(R.string.tip_beginner_projects_video, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bU;
bU = Main.this.bU();
return bU;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.M();
}
});
}
public Boolean bU() {
return Boolean.valueOf((this.h.y() > 5 || this.h.n() > 5) && this.h.A() == 1);
}
public boolean C() {
return this.i.a(R.string.tip_beginner_variables_video, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bT;
bT = Main.bT();
return bT;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.N();
}
});
}
public static Boolean bT() {
return true;
}
private boolean D() {
if (com.joaomgcd.taskerm.util.ds.a() || com.joaomgcd.taskerm.s.a.a((Context) this)) {
return false;
}
if ((this.h.y() <= 10 && this.h.n() <= 15) || this.h.A() <= 3) {
return false;
}
this.i.a(com.joaomgcd.taskerm.s.a.a((Activity) this));
return true;
}
private boolean E() {
return this.i.o();
}
private boolean F() {
if (com.joaomgcd.taskerm.util.g.a(this)) {
return this.i.a(R.string.google_changed_way_android_works_apps_target_api_29_dialog, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bS;
bS = Main.this.bS();
return bS;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.bR();
}
});
}
return false;
}
public Boolean bS() {
return Boolean.valueOf(com.joaomgcd.taskerm.util.bz.f(this));
}
public void bR() {
this.i.b(new GenericActionSendEmailToSupport("Functionality Not Working", "From Tasker: please let me know how I can get Wifi working again.").run(this));
com.joaomgcd.taskerm.util.bz.d(this, false);
}
private boolean G() {
return this.i.a(R.string.google_approved_assistant_actions_you_can_use, (c.f.a.a<Boolean>) new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bQ;
bQ = Main.bQ();
return bQ;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.bP();
}
}, "https://youtu.be/gGa4OfxmlzU", (Boolean) true);
}
public static Boolean bQ() {
return true;
}
public void bP() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/gGa4OfxmlzU");
}
private boolean H() {
return this.i.a(R.string.google_assistant_actions_with_routines, (c.f.a.a<Boolean>) new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bO;
bO = Main.bO();
return bO;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.bN();
}
}, "https://youtu.be/Uy4owfsBQKs", (Boolean) true);
}
public static Boolean bO() {
return true;
}
public void bN() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/Uy4owfsBQKs");
}
private boolean I() {
return this.i.a(R.string.tip_new_stuff_video, (c.f.a.a<Boolean>) new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bM;
bM = Main.bM();
return bM;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.O();
}
}, "https://youtu.be/pyUxrWArztc?tasker=true", (Boolean) true);
}
public static Boolean bM() {
return true;
}
private boolean J() {
com.joaomgcd.taskerm.plugin.a.a(this);
return this.i.a(R.string.dc_must_disable_unimportant_notification_text, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bL;
bL = Main.this.bL();
return bL;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.bJ();
}
});
}
public Boolean bL() {
return Boolean.valueOf(com.joaomgcd.taskerm.util.h.f(this));
}
public void bJ() {
this.i.a(new Runnable() {
@Override
public final void run() {
Main.this.bK();
}
});
}
public void bK() {
if (!new GenericActionActivityConfigureNotificationChannel("quick", false).run(this).b().b()) {
com.joaomgcd.taskerm.dialog.y.c(this, R.string.tip_dialog_title, "Unfortunately you didn't disable the useless notifications yet. You'll be spammed with them.\n\nPlease disable them for a better Tasker experience.").b();
} else {
com.joaomgcd.taskerm.dialog.y.c(this, R.string.tip_dialog_title, "Great! You won't get any more useless notifications!").b();
}
com.joaomgcd.taskerm.plugin.a.a(this);
}
private boolean K() {
return this.i.a(R.string.tip_beginner_tasks_video, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bI;
bI = Main.this.bI();
return bI;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.P();
}
});
}
public Boolean bI() {
return Boolean.valueOf(this.h.o() == 0);
}
public void L() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/s6EAbLW5WSk");
}
public void M() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/Oufvnh_9RD0");
}
public void N() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/rkQRH17H-DY");
}
public void O() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/pyUxrWArztc?tasker=true");
}
public void P() {
com.joaomgcd.taskerm.util.al.i(this, "https://youtu.be/bCJ3A-PZf5k");
}
private boolean Q() {
return this.i.a(R.string.tip_google_drive_backup_not_enabled, new c.f.a.a() {
@Override
public final Object invoke() {
Boolean bH;
bH = Main.this.bH();
return bH;
}
}, new Runnable() {
@Override
public final void run() {
Main.this.bG();
}
});
}
public Boolean bH() {
return Boolean.valueOf(!Settings.j(this) && (this.h.y() > 0 || this.h.n() > 0));
}
public void bG() {
com.joaomgcd.taskerm.util.ds.b((Activity) this);
}
private boolean R() {
String c2 = bo.c();
if (c2.length() <= 0) {
return false;
}
df.a(this, R.string.logdialog_title, c2);
bo.d();
bo.b("T", "LOG: " + c2);
return true;
}
private boolean S() {
File file = new File(gs.k(), "crash.txt");
boolean z = false;
if (file.exists()) {
long lastModified = file.lastModified();
if (o != lastModified) {
String a2 = gs.a(file);
if (a2 != null) {
if (a2.contains(OutOfMemoryError.class.getSimpleName())) {
df.a(this, R.string.dt_oom_crash, R.string.dc_oom_crash);
bo.d();
file.delete();
z = true;
} else {
z = gi.a(this, R.string.tip_crash);
}
}
o = lastModified;
}
if (!z && System.currentTimeMillis() - lastModified > 3600000) {
file.delete();
}
}
return z;
}
public void a(String str, String str2, int i2) {
int i3;
Intent intent = new Intent(this, (Class<?>) SceneEdit.class);
intent.putExtra(ProfileManager.EXTRA_PROFILE_NAME, str);
MyActivity.a(intent, i2);
if (str2 != null) {
intent.putExtra("el", str2);
i3 = NotificationCompat.FLAG_GROUP_SUMMARY;
} else {
i3 = 0;
}
if (ex.b(str)) {
i3 |= 48;
}
if (i3 != 0) {
intent.putExtra("flags", i3);
}
intent.putExtra("projectid", i());
b(intent, 11);
}
@Override
public void onBackPressed() {
b(true, "back");
}
public void a(View view) {
cl clVar = new cl(this, view);
if (MonitorService.a((Context) this)) {
clVar.a(b.Disable.ordinal(), R.string.ml_disable, R.attr.iconTaskerDisabledAB);
} else {
clVar.a(b.Enable.ordinal(), R.string.ml_enable, R.attr.iconTaskerAB);
}
clVar.a(new cl.c() {
@Override
public void onDismiss(cl clVar2) {
if (clVar2.h()) {
return;
}
Main.this.g();
gi.b(Main.this, R.string.tip_toggle_tasker);
}
}).show();
}
public void T() {
View view = this.B;
if (view == null) {
d(this, "populateViews projectTabHostShadow null");
return;
}
if (go.a()) {
gp.a(view);
} else {
ImageView imageView = (ImageView) findViewById(android.R.id.home);
if (imageView != null) {
imageView.setBackgroundResource(go.c(this, R.attr.drawableImageSelectIndicator));
imageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view2) {
Main.this.a(view2);
return true;
}
});
}
}
this.E = (ImageView) findViewById(R.id.button_add);
this.E.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view2) {
Main.this.e(view2);
}
});
this.E.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view2) {
boolean d2;
d2 = Main.d(view2);
return d2;
}
});
i(true);
this.f11314e = new fa();
this.f11314e.a(this, "T", null, this.E, this.z, view, null, false, true, (ImageView) findViewById(R.id.scroll_up_indicator), (ImageView) findViewById(R.id.scroll_down_indicator), null, new fa.c() {
@Override
public void a(fa.b bVar, int i2) {
Main.this.bc();
}
});
this.f11314e.a(this, (ListView) null, a((Context) this), "onCreate");
}
public void e(View view) {
if (u()) {
return;
}
be();
}
public boolean g() {
if (!a(4, (Object[]) null)) {
return false;
}
U();
return true;
}
private void U() {
boolean a2 = MonitorService.a((Context) this);
if (a2) {
gs.n(this);
u(2);
gs.a(this, R.string.word_disabled, new Object[0]);
} else {
gs.b((Context) this, false);
}
b(ClockContract.AlarmsColumns.ENABLED, !a2);
c(this, "T/doToggleOnOff");
a((Activity) this);
}
@Override
public void a(View view, int i2, int i3, boolean z) {
if (!u() || z) {
if (z) {
V();
}
this.M = (gb) this.s.getItem(i2);
if (this.M == null) {
bo.c("T", "unknown profile clicked, position " + i2 + " type " + i3);
return;
}
ft b2 = this.h.b(this.M, i3);
if (((b2 == null || !b2.i()) && !this.M.i()) || a(7, new Object[]{view, Integer.valueOf(i2), Integer.valueOf(i3), Boolean.valueOf(z)})) {
this.P = i3;
if (this.P == 1 || this.P == 0) {
if (z) {
v();
a(view, this.M, i3, i2);
return;
} else {
d(this.M, this.P);
return;
}
}
bo.c("T", "unknown task type " + this.P + " clicked, position " + i2);
}
}
}
public void V() {
if (gs.s(this)) {
this.z.performHapticFeedback(0, 2);
}
}
public void a(final ListView listView) {
listView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
int h2;
int action = motionEvent.getAction();
if (Main.this.f11314e.a() || Main.this.aN() == ai.a.Variable) {
return false;
}
int x = (int) motionEvent.getX();
int y = (int) motionEvent.getY();
if (action == 2 && Main.this.f11314e.a(y, "listViewTouchListener")) {
if (!fa.a(Main.this, Main.this.u(), x, listView.getWidth()) || fa.b(listView, x, y) == -1 || (h2 = Main.this.f11314e.h()) == -1 || !Main.this.f11314e.a(listView, Main.this.u(), h2)) {
return false;
}
Main.this.a(listView, h2, "listViewTouch");
return true;
}
if (action == 1) {
Main.this.aw();
return false;
}
if (action != 0) {
return false;
}
Main.this.f11314e.c(listView, x, y);
Main.this.f11314e.a(x, y);
return false;
}
});
}
@Override
public boolean a(ListView listView, int i2, int i3, float f2, float f3, boolean z, boolean z2) {
if (i3 == 2) {
if (z2) {
return false;
}
View childAt = listView.getChildAt(i2 - listView.getFirstVisiblePosition());
if (childAt == null) {
return true;
}
int y = ((int) childAt.getY()) + ((int) f3);
return this.f11314e.a(y, "onProfileTouch") ? b(listView, i2, i3, f2, y, z, z2) : true;
}
if (i3 == 1 || i3 == 3) {
this.f11314e.a("up/cancel");
return false;
}
if (i3 != 0) {
return false;
}
this.f11314e.b(i2);
if (z2) {
this.f11314e.a((int) f2, (int) f3);
return b(listView, i2, i3, f2, f3, z, z2);
}
View childAt2 = listView.getChildAt(i2 - listView.getFirstVisiblePosition());
if (childAt2 == null) {
return false;
}
int y2 = ((int) childAt2.getY()) + ((int) f3);
this.f11314e.b(i2);
this.f11314e.a((int) f2, y2);
if (!bz.a(listView, i2) || !fa.a(this)) {
return false;
}
this.f11314e.j();
return false;
}
private boolean b(ListView listView, int i2, int i3, float f2, float f3, boolean z, boolean z2) {
View childAt = listView.getChildAt(i2 - listView.getFirstVisiblePosition());
Rect rect = new Rect();
if (childAt == null) {
return false;
}
childAt.getHitRect(rect);
int width = listView.getWidth();
int a2 = z ? width - (fa.a(this, width) / 2) : (int) f2;
if (!this.f11314e.a(listView, u(), i2) || !fa.a(this, u(), a2, width)) {
return false;
}
this.f11314e.j();
if (z2) {
return false;
}
a(listView, i2, "checkInitDrag");
return true;
}
@Override
public void a(ListView listView, int i2, int i3) {
this.M = (gb) this.s.getItem(i3);
if (this.M == null) {
bo.c("T", "onProfileCommand: no editingProfile");
return;
}
boolean i4 = this.M.i();
bo.b("T", "onProfileCommand: position: " + i3 + " command: " + i2 + " collapsed: " + this.M.P() + " locked/Imp: " + i4);
if (!i4 || a(5, new Object[]{Integer.valueOf(i2), Integer.valueOf(i3)})) {
if (i2 == 2) {
a(listView, i3, false);
return;
}
if (i2 == 3) {
a(listView, i3, true);
} else if (i2 == 0) {
a(this.M);
s();
}
}
}
public void a(ListView listView, int i2, boolean z) {
bo.b("T", "click: pos: " + i2 + " long: " + z + " inAction: " + u());
if (z) {
V();
if (u()) {
return;
}
listView.setItemChecked(i2, true);
return;
}
if (!u()) {
boolean P = this.M.P();
if (!this.M.Q() && W() >= 1) {
int K = this.M.K();
Iterator<Integer> it = this.h.p().iterator();
while (it.hasNext()) {
int intValue = it.next().intValue();
if (intValue != K) {
this.h.k(intValue).ab();
}
}
}
a(false, ai.a.Profile);
if (P && this.s != null && i2 == this.s.getCount() - 1 && a((Context) this) && this.s.getCount() > listView.getChildCount()) {
bo.b("T", "move up");
listView.setSelection(i2);
return;
}
return;
}
listView.setItemChecked(i2, !this.s.c(i2));
}
public int W() {
return this.F.getInt("apl", 4);
}
@Override
public void b(View view, int i2, int i3, boolean z) {
if (!u() || z) {
gb gbVar = (gb) this.s.getItem(i2);
this.M = gbVar;
if (z) {
V();
}
if (!gbVar.i() || a(3, new Object[]{view, Integer.valueOf(i2), Integer.valueOf(i3), Boolean.valueOf(z)})) {
this.P = i3;
if (z) {
v();
a(gbVar, i3, view, i2);
} else {
a(gbVar, i3, false);
}
}
}
}
public void a(gb gbVar, int i2, boolean z) {
d(32, z);
this.M = gbVar;
switch (i2) {
case 0:
b(AppSelect.a(this, false, false, true, true, false, true, null, this.M != null ? (q) this.M.l(0) : null), 21);
return;
case 1:
d(gbVar);
return;
case 2:
bb();
return;
case 3:
b(gbVar);
return;
case 4:
case 5:
case 6:
a(gbVar, gbVar != null ? (fp) gbVar.l(i2) : null);
return;
case 7:
a(gbVar, gbVar != null ? (ao) gbVar.l(i2) : null);
return;
default:
b((View) null);
return;
}
}
private void h(final int i2) {
new cl(this, this.C.i(i2)).a(g.DeleteContents.ordinal(), R.string.ml_delete_project_contents, R.attr.iconTrash).a(g.KeepContents.ordinal(), R.string.ml_refile_project_contents, R.attr.iconFile).a(new cl.c() {
@Override
public void onDismiss(cl clVar) {
if (clVar.h()) {
return;
}
Main.this.c(i2, g.values()[clVar.g()] == g.DeleteContents);
}
}).show();
}
public void a(final j jVar, final View view, final gb gbVar, final int i2) {
final com.joaomgcd.taskerm.dialog.ac a2 = com.joaomgcd.taskerm.dialog.ac.a(this, R.string.dc_getting_tasks);
this.i.c(new Runnable() {
@Override
public final void run() {
Main.this.a(view, gbVar, i2, jVar, a2);
}
});
}
public void a(final View view, final gb gbVar, final int i2, final j jVar, final com.joaomgcd.taskerm.dialog.ac acVar) {
final cl clVar = new cl(this, view);
this.i.a(new Runnable() {
@Override
public final void run() {
Main.this.a(clVar, gbVar, i2, jVar, view, acVar);
}
});
}
public void a(final cl clVar, final gb gbVar, final int i2, final j jVar, final View view, com.joaomgcd.taskerm.dialog.ac acVar) {
try {
try {
this.i.d(new Runnable() {
@Override
public final void run() {
Main.a(cl.this);
}
});
final ArrayList<ft> b2 = this.h.b(i(), ft.c.Alpha);
final ArrayList<ft> b3 = this.h.b(-2, ft.c.Alpha);
final int n2 = gbVar.n(i2);
final int i3 = 0;
int g2 = go.g(this);
final int argb = Color.argb(110, Color.red(g2), Color.green(g2), Color.blue(g2));
final int b4 = gp.b((Context) this);
this.i.d(new Runnable() {
@Override
public final void run() {
Main.this.a(b2, n2, clVar, b4, i3, b3, argb, jVar, i2, gbVar, view);
}
});
com.joaomgcd.taskerm.helper.q qVar = this.i;
clVar.getClass();
qVar.d(new Runnable() {
@Override
public final void run() {
cl.this.show();
}
});
} catch (NullPointerException unused) {
com.joaomgcd.taskerm.util.ao.c(getString(R.string.tasker_doesnt_support_dont_keep_activities), this);
} catch (Exception e2) {
com.joaomgcd.taskerm.rx.h.a(this, e2);
}
} finally {
acVar.c();
}
}
public static void a(cl clVar) {
clVar.b();
clVar.a();
}
public void a(ArrayList arrayList, int i2, cl clVar, int i3, int i4, ArrayList arrayList2, int i5, final j jVar, final int i6, final gb gbVar, final View view) {
int G;
int i7 = this.G.getInt("lTsk", -1);
Iterator it = arrayList.iterator();
while (it.hasNext()) {
ft ftVar = (ft) it.next();
int G2 = ftVar.G();
if (G2 != i2) {
clVar.a(G2, ftVar.m(), ftVar.a(this, i3), i4, G2 == i7 ? cl.a.Top : cl.a.Bottom);
}
}
Iterator it2 = arrayList2.iterator();
while (it2.hasNext()) {
ft ftVar2 = (ft) it2.next();
if (!arrayList.contains(ftVar2) && (G = ftVar2.G()) != i2) {
clVar.a(G, ftVar2.m(), ftVar2.a(this, i3), i5, G == i7 ? cl.a.Top : cl.a.Bottom);
}
}
Drawable b2 = go.b(this, R.attr.iconAdd);
gp.a(b2, gp.a((Context) this));
clVar.a(934524, ct.a(this, R.string.dialog_entry_new_task, "T"), b2, 0, cl.a.Top);
if (aQ() && jVar == j.ProfileAddOfType) {
StringBuilder sb = new StringBuilder();
sb.append(ct.a(this, i6 == 0 ? R.string.word_enter : R.string.word_exit, new Object[0]));
sb.append(" ");
sb.append(ct.a(this, R.string.word_task, new Object[0]));
clVar.a(sb.toString());
}
if (clVar.d() > 1) {
clVar.a(i7, true, true);
}
clVar.a(new cl.c() {
@Override
public final void onDismiss(cl clVar2) {
Main.this.a(gbVar, jVar, view, i6, clVar2);
}
}).a(TextUtils.TruncateAt.MIDDLE);
}
public void a(final gb gbVar, final j jVar, final View view, final int i2, cl clVar) {
if (clVar.h()) {
if (gbVar.M() == 0) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.f(new int[]{gbVar.K()});
} else {
Main.this.a(jVar, view, gbVar, i2);
}
}
}, ct.a(this, R.string.dc_delete_unfinished_profile, new Object[0]));
return;
}
return;
}
int g2 = clVar.g();
if (g2 == 934524) {
this.M = gbVar;
this.P = i2;
a(ai.a.Task, view, this.s.b(this.M.K()), (String) null, -go.a(10));
} else {
gbVar.a(i2, g2);
a(ai.a.Profile);
}
}
private void a(az azVar, boolean z) {
if (this.h == null) {
return;
}
this.R = azVar;
com.joaomgcd.taskerm.datashare.export.f.a(this, azVar, this.h, 32, z);
}
public void G(final int i2) {
new cl(this, this.C.i(i2)).a(d.AsApp.ordinal(), R.string.ml_export_as_app, R.attr.iconContextApp).a(d.DescrToEmail.ordinal(), R.string.ml_export_descr_in_email, R.attr.iconEmail).a(d.DescrToClip.ordinal(), R.string.ml_export_descr_to_clipboard, R.attr.iconClipboard).a(d.XmlToSD.ordinal(), R.string.ml_export_xml_to_sd, R.attr.iconExport).a(d.ToLink.ordinal(), R.string.ml_export_to_url, R.attr.iconUrl, cl.a.Top).a(d.ToUri.ordinal(), R.string.ml_export_to_uri, R.attr.iconUrl, cl.a.Bottom).a(new cl.c() {
@Override
public final void onDismiss(cl clVar) {
Main.this.a(i2, clVar);
}
}).show();
}
public void a(int i2, cl clVar) {
if (clVar.h()) {
a("projMenuCancelled");
return;
}
final dm a2 = this.h.a(B(i2), "spen");
final d dVar = d.values()[clVar.g()];
switch (dVar) {
case AsApp:
a(a2);
return;
case DescrToClip:
case DescrToEmail:
this.i.a(dVar, new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(a2, dVar, (com.joaomgcd.taskerm.f.g) obj);
}
});
return;
case XmlToSD:
b(a2);
return;
case ToLink:
a((az) a2, false);
return;
case ToUri:
a((az) a2, true);
return;
default:
bo.c("T", "unexpected export mode " + clVar.g());
return;
}
}
public static class AnonymousClass60 {
static final int[] f11432c;
static final int[] f11433d;
static final int[] f11434e;
static final int[] f11435f;
static {
try {
g[d.AsApp.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
g[d.DescrToClip.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
g[d.DescrToEmail.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
g[d.XmlToSD.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
g[d.ToLink.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
g[d.ToUri.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
f11435f = new int[h.values().length];
try {
f11435f[h.Add.ordinal()] = 1;
} catch (NoSuchFieldError unused7) {
}
try {
f11435f[h.Delete.ordinal()] = 2;
} catch (NoSuchFieldError unused8) {
}
try {
f11435f[h.Export.ordinal()] = 3;
} catch (NoSuchFieldError unused9) {
}
try {
f11435f[h.Import.ordinal()] = 4;
} catch (NoSuchFieldError unused10) {
}
try {
f11435f[h.Lock.ordinal()] = 5;
} catch (NoSuchFieldError unused11) {
}
try {
f11435f[h.Unlock.ordinal()] = 6;
} catch (NoSuchFieldError unused12) {
}
try {
f11435f[h.Rename.ordinal()] = 7;
} catch (NoSuchFieldError unused13) {
}
try {
f11435f[h.SetIcon.ordinal()] = 8;
} catch (NoSuchFieldError unused14) {
}
try {
f11435f[h.ShiftLeft.ordinal()] = 9;
} catch (NoSuchFieldError unused15) {
}
try {
f11435f[h.ShiftRight.ordinal()] = 10;
} catch (NoSuchFieldError unused16) {
}
try {
f11435f[h.SelectProject.ordinal()] = 11;
} catch (NoSuchFieldError unused17) {
}
try {
f11435f[h.Properties.ordinal()] = 12;
} catch (NoSuchFieldError unused18) {
}
f11434e = new int[k.values().length];
try {
f11434e[k.Name.ordinal()] = 1;
} catch (NoSuchFieldError unused19) {
}
try {
f11434e[k.Unlink.ordinal()] = 2;
} catch (NoSuchFieldError unused20) {
}
try {
f11434e[k.Add.ordinal()] = 3;
} catch (NoSuchFieldError unused21) {
}
try {
f11434e[k.AddExit.ordinal()] = 4;
} catch (NoSuchFieldError unused22) {
}
try {
f11434e[k.MoveToExit.ordinal()] = 5;
} catch (NoSuchFieldError unused23) {
}
try {
f11434e[k.MoveToEnter.ordinal()] = 6;
} catch (NoSuchFieldError unused24) {
}
try {
f11434e[k.AddEnter.ordinal()] = 7;
} catch (NoSuchFieldError unused25) {
}
try {
f11434e[k.Reselect.ordinal()] = 8;
} catch (NoSuchFieldError unused26) {
}
f11433d = new int[a.values().length];
try {
f11433d[a.Add.ordinal()] = 1;
} catch (NoSuchFieldError unused27) {
}
try {
f11433d[a.Delete.ordinal()] = 2;
} catch (NoSuchFieldError unused28) {
}
try {
f11433d[a.Name.ordinal()] = 3;
} catch (NoSuchFieldError unused29) {
}
try {
f11433d[a.Clone.ordinal()] = 4;
} catch (NoSuchFieldError unused30) {
}
f11432c = new int[c.values().length];
try {
f11432c[c.ToggleTools.ordinal()] = 1;
} catch (NoSuchFieldError unused31) {
}
try {
f11432c[c.SetSort.ordinal()] = 2;
} catch (NoSuchFieldError unused32) {
}
try {
f11432c[c.ClearAll.ordinal()] = 3;
} catch (NoSuchFieldError unused33) {
}
try {
f11432c[c.Import.ordinal()] = 4;
} catch (NoSuchFieldError unused34) {
}
f11431b = new int[ai.a.values().length];
try {
f11431b[ai.a.Profile.ordinal()] = 1;
} catch (NoSuchFieldError unused35) {
}
try {
f11431b[ai.a.Task.ordinal()] = 2;
} catch (NoSuchFieldError unused36) {
}
try {
f11431b[ai.a.Scene.ordinal()] = 3;
} catch (NoSuchFieldError unused37) {
}
try {
f11431b[ai.a.Variable.ordinal()] = 4;
} catch (NoSuchFieldError unused38) {
}
f11430a = new int[RunLog.b.values().length];
try {
f11430a[RunLog.b.Profile.ordinal()] = 1;
} catch (NoSuchFieldError unused39) {
}
try {
f11430a[RunLog.b.Task.ordinal()] = 2;
} catch (NoSuchFieldError unused40) {
}
try {
f11430a[RunLog.b.Action.ordinal()] = 3;
} catch (NoSuchFieldError unused41) {
}
try {
f11430a[RunLog.b.MonitorStatus.ordinal()] = 4;
} catch (NoSuchFieldError unused42) {
}
try {
f11430a[RunLog.b.ExeStatus.ordinal()] = 5;
} catch (NoSuchFieldError unused43) {
}
}
}
public void a(dm dmVar, d dVar, com.joaomgcd.taskerm.f.g gVar) throws Exception {
a(dmVar.a(this, this.h, gVar), dVar);
}
public void a(final View view, String str) {
new dj(this, null).a(new dj.a() {
@Override
public void onDismiss(dj djVar) {
if (djVar.b() || !djVar.a()) {
return;
}
String c2 = djVar.c();
if (!Main.this.a(c2, Main.this.h.r(c2), (ai.a) null)) {
Main.this.a(view, c2);
return;
}
dm dmVar = new dm(c2);
dmVar.a(Main.this.h.a(0, "snpnp").j());
Main.this.h.a(dmVar);
if (Main.this.av()) {
Main.this.C.b(Main.this);
} else {
Main.this.C.a((Context) Main.this, false);
}
Main.this.aI();
Main.this.c(Main.this.C.g() - 1);
Main.this.f(Main.this.j());
Main.this.f();
}
}).b(R.string.dt_new_project).b(str).a(view, false);
}
private boolean b(Runnable runnable) {
if (com.joaomgcd.taskerm.util.bw.a(this, 121).f()) {
runnable.run();
return true;
}
c("reqPermsDialog", true);
return this.i.a(com.joaomgcd.taskerm.util.bw.a(this, 131), runnable);
}
public void j(final int i2) {
this.Q = i2;
final ViewGroup i3 = this.C.i(i2);
cl clVar = new cl(this, i3);
int X = X();
boolean y = y(i2);
final int B = B(i2);
final dm a2 = this.h.a(B, "spm");
if (a2 == null) {
gs.d(this, R.string.f_couldnt_retrieve_data, new Object[0]);
return;
}
clVar.a(h.Add.ordinal(), R.string.pl_add, R.attr.iconAdd);
if (!y) {
clVar.a(h.Delete.ordinal(), R.string.button_label_delete, R.attr.iconTrash);
clVar.a(h.Export.ordinal(), R.string.ml_export, R.attr.iconExport);
clVar.a(h.Properties.ordinal(), R.string.button_label_properties, R.attr.iconProperties);
}
clVar.a(h.Rename.ordinal(), R.string.button_label_rename, R.attr.iconName);
if (a2.A()) {
clVar.a(h.Unlock.ordinal(), R.string.ml_unlock, R.attr.iconUnlocked);
} else {
clVar.a(h.Lock.ordinal(), R.string.ml_lock, R.attr.iconLocked);
}
clVar.a(h.Import.ordinal(), R.string.ml_import_project, R.attr.iconImport);
clVar.a(h.SetIcon.ordinal(), R.string.ml_set_icon, R.attr.iconIcon);
if (!y) {
if (i2 > X) {
clVar.a(h.ShiftLeft.ordinal(), R.string.word_left, R.attr.iconPrevious);
}
if (i2 < this.C.g() - 1) {
clVar.a(h.ShiftRight.ordinal(), R.string.word_right, R.attr.iconNext);
}
}
if (this.C.g() > 4) {
clVar.a(h.SelectProject.ordinal(), R.string.select_project, R.attr.iconDepth);
}
clVar.a(new cl.c() {
@Override
public final void onDismiss(cl clVar2) {
Main.this.a(i3, i2, B, a2, clVar2);
}
});
try {
clVar.show();
} catch (Throwable unused) {
gs.d(this, R.string.f_couldnt_retrieve_data, new Object[0]);
}
}
public void a(View view, final int i2, int i3, dm dmVar, cl clVar) {
if (clVar.h()) {
return;
}
h hVar = h.values()[clVar.g()];
switch (AnonymousClass60.f11435f[hVar.ordinal()]) {
case 1:
a(view, (String) null);
return;
case 2:
h(i2);
return;
case 3:
b(new Runnable() {
@Override
public final void run() {
Main.this.G(i2);
}
});
return;
case 4:
b(new Runnable() {
@Override
public final void run() {
Main.this.bF();
}
});
return;
case 5:
case 6:
boolean C = this.h.C(B(i2));
aI();
a(false, false, false, ai.a.values());
if (C) {
aP();
return;
}
return;
case 7:
D(i2);
return;
case 8:
b(ImageSelect.a((Context) this, 383), 13);
return;
case 9:
case 10:
this.i.a(this.i.a(i2, hVar == h.ShiftLeft, this.C.g()), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(i2, (Integer) obj);
}
});
return;
case 11:
this.i.f();
return;
case g.a.MapAttrs_uiZoomControls:
this.i.a(i3, dmVar);
return;
default:
return;
}
}
public void bF() {
this.T = null;
b(this.T);
}
public void a(int i2, Integer num) throws Exception {
if (av()) {
this.C.a(this, i2, num.intValue());
} else {
this.C.a(i2, num.intValue());
}
this.h.a(B(i2), B(num.intValue()));
}
@Override
public void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
bundle.putInt("ssf", this.L);
if (this.M != null) {
bundle.putInt("sspid", this.M.K());
}
if (this.O != null) {
bundle.putString("sspn", this.O);
}
bundle.putInt("sset", this.P);
bundle.putInt("etab", this.Q);
if (this.V != null) {
bundle.putString("etag", this.V);
}
if (this.T != null) {
bundle.putString("eent", this.T.toString());
}
if (this.S != null) {
bundle.putBoolean("ssed", true);
this.S.a(0).a(this, "ssed", 0);
}
if (this.R != null) {
bundle.putBoolean("sseo", true);
this.R.a(0).a(this, "sseo", 0);
}
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.clear();
menu.add(0, 70, 0, R.string.taskernet);
menu.add(0, 71, 0, R.string.tutorials_pre_made_projects);
if (MonitorService.a((Context) this)) {
menu.add(0, 42, 0, ct.a(this, R.string.ml_disable_tasker, new Object[0]));
} else {
menu.add(0, 43, 0, ct.a(this, R.string.ml_enable_tasker, new Object[0]));
}
if (!v(64)) {
net.dinglisch.android.taskerm.a.a(this, 32, 0, R.string.bl_exit, menu);
}
menu.add(0, 4, 0, ct.a(this, R.string.ml_settings, new Object[0]));
SubMenu addSubMenu = menu.addSubMenu(0, 9995, 0, ct.a(this, R.string.ml_submenu_monitoring, new Object[0]));
SubMenu addSubMenu2 = menu.addSubMenu(0, 9999, 0, ct.a(this, R.string.ml_submenu_data, new Object[0]));
addSubMenu2.add(0, 0, 0, ct.a(this, R.string.ml_clear_data, new Object[0]));
addSubMenu2.add(0, 7, 0, ct.a(this, R.string.ml_backup, new Object[0]));
a((Menu) addSubMenu2);
addSubMenu2.add(0, 46, 0, ct.a(this, R.string.word_share, new Object[0]));
addSubMenu2.addSubMenu(0, 9999, 0, ct.a(this, R.string.pl_description, new Object[0])).add(0, 47, 0, ct.a(this, R.string.an_write_to_file, new Object[0]));
b(menu.addSubMenu(0, 9998, 0, ct.a(this, R.string.ml_submenu_info, new Object[0])));
SubMenu addSubMenu3 = menu.addSubMenu(0, 9997, 0, ct.a(this, R.string.ml_submenu_more, new Object[0]));
addSubMenu3.addSubMenu(0, 9996, 0, ct.a(this, R.string.ml_submenu_browse_profiles, new Object[0])).add(0, 11, 0, ct.a(this, R.string.ml_browse_wiki_profiles, new Object[0]));
e(addSubMenu3.addSubMenu(0, 9997, 0, ct.a(this, R.string.ml_android_settings_screens, new Object[0])));
addSubMenu3.add(0, 21, 0, ct.a(this, R.string.ml_run_one_action, new Object[0]));
if (this.F == null || !Settings.c(this.F)) {
f(addSubMenu3.addSubMenu(0, 9997, 0, ct.a(this, R.string.ml_submenu_developer, new Object[0])));
}
if (bs()) {
net.dinglisch.android.taskerm.a.a(this, 44, menu, R.string.button_label_apply, R.attr.iconAcceptAB, 1);
}
net.dinglisch.android.taskerm.a.a(this, 30, menu, R.string.dt_search_tasker, R.attr.iconSearchAB, 1);
menu.add(0, 10000, 0, R.string.ml_create_debug_log);
com.joaomgcd.a.a.a(menu, addSubMenu3, addSubMenu);
addSubMenu.add(0, 26, 0, ct.a(this, R.string.ml_view_runlog, new Object[0]));
return true;
}
private void a(Menu menu) {
boolean z = fy.f().size() > 0;
Settings.i(this);
SubMenu addSubMenu = menu.addSubMenu(0, 9999, 0, ct.a(this, R.string.ml_restore, new Object[0]));
if (z) {
addSubMenu.add(0, 51, 0, ct.a(this, R.string.ml_backup_type_auto, new Object[0]));
}
addSubMenu.add(0, 52, 0, ct.a(this, R.string.ml_backup_type_manual, new Object[0]));
addSubMenu.add(0, 65, 0, ct.a(this, R.string.ml_backup_type_google_drive, new Object[0]));
}
private void b(Menu menu) {
menu.add(0, 3, 0, ct.a(this, R.string.ml_help_this_screen, new Object[0]));
menu.add(0, 25, 0, ct.a(this, R.string.ml_overview, new Object[0]));
d(menu.addSubMenu(0, 9993, 0, ct.a(this, R.string.ml_submenu_beginner_videos, new Object[0])));
menu.add(0, 2, 0, ct.a(this, R.string.ml_userguide, new Object[0]));
menu.add(0, 29, 0, ct.a(this, R.string.ml_guides, new Object[0]));
menu.add(0, 17, 0, ct.a(this, R.string.ml_support, new Object[0]));
c(menu.addSubMenu(0, 9993, 0, ct.a(this, R.string.ml_submenu_more, new Object[0])));
}
private void c(Menu menu) {
menu.add(0, 1, 0, ct.a(this, R.string.ml_about, new Object[0]));
menu.add(0, 31, 0, ct.a(this, R.string.ml_privacy_policy, new Object[0]));
menu.add(0, 18, 0, ct.a(this, R.string.ml_release_notes, new Object[0]));
menu.add(0, 14, 0, ct.a(this, R.string.ml_device_id, new Object[0]));
menu.add(0, 12, 0, ct.a(this, R.string.ml_licences, new Object[0]));
}
private void d(Menu menu) {
menu.add(0, 66, 0, ct.a(this, R.string.word_profiles, new Object[0]));
menu.add(0, 67, 0, ct.a(this, R.string.word_tasks, new Object[0]));
menu.add(0, 68, 0, ct.a(this, R.string.word_projects, new Object[0]));
menu.add(0, 72, 0, ct.a(this, R.string.word_variables, new Object[0]));
}
public gb.b Y() {
if (this.h == null) {
return gb.b.values()[bh.j.b.f12232b];
}
int i2 = i();
dm a2 = this.h.a(i2, "gprofs");
if (a2 == null) {
bo.d("T", "getProfileSort: no project for index " + i2);
return gb.b.values()[bh.j.b.f12232b];
}
return a2.j();
}
public ft.c Z() {
ft.c cVar = ft.c.User;
dm a2 = this.h.a(i(), "gts");
if (a2 == null) {
bo.b("T", "gts: no project index " + i());
return cVar;
}
return a2.k();
}
public dt.f aa() {
dt.f fVar = dt.f.User;
if (this.h == null) {
return fVar;
}
dm a2 = this.h.a(i(), "gss");
if (a2 == null) {
bo.b("T", "gss: no project index " + i());
return fVar;
}
return a2.l();
}
public boolean a(String str, Intent intent) {
if (!f("activity")) {
return false;
}
c(str, true);
ai();
return gs.a((Context) this, intent);
}
private void a(String str, HTMLView.c cVar) {
c(str, true);
HTMLView.a(this, str, -1, cVar);
}
public void k(final int i2) {
b(new Runnable() {
@Override
public final void run() {
Main.this.F(i2);
}
});
}
public void F(int i2) {
if (i2 != 7) {
switch (i2) {
case 46:
bj();
return;
case 47:
this.i.a(d.DescrToEmail, new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a((com.joaomgcd.taskerm.f.g) obj);
}
});
return;
default:
return;
}
}
m(28);
}
public void a(com.joaomgcd.taskerm.f.g gVar) throws Exception {
String a2 = this.h.a(this, gVar);
File k2 = gs.k();
if (k2.exists()) {
File file = new File(k2, "datadescr.txt");
if (gs.a(a2, file, false)) {
gs.a(this, R.string.f_wrote_file, file);
return;
} else {
gs.a(this, R.string.f_export_failed, new Object[0]);
return;
}
}
gs.d(this, R.string.err_no_sd, new Object[0]);
}
private void m(final int i2) {
b(new Runnable() {
@Override
public final void run() {
Main.this.E(i2);
}
});
}
public void E(int i2) {
File a2 = fy.a(true);
if (a2 != null) {
b(FileSelect.a(this, null, a2.toString() + File.separator + "backup.xml", FileSelect.b.File, ".xml", false, false), i2);
}
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
StringBuilder sb = new StringBuilder();
sb.append("v");
sb.append("dd");
final int itemId = menuItem.getItemId();
switch (itemId) {
case 0:
if (a(2, (Object[]) null)) {
aW();
}
return true;
case 1:
a("about.html", HTMLView.c.Inform);
return true;
case 2:
a("index.html", HTMLView.c.Inform);
return true;
case 3:
a("activity_main.html", HTMLView.c.Inform);
return true;
case 4:
aj();
return true;
default:
switch (itemId) {
case 11:
a("wikiProfile", new Intent("android.intent.action.VIEW", Uri.parse("https://tasker.joaoapps.com/profiles")));
return true;
case g.a.MapAttrs_uiZoomControls:
a("licences.html", HTMLView.c.Inform);
return true;
case g.a.MapAttrs_uiZoomGestures:
f(false);
return true;
case g.a.MapAttrs_useViewLifecycle:
com.joaomgcd.taskerm.rx.h.a(new Runnable() {
@Override
public final void run() {
Main.this.bD();
}
});
return true;
case g.a.MapAttrs_zOrderOnTop:
case 16:
return true;
case g.a.MapAttrs_ambientEnabled:
a("support.html", HTMLView.c.Inform);
return true;
case g.a.MapAttrs_cameraMinZoomPreference:
a("releaseNotes", new Intent("android.intent.action.VIEW", Uri.parse("https://tasker.joaoapps.com/changes.html")));
return true;
default:
switch (itemId) {
case NotificationCompat.MessagingStyle.MAXIMUM_RETAINED_MESSAGES:
a("overview.html", HTMLView.c.Inform);
return true;
case 26:
aD();
return true;
default:
switch (itemId) {
case 29:
a("guides", new Intent("android.intent.action.VIEW", Uri.parse("https://tasker.joaoapps.com/guides.html")));
return true;
case 30:
aU();
return true;
case 31:
a("ppolicy", new Intent("android.intent.action.VIEW", Uri.parse("https://tasker.joaoapps.com/privacy.html")));
return true;
case 32:
ah();
return true;
default:
switch (itemId) {
case 42:
case 43:
if (g() && !go.a()) {
df.a(this, R.string.tip_dialog_title, R.string.tip_toggle_tasker);
}
return true;
case 44:
af();
return true;
default:
switch (itemId) {
case 46:
k(itemId);
return true;
default:
switch (itemId) {
case 50:
if (a(16, (Object[]) null)) {
aX();
}
return true;
case 51:
if (a(17, (Object[]) null)) {
aZ();
}
return true;
case 52:
if (a(18, (Object[]) null)) {
m(29);
}
return true;
case 53:
gs.a(this, R.string.ml_restore_no_options, new Object[0]);
return true;
default:
switch (itemId) {
case 55:
b(at.a(true), 30);
return true;
case 56:
b(dc.h(), 26);
return true;
case 57:
b(MyAccessibilityService.d(), 26);
return true;
case 58:
if (!bw.ai.a((PowerManager) df.a(getApplicationContext(), "power", "T", "androidpowermanagementmenu"), getPackageName())) {
b(b((Context) this), 26);
} else {
this.i.b(com.joaomgcd.taskerm.dialog.y.a(new com.joaomgcd.taskerm.dialog.h(this, R.string.dt_already_disabled, R.string.dc_battery_optimizations_already_disabled_tasker)));
}
return true;
case 59:
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.b(MyDeviceAdminReceiver.e(Main.this), 26);
}
}
}, R.string.ml_android_settings_device_admin, ct.a(this, R.string.dc_device_admin_disclosure, new Object[0]));
return true;
case 60:
b(bq.c(this), 26);
return true;
case 61:
b(bq.g(this), 26);
return true;
case 62:
b(bq.b(this), 26);
return true;
case 63:
b(Settings.t(this), 26);
return true;
case 64:
b(dc.i(), 26);
return true;
case 65:
if (a(19, (Object[]) null)) {
this.i.a(GenericActionBackupToGoogleDriveWhenConnectedAndCharging.restoreFromGoogleDrive(this), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a((com.joaomgcd.taskerm.util.cw) obj);
}
});
}
return true;
case 66:
L();
return true;
case 67:
P();
return true;
case 68:
M();
return true;
case 69:
this.i.a(new GenericActionActivityRequestCallScreeningAccess().run(this), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.c((com.joaomgcd.taskerm.util.cr) obj);
}
});
return true;
case 70:
this.i.k();
return true;
case 71:
this.i.l();
return true;
case 72:
N();
return true;
case 73:
this.i.b(new GenericActionActivityRequestManageExternalStorageAccess().run(this));
return true;
default:
switch (itemId) {
case 7:
break;
case g.a.MapAttrs_latLngBoundsSouthWestLongitude:
if (a(12, (Object[]) null)) {
ab();
}
return true;
case 76:
com.joaomgcd.taskerm.util.al.z(this);
return true;
case 80:
b(bq.b(), 26);
return true;
case 10000:
this.i.b(com.joaomgcd.taskerm.util.ds.a((Activity) this));
return true;
case android.R.id.home:
b(true, "apply");
return true;
default:
boolean a2 = a(menuItem);
return !a2 ? com.joaomgcd.a.a.a(this, menuItem) : a2;
}
}
}
case 47:
if (gi.c(this, R.string.dc_backup_data)) {
k(itemId);
} else {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
gi.b(Main.this, R.string.dc_backup_data);
Main.this.k(itemId);
}
}
}, R.string.dc_backup_data);
}
return true;
}
}
}
}
}
}
}
public void a(com.joaomgcd.taskerm.util.cw cwVar) throws Exception {
if (cwVar.b()) {
try {
this.h.b((Context) this, GenericActionBackupToGoogleDriveWhenConnectedAndCharging.getTAG(), (String) cwVar.d(), true);
e((File) null);
ao();
f();
return;
} catch (Throwable th) {
com.joaomgcd.taskerm.rx.h.a(this, th);
return;
}
}
com.joaomgcd.taskerm.util.af e2 = cwVar.e();
gs.e(this, e2 == null ? "Unknown error" : e2.getErrorMessage(), new Object[0]);
}
public void bD() {
this.i.a(com.joaomgcd.taskerm.util.bw.c((Context) this), new Runnable() {
@Override
public final void run() {
Main.this.bE();
}
});
}
public void bE() {
final String b2 = Licence.b((Context) this).b();
com.joaomgcd.taskerm.rx.h.c(new Runnable() {
@Override
public final void run() {
Main.this.i(b2);
}
});
}
public void i(String str) {
df.a(this, R.string.ml_device_id, "\nID:\t" + str + "\n\nSDK:\t" + gs.l() + "\nRelease:\t" + Build.VERSION.RELEASE + "\nDisplay:\t" + Build.DISPLAY + "\n\nModel:\t" + Build.MODEL + "\nBrand:\t" + Build.BRAND + "\nDevice:\t" + Build.DEVICE + "\nProduct:\t" + Build.PRODUCT + "\n");
}
public void c(com.joaomgcd.taskerm.util.cr crVar) throws Exception {
String string = getString(R.string.tasker_is_call_screening_app);
if (!crVar.b()) {
string = getString(R.string.tasker_is_not_call_screening_app);
}
com.joaomgcd.taskerm.util.ao.b(string, this);
}
private void f(boolean z) {
b(new Intent(this, (Class<?>) Licence.class), z ? 8 : 7);
}
private void ab() {
a("runAction", new Intent(this, (Class<?>) ActionEdit.class).putExtra("raf", ActionEdit.b.UI.toString()));
}
public boolean a(final gb gbVar, final int i2) {
if (gbVar.M() == 1) {
a(new int[]{gbVar.K()});
} else if (this.F.getBoolean("lPdta", true) && !this.h.b(gbVar, i2).n()) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.b(gbVar, i2);
}
}
}, ct.a(this, R.string.dc_delete_task, ct.a(this, R.string.word_anonymous, new Object[0])));
} else {
b(gbVar, i2);
return true;
}
return false;
}
public void b(gb gbVar, int i2) {
this.h.a((Context) this, gbVar, i2);
this.h.a((ai) gbVar);
a(false, ai.a.Profile);
}
public void a(final int[] iArr) {
if (this.F.getBoolean("lPEna", true)) {
String str = null;
if (iArr.length == 1) {
gb k2 = this.h.k(iArr[0]);
if (k2 == null) {
gs.d(this, R.string.f_couldnt_retrieve_data, new Object[0]);
} else if (k2.n()) {
str = k2.m();
} else {
str = k2.b(this, false, false, false);
}
}
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.f(iArr);
}
}
}, iArr.length == 1 ? ct.a(this, R.string.dc_delete_profile_named, str) : ct.a(this, R.string.dc_delete_profiles, Integer.valueOf(iArr.length)));
return;
}
f(iArr);
}
public void b(int[] iArr) {
for (int length = iArr.length - 1; length >= 0; length--) {
this.h.b(iArr[length], i(), 0);
}
}
public void c(int[] iArr) {
for (int length = iArr.length - 1; length >= 0; length--) {
this.h.a(iArr[length], i(), 0);
}
}
public void a(String[] strArr) {
for (int length = strArr.length - 1; length >= 0; length--) {
this.h.a(strArr[length], i(), 0);
}
}
public boolean d(final int[] iArr) {
if (!this.i.a(iArr)) {
return false;
}
if (this.F.getBoolean("lPdta", true)) {
String[] strArr = new String[iArr.length];
for (int i2 = 0; i2 < strArr.length; i2++) {
strArr[i2] = this.h.E(iArr[i2]);
}
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.e(iArr);
}
}
}, ct.a(this, R.string.dc_delete_task, gs.a(strArr)));
return false;
}
e(iArr);
return true;
}
public void e(int[] iArr) {
for (int i2 : iArr) {
this.h.o(i2);
}
a(ai.a.Profile, ai.a.Task);
v();
gs.a(this, R.string.message_deleted, new Object[0]);
}
public boolean b(final String[] strArr) {
if (this.F.getBoolean("lPdta", true)) {
int i2 = 0;
for (String str : strArr) {
i2 += this.h.a(getPackageManager(), str);
}
String a2 = gs.a(strArr);
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.c(strArr);
}
}
}, -1, i2 > 0 ? gs.e(this, R.string.dc_delete_referenced_scene_confirm, a2, Integer.valueOf(i2)) : gs.e(this, R.string.dc_delete_scene_confirm, a2));
return false;
}
c(strArr);
return true;
}
public void c(String[] strArr) {
for (String str : strArr) {
this.h.b(getPackageManager(), str);
}
gs.a(this, R.string.message_deleted, new Object[0]);
v();
a(ai.a.Scene);
}
public void a(String str) {
this.S = null;
this.R = null;
bo.b("T", "Clearing app export data: " + str);
v();
}
public void b(int i2, boolean z) {
int B = B(this.Q);
this.C.b(this.Q);
this.h.a(getPackageManager(), B, z);
this.s.a(i(), Y(), false);
a(ai.a.values());
}
public void c(final int i2, final boolean z) {
if (av()) {
by.a(this, this.C.i(i2), R.anim.fadeout, 0L, 450L, new by() {
@Override
public void a() {
Main.this.z.postDelayed(new Runnable() {
@Override
public void run() {
Main.this.b(i2, z);
}
}, 100L);
}
});
} else {
b(i2, z);
}
}
public boolean ac() {
if (this.M.I() == 1) {
a(new int[]{this.M.K()});
} else if (this.F.getBoolean("lPdta", true)) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.c(Main.this.M, Main.this.P);
Main.this.a(ai.a.Profile);
Main.this.b(Main.this.M.K());
}
}
}, R.string.dc_delete_context);
} else {
c(this.M, this.P);
return true;
}
return false;
}
public void c(gb gbVar, int i2) {
this.M.h(i2);
this.M.J();
this.h.a((ai) this.M);
}
private void ad() {
if (v(32)) {
b(this.D.i(ai.a.Profile.ordinal()));
}
}
public void a(fx fxVar) {
boolean z;
fy b2 = b("handleFinishContextEdit");
if (b2 == null) {
return;
}
if (this.M == null) {
this.M = b2.f(getBaseContext());
if (!TextUtils.isEmpty(this.O)) {
this.M.a(this.O);
}
z = true;
} else {
z = false;
}
this.O = null;
this.M.a(fxVar);
b2.a((ai) this.M);
if (z) {
if (W() >= 2) {
b2.d(i());
}
b2.a(this.M, i());
if (W() >= 5) {
this.M.i(true);
}
}
if (fxVar.w()) {
b2.a(fxVar);
}
if (fxVar.z() == 3 && !fxVar.w()) {
this.P = 3;
a(this.M, fxVar, true);
} else if (this.M.M() == 0) {
a(this.M, true);
}
a(ai.a.Profile);
if (z) {
a(l(), this.M.K());
}
switch (fxVar.z()) {
case 4:
case 5:
case 6:
case 7:
a(false, ai.a.Variable);
return;
default:
return;
}
}
private fy b(String str) {
fy a2 = fy.a((Context) this, false);
if (a2 == null) {
a2 = this.h;
}
if (a2 == null) {
d(this, str + " data null");
return null;
}
this.h = a2;
return a2;
}
public View n(int i2) {
ListView l2 = l();
if (l2 == null) {
return null;
}
int b2 = this.s.b(i2) - l2.getFirstVisiblePosition();
if (b2 < 0 || b2 >= l2.getChildCount()) {
bo.b("T", "bad relpos: " + b2);
return null;
}
return l2.getChildAt(b2);
}
private void a(final gb gbVar, final fx fxVar, boolean z) {
final ImageView imageView = this.E;
if (imageView == null) {
d(this, "showNewContextNameSelector buttonAdd null");
return;
}
Runnable runnable = new Runnable() {
@Override
public void run() {
?? findViewById;
ImageView imageView2 = imageView;
View n2 = Main.this.n(gbVar.K());
if (n2 != null && (findViewById = n2.findViewById(R.id.context_layout_one)) != 0) {
imageView2 = findViewById;
}
Main.this.a(gbVar, fxVar, imageView2);
}
};
if (z) {
imageView.postDelayed(runnable, 200L);
} else {
runnable.run();
}
}
public void a(final gb gbVar, boolean z) {
final Runnable runnable = new Runnable() {
@Override
public final void run() {
Main.this.e(gbVar);
}
};
if (z || this.i.j()) {
com.joaomgcd.taskerm.rx.h.a(new Runnable() {
@Override
public final void run() {
Main.this.c(runnable);
}
});
} else {
runnable.run();
}
}
public void e(final gb gbVar) {
com.joaomgcd.taskerm.rx.h.c(new Runnable() {
@Override
public final void run() {
Main.this.f(gbVar);
}
});
}
public void f(gb gbVar) {
View findViewById;
View view = this.E;
View n2 = n(gbVar.K());
if (n2 != null && (findViewById = n2.findViewById(R.id.task_layout_one)) != null) {
view = findViewById;
}
a(j.ProfileAddOfType, view, gbVar, 0);
}
public void c(Runnable runnable) {
b.a.b.a(200L, TimeUnit.MILLISECONDS).b();
this.i.i();
runnable.run();
}
public void a(ListView listView, int i2) {
dl dlVar = this.s;
if (dlVar != null && aN() == ai.a.Profile) {
for (int i3 = 0; i3 < dlVar.getCount(); i3++) {
gb gbVar = (gb) dlVar.getItem(i3);
if (gbVar != null && gbVar.K() == i2) {
gs.a(listView, i3);
return;
}
}
}
}
public void o(int i2) {
if (aN() == ai.a.Task) {
for (int i3 = 0; i3 < this.u.getCount(); i3++) {
if (this.u.getItemId(i3) == i2) {
gs.a(l(), i3);
return;
}
}
}
}
private void c(String str) {
if (aN() == ai.a.Scene) {
for (int i2 = 0; i2 < this.t.getCount(); i2++) {
if (((dt) this.t.getItem(i2)).m().equals(str)) {
gs.a(l(), i2);
return;
}
}
}
}
public void f(int[] iArr) {
for (int i2 : iArr) {
this.h.p(i2);
}
gs.a(this, R.string.message_deleted, new Object[0]);
a(ai.a.Profile);
v();
}
private void g(boolean z) {
ew.a(z ? new Handler() {
@Override
public void handleMessage(Message message) {
Main.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Main.this.c(ai.a.Scene);
}
});
}
} : null);
}
@Override
protected void onStart() {
a(true, "onStart");
this.K = true;
bo.b("T", "onStart");
super.onStart();
this.i.a(com.joaomgcd.taskerm.rx.b.a(this));
bo.b("T", "onStart done");
}
@Override
public void onStop() {
super.onStop();
com.joaomgcd.taskerm.rx.b.b(this);
}
@Override
public void onResume() {
this.K = true;
d(128, false);
try {
super.onResume();
} catch (Exception e2) {
bo.b("T", "Couldn't resume.", e2);
finish();
}
File a2 = gb.a(this.F);
if (a2 != null && a2.exists() && !gs.a((Object[]) a2.list()) && this.G.contains("dscl") && this.V.equals("wikiProfile")) {
gi.a(this, R.string.tip_import_downloaded_profiles);
}
ak();
if (q == -1) {
q = System.currentTimeMillis();
}
a("onResume", true);
a((Activity) this);
bo.b("T", "onresume done");
}
@EventBusRxSubscription
@Keep
public void onDataImported(com.joaomgcd.taskerm.datashare.export.d dVar) {
az a2 = dVar.a();
this.h = fy.e(this);
if (a2 instanceof dm) {
if (dVar.b()) {
aq();
}
a(ai.a.values());
} else if (a2 instanceof gb) {
a(ai.a.Profile, ai.a.Task);
} else if (a2 instanceof ft) {
a(ai.a.Task);
}
}
private boolean ae() {
return v(128);
}
@Override
protected void onUserLeaveHint() {
boolean ae = ae();
bo.b("T", "User leaving. Launching activity: " + ae);
if (!ae) {
gn.b("Main onUserLeaveHint");
}
if (!v(4)) {
bo.b("T", "userLeaveHint");
af();
}
super.onUserLeaveHint();
}
public boolean a(File file, String str) {
boolean z;
if (file != null) {
try {
if (this.h.a(this, file, str, 52, com.joaomgcd.taskerm.settings.ai.c(this))) {
z = true;
try {
File k2 = gs.k();
if (k2 != null) {
fs.a(k2, "usertabs.xml");
}
if (!z && !cj.a(this)) {
gs.d(this, R.string.f_keystore_backup_failed, new Object[0]);
return false;
}
} catch (OutOfMemoryError unused) {
gs.d(this, R.string.oom, new Object[0]);
return z;
}
}
} catch (OutOfMemoryError unused2) {
z = false;
gs.d(this, R.string.oom, new Object[0]);
return z;
}
}
gs.c(this, R.string.warn_write_backup_datafile, new Object[0]);
z = false;
return !z ? z : z;
}
public boolean a(boolean z) {
d("saveData: pre");
this.h = this.h.g(this);
boolean z2 = true;
if (!this.h.a((Context) this, this.F, this.H, q, z, true)) {
a(fy.c(true), "emergencybackup.xml");
z2 = false;
}
d("saveData: ok: " + z2);
return z2;
}
private void d(String str) {
if (this.h == null) {
bo.b("T", str + ": no data");
return;
}
bo.b("T", str + ": pCount: " + this.h.A());
}
private void b(String str, boolean z) {
this.G.edit().putBoolean(str, z).commit();
}
@Override
public void onClick(View view) {
int id = view.getId();
if (id == m[0]) {
this.F.edit().putBoolean(j[0], this.w[0].isChecked()).commit();
a(false, ai.a.Variable);
} else if (id == m[1]) {
this.F.edit().putBoolean(j[1], this.w[1].isChecked()).commit();
a(false, ai.a.Variable);
} else if (id == m[2]) {
this.F.edit().putBoolean(j[2], this.w[2].isChecked()).commit();
a(false, ai.a.Variable);
}
}
private void h(final boolean z) {
this.i.c(new Runnable() {
@Override
public final void run() {
Main.this.m(z);
}
});
}
public void m(boolean z) {
setProgressBarIndeterminateVisibility(z);
}
private void af() {
final com.joaomgcd.taskerm.dialog.ac a2 = com.joaomgcd.taskerm.dialog.ac.a(this, R.string.dc_applying);
h(true);
this.i.e(new Runnable() {
@Override
public final void run() {
Main.this.a(a2);
}
});
}
public void a(final com.joaomgcd.taskerm.dialog.ac acVar) {
this.h = this.h.g(this);
if (this.h.s() && this.h.a((Context) this, this.F, this.H, q, true, false)) {
q = System.currentTimeMillis();
k();
System.gc();
if (MonitorService.a((Context) this)) {
MonitorService.a((Context) this, true);
t(2);
}
this.i.d(new Runnable() {
@Override
public final void run() {
Main.this.bC();
}
});
b.a.l<Boolean> a2 = bt().a(new b.a.d.a() {
@Override
public final void run() {
Main.this.bB();
}
});
acVar.getClass();
a((b.a.l) a2.a(new b.a.d.a() {
@Override
public final void run() {
com.joaomgcd.taskerm.dialog.ac.this.c();
}
}));
return;
}
acVar.c();
}
public void bC() {
invalidateOptionsMenu();
}
public void bB() throws Exception {
h(false);
}
private <T> void a(b.a.l<T> lVar, b.a.d.f<T> fVar) {
this.i.a(lVar, fVar);
}
private <T> void a(b.a.l<T> lVar) {
a(lVar, new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.a(obj);
}
});
}
public void b(final boolean z, final String str) {
bo.e("T", "exit/" + str);
if (str.equals("leaveHint") || str.equals("back")) {
if (this.i.p()) {
this.i.q();
return;
} else {
this.i.a(d(z, str), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(z, str, (q.a) obj);
}
});
return;
}
}
c(z, str);
}
public void a(boolean z, String str, q.a aVar) throws Exception {
if (aVar.a()) {
c(z, str);
}
}
private void c(final boolean z, final String str) {
final com.joaomgcd.taskerm.dialog.ac a2 = com.joaomgcd.taskerm.dialog.ac.a((Context) this, R.string.dc_applying, false);
this.i.e(new Runnable() {
@Override
public final void run() {
Main.this.a(str, z, a2);
}
});
}
public void a(String str, boolean z, final com.joaomgcd.taskerm.dialog.ac acVar) {
ar();
al();
am();
fe.a((Context) this, false);
RunLog.c((Context) this);
Search.a((Context) this);
if (this.h.s()) {
u(2);
}
bo.b("T", "EXIT: from " + str + ": save: " + z + " dirty: " + this.h.s() + " must save: " + v(64) + " prefsDirty: " + v(8) + " need mrestart: " + v(2));
boolean z2 = true;
if (z || v(64)) {
if (this.h.s()) {
if (a(false)) {
k();
} else {
t(2);
z2 = false;
}
} else {
fy.a(fy.a.Passive, true);
if (!v(8)) {
t(2);
}
}
}
q = -1L;
if (z2) {
fy.a(fy.a.Passive, false);
}
System.gc();
MonitorService.a(this, v(2));
c("exit", false);
gn.b("Main reallyexit");
if (!isFinishing()) {
if (str.equals("leaveHint") || str.equals("back")) {
a(bt(), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(acVar, (Boolean) obj);
}
});
bo.a("T", "dont finish, requesting permissions");
return;
} else {
acVar.c();
finish();
}
} else {
acVar.c();
}
a(false, "exit");
}
public void a(com.joaomgcd.taskerm.dialog.ac acVar, Boolean bool) throws Exception {
acVar.c();
finish();
}
private b.a.l<q.a> d(boolean z, String str) {
return com.joaomgcd.taskerm.rx.h.c(com.joaomgcd.taskerm.rx.h.b(new c.f.a.a() {
@Override
public final Object invoke() {
q.a bA;
bA = Main.this.bA();
return bA;
}
}));
}
public q.a bA() {
if (!MonitorService.a((Context) this)) {
com.joaomgcd.taskerm.dialog.y.d(this, R.string.warning_dialog_title, R.string.dc_tasker_disabled_profiles_wont_work).b();
return new q.a(true);
}
if (!gs.t()) {
return new q.a(false);
}
if (!bw.ai.b()) {
bo.d("T", "on MM but no PM functions");
return new q.a(false);
}
if (this.G.contains("USER_DOESNT_WANT_BATTERY_OPTIMIZATION_DIALOGs")) {
return new q.a(true);
}
if (bw.ai.a((PowerManager) df.a(getApplicationContext(), "power", "T", "showMMWarning"), getPackageName())) {
if (com.joaomgcd.taskerm.settings.ai.l(this)) {
return new q.a(true, com.joaomgcd.taskerm.dialog.y.a(this, R.string.app_name, R.string.dc_really_want_to_exit_tasker).b().d());
}
return new q.a(false);
}
com.joaomgcd.taskerm.dialog.x b2 = com.joaomgcd.taskerm.dialog.y.a(this, R.string.dt_battery_optimized, R.string.dc_battery_optimized, R.string.button_label_stop_reminding).b();
if (b2.h()) {
com.joaomgcd.taskerm.dialog.y.d(this, R.string.tip_dialog_title, R.string.tip_battery_optimization).b();
return new q.a(true);
}
if (b2.g()) {
this.G.edit().putBoolean("USER_DOESNT_WANT_BATTERY_OPTIMIZATION_DIALOGs", true).commit();
com.joaomgcd.taskerm.dialog.y.d(this, R.string.tip_dialog_title, R.string.tip_ok_wont_show_battery_optimization_warning_again).b();
return new q.a(true);
}
if (!new GenericActionActivityDisableBatteryOptimizations().run(this).b().b()) {
com.joaomgcd.taskerm.dialog.y.d(this, R.string.dt_battery_optimized, R.string.dc_still_battery_optimized).b();
return new q.a(true);
}
bo.d("T", "User tuned off battery optimization, yay!");
if (!com.joaomgcd.taskerm.dialog.y.a(new com.joaomgcd.taskerm.dialog.h(this, R.string.warning_dialog_title, R.string.dc_battery_optimized_further, R.string.button_label_open_faq, R.string.button_label_ok)).b().d()) {
return new q.a(true);
}
com.joaomgcd.taskerm.util.al.i(this, "https://tasker.joaoapps.com/userguide/en/faqs/faq-problem.html#00");
return new q.a(true);
}
private void ag() {
this.h = null;
this.M = null;
this.O = null;
this.R = null;
this.S = null;
if (this.f11314e != null) {
this.f11314e.b();
this.f11314e = null;
}
this.x = null;
if (this.y != null) {
this.y.removeAllViews();
this.y = null;
}
this.z = null;
this.B = null;
if (this.C != null) {
this.C.a();
this.C = null;
}
this.E = null;
this.g = null;
this.w = null;
this.F = null;
this.G = null;
this.H = null;
if (this.J != null) {
this.J.a(true);
this.J.a();
}
this.I = null;
this.J = null;
if (this.s != null) {
this.s.b();
this.s = null;
}
if (this.t != null) {
this.t.b();
this.t = null;
}
if (this.u != null) {
this.u.b();
this.u = null;
}
if (this.v != null) {
this.v.b();
this.v = null;
}
this.i.b();
}
private boolean ah() {
if (this.h.s()) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.b(false, "anyway");
return;
}
if (message.what == 99 || message.what == 1) {
return;
}
if (gi.c(Main.this, R.string.tip_save_and_exit)) {
Main.this.b(true, "menu1");
} else {
gi.b(Main.this, R.string.tip_save_and_exit);
gf.a(Main.this, new Handler() {
@Override
public void handleMessage(Message message2) {
Main.this.b(true, "menu2");
}
}, R.string.tip_dialog_title, ct.a(Main.this, R.string.tip_save_and_exit, new Object[0]), R.string.button_label_ok, -1, -1, 4).a(Main.this);
}
}
}, R.string.confirm_dialog_cancel_title, ct.a(this, R.string.dc_confirm_cancel, new Object[0]), R.string.bl_exit, R.string.button_label_cancel, R.string.bl_save_first, 260).a(this);
return false;
}
if (!v(8)) {
t(2);
}
b(false, "checkcancel");
return true;
}
private void c(String str, boolean z) {
this.V = str;
d(4, z);
}
private void ai() {
u(128);
}
private void aj() {
b(Settings.a((Context) this, false, -1), 3);
}
private void ak() {
gw gwVar = this.v;
if (gwVar != null) {
gwVar.a(true);
}
}
private void al() {
gw gwVar = this.v;
if (gwVar != null) {
gwVar.a(false);
}
}
@Override
public void onDestroy() {
super.onDestroy();
bk();
g(false);
al();
ag();
a(false, "onDestroy");
System.gc();
}
@Override
public void onPause() {
bo.b("T", "onpause");
this.K = false;
ar();
am();
bo.b("T", "onpausedone");
bo.b("T", "Activity pausing. Launching activity: " + ae());
if (!ae()) {
gn.b("Main onPause");
}
super.onPause();
}
private void am() {
if (this.G != null) {
SharedPreferences.Editor edit = this.G.edit();
edit.putInt("spt", j());
Integer aK = aK();
if (aK != null) {
edit.putInt("ent", aK.intValue());
}
edit.commit();
}
}
private void a(final int i2, final Intent intent) {
this.i.g(new Runnable() {
@Override
public final void run() {
Main.this.f(i2, intent);
}
});
}
public void f(int i2, Intent intent) {
switch (i2) {
case 4:
case 5:
case 6:
case g.a.MapAttrs_latLngBoundsSouthWestLongitude:
case g.a.MapAttrs_latLngBoundsNorthEastLatitude:
case g.a.MapAttrs_latLngBoundsNorthEastLongitude:
ImageView imageView = this.E;
if (imageView != null) {
imageView.post(new Runnable() {
@Override
public final void run() {
Main.this.bz();
}
});
return;
}
return;
case 9:
if (df.c(this)) {
bq();
return;
} else {
b(false, "discfalse");
return;
}
case 11:
if (this.h != null) {
this.h.E();
return;
}
return;
case g.a.MapAttrs_zOrderOnTop:
case g.a.MapAttrs_cameraMinZoomPreference:
case g.a.MapAttrs_cameraMaxZoomPreference:
case 32:
a("oarc: kid/create");
return;
case 16:
gs.a(this, R.string.word_cancelled, new Object[0]);
a("oarc: spawn");
return;
case 27:
if (this.M == null || this.M.M() != 0) {
return;
}
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.f(new int[]{Main.this.M.K()});
} else {
Main.this.a(Main.this.M, true);
}
}
}, ct.a(this, R.string.dc_delete_unfinished_profile, new Object[0]));
return;
default:
return;
}
}
public void bz() {
if (isFinishing()) {
d(this, "is finishing handleOnActivityReturnCancelled");
} else {
ad();
}
}
private void c(final int i2, final Intent intent) {
this.i.g(new Runnable() {
@Override
public final void run() {
Main.this.e(i2, intent);
}
});
}
public void b(com.joaomgcd.taskerm.util.cr crVar) throws Exception {
if (crVar instanceof com.joaomgcd.taskerm.util.cs) {
gs.a((Context) this, ((com.joaomgcd.taskerm.util.cs) crVar).c());
} else {
gs.a(this, R.string.message_profiles_backed_up_google_drive, new Object[0]);
}
}
public void h(Intent intent) {
if (!cj.a(this, -1, intent, "keystore.auto")) {
gs.d(this, R.string.f_keystore_create_failed, new Object[0]);
} else {
this.i.a(a("keystore.auto", "bl^!)*(!*{a", "ImACertPass"), new Runnable() {
@Override
public final void run() {
Main.this.by();
}
});
}
}
public void by() {
a("cert");
}
public void e(int i2, final Intent intent) {
switch (i2) {
case 3:
x(Settings.a());
return;
case 4:
a((fx) new ao(new dh(intent.getBundleExtra("scntxt"))));
return;
case 5:
a((fx) new bn(new dh(intent.getBundleExtra("scntxt"))));
return;
case 6:
a(intent);
return;
case 7:
case 8:
return;
case 9:
br();
return;
case 10:
A();
return;
case 11:
c(intent);
return;
case g.a.MapAttrs_uiZoomControls:
f(intent);
return;
case g.a.MapAttrs_uiZoomGestures:
g(intent);
return;
case g.a.MapAttrs_useViewLifecycle:
RunLog.b valueOf = RunLog.b.valueOf(intent.getStringExtra(ProfileManager.EXTRA_PROFILE_NAME));
int intExtra = intent.getIntExtra("ID", Integer.MIN_VALUE);
switch (valueOf) {
case Profile:
a(intExtra);
return;
case Task:
case Action:
q(intExtra);
a(intExtra, -1, (String) null, 14);
return;
default:
return;
}
case g.a.MapAttrs_zOrderOnTop:
if (intent.hasExtra("b")) {
Bundle bundleExtra = intent.getBundleExtra("b");
if (bundleExtra != null) {
a(new bi(new dh(bundleExtra)));
return;
} else {
bo.c("T", "oar: null config data from KidConfig");
return;
}
}
bo.c("T", "oar: no config extra from KidConfig");
return;
case 16:
a("spawn ok");
return;
case g.a.MapAttrs_ambientEnabled:
File g2 = cj.g(this);
if (g2.exists()) {
g2.delete();
}
cj.a(this);
return;
case g.a.MapAttrs_cameraMinZoomPreference:
b(new Runnable() {
@Override
public final void run() {
Main.this.h(intent);
}
});
return;
case g.a.MapAttrs_cameraMaxZoomPreference:
b("dsclk", true);
q();
return;
case g.a.MapAttrs_latLngBoundsSouthWestLatitude:
aV();
return;
case g.a.MapAttrs_latLngBoundsSouthWestLongitude:
a((fx) new q(new dh(intent.getBundleExtra("ssc"))));
return;
case g.a.MapAttrs_latLngBoundsNorthEastLatitude:
a((fx) new ac(new dh(intent.getBundleExtra("context"))));
c(this.M);
return;
case g.a.MapAttrs_latLngBoundsNorthEastLongitude:
a((fx) new gh(new dh(intent.getBundleExtra("sTsc"))));
c(this.M);
return;
case 24:
b(this.T, intent.getExtras().getString("path"));
return;
case NotificationCompat.MessagingStyle.MAXIMUM_RETAINED_MESSAGES:
bh();
return;
case 26:
case 31:
default:
bo.c("T", "onActivityResult: bad request code: " + i2);
return;
case 27:
d(intent);
return;
case 28:
File file = new File(intent.getExtras().getString("path"));
String name = file.getName();
if (a(file.getParentFile(), name)) {
gs.a(this, R.string.message_profiles_backed_up, new Object[0]);
this.i.a(GenericActionBackupToGoogleDrive.backupToGoogleDrive(this, name), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.b((com.joaomgcd.taskerm.util.cr) obj);
}
});
return;
}
return;
case 29:
final com.joaomgcd.taskerm.j.d a2 = com.joaomgcd.taskerm.j.a.a(this, new File(intent.getExtras().getString("path")));
if (a2.k()) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.a((Context) Main.this, a2.l(), a2.c(), true);
}
}
}, R.string.dc_restore_data);
return;
} else {
gs.c(this, R.string.f_file_not_exist, a2);
return;
}
case 30:
at.a(this, -1, intent);
gs.a(this, R.string.button_label_ok, new Object[0]);
return;
case 32:
if (intent.hasExtra(com.joaomgcd.taskerm.datashare.export.f.b())) {
Bundle bundleExtra2 = intent.getBundleExtra(com.joaomgcd.taskerm.datashare.export.f.b());
if (bundleExtra2 != null) {
com.joaomgcd.taskerm.datashare.export.e b2 = com.joaomgcd.taskerm.datashare.export.e.b(new dh(bundleExtra2));
az azVar = (az) this.R;
if (azVar != null) {
azVar.a(b2);
f();
a("initkey");
com.joaomgcd.taskerm.datashare.export.f.a(this, this.h, azVar, b2);
return;
}
bo.c("T", "oar: null importable for ShareDataConfig");
return;
}
bo.c("T", "oar: null config data from ShareDataConfig");
return;
}
bo.c("T", "oar: no config extra from ShareDataConfig");
return;
}
}
@Override
protected void onActivityResult(int i2, int i3, Intent intent) {
this.K = true;
c("onActivityResult", false);
if (i2 == 26) {
return;
}
if (i3 == -1) {
c(i2, intent);
return;
}
if (i3 != 1) {
if (i3 == 0) {
a(i2, intent);
return;
} else {
if (i3 == 2) {
b(false, "licence");
return;
}
return;
}
}
if (i2 == 16 || i2 == 17 || i2 == 18) {
if (intent != null && intent.hasExtra("errMsg")) {
gs.a(this, "factory: " + intent.getStringExtra("errMsg"), new Object[0]);
return;
}
gs.d(this, R.string.f_export_failed, new Object[0]);
}
}
public void p(int i2) {
this.i.m();
gb k2 = this.h.k(i2);
if (k2 != null) {
k2.Q();
}
}
private void q(final int i2) {
fy fyVar = this.h;
if (fyVar == null) {
d(this, "gotoTask data null");
return;
}
ft j2 = fyVar.j(i2);
if (j2 == null) {
d(this, "gotoTask macroByID null");
return;
}
if (j2.n()) {
r(fyVar.u(i2));
a(ai.a.Task, "gotoTask");
ListView l2 = l();
if (l2 != null) {
l2.post(new Runnable() {
@Override
public void run() {
Main.this.o(i2);
}
});
return;
}
return;
}
List<Integer> m2 = fyVar.m(i2);
if (m2.size() > 0) {
a(m2.get(0).intValue());
}
}
public void a(int i2) {
a(i2, false);
}
public void a(final int i2, final boolean z) {
r(this.h.t(i2));
a(ai.a.Profile, "gotoProfile");
final ListView l2 = l();
if (l2 != null) {
l2.post(new Runnable() {
@Override
public void run() {
Main.this.a(l2, i2);
Main.this.p(i2);
if (z) {
Main.this.a(false, ai.a.Profile);
}
}
});
}
}
private void r(int i2) {
if (i2 < 0 || i() == i2) {
return;
}
c(g(i2));
}
public void a(ai.a... aVarArr) {
a(true, true, false, aVarArr);
}
private void b(ai.a... aVarArr) {
a(true, true, true, aVarArr);
}
public void a(boolean z, ai.a... aVarArr) {
a(true, z, false, aVarArr);
}
public void a(boolean z, boolean z2, boolean z3, ai.a... aVarArr) {
if (z) {
f();
}
final fy fyVar = this.h;
if (fyVar == null) {
d(this, "handleDataChanged data null");
return;
}
int length = aVarArr.length;
for (int i2 = 0; i2 < length; i2++) {
switch (aVarArr[i2]) {
case Profile:
if (this.s != null) {
this.s.a("dataChanged", Y(), fyVar);
break;
} else {
break;
}
case Task:
if (this.u != null) {
this.u.a(fyVar, i(), Z());
break;
} else {
break;
}
case Scene:
if (this.t != null) {
this.t.a(fyVar, i(), aa());
break;
} else {
break;
}
case Variable:
if (this.v != null) {
this.v.a(fyVar, i());
this.v.a();
break;
} else {
break;
}
}
}
if (z2) {
if (z3) {
com.joaomgcd.taskerm.rx.h.a(new Runnable() {
@Override
public final void run() {
Main.this.b(fyVar);
}
});
} else {
fyVar.a(getPackageManager(), ai.a.values());
}
}
an();
}
public void b(fy fyVar) {
fyVar.a(getPackageManager(), ai.a.values());
}
private void an() {
this.h.D();
this.h.a(getPackageManager());
}
public boolean a(Context context, File file, String str, boolean z) {
boolean z2;
if (this.h.a(context, file, str, z, false, true)) {
z2 = true;
if (!cj.b(this)) {
gs.a(this, R.string.f_keystore_restore_failed, new Object[0]);
} else {
gs.a(this, R.string.restored_from_backup, new Object[0]);
}
e(file);
ao();
} else {
gs.d(this, R.string.warn_read_backup_datafile, new Object[0]);
z2 = false;
}
f();
return z2;
}
public void ao() {
ap();
aH();
a(false, true, false, ai.a.values());
}
private boolean e(String str) {
try {
fy a2 = fy.a(fy.a.Passive, (Context) this, false);
if (a2 != null) {
this.h = a2;
} else {
try {
this.h = fy.d(this);
if (this.h == null) {
gs.c(this, R.string.warn_read_existing_datafile, new Object[0]);
} else {
bo.b("T", "loadData: p: " + this.h.A());
}
} catch (dh.b e2) {
gs.b(this, e2.a(this), new Object[0]);
bo.d("T", "loadData: object version exception");
}
}
} catch (OutOfMemoryError unused) {
gs.d(this, R.string.oom, new Object[0]);
bo.c("T", "loadData: oom");
System.exit(1);
}
if (this.h == null) {
bo.d("T", str + "failed to load data, creating new");
this.h = new fy();
} else {
bo.b("T", "loadData: done: p: " + this.h.A());
}
return false;
}
public void ap() {
fy fyVar = this.h;
if (fyVar == null) {
return;
}
fyVar.c((Context) this, true);
}
private void i(boolean z) {
if (z) {
this.x = new e(this);
this.x.sendEmptyMessageDelayed(0, 750L);
}
}
public boolean a(int i2, Object[] objArr) {
if (!gn.c(this)) {
return true;
}
b(false, i2, objArr);
return false;
}
private void b(gb gbVar) {
bn bnVar = gbVar == null ? null : (bn) gbVar.l(3);
int K = gbVar == null ? -1 : gbVar.K();
Intent intent = new Intent(this, (Class<?>) LocSelect.class);
intent.addFlags(67108864);
List<gb> a2 = this.h.a((Object[]) null, 3);
ArrayList<String> arrayList = new ArrayList<>();
for (int i2 = 0; i2 < a2.size(); i2++) {
gb gbVar2 = a2.get(i2);
bn bnVar2 = (bn) gbVar2.l(3);
if (K != gbVar2.K()) {
String b2 = bnVar2.a(0).b(0);
if (b2 == null) {
bo.d("T", "failed to pack loc context");
} else {
arrayList.add(b2);
}
}
}
if (arrayList.size() > 0) {
intent.putStringArrayListExtra("olcntxt", arrayList);
}
if (bnVar != null) {
intent.putExtra("scntxt", bnVar.a(0).c());
}
b(intent, 5);
}
private boolean f(String str) {
return !isFinishing() && this.K;
}
public boolean b(Intent intent, int i2) {
ai();
if (!f("subactivity " + i2)) {
return false;
}
try {
startActivityForResult(intent, i2);
c("startActivityResult", true);
return true;
} catch (ActivityNotFoundException unused) {
gs.d(this, R.string.f_no_app_found, intent.getAction());
return false;
} catch (Throwable th) {
gs.d(this, R.string.word_error, th.getMessage());
return false;
}
}
private void a(gb gbVar, ao aoVar) {
if (aoVar != null && an.q(aoVar.i()) && !di.a(di.a.Event, aoVar.i())) {
df.a(this, aoVar, di.a.Event, 1, 2);
return;
}
Intent intent = new Intent(this, (Class<?>) EventEdit.class);
intent.addFlags(67108864);
if (aoVar != null) {
intent.putExtra("scntxt", aoVar.a(0).c());
}
gx.a(this, this.h, (ft) null, intent, (Collection<String>) null, gbVar, Integer.valueOf(i()));
b(intent, 4);
}
private void a(gb gbVar, fp fpVar) {
if (fpVar != null && fo.b(fpVar.i()) && !di.a(di.a.Condition, fpVar.i())) {
df.a(this, fpVar, di.a.Condition, 1, 2);
return;
}
Intent intent = new Intent(this, (Class<?>) StateEdit.class);
intent.addFlags(67108864);
if (fpVar != null) {
intent.putExtra("scntxt", fpVar.a(0).c());
}
gx.a(this, this.h, (ft) null, intent, (Collection<String>) null, gbVar, Integer.valueOf(i()));
b(intent, 6);
}
private void s(int i2) {
a(i2, -1, (String) null, -1);
}
private void a(int i2, int i3, String str, int i4) {
Intent intent = new Intent(this, (Class<?>) MacroEdit.class);
intent.putExtra("son", true);
intent.putExtra("amt", -1);
intent.putExtra("tid", i2);
intent.putExtra(ProfileManager.EXTRA_PROFILE_NAME, str);
intent.putExtra("projectid", i());
MyActivity.a(intent, i4);
if (i3 != -1) {
intent.putExtra("actioncode", i3);
}
b(intent, 12);
}
private void d(gb gbVar, int i2) {
a(gbVar, i2, Integer.MIN_VALUE, (String) null);
}
private void a(gb gbVar, int i2, int i3, String str) {
Intent intent = new Intent(this, (Class<?>) MacroEdit.class);
this.P = i2;
this.M = gbVar;
intent.putExtra(ProfileManager.EXTRA_PROFILE_NAME, str);
if (i3 == Integer.MIN_VALUE) {
i3 = gbVar == null ? -1 : gbVar.n(i2);
}
intent.putExtra("son", gbVar != null);
Bundle a2 = com.joaomgcd.taskerm.util.an.a(this.h, this, gbVar, (Bundle) null, "startTaskEditWithTaskIDFromProfile");
if (gbVar != null && gbVar.a(this, a2)) {
i2 = 0;
}
intent.putExtra("amt", i2);
intent.putExtra("tid", i3);
intent.putExtra("projectid", i());
if (gbVar != null) {
intent.putExtra("profileid", gbVar.K());
}
b(intent, 27);
}
private void c(gb gbVar) {
if (gbVar != null && gbVar.j(2) && gbVar.j(1)) {
Bundle a2 = com.joaomgcd.taskerm.util.an.a(this.h, this, gbVar, (Bundle) null, "checkDayAndTimeTip");
gh ghVar = (gh) gbVar.l(1);
if (ghVar.m() && ghVar.o() && ghVar.a(this, a2) > ghVar.b(this, a2)) {
gi.b(this, 1, R.string.tip_day_and_time_contexts, 1);
}
}
}
private void a(File file) {
ay b2 = this.h.b(this, file, i());
if (b2.a()) {
gs.a(this, b2.a(this), new Object[0]);
return;
}
ft ftVar = (ft) b2.f12149c;
c(ai.a.Task);
int u = this.h.u(ftVar.G());
if (u != i()) {
r(u);
}
o(ftVar.G());
}
private void b(File file) {
ay a2 = this.h.a(this, file, i());
if (a2.a()) {
gs.a(this, a2.a(this), new Object[0]);
return;
}
dt dtVar = (dt) a2.f12149c;
c(ai.a.Scene);
c(dtVar.m());
}
private void c(ai.a... aVarArr) {
if (!gi.b(this, 1, R.string.tip_import, 1)) {
gs.a(this, R.string.button_label_done, new Object[0]);
}
a(aVarArr);
}
private void c(File file) {
ay c2 = this.h.c(this, file, i());
if (c2.a()) {
gs.a(this, c2.a(this), new Object[0]);
return;
}
gb gbVar = (gb) c2.f12149c;
c(ai.a.Profile, ai.a.Task);
a(l(), gbVar.K());
}
private void d(File file) {
ay a2 = this.h.a(this, getPackageManager(), file);
if (a2.f12148b == -1) {
aq();
c(ai.a.values());
} else {
gs.d(this, R.string.f_profile_import_failed, file.getName(), a2.a(this));
}
}
private void aq() {
cw cwVar = this.C;
if (cwVar == null) {
d(this, "addProjectTab projectTabs null");
return;
}
cwVar.a((Context) this, false);
cwVar.e();
this.s.a(i());
aI();
}
private void b(final dm dmVar) {
b(new Runnable() {
@Override
public final void run() {
Main.this.c(dmVar);
}
});
}
public void c(dm dmVar) {
if (a(dmVar.m(), this.h.a(getPackageManager(), dmVar), dm.a(this.F), ".prj.xml")) {
gs.a(this, R.string.button_label_done, new Object[0]);
}
}
private boolean a(String str, fy fyVar, File file, String str2) {
String str3 = gs.h(str) + str2;
final File file2 = new File(file, str3);
if (file2.exists()) {
file2.delete();
}
if (fyVar.a(this, file, str3, 6)) {
if (com.joaomgcd.taskerm.settings.ag.a(this)) {
this.i.a(com.joaomgcd.taskerm.dialog.y.a(this, str3, com.joaomgcd.taskerm.util.an.a(R.string.file_saved_to_x_ask_if_share, this, file2.getAbsolutePath())), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(file2, (com.joaomgcd.taskerm.dialog.x) obj);
}
});
} else {
com.joaomgcd.taskerm.util.ao.c(com.joaomgcd.taskerm.util.an.a(R.string.file_saved_to_x, this, file2.getAbsolutePath()), this);
}
return true;
}
gs.d(this, R.string.warn_write_datafile, new Object[0]);
return false;
}
public void a(File file, com.joaomgcd.taskerm.dialog.x xVar) throws Exception {
if (xVar.d()) {
com.joaomgcd.taskerm.util.dq.a(file, (Context) this, true, "Share File To");
}
}
private void ar() {
if (this.x == null || !this.x.hasMessages(0)) {
return;
}
this.x.removeMessages(0);
}
private void d(int i2, boolean z) {
if (z) {
this.L = i2 | this.L;
} else {
this.L = (~i2) & this.L;
}
}
private void t(int i2) {
d(i2, false);
}
public void u(int i2) {
d(i2, true);
}
private boolean v(int i2) {
return (i2 & this.L) > 0;
}
private boolean as() {
fy fyVar = this.h;
if (fyVar == null) {
d(this, "needGateLock data null");
return false;
}
try {
if (!gn.d(this)) {
return false;
}
if (fyVar.z(B(j())).A() || gn.b(this)) {
return this.Y;
}
return false;
} catch (Throwable th) {
bo.b("T", "needGateLock", th);
return false;
}
}
public void at() {
this.i.e();
if (au()) {
if (as()) {
b(true, 0, (Object[]) null);
return;
} else {
aC();
return;
}
}
int currentTimeMillis = (int) ((System.currentTimeMillis() - this.G.getLong(bh.o.f12242b, -1L)) / 86400000);
int i2 = 7 - currentTimeMillis;
Licence.a(this.G);
if (currentTimeMillis >= 7 && !p && a(fy.a(true), "backup.xml")) {
gs.b(this, R.string.message_profiles_backed_up, new Object[0]);
p = true;
}
if (i2 <= 0) {
f(true);
} else if (i2 <= 4) {
f(false);
} else {
Licence.a((Context) this);
}
}
private boolean au() {
gs.m();
return true;
}
public void a(ListView listView, int i2, String str) {
if (fa.d(this)) {
b(i2, "startDrag");
View childAt = listView.getChildAt(i2 - listView.getFirstVisiblePosition());
boolean z = true;
try {
if (((ai) listView.getAdapter().getItem(i2)).i()) {
z = a(15, (Object[]) null);
}
} catch (Exception unused) {
}
if (z) {
if (a((Context) this) && this.z.getVisibility() != 0) {
this.f11314e.a(listView, false, "T/startDrag");
}
he.a(listView, null, new cg(childAt), false, 0);
}
}
}
public boolean av() {
return this.F.getBoolean("anm", false);
}
public void aw() {
if (this.U >= 0) {
this.C.i();
this.f11314e.d();
this.f11314e.e();
}
this.f11314e.c();
b(-2, "clearDrag");
this.f11314e.i();
this.f11314e.a("clearDrag");
}
private void ax() {
this.u = new fu(this);
}
private void ay() {
this.v = new gw(this);
}
private void az() {
this.t = new ev(this);
}
private void aA() {
this.s = new dl(this, this.h, i(), Y());
this.s.a(this, this, this, this);
}
private void x(int i2) {
if ((i2 & 2) > 0) {
u(2);
}
if ((i2 & 32) > 0) {
Settings.a((Activity) this);
}
fu fuVar = this.u;
if ((i2 & 128) > 0 && fuVar != null) {
fuVar.notifyDataSetChanged();
aH();
aG();
}
dl dlVar = this.s;
if ((i2 & 8) > 0 && dlVar != null) {
dlVar.notifyDataSetInvalidated();
}
if ((i2 & 1) > 0) {
a(false, false, false, ai.a.Profile);
}
if ((i2 & NotificationCompat.FLAG_GROUP_SUMMARY) > 0) {
if (dlVar != null) {
dlVar.notifyDataSetInvalidated();
}
if (fuVar != null) {
fuVar.notifyDataSetInvalidated();
}
ev evVar = this.t;
if (evVar != null) {
evVar.notifyDataSetInvalidated();
}
gw gwVar = this.v;
if (gwVar != null) {
gwVar.notifyDataSetInvalidated();
}
}
aB();
u(8);
}
private void aB() {
for (ai.a aVar : ai.a.values()) {
if (a(aVar) != null) {
b(a(aVar));
}
}
}
public void b(int i2) {
int b2 = this.s.b(i2);
if ((b2 == -1 || b2 >= l().getFirstVisiblePosition()) && b2 <= l().getLastVisiblePosition()) {
return;
}
l().setSelectionFromTop(b2, 10);
}
private void aD() {
b(new Intent(this, (Class<?>) RunLog.class), 14);
}
public void aE() {
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.project_tab_host);
if (relativeLayout == null) {
d(this, "populateProjectTabs projectTabHost null");
return;
}
this.z = relativeLayout;
this.B = findViewById(R.id.project_host_shadow);
bd();
this.C = new cw(this, relativeLayout, cw.c.Filled, cw.a.No, 0, go.x(this), 0, true, go.a(60), -1);
if (go.f(this) == go.a.Tangerine) {
this.C.e(R.attr.drawableImageSelectIndicator);
}
this.C.a(new cw.b() {
@Override
public void a(int i2, int i3, int i4, int i5) {
}
@Override
public void a(int i2, int i3, boolean z) {
}
@Override
public void a(boolean z) {
}
@Override
public boolean a(int i2) {
int b2;
if (!Main.this.t()) {
return false;
}
int B = Main.this.B(i2);
ai.a aN = Main.this.aN();
switch (AnonymousClass60.f11431b[aN.ordinal()]) {
case 1:
b2 = Main.this.b(Main.this.i(), B);
break;
case 2:
b2 = Main.this.a(Main.this.i(), B);
break;
case 3:
b2 = Main.this.c(Main.this.i(), B);
break;
default:
b2 = 0;
break;
}
if (b2 > 0) {
Main.this.a(false, aN);
Main.this.a(false, ai.a.Variable);
}
Main.this.v();
return true;
}
@Override
public void b(int i2) {
Main.this.v();
if (i2 != -1 && Main.this.a(11, new Object[]{new Integer(i2)})) {
Main.this.j(i2);
}
}
@Override
public boolean b(int i2, int i3, boolean z) {
Main.this.v();
return Main.this.c(i3);
}
@Override
public void c(int i2) {
Main.this.v();
if (Main.this.a(11, new Object[]{new Integer(i2)})) {
Main.this.j(i2);
}
}
});
this.C.c(12);
aH();
}
public int aF() {
Rect rect = new Rect();
this.E.getHitRect(rect);
Rect rect2 = new Rect();
this.z.getHitRect(rect2);
return (rect2.right - rect.left) + go.a(5);
}
private void aG() {
for (ai.a aVar : ai.a.values()) {
b(aVar, a(aVar));
}
}
public void b(ai.a aVar, ListView listView) {
int e2;
if (listView != null) {
if (aVar == ai.a.Profile) {
listView.setClipToPadding(false);
e2 = (go.e(this, R.dimen.fab_margin_bottom) + go.e(this, R.dimen.fab_size)) - go.a(8);
} else {
e2 = (!a((Context) this) || av()) ? 0 : go.e(this, R.dimen.bottom_bar_height);
}
df.d(listView, e2);
}
}
public void aH() {
this.C.h();
for (int i2 = 0; i2 < this.h.A(); i2++) {
this.C.a((Context) this, false);
}
aI();
}
private boolean y(int i2) {
return i2 < X();
}
public void aI() {
dm a2;
for (int i2 = 0; i2 < this.C.g(); i2++) {
int B = B(i2);
if (B >= 0 && (a2 = this.h.a(B, "rpt")) != null) {
if (a2.i()) {
this.C.a(i2, B == 0 ? getString(R.string.default_project) : a2.m());
this.C.g(i2);
this.C.a(this, i2, a2.n());
} else {
this.C.h(i2);
this.C.a(i2, a2.m());
this.C.b(i2, 1);
}
this.C.a(this, B, gn.a(a2.A(), false, gn.d(this), gn.c()));
}
}
}
public void z(int i2) {
if (i2 < 0) {
d(this, "handleEntityTabLongClick tabNo < 0");
return;
}
this.T = C(i2);
cl clVar = new cl(this, b((View) this.D.i(i2), true));
boolean z = this.T == ai.a.Variable;
boolean z2 = this.T == ai.a.Scene;
boolean z3 = this.T == ai.a.Profile;
boolean z4 = this.T == ai.a.Task;
if (z) {
clVar.a(c.ClearAll.ordinal(), R.string.ml_clear_all, R.attr.iconTrash);
clVar.a(c.ToggleTools.ordinal(), R.string.word_filter, o() ? R.attr.iconRemove : R.attr.iconAdd);
} else {
clVar.a(c.SetSort.ordinal(), R.string.ml_set_sort, R.attr.iconSort);
int i3 = R.string.ml_import;
if (z3) {
i3 = R.string.ml_import_profile;
}
if (z4) {
i3 = R.string.ml_import_task;
}
if (z2) {
i3 = R.string.ml_import_scene;
}
clVar.a(c.Import.ordinal(), i3, R.attr.iconImport);
}
if (this.T == ai.a.Scene && ew.a() > 0) {
clVar.a(c.ClearAll.ordinal(), R.string.ml_destroy_all, R.attr.iconStopTasks);
}
if (this.T == ai.a.Task && gs.d(this, ExecuteService.class.getName())) {
clVar.a(c.ClearAll.ordinal(), R.string.bl_terminate_tasks, R.attr.iconStopTasks);
}
clVar.a(new AnonymousClass19(i2)).show();
}
public class AnonymousClass19 implements cl.c {
final int f11336a;
AnonymousClass19(int i) {
this.f11336a = i;
}
@Override
public void onDismiss(cl clVar) {
if (clVar.h()) {
return;
}
switch (AnonymousClass60.f11432c[c.values()[clVar.g()].ordinal()]) {
case 1:
Main.this.d(!Main.this.o());
Main.this.a(Main.this.o(), true, true, false);
Main.this.g.setText("");
return;
case 2:
Main.this.A(this.f11336a);
return;
case 3:
if (Main.this.T != ai.a.Scene) {
if (Main.this.T == ai.a.Task) {
gs.a((Context) Main.this, (Class<?>) ExecuteService.class);
ExecuteService.b(Main.this);
return;
} else {
Main.this.i.a(com.joaomgcd.taskerm.dialog.y.a(Main.this, R.string.ml_clear_all, R.string.really_clear_all_variable_values), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.AnonymousClass19.this.a((com.joaomgcd.taskerm.dialog.x) obj);
}
});
return;
}
}
ew.a(Main.this);
return;
case 4:
Main.this.b(Main.this.T);
return;
default:
return;
}
}
public void a(com.joaomgcd.taskerm.dialog.x xVar) throws Exception {
if (xVar.d()) {
gx.a((Context) Main.this, "", false, true, (Bundle) null);
Main.this.c(ai.a.Variable);
}
}
}
public void A(int i2) {
String[] a2;
int ordinal;
cl clVar = new cl(this, b((View) this.D.i(i2), true));
switch (this.T) {
case Profile:
a2 = ct.a(this, R.array.profile_list_sort);
ordinal = Y().ordinal();
break;
case Task:
a2 = ft.a(this.H);
ordinal = Z().ordinal();
break;
case Scene:
a2 = dt.b(this.H);
ordinal = aa().ordinal();
break;
default:
ordinal = -1;
a2 = null;
break;
}
for (int i3 = 0; i3 < a2.length; i3++) {
clVar.a(i3, a2[i3], (net.dinglisch.android.taskerm.g) null);
}
clVar.a(ordinal, true, false);
clVar.a(new cl.c() {
@Override
public void onDismiss(cl clVar2) {
if (clVar2.h()) {
return;
}
int g2 = clVar2.g();
int i4 = Main.this.i();
switch (AnonymousClass60.f11431b[Main.this.T.ordinal()]) {
case 1:
gb.b bVar = gb.b.values()[g2];
Main.this.h.a(i4, bVar);
Main.this.s.a(i4, bVar, true);
return;
case 2:
ft.c cVar = ft.c.values()[g2];
Main.this.h.c(i4, cVar);
Main.this.u.a(Main.this.h, i4, cVar);
return;
case 3:
dt.f fVar = dt.f.values()[g2];
Main.this.h.a(i4, fVar);
Main.this.t.a(Main.this.h, i4, fVar);
return;
default:
return;
}
}
}).show();
}
public void h() {
int i2;
int i3;
int i4;
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.entity_tab_host);
if (relativeLayout == null) {
d(this, "populateEntityTabs entityTabHost null");
return;
}
this.A = relativeLayout;
relativeLayout.removeAllViews();
if (go.v(this)) {
i2 = gp.i(this);
i3 = go.g(this);
i4 = go.w(this);
} else {
i2 = 0;
i3 = 0;
i4 = 0;
}
this.D = cw.a(this, relativeLayout, i2, i3, i4);
this.D.a(new cw.b() {
@Override
public void a(int i5, int i6, int i7, int i8) {
}
@Override
public void a(int i5, int i6, boolean z) {
}
@Override
public void a(boolean z) {
}
@Override
public boolean a(int i5) {
return false;
}
@Override
public boolean b(int i5, int i6, boolean z) {
boolean z2;
ListView a2;
if (!Main.n) {
return false;
}
Main.this.I.setCurrentItem(i6);
ai.a aVar = ai.a.values()[i6];
if (aVar == ai.a.Variable) {
Main.this.a(false, false, false, ai.a.Variable);
z2 = Main.this.o();
Main.this.bg();
} else {
z2 = false;
}
Main.this.a(z2, true, false, false);
if (!Main.a((Context) Main.this) || Main.this.z.getVisibility() == 0 || (a2 = Main.this.a(aVar)) == null || (a2.getLastVisiblePosition() - a2.getFirstVisiblePosition()) + 1 < a2.getAdapter().getCount()) {
return true;
}
Main.this.f11314e.a(a2, false, "T/entityDrag");
return true;
}
@Override
public void b(int i5) {
Main.this.z(i5);
}
@Override
public void c(int i5) {
bo.b("T", "tabReselect: enabled: " + Main.n + " " + System.currentTimeMillis());
if (Main.n) {
Main.this.z(i5);
}
}
});
this.D.c(12);
if (this.I == null) {
this.I = (ViewPager) findViewById(R.id.pager);
} else {
this.J.a(false);
}
this.J = new i(this, this.I);
Bundle bundle = new Bundle();
bundle.putString("type", ai.a.Profile.toString());
Bundle bundle2 = new Bundle();
bundle2.putString("type", ai.a.Task.toString());
Bundle bundle3 = new Bundle();
bundle3.putString("type", ai.a.Scene.toString());
Bundle bundle4 = new Bundle();
bundle4.putString("type", ai.a.Variable.toString());
Bundle[] bundleArr = {bundle, bundle2, bundle3, bundle4};
boolean c2 = Settings.c(gs.g(this));
for (ai.a aVar : ai.a.values()) {
if (!c2 || aVar != ai.a.Variable) {
this.J.a(f.class, bundleArr[aVar.ordinal()]);
this.D.a((Context) this, true);
this.D.h(aVar.ordinal());
this.D.a(aVar.ordinal(), ct.a(this, ai.a(aVar), new Object[0]));
}
}
this.J.notifyDataSetChanged();
}
public boolean c(int i2) {
dm a2 = this.h.a(B(i2), "hptc");
if (a2 == null) {
return false;
}
if (a2.A() && !a(10, new Object[]{Integer.valueOf(i2)})) {
return false;
}
this.C.d(i2);
a(aN(), "handleProjectTabClick");
this.C.d(i2);
bg();
aJ();
return true;
}
public void a(ai.a aVar, String str) {
a(aVar.ordinal(), str);
}
private void a(int i2, String str) {
int count;
if (this.J == null) {
bo.c("T", "selectEntityTab: " + str + ": no tabs adapter");
count = 0;
} else {
count = this.J.getCount();
}
if (i2 >= count) {
i2 = 0;
}
if (this.I == null) {
bo.c("T", "selectEntityTab: " + str + ": no view pager");
return;
}
if (this.I.getCurrentItem() != i2) {
this.I.setCurrentItem(i2);
}
}
private void aJ() {
for (ai.a aVar : ai.a.values()) {
c(aVar);
}
}
public void c(ai.a aVar) {
int i2 = i();
switch (aVar) {
case Profile:
dl dlVar = this.s;
if (dlVar == null) {
d(this, "updateEntityData profileAdapter is null");
return;
} else {
dlVar.a(i2, Y(), true);
return;
}
case Task:
fu fuVar = this.u;
if (fuVar == null) {
d(this, "updateEntityData taskAdapter is null");
return;
} else {
fuVar.a(this.h, i2, Z());
return;
}
case Scene:
ev evVar = this.t;
if (evVar == null) {
bo.d("T", "updateEntityData: no scene adapter");
d(this, "updateEntityData sceneAdapter is null");
return;
} else {
evVar.a(this.h, i2, aa());
return;
}
case Variable:
al();
gw gwVar = this.v;
if (gwVar == null) {
d(this, "updateEntityData variableAdapter is null");
return;
}
gwVar.a(this.h, i2);
gwVar.a();
ak();
return;
default:
return;
}
}
public void b(ListView listView) {
listView.setHapticFeedbackEnabled(false);
}
public int i() {
return B(j());
}
public int j() {
if (this.C == null) {
bo.c("T", "curTab: tabs null");
return 0;
}
return this.C.f();
}
public Integer aK() {
if (this.D == null) {
return null;
}
return Integer.valueOf(this.D.f());
}
public void b(boolean z, boolean z2) {
ViewGroup viewGroup = this.y;
if (viewGroup == null) {
d(this, "setEntityToolsVis entityToolsLayout null");
} else {
a(a(ai.a.Variable), z);
viewGroup.setVisibility(z ? 0 : 8);
}
}
private void j(boolean z) {
if (go.a()) {
ha.a(this.y, z ? go.e(this, R.dimen.top_bar_elevation) / 2 : 0);
}
}
public void a(ListView listView, boolean z) {
df.a(listView, z ? go.e(this, R.dimen.top_bar_height) : 0);
}
public void a(boolean z, boolean z2, boolean z3, final boolean z4) {
if (z3 || z != aL()) {
if (!z2 || !av()) {
b(z, z4);
} else if (z) {
this.y.setVisibility(0);
by.a(this, this.y, R.anim.movedownfromup, 0L, 200L, new by() {
@Override
public void a() {
Main.this.b(true, z4);
}
});
} else {
by.a(this, this.y, R.anim.moveupfromzero, 0L, 200L, new by() {
@Override
public void a() {
Main.this.b(false, z4);
}
});
}
}
}
public boolean aL() {
return this.y.getVisibility() == 0;
}
private void aM() {
ViewGroup viewGroup = (ViewGroup) findViewById(R.id.entity_tools);
if (viewGroup == null) {
d(this, "populateEntityTools entityToolsLayout null");
return;
}
this.y = viewGroup;
if (go.a()) {
viewGroup.setBackgroundColor(go.a(this, android.R.attr.panelBackground, "T/tools"));
j(true);
} else {
viewGroup.setBackgroundColor(go.m(this));
}
for (int i2 = 0; i2 < m.length; i2++) {
this.w[i2] = (ToggleButton) findViewById(m[i2]);
String a2 = ct.a(this, l[i2], new Object[0]);
this.w[i2].setTextOn(a2);
this.w[i2].setTextOff(a2);
this.w[i2].setChecked(this.F.getBoolean(j[i2], k[i2]));
this.w[i2].setOnClickListener(this);
}
this.g = (EditText) findViewById(R.id.tool_filter_text);
this.g.setHint(ct.a(this, R.string.hint_filter, new Object[0]));
this.g.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i3, int i4, int i5) {
}
@Override
public void afterTextChanged(Editable editable) {
Main.this.v.b(editable.toString());
Main.this.v.a();
}
});
}
public void d(int i2) {
this.M = null;
ft ftVar = (ft) this.u.getItem(i2);
if (ftVar == null) {
bo.d("T", "handleTaskClick: no task at position " + i2);
return;
}
this.P = ftVar.G();
if (!ftVar.i() || a(9, new Object[]{Integer.valueOf(i2)})) {
s(ftVar.G());
}
}
public void e(int i2) {
this.P = i2;
dt dtVar = (dt) this.t.getItem(this.P);
if (!dtVar.i() || a(8, new Object[]{Integer.valueOf(i2)})) {
a(dtVar.m(), (String) null, -1);
}
}
private ai.a C(int i2) {
return ai.a.values()[i2];
}
public ai.a aN() {
Integer aK = aK();
if (aK == null) {
d(this, "curEntity tabNo null");
return ai.a.Profile;
}
return C(aK.intValue());
}
public boolean a(String str, boolean z, ai.a aVar) {
if (str.length() == 0) {
gs.a(this, R.string.f_need_name, new Object[0]);
} else if (z) {
gs.d(this, R.string.f_name_already_exists, str);
} else {
if (aVar == null || aVar != ai.a.Scene) {
return true;
}
if (ex.c(str)) {
gs.d(this, R.string.f_reserved_scene_name, str);
} else {
if (!str.contains(dm.g())) {
return true;
}
gs.d(this, R.string.f_name_cannot_contain, ct.a(this, R.string.word_scene, new Object[0]), dm.g());
}
}
return false;
}
public void a(ai.a aVar, ListView listView) {
switch (aVar) {
case Profile:
listView.setClickable(false);
listView.setLongClickable(false);
return;
case Task:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j2) {
if (Main.this.u()) {
return;
}
Main.this.d(i2);
}
});
return;
case Scene:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j2) {
Main.this.M = null;
if (Main.this.u()) {
return;
}
Main.this.e(i2);
}
});
return;
case Variable:
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i2, long j2) {
View findViewById;
Main.this.M = null;
if (Main.this.u()) {
return;
}
if (Main.this.bf()) {
findViewById = Main.this.D.i(ai.a.Variable.ordinal());
} else {
findViewById = view.findViewById(R.id.value);
}
Main.this.a((gu) Main.this.v.getItem(i2), findViewById, (ListView) adapterView, i2);
}
});
return;
default:
return;
}
}
private void a(final List<Object> list, final d dVar) {
b(new Runnable() {
@Override
public final void run() {
Main.this.a(dVar, list);
}
});
}
public void a(final d dVar, final List list) {
this.i.a(dVar, new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.d(list, dVar, (com.joaomgcd.taskerm.f.g) obj);
}
});
}
public void d(List list, d dVar, com.joaomgcd.taskerm.f.g gVar) throws Exception {
String a2;
Iterator it = list.iterator();
boolean z = true;
StringBuilder sb = null;
boolean z2 = true;
while (true) {
if (!it.hasNext()) {
break;
}
ft ftVar = (ft) it.next();
if (dVar == d.AsApp) {
a(ftVar);
} else if (dVar == d.ToLink) {
a((az) ftVar, false);
} else if (dVar == d.ToUri) {
a((az) ftVar, true);
} else if (dVar == d.XmlToSD) {
if (!a(ftVar.m(), this.h.c(ftVar), ft.u(), ".tsk.xml")) {
z = false;
break;
}
} else {
if (dVar == d.DescrToClip || dVar == d.DescrToEmail) {
a2 = this.h.a(this, ftVar, this.H, gVar);
} else {
fy c2 = this.h.c(ftVar);
a2 = c2 != null ? c2.a(this, 2) : null;
}
if (sb == null) {
sb = new StringBuilder();
} else {
sb.append("\n");
}
sb.append(a2);
}
z2 = false;
}
if (z) {
if (sb != null) {
a(sb.toString(), dVar);
}
if (z2) {
gs.a(this, R.string.button_label_done, new Object[0]);
}
}
}
private void b(final List<Object> list, final d dVar) {
b(new Runnable() {
@Override
public final void run() {
Main.this.c(list, dVar);
}
});
}
public void c(List list, d dVar) {
boolean z;
String a2;
Iterator it = list.iterator();
StringBuilder sb = null;
while (true) {
if (!it.hasNext()) {
z = true;
break;
}
dt dtVar = (dt) it.next();
if (dVar == d.XmlToSD) {
if (!a(dtVar.m(), this.h.a(dtVar), dt.u(), ".scn.xml")) {
z = false;
break;
}
} else {
if (dVar == d.DescrToClip || dVar == d.DescrToEmail) {
a2 = this.h.a(dtVar, this.H);
} else {
fy a3 = this.h.a(dtVar);
a2 = a3 != null ? a3.a(this, 2) : null;
}
if (sb == null) {
sb = new StringBuilder();
} else {
sb.append("\n");
}
sb.append(a2);
}
}
if (z) {
if (sb != null) {
a(sb.toString(), dVar);
}
gs.a(this, R.string.button_label_done, new Object[0]);
}
}
private boolean a(String str, d dVar) {
if (str == null) {
gs.d(this, R.string.f_no_export_desc, new Object[0]);
return false;
}
if (dVar == d.DescrToEmail || dVar == d.XmlToEmail) {
d(str, dVar == d.XmlToEmail);
return true;
}
return g(str);
}
private void a(final List<Object> list, final d dVar, final com.joaomgcd.taskerm.f.g gVar) {
b(new Runnable() {
@Override
public final void run() {
Main.this.c(list, dVar, gVar);
}
});
}
public void c(List list, d dVar, com.joaomgcd.taskerm.f.g gVar) {
boolean z;
String a2;
Iterator it = list.iterator();
StringBuilder sb = null;
while (true) {
z = true;
if (!it.hasNext()) {
break;
}
gb gbVar = (gb) it.next();
if (dVar == d.XmlToSD) {
if (!a(gbVar.m(), this.h.a(gbVar), gb.a(this.F), ".prf.xml")) {
z = false;
break;
}
} else if (dVar == d.ToLink) {
a((az) gbVar, false);
} else if (dVar == d.ToUri) {
a((az) gbVar, true);
} else {
if (dVar == d.DescrToClip || dVar == d.DescrToEmail) {
a2 = this.h.a(gbVar, (Context) this, true, gVar);
} else {
fy a3 = this.h.a(gbVar);
a2 = a3 != null ? a3.a(this, 2) : null;
}
if (sb == null) {
sb = new StringBuilder();
} else {
sb.append("\n");
}
sb.append(a2);
}
}
if (z) {
if (sb != null) {
a(sb.toString(), dVar);
}
gs.a(this, R.string.button_label_done, new Object[0]);
}
}
private boolean g(String str) {
if (cc.a(this, str, cc.a.None)) {
return true;
}
gs.d(this, R.string.err_no_clipboard_manager, new Object[0]);
return false;
}
private void d(String str, boolean z) {
Intent intent = new Intent("android.intent.action.SEND");
intent.putExtra("android.intent.extra.TEXT", str);
intent.setType(z ? "text/xml" : "text/plain");
b(intent, -1);
}
public void k() {
Iterator<dt> it = this.h.b(-2, dt.f.User, true).iterator();
while (it.hasNext()) {
ew.e(this, it.next());
}
}
private boolean aO() {
return (aN() == ai.a.Task && Z() == ft.c.User) || (aN() == ai.a.Scene && aa() == dt.f.User) || (aN() == ai.a.Profile && Y() == gb.b.User);
}
public void aP() {
if (this.F.getString("lcD", "").length() == 0) {
gi.a(this, R.string.tip_need_lock_code);
}
}
private void e(File file) {
boolean z;
int n2;
int u;
Iterator<String> it;
Iterator<Integer> it2;
boolean z2 = file == null;
fs[] fsVarArr = new fs[6];
if (z2) {
fs.a(gs.h(this), fsVarArr);
} else {
fs.a(this, file, "usertabs.xml", fsVarArr);
}
int i2 = 1;
for (fs fsVar : fsVarArr) {
if (fsVar != null && fsVar.a()) {
StringBuilder sb = new StringBuilder();
sb.append("P");
int i3 = i2 + 1;
sb.append(String.valueOf(i2));
dm dmVar = new dm(sb.toString());
dmVar.a(gb.b.values()[fsVar.c()]);
if (fsVar.b()) {
dmVar.a(fsVar.d());
}
this.h.a(dmVar);
i2 = i3;
}
}
this.h.c((Context) this, false);
if (z2) {
fs.a(gs.h(this));
}
Map<Integer, ArrayList<String>> e2 = fs.e();
if (e2 != null) {
Iterator<Integer> it3 = e2.keySet().iterator();
while (true) {
if (!it3.hasNext()) {
z = false;
break;
}
int intValue = it3.next().intValue();
if (intValue != -1 && intValue != 0) {
z = true;
break;
}
}
for (Integer num : e2.keySet()) {
if (num.intValue() == -1) {
if (!z) {
if (num.intValue() != -1 || this.h.A() > num.intValue()) {
dm a2 = this.h.a(num.intValue() != -1 ? 0 : num.intValue(), "iadti");
List<Integer> p2 = a2.p();
a2.t();
int[] iArr = new int[e2.get(num).size()];
Arrays.fill(iArr, -1);
it = e2.get(num).iterator();
while (it.hasNext()) {
String[] split = it.next().split(",");
int parseInt = Integer.parseInt(split[0]);
int parseInt2 = Integer.parseInt(split[1]);
if (parseInt2 >= iArr.length) {
bo.d("T", "pid " + parseInt + " wants position " + parseInt2 + ", only " + iArr.length + " spaces ");
} else {
iArr[parseInt2] = parseInt;
}
}
for (int i4 : iArr) {
if (i4 != -1) {
a2.e(i4);
}
}
it2 = p2.iterator();
while (it2.hasNext()) {
a2.e(it2.next().intValue());
}
} else {
bo.d("T", "skip tab " + num + ", not that many projects");
}
}
} else if (z) {
if (num.intValue() != -1) {
}
dm a22 = this.h.a(num.intValue() != -1 ? 0 : num.intValue(), "iadti");
List<Integer> p22 = a22.p();
a22.t();
int[] iArr2 = new int[e2.get(num).size()];
Arrays.fill(iArr2, -1);
it = e2.get(num).iterator();
while (it.hasNext()) {
}
while (r9 < r5) {
}
it2 = p22.iterator();
while (it2.hasNext()) {
}
}
}
for (int i5 = 0; i5 < this.h.A(); i5++) {
for (gb gbVar : this.h.B(i5)) {
for (int i6 = 0; i6 < 2; i6++) {
if (gbVar.k(i6) && (u = this.h.u((n2 = gbVar.n(i6)))) != i5) {
if (u != -1) {
this.h.e(u, n2);
}
this.h.b(n2, i5);
}
}
}
}
for (int A = this.h.A() - 1; A > 0; A--) {
if (this.h.D(A) == 0) {
this.h.a(getPackageManager(), A, false);
}
}
this.h.h(this);
fs.f();
this.h.e(false);
}
}
private boolean aQ() {
return Settings.c(this.F);
}
public void f(final int i2) {
if (this.z != null) {
this.z.post(new Runnable() {
@Override
public void run() {
if (Main.this.C != null) {
Main.this.C.m(Main.this.aF());
Main.this.C.a(i2);
}
}
});
}
}
private void aR() {
SharedPreferences sharedPreferences = this.G;
if (sharedPreferences == null) {
d(this, "setInitialProjectTab state null");
return;
}
int i2 = sharedPreferences.getInt("spt", 0);
if (i2 >= this.h.A() || i2 < 0) {
bo.c("T", "sip: bad project: " + i2 + ", resetting to 0");
i2 = 0;
}
this.C.d(i2);
}
public void aS() {
b(new Intent(this, (Class<?>) CreateKeyStore.class), 17);
}
private void a(bi biVar) {
fy fyVar = this.S;
if (fyVar == null) {
d(this, "initKeyStoreOrLaunchFactory appExportData null");
return;
}
fyVar.a(0, "ikslf").a(biVar);
if (this.R.getClass().equals(ft.class)) {
((ft) this.R).a(biVar);
} else {
((dm) this.R).a(biVar);
}
f();
if (cj.c(this)) {
bo.b("T", "Spawn have user key");
gf.a(new AnonymousClass30(), com.joaomgcd.taskerm.util.an.a(R.string.pl_cert_password, this, new Object[0]), null, com.joaomgcd.taskerm.util.an.a(R.string.button_label_ok, this, new Object[0]), com.joaomgcd.taskerm.util.an.a(R.string.button_label_cancel, this, new Object[0]), null, 37, null, 128, null, null).a(this);
return;
}
bo.b("T", "Spawn don't have user key");
if (cj.d(this)) {
bo.b("T", "Spawn have basic key");
this.i.a(a("keystore.auto", "bl^!)*(!*{a", "ImACertPass"), new Runnable() {
@Override
public final void run() {
Main.this.bx();
}
});
return;
}
bo.b("T", "Spawn don't have basic key");
Intent e2 = cj.e(this);
if (e2 != null) {
b(e2, 18);
} else {
gs.d(this, R.string.f_keystore_create_failed, new Object[0]);
a("initkey3");
}
}
public class AnonymousClass30 extends Handler {
AnonymousClass30() {
}
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.i.a(Main.this.a("keystore.user", "bl^!)*(!*{a", message.getData().getString("text")), new Runnable() {
@Override
public final void run() {
Main.AnonymousClass30.this.a();
}
});
}
}
public void a() {
Main.this.a("initkey");
}
}
public void bx() {
a("initkeybas");
}
private void aT() {
File a2 = dk.a();
if (a2 == null) {
gs.d(this, R.string.err_no_sd, new Object[0]);
return;
}
String libraryTemplate = bf.getLibraryTemplate();
File file = new File(a2, bf.EXPORT_FILENAME);
if (gs.a(libraryTemplate, file, false)) {
gs.a(this, R.string.f_wrote_file, file);
} else {
gs.d(this, R.string.f_write_file_fail, file);
}
}
private void aU() {
b(new Intent(this, (Class<?>) Search.class), 20);
}
private void aV() {
fc a2 = Search.a();
if (a2 == null) {
return;
}
List<Object> c2 = a2.c();
if (c2.size() > 0) {
r(g(c2.get(0).getClass() == dm.class ? this.h.s(((dm) c2.remove(0)).m()) : 0));
if (c2.size() > 0) {
Collections.reverse(c2);
Object remove = c2.remove(0);
Class<?> cls = remove.getClass();
Class<? super Object> superclass = cls.getSuperclass();
if (cls == gb.class) {
a(((gb) remove).K());
return;
}
if (cls == bm.class) {
a((bm) remove, c2);
return;
}
if (cls == dt.class) {
a((dt) remove, (du) null);
return;
}
if (superclass == du.class || superclass == er.class) {
a((du) remove, c2);
return;
}
if (cls == ft.class) {
a((ft) remove, (net.dinglisch.android.taskerm.c) null, c2);
return;
}
if (cls == net.dinglisch.android.taskerm.c.class) {
a((net.dinglisch.android.taskerm.c) remove, c2);
return;
}
if (superclass == fx.class) {
a((fx) remove, c2);
return;
}
if (cls == hj.class || superclass == hj.class || cls == z.class) {
Object remove2 = c2.remove(0);
Class<?> cls2 = remove2.getClass();
Class<? super Object> superclass2 = cls2.getSuperclass();
if (cls2 == net.dinglisch.android.taskerm.c.class) {
a((net.dinglisch.android.taskerm.c) remove2, c2);
return;
}
if (cls2 == ao.class) {
a((fx) remove2, c2);
return;
}
if (cls2 == fp.class) {
a((fx) remove2, c2);
} else if (superclass2 == du.class || superclass2 == er.class) {
a((du) remove2, c2);
}
}
}
}
}
private void a(du duVar, List<Object> list) {
a((dt) list.remove(0), duVar);
}
private void a(fx fxVar, List<Object> list) {
gb gbVar = (gb) list.remove(0);
a(ai.a.Profile, "handleCSR");
this.P = fxVar.z();
a(gbVar, this.P, false);
}
private void a(ft ftVar, net.dinglisch.android.taskerm.c cVar, List<Object> list) {
int G = ftVar.G();
q(G);
if (ftVar.i() && gn.c(this)) {
gs.d(this, R.string.f_not_available_when_locked, new Object[0]);
} else {
a(G, cVar == null ? -1 : ftVar.b(cVar), (String) null, 20);
}
}
private void a(net.dinglisch.android.taskerm.c cVar, List<Object> list) {
Object remove = list.remove(0);
if (remove.getClass() == ft.class) {
a((ft) remove, cVar, list);
} else if (remove.getClass() == bm.class) {
a((bm) remove, list);
}
}
private void a(bm bmVar, List<Object> list) {
Object remove = list.remove(0);
if (remove.getClass() == net.dinglisch.android.taskerm.c.class) {
a((ft) list.remove(0), (net.dinglisch.android.taskerm.c) remove, list);
} else if (remove.getClass() == ef.class || remove.getClass() == eo.class || remove.getClass() == ek.class) {
a((dt) list.remove(0), (ed) remove);
}
}
private void a(dt dtVar, du duVar) {
a(ai.a.Scene, "handleSSR");
if (dtVar.i() && gn.c(this)) {
gs.d(this, R.string.f_not_available_when_locked, new Object[0]);
} else if (duVar == null) {
a(dtVar.m(), (String) null, 20);
} else {
a(dtVar.m(), duVar.n(), 20);
}
}
public void b(final View view) {
boolean z;
String[] strArr = new String[8];
Resources resources = this.H;
if (resources == null) {
d(this, "showContextSelectDialog res null");
return;
}
int i2 = 0;
int i3 = 0;
int i4 = 0;
while (true) {
if (i2 >= 8) {
break;
}
if (this.M == null || !this.M.j(i2)) {
if (fx.n(i2)) {
z = i4 <= 0;
i4++;
}
if (z) {
strArr[i3] = fx.d(resources, i2);
i3++;
}
}
i2++;
}
String[] strArr2 = new String[i3];
while (true) {
int i5 = i3 - 1;
if (i3 <= 0) {
break;
}
strArr2[i5] = strArr[i5];
i3 = i5;
}
int[] iArr = new int[strArr2.length];
int[] iArr2 = new int[strArr2.length];
for (int i6 = 0; i6 < iArr.length; i6++) {
String str = strArr2[i6];
int i7 = 0;
while (true) {
if (i7 >= 8) {
break;
}
if (fx.d(resources, i7).equals(str)) {
iArr[i6] = fx.l(i7);
iArr2[i6] = i7;
break;
}
i7++;
}
}
if (this.M != null && this.M.H() != 0) {
z = false;
}
if (view == null) {
view = this.E;
}
cl clVar = new cl(this, view);
for (int i8 = 0; i8 < strArr2.length; i8++) {
clVar.a(iArr2[i8], strArr2[i8], iArr[i8]);
}
if (z && aQ()) {
clVar.a(R.string.context_select_dialog_title_first);
}
clVar.a(new cl.c() {
@Override
public void onDismiss(cl clVar2) {
if (clVar2.h()) {
return;
}
Main.this.P = clVar2.g();
if (Main.this.P != 3 || Main.this.h.x(3).size() <= 0) {
if (Main.this.M != null && fx.n(Main.this.P)) {
int i9 = 4;
while (true) {
if (i9 > 6) {
break;
}
if (!Main.this.M.j(i9)) {
Main.this.P = i9;
break;
}
i9++;
}
}
Main.this.a(Main.this.M, Main.this.P, true);
return;
}
Main.this.c(view);
}
}).show();
}
public void c(View view) {
cl clVar = new cl(this, view);
final List<String> x = this.h.x(3);
for (int i2 = 0; i2 < x.size(); i2++) {
clVar.a(i2, x.get(i2), R.attr.iconContextLoc);
}
clVar.b().a(9535435, R.string.ml_new_location, R.attr.iconAdd, cl.a.Top).a(new cl.c() {
@Override
public void onDismiss(cl clVar2) {
if (clVar2.h()) {
return;
}
int g2 = clVar2.g();
if (g2 == 9535435) {
Main.this.a(Main.this.M, 3, true);
} else {
Main.this.a(Main.this.h.b((String) x.get(g2), 3));
}
}
}).a(R.string.dt_locselect).show();
}
private void e(Menu menu) {
if (MyAccessibilityService.b()) {
menu.add(0, 57, 0, ct.a(this, R.string.an_dialog_accessibility_settings, new Object[0]));
}
menu.add(0, 62, 0, ct.a(this, R.string.ml_android_settings_package_usage_stats, new Object[0]));
menu.add(0, 59, 0, ct.a(this, R.string.ml_android_settings_device_admin, new Object[0]));
if (bq.c()) {
menu.add(0, 61, 0, ct.a(this, R.string.ml_android_settings_overlays, new Object[0]));
}
if (at.a() && bw.z.a()) {
menu.add(0, 55, 0, ct.a(this, R.string.ml_grant_doctree_access, new Object[0]));
}
if (gs.l() >= 22) {
menu.add(0, 56, 0, ct.a(this, R.string.ml_android_settings_notification_listener, new Object[0]));
}
if (gs.t()) {
menu.add(0, 64, 0, ct.a(this, R.string.ml_android_dnd_access, new Object[0]));
menu.add(0, 58, 0, ct.a(this, R.string.sn_power_save_mode, new Object[0]));
}
menu.add(0, 63, 0, ct.a(this, R.string.ml_android_settings_tasker, new Object[0]));
if (bq.a()) {
menu.add(0, 60, 0, ct.a(this, R.string.ml_android_settings_write_settings, new Object[0]));
}
if (bq.a()) {
menu.add(0, 80, 0, ct.a(this, R.string.ml_android_settings_assistant_settings, new Object[0]));
}
if (com.joaomgcd.taskerm.util.g.e()) {
menu.add(0, 69, 0, ct.a(this, R.string.ml_android_spam_caller_id_settings, new Object[0]));
}
if (com.joaomgcd.taskerm.util.g.h()) {
menu.add(0, 73, 0, ct.a(this, R.string.ml_manage_all_files, new Object[0]));
}
}
private void f(Menu menu) {
boolean a2 = fi.a((Context) this);
boolean z = a2 && cj.f(this).exists();
if (a2) {
if (z) {
menu.add(0, 35, 0, ct.a(this, R.string.ml_cert_checksum, new Object[0]));
} else {
menu.add(0, 40, 0, ct.a(this, R.string.ml_create_keystore, new Object[0]));
}
}
if (z) {
menu.add(0, 36, 0, ct.a(this, R.string.ml_delete_keystore, new Object[0]));
}
menu.add(0, 37, 0, ct.a(this, R.string.ml_write_capabilities, new Object[0]));
menu.add(0, 38, 0, ct.a(this, R.string.ml_write_datadef, new Object[0]));
menu.add(0, 39, 0, ct.a(this, R.string.ml_save_js_template, new Object[0]));
}
private boolean a(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case 35:
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
String a2 = cj.a(Main.this, message.getData().getString("text"));
if (a2 == null) {
gs.d(Main.this, R.string.fi_mkdir_fail, ct.a(Main.this, R.string.ml_cert_checksum, new Object[0]));
} else {
gf.a(Main.this, (Handler) null, R.string.ml_cert_checksum, a2, R.string.button_label_ok, -1, -1, 521).a(Main.this);
}
}
}, R.string.dt_enter_password, (String) null, R.string.button_label_ok, R.string.button_label_cancel, -1, 229).a(this);
return true;
case 36:
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
File f2 = cj.f(Main.this);
if (f2 == null || !f2.delete()) {
gs.d(Main.this, R.string.fi_failed_delete_file, f2.getName());
} else {
gs.a(Main.this, R.string.button_label_ok, new Object[0]);
}
}
}
}, R.string.dc_confirm_delete_keystore);
return true;
case 37:
if (fy.a("capabilities.xml") != null) {
gs.a(this, R.string.button_label_ok, new Object[0]);
}
return true;
case 38:
if (fy.a(this.H, "datadef.xml", true) != null) {
gs.a(this, R.string.button_label_ok, new Object[0]);
}
return true;
case 39:
aT();
return true;
case 40:
if (cj.f(this).exists()) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.aS();
}
}
}, R.string.dc_confirm_create_keystore);
} else {
aS();
}
return true;
default:
return false;
}
}
private void aW() {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.deleteFile("autobackup.xml");
Main.this.h.g("ui");
Main.this.ap();
Main.this.aH();
Main.this.C.d(0);
Main.this.s.a(0, Main.this.Y(), false);
Main.this.u(64);
Main.this.u(8);
Main.this.a(false, true, false, ai.a.values());
Main.this.a(ai.a.Profile, "showConfirmClearData");
Main.this.invalidateOptionsMenu();
}
}
}, R.string.dc_clear_data);
}
private void a(final gb gbVar, final int i2, final View view, int i3) {
cl clVar = new cl(this, view);
if (gbVar.I() < 4) {
clVar.a(a.Add.ordinal(), R.string.pl_add, R.attr.iconAdd);
}
if (!Settings.c(this.F)) {
clVar.a(a.Clone.ordinal(), R.string.ml_clone, R.attr.iconCopy);
}
clVar.a(a.Delete.ordinal(), R.string.ml_delete, R.attr.iconTrash);
clVar.a(a.Name.ordinal(), gbVar.l(i2).w() ? R.string.ml_rename : R.string.pl_name, R.attr.iconName);
clVar.a(new cl.c() {
@Override
public void onDismiss(cl clVar2) {
if (clVar2.h()) {
return;
}
switch (AnonymousClass60.f11433d[a.values()[clVar2.g()].ordinal()]) {
case 1:
Main.this.b(view);
return;
case 2:
if (Main.this.ac()) {
Main.this.a(ai.a.Profile);
return;
}
return;
case 3:
Main.this.a(gbVar, gbVar.l(i2), view);
return;
case 4:
gb c2 = Main.this.h.c(gbVar, Main.this.P);
c2.a((String) null);
Main.this.a(ai.a.Profile);
Main.this.M = c2;
Main.this.a(Main.this.l(), Main.this.M.K());
Main.this.a(c2, true);
return;
default:
return;
}
}
}).show();
}
private void a(final View view, final gb gbVar, final int i2, final int i3) {
char c2;
boolean k2 = gbVar.k(0);
boolean k3 = gbVar.k(1);
boolean n2 = this.h.b(gbVar, i2).n();
boolean a2 = gbVar.a(this, com.joaomgcd.taskerm.util.an.a(this.h, this, gbVar, (Bundle) null, "showTaskOptionsFromProfile"));
cl clVar = new cl(this, view);
String a3 = ct.a(this, R.string.word_enter, new Object[0]);
String a4 = ct.a(this, R.string.word_exit, new Object[0]);
if (!k2) {
if (a2) {
clVar.a(k.Add.ordinal(), R.string.ml_add_task, R.attr.iconAdd);
} else {
clVar.a(k.AddEnter.ordinal(), ct.a(this, R.string.ml_add_task_of_type, a3), R.attr.iconEnterTask);
}
}
if (!k3) {
if (a2) {
clVar.a(k.Add.ordinal(), R.string.ml_add_task, R.attr.iconAdd);
} else {
clVar.a(k.AddExit.ordinal(), ct.a(this, R.string.ml_add_task_of_type, a4), R.attr.iconExitTask);
}
}
if (!a2) {
if (k2) {
c2 = 0;
} else {
c2 = 0;
clVar.a(k.MoveToEnter.ordinal(), ct.a(this, R.string.ml_move_to_x, a3), R.attr.iconSwap);
}
if (!k3) {
int ordinal = k.MoveToExit.ordinal();
Object[] objArr = new Object[1];
objArr[c2] = a4;
clVar.a(ordinal, ct.a(this, R.string.ml_move_to_x, objArr), R.attr.iconSwap);
}
}
if (!n2) {
clVar.a(k.Name.ordinal(), R.string.pl_name, R.attr.iconName);
}
clVar.a(k.Reselect.ordinal(), R.string.ml_reselect_task, R.attr.iconSelectionMode);
clVar.a(k.Unlink.ordinal(), R.string.ml_unlink_task, R.attr.iconRemove);
clVar.a(new cl.c() {
@Override
public void onDismiss(cl clVar2) {
if (clVar2.h()) {
return;
}
switch (AnonymousClass60.f11434e[k.values()[clVar2.g()].ordinal()]) {
case 1:
Main.this.a(view, (ai) Main.this.h.b(gbVar, i2), false, i3);
return;
case 2:
Main.this.a(Main.this.M, Main.this.P);
return;
case 3:
if (Main.this.P == 0) {
Main.this.P = 1;
} else {
Main.this.P = 0;
}
Main.this.a(j.ProfileAddOfType, view, Main.this.M, Main.this.P);
return;
case 4:
Main.this.a(j.ProfileAddOfType, view, Main.this.M, 1);
return;
case 5:
case 6:
int i4 = Main.this.P == 0 ? 1 : 0;
int n3 = Main.this.M.n(Main.this.P);
Main.this.M.a(Main.this.P, -1);
Main.this.M.a(i4, n3);
Main.this.h.a((ai) Main.this.M);
Main.this.a(false, ai.a.Profile);
return;
case 7:
Main.this.a(j.ProfileAddOfType, view, Main.this.M, 0);
return;
case 8:
Main.this.a(j.ProfileReselect, view, Main.this.M, Main.this.P);
return;
default:
return;
}
}
}).show();
}
public ListView a(ai.a aVar) {
return a(Integer.valueOf(aVar.ordinal()));
}
public ListView a(Integer num) {
if (this.J == null) {
return null;
}
return this.J.a(num);
}
public ListView l() {
return a(aK());
}
private void aX() {
b(new Runnable() {
@Override
public final void run() {
Main.this.aY();
}
});
}
public void aY() {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
try {
int a2 = MyBackupAgent.a(Main.this, new RestoreObserver() {
@Override
public void onUpdate(int i2, String str) {
bo.b("T", "now restoring package: " + i2 + " (" + str + ")");
}
@Override
public void restoreFinished(int i2) {
if (Main.this.h != null) {
if (i2 == 0) {
if (Main.this.h.b(Main.this, "autobackup.xml")) {
Main.this.ao();
gs.a(Main.this, R.string.restored_from_backup, new Object[0]);
} else {
gs.d(Main.this, R.string.warn_read_backup_datafile, new Object[0]);
}
Main.this.f();
return;
}
gs.a(Main.this, String.valueOf(i2), new Object[0]);
}
}
@Override
public void restoreStarting(int i2) {
bo.b("T", "starting restore of " + i2 + " packages ");
}
});
if (a2 != 0) {
gs.a(Main.this, String.valueOf(a2), new Object[0]);
}
} catch (SecurityException e2) {
gs.a(Main.this, "security exception: " + e2.getMessage(), new Object[0]);
}
}
}
}, R.string.dc_restore_data);
}
private void aZ() {
b(new Runnable() {
@Override
public final void run() {
Main.this.ba();
}
});
}
public void ba() {
int i2;
Long[] a2 = gs.a(fy.f().keySet(), true);
String[] strArr = new String[a2.length];
String[] strArr2 = new String[a2.length];
int i3 = 0;
for (Long l2 : a2) {
long longValue = l2.longValue();
strArr[i3] = cb.b(this, cb.c(longValue)).replace(" ", ", ");
long currentTimeMillis = System.currentTimeMillis() - longValue;
long j2 = 60000;
if (currentTimeMillis > 86400000) {
j2 = 86400000;
i2 = R.string.pl_days;
} else if (currentTimeMillis > 3600000) {
j2 = 3600000;
i2 = R.string.pl_hours;
} else if (currentTimeMillis > 60000) {
i2 = R.string.pl_minutes;
} else {
j2 = 1000;
i2 = R.string.pl_seconds;
}
strArr2[i3] = String.valueOf(currentTimeMillis / j2) + " " + ct.a(this, R.string.ago, ct.a(this, i2, new Object[0]));
i3++;
}
dp.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 1) {
int i4 = message.getData().getInt("index");
Map<Long, File> f2 = fy.f();
final File file = f2.get(Long.valueOf(gs.a(f2.keySet(), true)[i4].longValue()));
gf.a(Main.this, new Handler() {
@Override
public void handleMessage(Message message2) {
if (message2.what == 0) {
Main.this.a((Context) Main.this, file, "userbackup.xml", true);
}
}
}, R.string.dc_restore_data);
}
}
}, R.string.dt_choose_backup).a(strArr).b(strArr2).a(this);
}
private void bb() {
b(DaySelect.b(this.M == null ? null : (ac) this.M.l(2)), 22);
}
private void d(gb gbVar) {
Intent c2 = TimeSelect.c(this.M == null ? null : (gh) this.M.l(1));
gx.a(this, this.h, (ft) null, c2, (Collection<String>) null, gbVar);
b(c2, 23);
}
void b(final ai.a aVar) {
b(new Runnable() {
@Override
public final void run() {
Main.this.f(aVar);
}
});
}
public void f(ai.a aVar) {
File u;
String str;
int i2;
if (aVar == null) {
u = dm.a(this.F);
str = ".prj.xml";
i2 = R.string.dt_project_file_select;
} else if (aVar == ai.a.Scene) {
u = dt.u();
str = ".scn.xml";
i2 = R.string.dt_scene_file_select;
} else if (aVar == ai.a.Profile) {
u = gb.a(this.F);
str = ".prf.xml";
i2 = R.string.dt_profile_file_select;
} else {
u = ft.u();
str = ".tsk.xml";
i2 = R.string.dt_task_file_select;
}
String str2 = str;
if (!u.isDirectory()) {
u.mkdirs();
}
b(FileSelect.a(this, ct.a(this, i2, new Object[0]), u.toString(), FileSelect.b.File, str2, false, false), 24);
}
private void b(ai.a aVar, String str) {
File file = new File(str);
if (!file.isFile()) {
gs.d(this, R.string.f_select_file, new Object[0]);
return;
}
if (aVar == null) {
d(file);
return;
}
switch (aVar) {
case Profile:
c(file);
break;
case Task:
a(file);
break;
case Scene:
b(file);
break;
}
a(ai.a.Variable);
}
private void b(final boolean z, final int i2, final Object[] objArr) {
gn.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.a(z, i2, objArr);
return;
}
if (z) {
Main.this.b(false, "lockfail");
} else if (i2 == 13 || i2 == 14) {
Main.this.v();
}
}
}).a((Activity) this);
}
private void k(boolean z) {
findViewById(R.id.root_layout).setVisibility(z ? 0 : 4);
}
public void a(boolean z, int i2, Object[] objArr) {
aI();
if (z) {
k(true);
if (!this.V.equals("disclaimer")) {
c(this.G.contains("dscl"), false);
}
aC();
return;
}
switch (i2) {
case 0:
gs.a(this, R.string.f_unlock_code_passed, new Object[0]);
return;
case 1:
aj();
return;
case 2:
aW();
return;
case 3:
b((View) objArr[0], ((Integer) objArr[1]).intValue(), ((Integer) objArr[2]).intValue(), ((Boolean) objArr[3]).booleanValue());
return;
case 4:
U();
if (gi.a(this, R.string.tip_toggle_tasker)) {
invalidateOptionsMenu();
return;
}
return;
case 5:
a(l(), ((Integer) objArr[0]).intValue(), ((Integer) objArr[1]).intValue());
return;
case 6:
case g.a.MapAttrs_uiZoomGestures:
case g.a.MapAttrs_useViewLifecycle:
case 16:
default:
bo.c("T", "unknown lock action " + i2);
return;
case 7:
a((View) objArr[0], ((Integer) objArr[1]).intValue(), ((Integer) objArr[2]).intValue(), ((Boolean) objArr[3]).booleanValue());
return;
case 8:
e(((Integer) objArr[0]).intValue());
return;
case 9:
d(((Integer) objArr[0]).intValue());
return;
case 10:
c(((Integer) objArr[0]).intValue());
return;
case 11:
j(((Integer) objArr[0]).intValue());
return;
case g.a.MapAttrs_uiZoomControls:
ab();
return;
case g.a.MapAttrs_zOrderOnTop:
return;
case g.a.MapAttrs_ambientEnabled:
aZ();
return;
case g.a.MapAttrs_cameraMinZoomPreference:
m(29);
return;
}
}
public int[] a(List<Object> list) {
int[] iArr = new int[list.size()];
for (int i2 = 0; i2 < iArr.length; i2++) {
iArr[i2] = ((ft) list.get(i2)).G();
}
return iArr;
}
public int[] b(List<Object> list) {
int[] iArr = new int[list.size()];
for (int i2 = 0; i2 < iArr.length; i2++) {
iArr[i2] = ((gb) list.get(i2)).K();
}
return iArr;
}
public void bc() {
switch (aN()) {
case Profile:
if (!this.s.e()) {
gb gbVar = (gb) this.s.getItem(this.U);
if (gbVar != null) {
a(new int[]{gbVar.K()});
return;
}
return;
}
a(b(this.s.h()));
return;
case Task:
if (!this.s.e()) {
ft ftVar = (ft) this.u.getItem(this.U);
if (ftVar == null) {
bo.d("T", "handleDropOnBin: no task at position " + this.U);
return;
}
d(new int[]{ftVar.G()});
return;
}
d(a(this.u.h()));
return;
case Scene:
if (!this.s.e()) {
b(new String[]{((dt) this.t.getItem(this.U)).m()});
return;
} else {
b(c(this.t.h()));
return;
}
default:
return;
}
}
public String[] c(List<Object> list) {
String[] strArr = new String[list.size()];
for (int i2 = 0; i2 < strArr.length; i2++) {
strArr[i2] = ((dt) list.get(i2)).m();
}
return strArr;
}
public void c(final ai.a aVar, final ListView listView) {
if (fa.d(this)) {
listView.setOnDragListener(new View.OnDragListener() {
@Override
public boolean onDrag(View view, DragEvent dragEvent) {
if (Main.this.f11314e.a()) {
return false;
}
try {
return Main.this.a(aVar, listView, view, dragEvent);
} catch (Exception e2) {
bo.b("T", "onDrag/list", e2);
return false;
}
}
});
}
}
public boolean a(ai.a aVar, ListView listView, View view, DragEvent dragEvent) {
if (dragEvent == null) {
bo.d("T", "handleListDrag: null event");
} else {
int action = dragEvent.getAction();
if (action != 6) {
switch (action) {
case 1:
if (aVar != aN()) {
return true;
}
fa.a((Context) this, this.E, false, "main: list started");
return true;
case 2:
if (this.f11314e != null && aO() && fa.b(listView, (int) dragEvent.getX(), (int) dragEvent.getY()) != -1) {
this.f11314e.a(listView, dragEvent.getY(), this.f11314e.a(listView, dragEvent.getY()));
break;
}
break;
case 3:
return a(listView, dragEvent.getX(), dragEvent.getY());
case 4:
aw();
v();
break;
}
} else if (this.f11314e != null) {
this.f11314e.a(listView, dragEvent.getY(), 0);
}
}
return false;
}
private void bd() {
RelativeLayout relativeLayout = this.z;
if (relativeLayout == null) {
d(this, "setProjectTabDragListener projectTabHost null");
} else {
relativeLayout.setOnDragListener(new View.OnDragListener() {
@Override
public final boolean onDrag(View view, DragEvent dragEvent) {
boolean b2;
b2 = Main.this.b(view, dragEvent);
return b2;
}
});
}
}
public boolean b(View view, DragEvent dragEvent) {
try {
return a(view, dragEvent);
} catch (Exception e2) {
bo.b("T", "onDrag/project", e2);
return false;
}
}
private boolean a(View view, DragEvent dragEvent) {
if (this.C == null || dragEvent == null) {
return false;
}
int action = dragEvent.getAction();
if (action == 6) {
this.C.i();
return false;
}
switch (action) {
case 1:
return true;
case 2:
this.C.f(this.C.c((int) dragEvent.getX(), (int) dragEvent.getY()));
this.f11314e.a(view);
return false;
case 3:
return a(dragEvent.getX(), dragEvent.getY());
default:
return false;
}
}
private boolean a(float f2, float f3) {
int c2;
boolean z;
int c3 = this.C.c((int) f2, (int) f3);
if (c3 == -1) {
return false;
}
if (c3 == j()) {
return true;
}
int i2 = i();
int B = B(c3);
switch (aN()) {
case Profile:
if (!u()) {
int K = ((gb) this.s.getItem(this.U)).K();
this.h.d(i2, K);
this.h.c(K, B);
} else {
b(i2, B);
}
a(false, ai.a.Profile);
break;
case Task:
if (!u()) {
ft ftVar = (ft) this.u.getItem(this.U);
if (ftVar == null) {
bo.d("T", "handleDropOnProject: no task at position " + this.U);
} else {
int G = ftVar.G();
this.h.e(i2, G);
this.h.b(G, B);
}
} else {
a(i2, B);
}
a(false, ai.a.Profile, ai.a.Task);
break;
case Scene:
if (!u()) {
String m2 = ((dt) this.t.getItem(this.U)).m();
if (ex.c(m2)) {
c2 = 0;
z = true;
if (c2 > 0) {
a(false, ai.a.Scene);
}
if (z) {
gs.c(this, R.string.f_cant_refile_builtin_scenes, new Object[0]);
break;
}
} else {
this.h.c(i2, m2);
this.h.d(m2, B);
c2 = 1;
}
} else {
c2 = c(i2, B);
}
z = false;
if (c2 > 0) {
}
if (z) {
}
break;
}
a(false, ai.a.Variable);
return true;
}
private void b(int i2, String str) {
this.U = i2;
this.f11314e.a(i2);
}
public void a(View view, final dt dtVar) {
final dj djVar = new dj(this, dtVar.m());
djVar.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public final void onDismiss() {
Main.this.a(djVar, dtVar);
}
});
djVar.a(b(view, true), true);
}
public void a(dj djVar, dt dtVar) {
if (!djVar.b()) {
String c2 = djVar.c();
if (a(c2, this.h.t(c2), ai.a.Scene) && !TextUtils.isEmpty(c2)) {
if (this.h.t(c2)) {
gs.d(this, R.string.f_scene_import_name_exists, c2);
} else {
dt B = dtVar.B();
B.a(c2);
B.a(this.h);
this.h.a(B, i());
a(ai.a.Scene);
c(B.m());
}
}
}
v();
}
public void a(View view, final ft ftVar) {
final dj djVar = new dj(this, ftVar.n() ? ftVar.m() : null);
djVar.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public final void onDismiss() {
Main.this.a(djVar, ftVar);
}
});
djVar.a(b(view, true), true);
}
public void a(dj djVar, ft ftVar) {
if (!djVar.b()) {
String c2 = djVar.c();
if (!TextUtils.isEmpty(c2)) {
if (this.h.n(c2)) {
gs.d(this, R.string.macroedit_warn_macro_already_exists, new Object[0]);
} else {
ft af = ftVar.af();
af.e(-1);
af.a(c2);
this.h.a(af, i());
af.ag();
a(ai.a.Task);
o(af.G());
}
}
}
v();
}
public void a(final View view, final ai aiVar, final boolean z, final int i2) {
final dj djVar = new dj(this, aiVar.n() ? aiVar.m() : null);
djVar.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
boolean z2;
boolean z3;
boolean z4;
if (djVar.b() || !djVar.a()) {
return;
}
String c2 = djVar.c();
switch (AnonymousClass60.f11431b[aiVar.d().ordinal()]) {
case 1:
Main.this.h.a((gb) aiVar, c2);
z2 = true;
z3 = false;
z4 = false;
break;
case 2:
gb gbVar = Main.this.M;
if (((ft) aiVar).a(Main.this, Main.this.h, gbVar == null ? null : Integer.valueOf(gbVar.K()), c2)) {
Main.this.a(ai.a.Profile);
z2 = true;
z3 = true;
z4 = false;
break;
}
z2 = false;
z3 = false;
z4 = true;
break;
case 3:
if (Main.this.a(c2, Main.this.h.t(c2), ai.a.Scene)) {
Main.this.h.a((dt) aiVar, c2);
z2 = true;
z3 = false;
z4 = false;
break;
}
z2 = false;
z3 = false;
z4 = true;
break;
case 4:
if (gx.c(c2)) {
String d2 = gx.d(Main.this, aiVar.m());
gx.a(Main.this, aiVar.m());
gx.a(Main.this, c2, d2, "varRename");
Main.this.bi();
z2 = true;
z3 = false;
z4 = false;
break;
} else {
gs.d(Main.this, R.string.err_bad_variable_name, c2);
}
default:
z2 = false;
z3 = false;
z4 = false;
break;
}
if (z2) {
Main.this.h.a(aiVar);
Main.this.a(!z3, aiVar.d());
Main.this.v();
} else if (z4) {
Main.this.a(view, aiVar, z, i2);
}
}
});
if (i2 != -1) {
djVar.a(l(), i2);
}
djVar.a(b(view, z), z);
}
private void be() {
final ai.a aN = aN();
if (aN == ai.a.Scene || aN == ai.a.Variable) {
d(aN);
} else {
com.joaomgcd.taskerm.util.l lVar = new com.joaomgcd.taskerm.util.l(this, R.string.taskernet, new Object[0]);
this.i.a(com.joaomgcd.taskerm.dialog.y.a(this, lVar, new com.joaomgcd.taskerm.util.l(this, R.string.import_from_taskernet_or_local, com.joaomgcd.taskerm.util.an.a(aN.a(), this, new Object[0])), lVar, new com.joaomgcd.taskerm.util.l(this, R.string.create, new Object[0]), new com.joaomgcd.taskerm.util.k("importfromtaskernetonnew")), new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.a(aN, (com.joaomgcd.taskerm.dialog.x) obj);
}
});
}
}
public void a(ai.a aVar, com.joaomgcd.taskerm.dialog.x xVar) throws Exception {
if (xVar.d()) {
this.i.k();
} else {
d(aVar);
}
}
private void d(ai.a aVar) {
ViewGroup i2 = this.D.i(aK().intValue());
switch (aVar) {
case Profile:
this.O = null;
this.M = null;
if (this.F.getBoolean("apn", false)) {
a(ai.a.Profile, i2, -1, (String) null);
return;
} else {
b(i2);
return;
}
case Task:
this.M = null;
this.P = 2;
a(ai.a.Task, i2, -1, (String) null);
return;
case Scene:
a(ai.a.Scene, i2, -1, (String) null);
return;
case Variable:
a(ai.a.Variable, i2, -1, (String) null);
return;
default:
return;
}
}
public void a(ai.a aVar, View view, int i2, String str) {
a(aVar, view, i2, str, 0);
}
private void a(final ai.a aVar, final View view, final int i2, final String str, int i3) {
String str2;
int i4;
int i5;
switch (aVar) {
case Profile:
str2 = null;
i4 = R.string.dialog_title_new_profile;
i5 = R.string.word_optional;
break;
case Task:
if (this.M == null) {
str2 = null;
i4 = R.string.dt_new_task;
i5 = -1;
break;
} else {
str2 = null;
i4 = R.string.dt_new_task;
i5 = R.string.word_optional;
break;
}
case Scene:
str2 = null;
i4 = R.string.dt_new_scene;
i5 = -1;
break;
case Variable:
str2 = "%";
i4 = R.string.dt_new_variable_name;
i5 = -1;
break;
default:
str2 = null;
i4 = -1;
i5 = -1;
break;
}
String str3 = str != null ? str : str2;
dj djVar = new dj(this, null);
djVar.a(i3);
if (i2 != -1) {
ListView l2 = l();
if (l2 == null) {
d(this, "showNewEntityNamePopup lv null");
return;
}
djVar.a(l2, i2);
}
if (aVar == ai.a.Variable) {
djVar.d();
}
djVar.a(new dj.a() {
@Override
public final void onDismiss(dj djVar2) {
Main.this.a(aVar, view, i2, str, djVar2);
}
}).b(str3).b(i4).c(i5).a(view, this.E, true);
}
public void a(final ai.a aVar, final View view, final int i2, final String str, dj djVar) {
if (djVar.b()) {
if (aVar == ai.a.Task && this.M != null && this.M.M() == 0) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.f(new int[]{Main.this.M.K()});
} else {
Main.this.a(aVar, view, i2, str);
}
}
}, ct.a(this, R.string.dc_delete_unfinished_profile, new Object[0]));
return;
}
return;
}
if (djVar.a()) {
String c2 = djVar.c();
boolean z = true;
switch (aVar) {
case Profile:
this.O = c2;
b(view);
z = false;
break;
case Task:
if (TextUtils.isEmpty(c2) && this.M != null) {
a(this.M, this.P, -1, (String) null);
} else if (a(c2, this.h.n(c2), ai.a.Task)) {
if (this.M == null) {
a(-1, -1, c2, -1);
} else {
a(this.M, this.P, -1, c2);
}
}
z = false;
break;
case Scene:
if (a(c2, this.h.t(c2), ai.a.Scene)) {
a(c2, (String) null, -1);
z = false;
break;
}
break;
case Variable:
if (!gx.c(c2)) {
gs.d(this, R.string.err_bad_variable_name, c2);
break;
} else if (gx.o(c2)) {
gs.a(this, R.string.f_no_local_vars, ct.a(this, R.string.word_error, new Object[0]));
break;
} else if (gx.b(c2)) {
gs.d(this, R.string.seedit_err_builtin_var, new Object[0]);
break;
} else {
gx.a(this, c2, "", "newvar");
a(aVar);
z = false;
break;
}
default:
z = false;
break;
}
if (z) {
a(aVar, view, i2, c2);
}
}
}
public void a(final gb gbVar, final fx fxVar, final View view) {
dj djVar = new dj(this, fxVar.w() ? fxVar.n() : null);
int b2 = this.s.b(gbVar.K());
if (aQ()) {
djVar.b(R.string.dialog_title_context_name);
}
djVar.a(l(), b2);
djVar.a(new dj.a() {
@Override
public void onDismiss(dj djVar2) {
boolean z = gbVar.M() == 0;
if (djVar2.b()) {
if (z) {
Main.this.f(new int[]{gbVar.K()});
return;
}
return;
}
if (djVar2.a()) {
String c2 = djVar2.c();
if (TextUtils.isEmpty(c2)) {
if (z) {
gs.a(Main.this, R.string.f_need_name, new Object[0]);
Main.this.a(gbVar, fxVar, view);
return;
} else {
fxVar.d((String) null);
Main.this.h.a((ai) gbVar);
Main.this.a(ai.a.Profile);
return;
}
}
if (Main.this.h.a(c2, fxVar.z())) {
gs.d(Main.this, R.string.warn_context_already_exists, new Object[0]);
Main.this.a(gbVar, fxVar, view);
return;
}
fxVar.d(c2);
Main.this.h.a((ai) gbVar);
Main.this.a(ai.a.Profile);
if (z) {
Main.this.a(gbVar, false);
}
}
}
}).a(b(view, true), this.z, false);
}
private void D(int i2) {
ViewGroup i3;
final int B = B(i2);
dj djVar = new dj(this, this.h.y(B));
djVar.a(new dj.a() {
@Override
public void onDismiss(dj djVar2) {
if (djVar2.b() || !djVar2.a()) {
return;
}
String c2 = djVar2.c();
if (Main.this.a(c2, Main.this.h.r(c2), (ai.a) null)) {
Main.this.h.b(B, c2);
Main.this.aI();
Main.this.v();
}
}
});
boolean bf = bf();
if (bf) {
i3 = this.A;
} else {
i3 = this.C.i(i2);
}
djVar.a(b(i3, bf), false);
}
public boolean bf() {
return gs.r() && "OnePlus".equals(Build.BRAND);
}
public void a(final gu guVar, View view, ListView listView, int i2) {
dj djVar = new dj(this, gx.e(this, guVar.m()));
djVar.a(new dj.a() {
@Override
public final void onDismiss(dj djVar2) {
Main.this.a(guVar, djVar2);
}
}).d(15).a(listView, i2);
djVar.a(b(view, true), false);
}
public void a(gu guVar, dj djVar) {
if (djVar.b() || !djVar.a()) {
return;
}
String m2 = guVar.m();
String c2 = djVar.c();
gx.a(this, m2, c2, "showVV");
this.i.a(m2, c2);
a(ai.a.Variable);
bi();
}
private View b(View view, boolean z) {
if (view == null) {
if (z) {
view = this.A;
} else {
view = this.E;
}
}
if (view != null) {
return view;
}
if (z) {
return l();
}
return this.E;
}
public void a(View view, final List<Object> list) {
cl clVar = new cl(this, b(view, true));
final ai.a d2 = ((ai) list.get(0)).d();
boolean z = list.size() == 1;
boolean z2 = d2 != ai.a.Scene;
if (z2) {
clVar.a(d.ToLink.ordinal(), R.string.ml_export_to_url, R.attr.iconUrl, cl.a.Top);
}
if (d2 == ai.a.Task && z) {
clVar.a(d.AsApp.ordinal(), R.string.ml_export_as_app, R.attr.iconContextApp, cl.a.Bottom);
}
clVar.a(d.DescrToClip.ordinal(), R.string.ml_export_descr_to_clipboard, R.attr.iconClipboard, cl.a.Bottom);
clVar.a(d.DescrToEmail.ordinal(), R.string.ml_export_descr_in_email, R.attr.iconEmail, cl.a.Bottom);
clVar.a(d.XmlToEmail.ordinal(), R.string.ml_export_xml_in_email, R.attr.iconEmail, cl.a.Bottom);
clVar.a(d.XmlToClip.ordinal(), R.string.ml_export_xml_to_clipboard, R.attr.iconClipboard, cl.a.Bottom);
clVar.a(d.XmlToSD.ordinal(), R.string.ml_export_xml_to_sd, R.attr.iconSD, cl.a.Bottom);
if (z2) {
clVar.a(d.ToUri.ordinal(), R.string.ml_export_to_uri, R.attr.iconUrl, cl.a.Bottom);
}
clVar.a(new cl.c() {
@Override
public final void onDismiss(cl clVar2) {
Main.this.a(d2, list, clVar2);
}
});
try {
clVar.show();
} catch (Exception e2) {
gs.a(this, "showing export menu", new Object[0]);
bo.b("T", "error showing export menu", e2);
}
}
public void a(ai.a aVar, final List list, cl clVar) {
if (clVar.h()) {
if (aVar == ai.a.Profile && fi.a((Context) this)) {
gi.a(this, R.string.tip_profile_export_as_app);
return;
}
return;
}
final d dVar = d.values()[clVar.g()];
switch (aVar) {
case Profile:
this.i.a(dVar, new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.this.b(list, dVar, (com.joaomgcd.taskerm.f.g) obj);
}
});
return;
case Task:
a((List<Object>) list, dVar);
return;
case Scene:
b((List<Object>) list, dVar);
return;
default:
return;
}
}
public void b(List list, d dVar, com.joaomgcd.taskerm.f.g gVar) throws Exception {
a((List<Object>) list, dVar, gVar);
}
private boolean a(ListView listView, float f2, float f3) {
boolean z = true;
if (aO()) {
int b2 = fa.b(listView, (int) f2, (int) f3);
int count = b2 == -1 ? listView.getCount() - 1 : listView.getFirstVisiblePosition() + b2;
if (count != this.U) {
if (!u()) {
switch (aN()) {
case Profile:
this.h.a(((gb) this.s.getItem(this.U)).K(), i(), count);
break;
case Task:
ft ftVar = (ft) this.u.getItem(this.U);
if (ftVar == null) {
bo.d("T", "handleDropOnList: no task at pos " + this.U);
break;
} else {
this.h.b(ftVar.G(), i(), count);
break;
}
case Scene:
this.h.a(((dt) this.t.getItem(this.U)).m(), i(), count);
break;
}
} else {
a(aN(), count);
}
}
a(false, aN());
} else {
z = false;
}
v();
return z;
}
private void a(ai.a aVar, int i2) {
bz bzVar = (bz) a(aVar).getAdapter();
List<Integer> k2 = bzVar.k();
for (int size = k2.size() - 1; size >= 0; size--) {
int intValue = k2.get(size).intValue();
switch (aVar) {
case Profile:
this.h.a(((gb) bzVar.getItem(intValue)).K(), i(), i2);
break;
case Task:
this.h.b(((ft) bzVar.getItem(intValue)).G(), i(), i2);
break;
case Scene:
this.h.a(((dt) this.t.getItem(intValue)).m(), i(), i2);
break;
}
if (intValue < i2) {
i2--;
}
}
}
public int a(int i2, int i3) {
Iterator<Object> it = this.u.h().iterator();
int i4 = 0;
while (it.hasNext()) {
int G = ((ft) it.next()).G();
this.h.e(i2, G);
this.h.b(G, i3);
i4++;
}
return i4;
}
public int b(int i2, int i3) {
Iterator<Object> it = this.s.h().iterator();
int i4 = 0;
while (it.hasNext()) {
int K = ((gb) it.next()).K();
this.h.d(i2, K);
this.h.c(K, i3);
i4++;
}
return i4;
}
public int c(int i2, int i3) {
Iterator<Object> it = this.t.h().iterator();
boolean z = false;
int i4 = 0;
while (it.hasNext()) {
String m2 = ((dt) it.next()).m();
if (ex.c(m2)) {
z = true;
} else {
this.h.c(i2, m2);
this.h.d(m2, i3);
i4++;
}
}
if (z) {
gs.c(this, R.string.f_cant_refile_builtin_scenes, new Object[0]);
}
return i4;
}
public void c(final ListView listView) {
listView.setMultiChoiceModeListener(new co(this, this.s, this.E, null, null) {
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
super.onCreateActionMode(actionMode, menu);
return Main.this.a(actionMode);
}
@Override
public void onItemCheckedStateChanged(ActionMode actionMode, int i2, long j2, boolean z) {
if (Main.this.b(ai.a.Profile, i2)) {
return;
}
super.onItemCheckedStateChanged(actionMode, i2, j2, z);
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
super.onDestroyActionMode(actionMode);
Main.this.a((ActionMode) null);
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
boolean z;
switch (menuItem.getItemId()) {
case 1:
List<Integer> k2 = d().k();
gb gbVar = (gb) d().getItem(k2.get(0).intValue());
if (k2.size() == 1 && gbVar.n()) {
Main.this.a(listView, gbVar, Main.this.D.i(ai.a.Profile.ordinal()), -1, gbVar.m());
actionMode.finish();
} else {
Iterator<Integer> it = d().k().iterator();
int i2 = -1;
while (it.hasNext()) {
gb a2 = Main.this.h.a((gb) d().getItem(it.next().intValue()), true);
a2.i(Main.this.W() >= 6);
if (i2 == -1) {
i2 = a2.K();
}
}
actionMode.finish();
Main.this.a(ai.a.Profile);
Main.this.a(listView, i2);
}
return true;
case 2:
Main.this.a(Main.this.b(d().h()));
return true;
case 3:
Iterator<Object> it2 = d().h().iterator();
while (true) {
if (!it2.hasNext()) {
z = true;
} else if (!((gb) it2.next()).n()) {
z = false;
}
}
if (z) {
Main.this.a(Main.this.findViewById(2), d().h());
} else {
gs.d(Main.this, R.string.err_export_need_name, new Object[0]);
}
return true;
case 4:
case 5:
Iterator<Object> it3 = d().h().iterator();
while (it3.hasNext()) {
((gb) it3.next()).b(menuItem.getItemId() == 4);
}
Main.this.a(false, ai.a.Profile);
Main.this.a(false, ai.a.Task);
Main.this.v();
return true;
case 6:
case 7:
Iterator<Object> it4 = d().h().iterator();
while (it4.hasNext()) {
gb gbVar2 = (gb) it4.next();
if (menuItem.getItemId() == 6) {
gbVar2.j(true);
gbVar2.p(0);
} else {
gbVar2.j(false);
}
}
Main.this.a(false, ai.a.Profile);
Main.this.v();
return true;
case 8:
Main.this.a(Main.this.findViewById(8), (ai) Main.this.s.j(), true, -1);
return true;
case 9:
gb gbVar3 = Main.this.M;
if (gbVar3 != null) {
Main.this.b(ProfileProperties.a(gbVar3), 25);
Main.this.v();
}
return true;
case 10:
Main.this.y();
return true;
case 11:
Main.this.c(Main.this.b(Main.this.s.h()));
Main.this.a(false, ai.a.Profile);
Main.this.v();
return true;
case g.a.MapAttrs_uiZoomControls:
a(listView);
return true;
default:
return false;
}
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
super.a(actionMode, menu, false);
if (Main.this.t()) {
Main.this.a(menu, 10);
return true;
}
if (this.f12604c == -1) {
return false;
}
gb gbVar = (gb) Main.this.s.getItem(this.f12604c);
boolean c2 = Settings.c(Main.this.F);
if (e()) {
net.dinglisch.android.taskerm.a.j(Main.this, 8, menu);
}
if ((!e() || !dl.a(Main.this.F)) && gbVar != null) {
if (gbVar.S()) {
net.dinglisch.android.taskerm.a.c((Context) Main.this, 6, menu, true);
}
if (!gbVar.S()) {
net.dinglisch.android.taskerm.a.b((Context) Main.this, 7, menu, true);
}
}
if (e() && !c2) {
net.dinglisch.android.taskerm.a.l(Main.this, 9, menu);
}
Main.this.a(menu, 10);
if (!c2) {
net.dinglisch.android.taskerm.a.a((Context) Main.this, 1, menu, false);
}
net.dinglisch.android.taskerm.a.i(Main.this, 2, menu);
net.dinglisch.android.taskerm.a.a((Context) Main.this, 3, false, menu);
if (gbVar != null && !gbVar.h() && !c2) {
net.dinglisch.android.taskerm.a.b((Context) Main.this, 4, false, menu);
}
if (Main.this.Y() == gb.b.User && (!e() || this.f12604c > 0)) {
net.dinglisch.android.taskerm.a.x(Main.this, 11, menu);
}
if (gbVar != null && gbVar.h()) {
net.dinglisch.android.taskerm.a.c((Context) Main.this, 5, false, menu);
}
if (!d().d()) {
net.dinglisch.android.taskerm.a.m(Main.this, 12, menu);
}
return true;
}
});
}
public void a(Menu menu, int i2) {
if (Settings.a((Context) this) == 5) {
if (this.h.A() > 1 || (l() != null && l().getCount() > 1)) {
net.dinglisch.android.taskerm.a.y(this, i2, menu);
}
}
}
public void a(final ListView listView, final gb gbVar, View view, int i2, String str) {
boolean z;
dj djVar = new dj(this, str);
if (view != null || i2 == -1) {
z = true;
} else {
djVar.a(l(), i2);
z = false;
}
djVar.a(new dj.a() {
@Override
public void onDismiss(dj djVar2) {
if (djVar2.b()) {
return;
}
String c2 = djVar2.c();
gb a2 = Main.this.h.a(gbVar, true);
if (c2.length() > 0) {
a2.a(c2);
}
a2.i(Main.this.W() >= 6);
Main.this.a(ai.a.Profile);
Main.this.a(listView, a2.K());
}
}).b(R.string.dialog_title_new_profile).a(view, this.E, z);
}
public void d(final List<Object> list) {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
boolean z = false;
Iterator it = list.iterator();
while (it.hasNext()) {
String m2 = ((gu) it.next()).m();
if (Main.this.v.a(m2)) {
z = true;
}
gx.a(Main.this, m2);
}
Main.this.v.a();
if (z) {
gi.a(Main.this, R.string.tip_clear_data_var);
}
Main.this.v();
Main.this.bi();
}
}
}, R.string.dc_confirm_variable_clear);
}
public boolean b(ai.a aVar, int i2) {
if (!t()) {
return false;
}
a(aVar, i2);
v();
a(false, aVar);
return true;
}
public void d(final ListView listView) {
listView.setMultiChoiceModeListener(new co(this, this.u, this.E, null, null) {
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
super.onCreateActionMode(actionMode, menu);
Main.this.V();
return Main.this.a(actionMode);
}
@Override
public void onItemCheckedStateChanged(ActionMode actionMode, int i2, long j2, boolean z) {
if (Main.this.b(ai.a.Task, i2)) {
return;
}
super.onItemCheckedStateChanged(actionMode, i2, j2, z);
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
super.onDestroyActionMode(actionMode);
Main.this.a((ActionMode) null);
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
switch (menuItem.getItemId()) {
case 1:
Main.this.a(Main.this.findViewById(1), (ft) d().j());
return true;
case 2:
Main.this.d(Main.this.a(Main.this.u.h()));
return true;
case 3:
Main.this.a(Main.this.findViewById(2), d().h());
return true;
case 4:
case 5:
Iterator<Object> it = d().h().iterator();
while (it.hasNext()) {
((ft) it.next()).b(menuItem.getItemId() == 4);
}
Main.this.a(false, ai.a.Task);
Main.this.a(false, ai.a.Profile);
Main.this.a(false, ai.a.Scene);
Main.this.v();
return true;
case 6:
case 7:
default:
return false;
case 8:
Main.this.a(Main.this.findViewById(8), (ai) d().j(), true, -1);
return true;
case 9:
Main.this.y();
return true;
case 10:
Main.this.b(Main.this.a(Main.this.u.h()));
Main.this.a(false, ai.a.Task);
Main.this.v();
return true;
case 11:
a(listView);
return true;
case g.a.MapAttrs_uiZoomControls:
ft ftVar = (ft) d().j();
ftVar.g(100);
ExecuteService.a(Main.this, ftVar, 9, -1, -1, -1, (String) null, (List<String>) null, "ui", (Bundle) null);
Main.this.v();
return true;
case g.a.MapAttrs_uiZoomGestures:
Main.this.i.a((ft) d().j());
return true;
}
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
super.a(actionMode, menu, false);
if (Main.this.t()) {
Main.this.a(menu, 9);
return true;
}
if (this.f12604c == -1) {
return false;
}
ft ftVar = (ft) Main.this.u.getItem(this.f12604c);
boolean c2 = Settings.c(Main.this.F);
if (e()) {
net.dinglisch.android.taskerm.a.j(Main.this, 8, menu);
net.dinglisch.android.taskerm.a.k(Main.this, 12, menu);
}
Main.this.a(menu, 9);
if (!c2 && e()) {
net.dinglisch.android.taskerm.a.a((Context) Main.this, 1, menu, false);
}
net.dinglisch.android.taskerm.a.i(Main.this, 2, menu);
net.dinglisch.android.taskerm.a.a((Context) Main.this, 3, false, menu);
if (ftVar != null && ftVar.h()) {
net.dinglisch.android.taskerm.a.c((Context) Main.this, 5, false, menu);
} else if (!c2) {
net.dinglisch.android.taskerm.a.b((Context) Main.this, 4, false, menu);
}
if (Main.this.Z() == ft.c.User && (!e() || this.f12604c > 0)) {
net.dinglisch.android.taskerm.a.x(Main.this, 10, menu);
}
if (!d().d()) {
net.dinglisch.android.taskerm.a.m(Main.this, 11, menu);
}
Iterator<Object> it = Main.this.u.h().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ft ftVar2 = (ft) it.next();
if (ftVar2 != null && ftVar2.i()) {
Main.this.a(13, (Object[]) null);
break;
}
}
if (e()) {
net.dinglisch.android.taskerm.a.a(Main.this, 13, menu, R.string.show_linked_profiles, R.attr.iconList);
}
return true;
}
});
}
public void e(final ListView listView) {
listView.setMultiChoiceModeListener(new co(this, this.t, this.E, null, null) {
@Override
public void onItemCheckedStateChanged(ActionMode actionMode, int i2, long j2, boolean z) {
if (Main.this.b(ai.a.Scene, i2)) {
return;
}
super.onItemCheckedStateChanged(actionMode, i2, j2, z);
}
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
super.onCreateActionMode(actionMode, menu);
Main.this.V();
return Main.this.a(actionMode);
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
super.onDestroyActionMode(actionMode);
Main.this.a((ActionMode) null);
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
dt dtVar = (dt) d().j();
switch (menuItem.getItemId()) {
case 1:
Main.this.a(Main.this.findViewById(1), dtVar);
return true;
case 2:
Main.this.b(Main.this.c(d().h()));
return true;
case 3:
Main.this.a(Main.this.findViewById(2), d().h());
return true;
case 4:
case 5:
Iterator<Object> it = d().h().iterator();
while (it.hasNext()) {
((dt) it.next()).b(menuItem.getItemId() == 4);
}
Main.this.a(false, ai.a.Scene);
Main.this.v();
if (dtVar.h()) {
Main.this.aP();
}
return true;
case 6:
default:
return false;
case 7:
Iterator<Object> it2 = d().h().iterator();
while (it2.hasNext()) {
dt dtVar2 = (dt) it2.next();
if (ew.a(dtVar2.m())) {
ew.a((Context) Main.this, dtVar2.m(), true);
}
}
Main.this.a(ai.a.Scene);
Main.this.v();
return true;
case 8:
Main.this.a(Main.this.findViewById(8), (ai) d().j(), true, -1);
return true;
case 9:
Main.this.y();
return true;
case 10:
Main.this.a(Main.this.c(d().h()));
Main.this.a(false, ai.a.Scene);
Main.this.v();
return true;
case 11:
a(listView);
return true;
case g.a.MapAttrs_uiZoomControls:
Main.this.a(dtVar, Main.this.findViewById(8));
return true;
}
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
super.a(actionMode, menu, false);
if (Main.this.t()) {
Main.this.a(menu, 9);
return true;
}
if (this.f12604c == -1) {
return false;
}
dt dtVar = (dt) Main.this.t.getItem(this.f12604c);
boolean c2 = Settings.c(Main.this.F);
if (e() && !ex.c(dtVar.m())) {
net.dinglisch.android.taskerm.a.j(Main.this, 8, menu);
}
Main.this.a(menu, 9);
if (!c2 && e()) {
net.dinglisch.android.taskerm.a.a((Context) Main.this, 1, menu, false);
}
net.dinglisch.android.taskerm.a.i(Main.this, 2, menu);
if (ew.a(dtVar.m())) {
net.dinglisch.android.taskerm.a.o(Main.this, 7, menu);
}
net.dinglisch.android.taskerm.a.a((Context) Main.this, 3, false, menu);
if (!c2 && e() && dtVar.w() > 0) {
net.dinglisch.android.taskerm.a.f(Main.this, 12, menu);
}
if (dtVar.h()) {
net.dinglisch.android.taskerm.a.c((Context) Main.this, 5, false, menu);
} else if (!c2) {
net.dinglisch.android.taskerm.a.b((Context) Main.this, 4, false, menu);
}
if (Main.this.aa() == dt.f.User && (!e() || this.f12604c > 0)) {
net.dinglisch.android.taskerm.a.x(Main.this, 10, menu);
}
if (!d().d()) {
net.dinglisch.android.taskerm.a.m(Main.this, 11, menu);
}
Iterator<Object> it = Main.this.t.h().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
if (((dt) it.next()).i()) {
Main.this.a(14, (Object[]) null);
break;
}
}
return true;
}
});
}
public void f(final ListView listView) {
listView.setMultiChoiceModeListener(new co(this, this.v, this.E, null, null) {
@Override
public boolean onCreateActionMode(ActionMode actionMode, Menu menu) {
super.onCreateActionMode(actionMode, menu);
Main.this.V();
return Main.this.a(actionMode);
}
@Override
public void onDestroyActionMode(ActionMode actionMode) {
super.onDestroyActionMode(actionMode);
Main.this.a((ActionMode) null);
}
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 3) {
StringBuilder sb = new StringBuilder();
for (Object obj : d().h()) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(gx.e(Main.this, ((gu) obj).m()));
}
if (cc.a(Main.this, sb.toString(), cc.a.None)) {
gs.a(Main.this, R.string.message_quick_confirmation, new Object[0]);
} else {
gs.d(Main.this, R.string.err_no_clipboard_manager, new Object[0]);
}
Main.this.v();
} else if (itemId != 11) {
switch (itemId) {
case 8:
Main.this.a(Main.this.findViewById(8), (ai) d().j(), true, -1);
break;
case 9:
Main.this.d(d().h());
break;
default:
return false;
}
} else {
a(listView);
}
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) {
super.a(actionMode, menu, false);
if (this.f12604c == -1) {
return false;
}
gu guVar = (gu) Main.this.v.getItem(this.f12604c);
boolean c2 = gx.c(Main.this, guVar.m());
if (e() && !Main.this.h.a((Context) Main.this, Main.this.getPackageManager(), -2, false).contains(guVar.m())) {
net.dinglisch.android.taskerm.a.j(Main.this, 8, menu);
}
if (c2) {
net.dinglisch.android.taskerm.a.a(Main.this, 9, menu);
net.dinglisch.android.taskerm.a.g(Main.this, 3, menu);
}
if (d().d()) {
return true;
}
net.dinglisch.android.taskerm.a.m(Main.this, 11, menu);
return true;
}
});
}
@Override
public boolean a(ActionMode actionMode) {
l(actionMode == null);
return super.a(actionMode);
}
public void bg() {
ToggleButton toggleButton;
gw.a[] values = gw.a.values();
int length = values.length;
for (int i2 = 0; i2 < length; i2++) {
gw.a aVar = values[i2];
boolean z = j() == 0 || aVar != gw.a.Referenced;
ToggleButton[] toggleButtonArr = this.w;
if (toggleButtonArr != null && (toggleButton = toggleButtonArr[aVar.ordinal()]) != null) {
toggleButton.setEnabled(z);
}
}
}
private void l(boolean z) {
this.s.a(!z);
if (this.E != null) {
this.E.setClickable(z);
}
if (z) {
bg();
} else {
for (ToggleButton toggleButton : this.w) {
if (toggleButton != null) {
toggleButton.setEnabled(z);
}
}
}
if (this.g != null) {
this.g.setEnabled(z);
}
}
private void a(Intent intent) {
fp fpVar = new fp(new dh(intent.getBundleExtra("scntxt")));
if (this.P == 5) {
fpVar.o(5);
} else if (this.P == 6) {
fpVar.o(6);
}
a((fx) fpVar);
}
private void c(Intent intent) {
bo.b("T", "oar: scene edit");
if (intent == null) {
bo.c("T", "handleOARSE:no result data");
} else if (this.h == null) {
bo.c("T", "handleOARSE:no data");
} else {
String stringExtra = intent.getStringExtra("sc");
dm a2 = this.h.a(i(), "hoars");
d("oar scene edit");
if (a2 == null) {
bo.c("T", "handleOARSE:no project with index " + i());
} else {
StringBuilder sb = new StringBuilder();
sb.append("have cur project: ");
sb.append(a2 != null);
bo.b("T", sb.toString());
boolean z = !a2.e(stringExtra);
bo.b("T", "was new scene: " + z);
dt u = this.h.u(stringExtra);
StringBuilder sb2 = new StringBuilder();
sb2.append("have data scene: ");
sb2.append(u != null);
bo.b("T", sb2.toString());
if (u == null) {
bo.c("T", "handleOARSE:no scene");
} else {
if (ew.a(u.m())) {
ew.a((Context) this, u.m(), true);
}
bo.b("T", "data scene name: " + u.m());
this.h.d(u.m(), i());
bo.b("T", "reset entity edit data");
this.h.a((ai) u);
bo.b("T", "check links");
try {
for (dr drVar : u.a(getPackageManager())) {
if (drVar.b() == dr.a.Task && this.h.a(drVar) && this.h.d((ft) this.h.b(drVar))) {
this.h.b(drVar.d(), i());
}
}
} catch (Exception e2) {
bo.a("T", "handleOAR", e2);
}
d("handle data changed");
a(false, ai.a.Scene);
bo.b("T", "handle data changed done");
if (z) {
bo.b("T", "centre on scene");
c(stringExtra);
}
this.h.E();
a(ai.a.Variable);
d("oar scene edit finished");
}
}
}
e(intent);
}
private void d(Intent intent) {
int n2;
ft j2;
int i2 = intent.getExtras().getInt("taskidr");
fy b2 = b("handleOARTaskEditFromProfile");
if (b2 == null) {
return;
}
ft j3 = b2.j(i2);
if (j3 != null && b2.d(j3)) {
b2.b(i2, i());
}
b2.a((ai) j3);
if (this.M == null) {
bo.c("T", "taskEditFromProfileResult: profile null, can't connect task to profile");
} else {
if (!b2.l(this.M.K())) {
bo.d("T", "taskEditFromProfileResult: profile unknown in data");
}
if (this.P != 0 && this.P != 1) {
bo.c("T", "bad editingType: " + this.P + ": assuming pre");
this.P = 0;
}
if (this.M.k(this.P) && (n2 = this.M.n(this.P)) != i2 && (j2 = b2.j(n2)) != null && !j2.n()) {
bo.b("T", "delete previous (anonymous) task ID " + n2);
b2.o(n2);
}
this.M.a(this.P, i2);
b2.a((ai) this.M);
if ((this.M.n() || com.joaomgcd.taskerm.q.b.a(this, new com.joaomgcd.taskerm.util.l(this, R.string.the_profile_you_just_created_doesnt_have_name_italic, new Object[0]))) ? false : true) {
this.i.b(R.string.the_profile_you_just_created_doesnt_have_name_italic);
} else {
gi.b(this, 0, R.string.tip_profile_list_long_press, 2);
}
if (b2.a(this, b2.j(i2))) {
a(false, ai.a.Scene);
}
}
a(ai.a.Profile, ai.a.Task, ai.a.Variable);
bo.b("T", "done");
}
private void e(Intent intent) {
int b2 = MyActivity.b(intent);
if (b2 == 14) {
aD();
} else if (b2 == 20) {
aU();
} else if (b2 == 31) {
b(true, "reqCode");
}
}
private void f(Intent intent) {
int i2 = intent.getExtras().getInt("taskidr");
fy b2 = b("handleOARTaskEdit");
if (b2 == null) {
return;
}
if (b2.i(i2)) {
ft j2 = b2.j(i2);
b2.a((ai) j2);
dm a2 = b2.a(i(), "hoart");
if (a2 == null) {
bo.c("T", "handleOARTaskEdit: null project, index " + i() + ", no proj " + b2.A() + " taskID " + i2);
} else {
boolean z = !a2.h(i2);
if (b2.d(j2)) {
b2.b(i2, i());
}
a(false, ai.a.Profile, ai.a.Task);
if (z) {
o(i2);
}
if (b2.a(this, b2.j(i2))) {
a(false, ai.a.Scene);
}
b(ai.a.Variable);
}
} else {
bo.d("T", "oar: task edit: task ID " + i2 + " doesn't exist");
}
e(intent);
bo.b("T", "done");
}
private void bh() {
fy b2 = b("handleOARProfileProperties");
if (b2 == null) {
return;
}
b2.a((ai) this.M);
a(ai.a.Profile);
}
private void g(Intent intent) {
this.h.a(B(this.Q), ImageSelect.a(intent));
aI();
invalidateOptionsMenu();
}
public void bi() {
if (gs.d(this, ExecuteService.class.getName())) {
sendBroadcast(ExecuteService.c(this));
}
}
private void bj() {
String str;
bo.b("T", "share start");
Intent intent = null;
try {
str = this.h.a(this, 52);
} catch (Exception unused) {
gs.a(this, "failed to compile data for sharing", new Object[0]);
str = null;
}
bo.b("T", "share got config data");
Intent intent2 = new Intent();
intent2.setType("text/plain");
intent2.setAction("android.intent.action.SEND");
if (str == null) {
gs.a(this, "failed to compile data for sharing (2)", new Object[0]);
} else {
bo.b("T", "share get bytes");
long length = str.getBytes().length;
bo.b("T", "share got " + length + " bytes");
if (length < 130000) {
intent2.putExtra("android.intent.extra.TEXT", str);
} else {
File a2 = com.joaomgcd.taskerm.util.dq.a(this, "share.txt");
bo.b("T", "share bytes " + length + " too large, use temp file " + a2);
try {
com.joaomgcd.taskerm.util.dq.b(a2, str);
intent2.putExtra("android.intent.extra.STREAM", com.joaomgcd.taskerm.util.dq.a(a2, this, (String[]) null, intent2));
} catch (Exception unused2) {
gs.d(this, R.string.f_write_file_fail, a2);
}
}
}
intent = intent2;
if (intent != null) {
if (gs.a((Collection<?>) getPackageManager().queryIntentActivities(intent, 0))) {
bo.b("T", "no activities match intent");
gs.d(this, R.string.f_no_app_found, ct.a(this, R.string.word_share, new Object[0]));
return;
}
try {
b(Intent.createChooser(intent, ct.a(this, R.string.word_share, new Object[0])), 26);
} catch (Exception e2) {
bo.a("T", "share", e2);
gs.d(this, R.string.f_no_app_found, ct.a(this, R.string.word_share, new Object[0]));
}
}
}
public MonitorService h(String str) {
if (this.W == null) {
bo.c("T", "getMonitorService: " + str + ": connection is null");
return null;
}
return (MonitorService) this.W.a();
}
public void bk() {
bn();
if (bm()) {
bo.b("T", "unbind monitor service");
this.W.b();
this.W = null;
}
}
public void bl() {
if (bm()) {
return;
}
this.W = new cu(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
bo.b("T", "connected to monitor service");
Main.this.bp();
MonitorService h2 = Main.this.h("bind:handleMessage");
if (h2 != null) {
h2.j();
return;
} else {
bo.d("T", "no monitor service after bind, unbind");
Main.this.bk();
return;
}
}
if (message.what == 2) {
bo.d("T", "monitor service connection error");
Main.this.W = null;
} else if (message.what == 1) {
bo.b("T", "disconnected from monitor service");
if (Main.this.h != null) {
Main.this.h.G();
}
}
}
});
if (this.W.a(MonitorService.class, 32)) {
return;
}
bo.d("T", "failed to bind to " + this.W.toString());
this.W = null;
}
private boolean bm() {
return this.W != null;
}
private void bn() {
if (bm() && bo() && this.X != null) {
bo.b("T", "remove monitor listener");
MonitorService h2 = h("rmsl");
if (h2 != null) {
h2.a(this.X);
}
this.X = null;
}
}
private boolean bo() {
return bm() && this.W.c();
}
public boolean bp() {
MonitorService h2 = h("smsel");
if (h2 == null) {
bo.d("T", "setupMonitorServiceEventListener: no service");
} else {
this.X = new AnonymousClass57();
h2.b(this.X);
}
return this.X != null;
}
public class AnonymousClass57 implements MonitorService.c {
AnonymousClass57() {
}
@Override
public void a(final int i, final int i2, boolean z, final boolean z2) {
com.joaomgcd.taskerm.rx.h.c(new Runnable() {
@Override
public final void run() {
Main.AnonymousClass57.this.a(i, i2, z2);
}
});
}
public void a(int i, int i2, boolean z) {
boolean z2;
gb k;
if (Main.this.h == null || (k = Main.this.h.k(i)) == null || !k.j(i2)) {
z2 = false;
} else {
fx l = k.l(i2);
bo.b("T", "Setting profile " + k.K() + " context " + i2 + " to active " + z);
l.c(z);
z2 = true;
}
if (!z2 || Main.this.s == null) {
return;
}
Main.this.s.notifyDataSetChanged();
}
@Override
public void a(final int i, boolean z, boolean z2, final boolean z3) {
com.joaomgcd.taskerm.rx.h.c(new Runnable() {
@Override
public final void run() {
Main.AnonymousClass57.this.a(z3, i);
}
});
}
public void a(boolean z, int i) {
if (Main.this.h != null) {
gb k = Main.this.h.k(i);
if (k != null) {
k.F();
if (Main.this.s != null) {
gb.b Y = Main.this.Y();
if (Y == gb.b.ActiveAlpha || Y == gb.b.ActiveContext) {
z = true;
} else {
Main.this.s.notifyDataSetChanged();
}
}
}
if (z) {
Main.this.a(false, false, false, ai.a.Profile);
}
}
}
}
private void bq() {
gf.a(this, new Handler() {
@Override
public void handleMessage(Message message) {
if (message.what == 0) {
Main.this.br();
} else {
Main.this.b(false, "discdialogfalse");
}
}
}, ct.a(this, R.string.dc_accept_disclaimer_dialog, new Object[0]));
}
public void a(final dt dtVar, View view) {
if (view == null) {
view = this.D.i(ai.a.Scene.ordinal());
}
SceneEdit.a(this, view, dtVar, new cl.c() {
@Override
public void onDismiss(cl clVar) {
if (clVar.h()) {
return;
}
Main.this.a(dtVar.m(), clVar.f(), 11);
Main.this.v();
}
}, false);
}
public void br() {
b("dscl", true);
c("overview", true);
HTMLView.a(this, "overview.html", 10, HTMLView.c.InformWithAccept);
}
private boolean bs() {
return (aQ() || this.h == null || !this.h.s()) ? false : true;
}
private void e(ai.a aVar) {
fa faVar = this.f11314e;
if (faVar == null) {
d(this, "showHideProjectTabs scrollControl null");
return;
}
boolean a2 = a((Context) this);
ListView l2 = this.D != null ? l() : null;
faVar.a(this, l2, a2, "showHide");
if (l2 != null) {
faVar.a(l2, a2, aVar == ai.a.Profile);
}
}
private b.a.l<Boolean> bt() {
if (!com.joaomgcd.taskerm.settings.ai.k(this)) {
return b.a.l.a(true);
}
h(true);
return this.i.c(new c.f.a.a() {
@Override
public final Object invoke() {
b.a.l bv;
bv = Main.this.bv();
return bv;
}
});
}
public b.a.l bv() {
HashMap<String, List<String>> b2 = this.h.b((Context) this, TaskerAppWidgetConfigure.b(this), false, true);
HashSet hashSet = new HashSet(b2.keySet());
hashSet.remove("android.permission.WRITE_SECURE_SETTINGS");
hashSet.remove("android.permission.ACCESS_SUPERUSER");
this.f11315f = new com.joaomgcd.taskerm.util.bw(this, 123, hashSet);
bo.a("T", "needed: " + gs.d(gs.b(hashSet)));
return this.f11315f.g() ? b.a.l.a(false) : a(this.f11315f.j(), b2).a(new b.a.d.g() {
@Override
public final Object apply(Object obj) {
b.a.p a2;
a2 = Main.this.a((com.joaomgcd.taskerm.dialog.x) obj);
return a2;
}
}).a(new b.a.d.a() {
@Override
public final void run() {
Main.this.bw();
}
});
}
public b.a.p a(com.joaomgcd.taskerm.dialog.x xVar) throws Exception {
if (!xVar.d()) {
return b.a.l.a(false);
}
c("reqPermsDialog", true);
return bu();
}
public void bw() throws Exception {
h(false);
}
private b.a.p<? extends Boolean> bu() {
final List<String> l2 = this.f11315f.l();
if (l2.isEmpty()) {
return b.a.l.a(true);
}
final Runnable runnable = new Runnable() {
@Override
public final void run() {
Main.this.e(l2);
}
};
if (this.f11315f.a((Context) this)) {
runnable.run();
return b.a.l.a(false);
}
return new GenericActionActivityRequestMissingPermissions(this.f11315f.p(), null).run(this).b(new b.a.d.f() {
@Override
public final void accept(Object obj) {
Main.a(l2, runnable, (com.joaomgcd.taskerm.util.cr) obj);
}
}).c(new b.a.d.g() {
@Override
public final Object apply(Object obj) {
Boolean a2;
a2 = Main.a((com.joaomgcd.taskerm.util.cr) obj);
return a2;
}
});
}
public void e(final List list) {
com.joaomgcd.taskerm.rx.h.c(new Runnable() {
@Override
public final void run() {
Main.this.f(list);
}
});
}
public void f(List list) {
gs.a(this, "Still missing permissions: " + com.joaomgcd.taskerm.util.an.a((Iterable) list), new Object[0]);
}
public static void a(List list, Runnable runnable, com.joaomgcd.taskerm.util.cr crVar) throws Exception {
if (crVar.b() || list.size() <= 0) {
return;
}
runnable.run();
}
public static Boolean a(com.joaomgcd.taskerm.util.cr crVar) throws Exception {
return true;
}
private b.a.l<com.joaomgcd.taskerm.dialog.x> a(final String[] strArr, final HashMap<String, List<String>> hashMap) {
return this.i.c(new c.f.a.a() {
@Override
public final Object invoke() {
b.a.l a2;
a2 = Main.this.a(hashMap, strArr);
return a2;
}
});
}
public b.a.l a(HashMap hashMap, String[] strArr) {
if (this.f11315f == null) {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x());
}
StringBuilder sb = new StringBuilder();
sb.append("<P>");
for (String str : com.joaomgcd.taskerm.util.bw.r()) {
hashMap.remove(str);
}
HashMap hashMap2 = new HashMap();
PackageManager packageManager = getPackageManager();
for (String str2 : strArr) {
String a2 = bq.a(this, packageManager, str2);
List list = (List) hashMap.get(str2);
if (list != null) {
Iterator it = list.iterator();
while (it.hasNext()) {
gs.b((HashMap<String, HashSet<String>>) hashMap2, a2, (String) it.next());
}
}
}
if (hashMap2.size() == 0) {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x((Integer) 0));
}
for (String str3 : hashMap2.keySet()) {
sb.append("<B>");
sb.append(str3);
sb.append("</B><BR>");
Iterator it2 = ((HashSet) hashMap2.get(str3)).iterator();
while (it2.hasNext()) {
String str4 = (String) it2.next();
sb.append(" * ");
sb.append(str4);
sb.append("<BR>");
}
}
return com.joaomgcd.taskerm.dialog.y.a(new com.joaomgcd.taskerm.dialog.h(this, R.string.dt_missing_permissions, ct.a(this, R.string.dc_missing_permissions, com.joaomgcd.taskerm.util.al.a((Context) this), sb.toString()), R.string.button_label_ok, R.string.button_label_cancel, -1, false, 4));
}
@Override
public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
c("reqPermsDialog", false);
this.i.a(i2, strArr, iArr);
if (this.f11315f == null) {
return;
}
for (com.joaomgcd.taskerm.util.br brVar : this.f11315f.a(i2, strArr, iArr)) {
bo.a("T", "orpResult: perm: " + brVar.b() + " res: " + brVar.c());
}
finish();
}
public static class e extends Handler {
WeakReference<Main> f11471a;
e(Main main) {
this.f11471a = new WeakReference<>(main);
}
@Override
public void handleMessage(Message message) {
Main main = this.f11471a.get();
if (main == null) {
return;
}
main.at();
}
}
public static class f extends ListFragment {
ai.a f11472a;
@Override
public void onSaveInstanceState(Bundle bundle) {
bundle.putString("type", this.f11472a.toString());
}
@Override
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
a();
}
public void a() {
Main main = (Main) getActivity();
switch (this.f11472a) {
case Profile:
setListAdapter(main.s);
return;
case Task:
setListAdapter(main.u);
return;
case Scene:
setListAdapter(main.t);
return;
case Variable:
setListAdapter(main.v);
return;
default:
return;
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
this.f11472a = ai.a.valueOf(getArguments().getString("type"));
}
public Main b() {
return (Main) getActivity();
}
@Override
public void onDestroyView() {
super.onDestroyView();
i e2 = b().e();
if (e2 != null) {
e2.a(this.f11472a, (ListView) null);
}
}
@Override
public void onViewCreated(View view, Bundle bundle) {
int i;
int i2;
if (bundle != null) {
this.f11472a = ai.a.valueOf(bundle.getString("type"));
}
Main b2 = b();
fa faVar = b2.f11314e;
ListView listView = getListView();
b2.b(this.f11472a, listView);
if (faVar != null) {
faVar.a(listView, Main.a((Context) b2), this.f11472a == ai.a.Profile);
}
if (this.f11472a == ai.a.Variable) {
b2.a(listView, b2.o());
}
b2.a(this.f11472a, listView);
b2.a(listView);
b2.c(this.f11472a, listView);
listView.setScrollBarStyle(33554432);
df.b(listView, go.e(b2, R.dimen.content_side_margin_right));
df.c(listView, go.e(b2, R.dimen.content_side_margin_left));
listView.setChoiceMode(3);
listView.setItemsCanFocus(true);
listView.setDividerHeight(go.e(b2, R.dimen.list_divider_height));
b2.b(listView);
switch (this.f11472a) {
case Profile:
i = R.string.no_profiles_hint_text;
i2 = R.string.tip_entity_profile;
b2.c(listView);
break;
case Task:
i = R.string.no_tasks_hint_text;
i2 = R.string.tip_entity_task;
b2.d(listView);
break;
case Scene:
i = R.string.no_scenes_hint_text;
i2 = R.string.tip_entity_scene;
b2.e(listView);
break;
default:
i = R.string.no_variables_hint_text;
i2 = R.string.tip_entity_variable;
b2.f(listView);
break;
}
a(b2, i2, i);
i e2 = b2.e();
if (e2 != null) {
e2.a(this.f11472a, listView);
}
}
private void a(Main main, int i, int i2) {
setEmptyText(Html.fromHtml("<I><SMALL>" + ct.a(main, i, new Object[0]) + "</SMALL></I>"));
}
}
public class i extends FragmentPagerAdapter implements ViewPager.OnPageChangeListener {
private ViewPager f11483b;
private ArrayList<a> f11484c;
private Activity f11485d;
private int f11486e;
public i(Activity activity, ViewPager viewPager) {
super(activity.getFragmentManager());
this.f11484c = new ArrayList<>();
this.f11486e = 0;
this.f11485d = activity;
this.f11483b = viewPager;
this.f11483b.setAdapter(this);
this.f11483b.setOnPageChangeListener(this);
}
public void a() {
this.f11483b = null;
this.f11484c = null;
this.f11485d = null;
}
public void a(boolean z) {
for (int i = 0; i < this.f11484c.size(); i++) {
a aVar = this.f11484c.get(i);
if (aVar.f11490d != null && z) {
MyActivity.unbindAllReferences(aVar.f11490d);
}
aVar.a((ListView) null);
}
this.f11484c.clear();
if (z) {
return;
}
try {
notifyDataSetChanged();
} catch (Exception unused) {
}
}
public void a(Class<?> cls, Bundle bundle) {
this.f11484c.add(new a(cls, bundle));
}
@Override
public int getCount() {
ArrayList<a> arrayList = this.f11484c;
if (arrayList == null) {
MyActivity.d(this.f11485d, "TabsAdapter getCount null");
return 0;
}
return arrayList.size();
}
public void a(ai.a aVar, ListView listView) {
if (aVar.ordinal() < this.f11484c.size()) {
this.f11484c.get(aVar.ordinal()).a(listView);
}
}
public ListView a(Integer num) {
if (num != null && num.intValue() < this.f11484c.size()) {
return this.f11484c.get(num.intValue()).a();
}
return null;
}
@Override
public int getItemPosition(Object obj) {
Fragment fragment = (Fragment) obj;
for (int i = 0; i < this.f11484c.size(); i++) {
if (this.f11484c.get(i).f11488b == fragment.getClass()) {
return i;
}
}
return -2;
}
@Override
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
super.destroyItem(viewGroup, i, obj);
FragmentManager fragmentManager = ((Fragment) obj).getFragmentManager();
if (fragmentManager != null) {
try {
FragmentTransaction beginTransaction = fragmentManager.beginTransaction();
beginTransaction.remove((Fragment) obj);
beginTransaction.commit();
} catch (IllegalStateException unused) {
}
}
}
@Override
public Fragment getItem(int i) {
a aVar = this.f11484c.get(i);
return Fragment.instantiate(this.f11485d, aVar.f11488b.getName(), aVar.f11489c);
}
@Override
public void onPageScrolled(int i, float f2, int i2) {
if (Main.this.av() && go.a() && i == 2 && Main.this.o()) {
if (this.f11486e == 1 && !Main.this.aL()) {
Main.this.b(true, false);
}
Main.this.y.setTranslationY(0.0f - ((1.0f - f2) * Main.this.y.getHeight()));
}
}
@Override
public void onPageScrollStateChanged(int i) {
this.f11486e = i;
}
@Override
public void onPageSelected(int i) {
if (Main.n) {
Main.this.v();
if (Main.this.aK().intValue() != i) {
Main.this.D.a(i, false);
if (i == 3) {
Main.this.C();
}
}
}
}
public final class a {
private final Class<?> f11488b;
private final Bundle f11489c;
private ListView f11490d = null;
a(Class<?> cls, Bundle bundle) {
this.f11488b = cls;
this.f11489c = bundle;
}
public ListView a() {
return this.f11490d;
}
public void a(ListView listView) {
this.f11490d = listView;
}
}
}
}