ComeetChat v1.866866806590版本的 MD5 值为:4a7461802cd62adce19de75377dd7ca7
以下内容为反编译后的 y.java 源代码,内容仅作参考
package com.joaomgcd.taskerm.dialog;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.NotificationChannel;
import android.app.TimePickerDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.net.wifi.ScanResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.DatePicker;
import android.widget.TimePicker;
import androidx.core.app.NotificationCompat;
import c.f.b.w;
import com.joaomgcd.taskerm.contacts.ContactData;
import com.joaomgcd.taskerm.dialog.ac;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityPickShortcut;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestCallScreeningAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestDigitalAssistantPermission;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestDoNotDisturbAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestManageExternalStorageAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestMissingPermissions;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestNotificationAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivitySelectApp;
import com.joaomgcd.taskerm.genericaction.GenericActionPickContact;
import com.joaomgcd.taskerm.genericaction.GenericActionPickContactWithMimeType;
import com.joaomgcd.taskerm.navigationbar.IconProvider;
import com.joaomgcd.taskerm.settings.ComponentNameList;
import com.joaomgcd.taskerm.util.AppBasic;
import com.joaomgcd.taskerm.util.GenericActionActivityGrantUriPermission;
import com.joaomgcd.taskerm.util.bw;
import com.joaomgcd.taskerm.util.cq;
import com.joaomgcd.taskerm.util.cr;
import com.joaomgcd.taskerm.util.cs;
import com.joaomgcd.taskerm.util.ct;
import com.joaomgcd.taskerm.util.cu;
import com.joaomgcd.taskerm.util.cv;
import com.joaomgcd.taskerm.util.cw;
import com.joaomgcd.taskerm.util.dq;
import com.joaomgcd.taskerm.util.ds;
import cyanogenmod.app.ProfileManager;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import net.danlew.android.joda.R;
import net.dinglisch.android.taskerm.ActionEdit;
import net.dinglisch.android.taskerm.FileSelect;
import net.dinglisch.android.taskerm.Kid;
import net.dinglisch.android.taskerm.as;
import net.dinglisch.android.taskerm.ax;
import net.dinglisch.android.taskerm.cb;
import net.dinglisch.android.taskerm.ce;
import net.dinglisch.android.taskerm.di;
import net.dinglisch.android.taskerm.dm;
import net.dinglisch.android.taskerm.ft;
import net.dinglisch.android.taskerm.fy;
import net.dinglisch.android.taskerm.fz;
import net.dinglisch.android.taskerm.gf;
import net.dinglisch.android.taskerm.gn;
import net.dinglisch.android.taskerm.go;
import net.dinglisch.android.taskerm.gs;
import net.dinglisch.android.taskerm.hh;
import net.dinglisch.android.taskerm.z;
public final class y {
private static com.joaomgcd.taskerm.securesettings.aj f6580a;
public static final class bq extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, c.s> {
public static final bq f6707a = new bq();
bq() {
super(1);
}
public final void a(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.x xVar) {
a(xVar);
return c.s.f2131a;
}
}
public static final b.a.l<String> a(Activity activity, int i2) {
return a(activity, i2, (Integer) null, (com.joaomgcd.taskerm.util.i) null, (Integer) null, (Integer) null, (List) null, 124, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, int i3) {
return a(activity, i2, i3, 0, 8, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, com.joaomgcd.taskerm.util.i iVar, com.joaomgcd.taskerm.util.i iVar2, com.joaomgcd.taskerm.util.i iVar3, com.joaomgcd.taskerm.util.i iVar4, com.joaomgcd.taskerm.util.i iVar5) {
return a(activity, iVar, iVar2, iVar3, iVar4, iVar5, (com.joaomgcd.taskerm.util.i) null, (SharedPreferences) null, 192, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, String str, String str2) {
return a(activity, str, str2, 0, 8, (Object) null);
}
public static final String a() {
return "DialogMessage";
}
public static final int b(boolean z2) {
return z2 ? 1 : 0;
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> c(Activity activity, int i2, int i3) {
return a(activity, i2, i3, 0, 0, (String) null, 56, (Object) null);
}
public static final b.a.l<cr> j(Activity activity) {
return a(activity, (cs) null, 2, (Object) null);
}
public static final class bz extends c.f.b.l implements c.f.a.b<Message, com.joaomgcd.taskerm.dialog.x> {
public static final bz f6719a = new bz();
bz() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.x invoke(Message message) {
c.f.b.k.b(message, "it");
return new com.joaomgcd.taskerm.dialog.x(message);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(c.f.a.b<? super com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>>, c.s> bVar, c.f.a.b<? super com.joaomgcd.taskerm.dialog.x, Boolean> bVar2) {
c.f.b.k.b(bVar, "block");
return a(bVar, bVar2, bz.f6719a);
}
public static b.a.l a(c.f.a.b bVar, c.f.a.b bVar2, int i2, Object obj) {
if ((i2 & 2) != 0) {
bVar2 = (c.f.a.b) null;
}
return a((c.f.a.b<? super com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>>, c.s>) bVar, (c.f.a.b<? super com.joaomgcd.taskerm.dialog.x, Boolean>) bVar2);
}
public static final class ca<TDialogMessage> extends c.f.b.l implements c.f.a.a<b.a.k.d<TDialogMessage>> {
final c.f.a.b f6726a;
final c.f.a.b f6727b;
final c.f.a.b f6728c;
ca(c.f.a.b bVar, c.f.a.b bVar2, c.f.a.b bVar3) {
super(0);
this.f6726a = bVar;
this.f6727b = bVar2;
this.f6728c = bVar3;
}
@Override
public final b.a.k.d<TDialogMessage> invoke() {
b.a.k.d<TDialogMessage> f2 = b.a.k.d.f();
c.f.b.k.a((Object) f2, "SingleSubject.create<TDialogMessage>()");
this.f6728c.invoke(new com.joaomgcd.taskerm.dialog.ah(f2, new a()));
return f2;
}
public static final class a extends c.f.b.l implements c.f.a.m<b.a.k.d<TDialogMessage>, Message, c.s> {
a() {
super(2);
}
@Override
public c.s invoke(Object obj, Message message) {
a((b.a.k.d) obj, message);
return c.s.f2131a;
}
public final void a(b.a.k.d<TDialogMessage> dVar, Message message) {
c.f.b.k.b(dVar, "singleSubject");
c.f.b.k.b(message, "message");
com.joaomgcd.taskerm.dialog.x xVar = (com.joaomgcd.taskerm.dialog.x) ca.this.f6726a.invoke(message);
if (ca.this.f6727b == null || !((Boolean) ca.this.f6727b.invoke(xVar)).booleanValue()) {
dVar.d_(xVar);
}
}
}
}
public static final <TDialogMessage extends com.joaomgcd.taskerm.dialog.x> b.a.l<TDialogMessage> a(c.f.a.b<? super com.joaomgcd.taskerm.dialog.ah<b.a.k.d<TDialogMessage>>, c.s> bVar, c.f.a.b<? super TDialogMessage, Boolean> bVar2, c.f.a.b<? super Message, ? extends TDialogMessage> bVar3) {
c.f.b.k.b(bVar, "block");
c.f.b.k.b(bVar3, "getDialogMessage");
return com.joaomgcd.taskerm.rx.h.f(new ca(bVar3, bVar2, bVar));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(com.joaomgcd.taskerm.dialog.h hVar) {
c.f.b.k.b(hVar, "args");
return a(new bt(hVar), (c.f.a.b) null, 2, (Object) null);
}
public static final class bt extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>>, c.s> {
final com.joaomgcd.taskerm.dialog.h f6710a;
bt(com.joaomgcd.taskerm.dialog.h hVar) {
super(1);
this.f6710a = hVar;
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
a(ahVar);
return c.s.f2131a;
}
public final void a(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
c.f.b.k.b(ahVar, "it");
com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar2 = ahVar;
com.joaomgcd.taskerm.util.i b2 = this.f6710a.b();
String a2 = b2 != null ? b2.a() : null;
com.joaomgcd.taskerm.util.i c2 = this.f6710a.c();
String a3 = c2 != null ? c2.a() : null;
com.joaomgcd.taskerm.util.i d2 = this.f6710a.d();
String a4 = d2 != null ? d2.a() : null;
com.joaomgcd.taskerm.util.i e2 = this.f6710a.e();
String a5 = e2 != null ? e2.a() : null;
com.joaomgcd.taskerm.util.i f2 = this.f6710a.f();
gf a6 = gf.a(ahVar2, a2, a3, a4, a5, f2 != null ? f2.a() : null, this.f6710a.g(), this.f6710a.h(), this.f6710a.i(), this.f6710a.j(), this.f6710a.k());
a6.a(this.f6710a.l());
this.f6710a.a(a6);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, String str, int i3) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, str, R.string.button_label_yes, R.string.button_label_no, i3, false, 0, (String) null, 0, (Integer) null, 1984, (c.f.b.g) null));
}
public static b.a.l a(Activity activity, int i2, String str, int i3, int i4, Object obj) {
if ((i4 & 8) != 0) {
i3 = -1;
}
return a(activity, i2, str, i3);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, int i3, int i4) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, i3, R.string.button_label_yes, R.string.button_label_no, i4, false, 0, (String) null, 0, (Integer) null, 1984, (c.f.b.g) null));
}
public static b.a.l a(Activity activity, int i2, int i3, int i4, int i5, Object obj) {
if ((i5 & 8) != 0) {
i4 = -1;
}
return a(activity, i2, i3, i4);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, String str, String str2, int i2) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "title");
return a(new com.joaomgcd.taskerm.dialog.h(activity, str, str2, R.string.button_label_yes, R.string.button_label_no, i2, false, 0, null, 0, null, null, 4032, null));
}
public static b.a.l a(Activity activity, String str, String str2, int i2, int i3, Object obj) {
if ((i3 & 8) != 0) {
i2 = -1;
}
return a(activity, str, str2, i2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> b(Activity activity, String str, String str2, int i2) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "title");
return a(new com.joaomgcd.taskerm.dialog.h(activity, str, str2, R.string.button_label_enabled_on, R.string.button_label_enabled_off, i2, false, 0, null, 0, null, null, 4032, null));
}
public static b.a.l b(Activity activity, String str, String str2, int i2, int i3, Object obj) {
if ((i3 & 8) != 0) {
i2 = -1;
}
return b(activity, str, str2, i2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> c(Activity activity, String str, String str2, int i2) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "title");
return a(new com.joaomgcd.taskerm.dialog.h(activity, str, str2, R.string.word_true, R.string.word_false, i2, false, 0, null, 0, null, null, 4032, null));
}
public static b.a.l c(Activity activity, String str, String str2, int i2, int i3, Object obj) {
if ((i3 & 8) != 0) {
i2 = -1;
}
return c(activity, str, str2, i2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> d(Activity activity, String str, String str2, int i2) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "title");
return a(new com.joaomgcd.taskerm.dialog.h(activity, str, str2, R.string.pl_enable, R.string.ml_disable, i2, false, 0, null, 0, null, null, 4032, null));
}
public static b.a.l d(Activity activity, String str, String str2, int i2, int i3, Object obj) {
if ((i3 & 4) != 0) {
str2 = com.joaomgcd.taskerm.util.an.a(R.string.enable_or_disable_value, activity, str);
}
if ((i3 & 8) != 0) {
i2 = -1;
}
return d(activity, str, str2, i2);
}
public static b.a.l a(Activity activity, String str, String str2, int i2, boolean z2, String str3, Integer num, int i3, Integer num2, List list, int i4, Object obj) {
return a(activity, str, str2, (i4 & 8) != 0 ? -1 : i2, (i4 & 16) != 0 ? false : z2, (i4 & 32) != 0 ? (String) null : str3, (i4 & 64) != 0 ? (Integer) null : num, (i4 & 128) != 0 ? 0 : i3, (i4 & 256) != 0 ? Integer.valueOf(go.c(activity)) : num2, (List<String>) ((i4 & NotificationCompat.FLAG_GROUP_SUMMARY) != 0 ? (List) null : list));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, String str, String str2, int i2, boolean z2, String str3, Integer num, int i3, Integer num2, List<String> list) {
int b2;
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "title");
if (num != null) {
b2 = num.intValue() | b(z2);
} else {
b2 = b(z2);
}
return a(new com.joaomgcd.taskerm.dialog.h(activity, str, str2, R.string.button_label_ok, R.string.button_label_cancel, i2, z2, b2, str3, i3, num2, list));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, String str, int i3, boolean z2, String str2) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, str, R.string.button_label_ok, R.string.button_label_cancel, i3, z2, 0, str2, 0, (Integer) null, 1664, (c.f.b.g) null));
}
public static b.a.l a(Activity activity, int i2, String str, int i3, boolean z2, String str2, int i4, Object obj) {
int i5 = (i4 & 8) != 0 ? -1 : i3;
boolean z3 = (i4 & 16) != 0 ? false : z2;
if ((i4 & 32) != 0) {
str2 = (String) null;
}
return a(activity, i2, str, i5, z3, str2);
}
public static final b.a.l<String> a(Activity activity, com.joaomgcd.taskerm.util.i iVar, com.joaomgcd.taskerm.util.i iVar2, com.joaomgcd.taskerm.util.i iVar3, Integer num, Integer num2, List<String> list) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(iVar, "title");
return a(activity, iVar.a(), iVar3 != null ? iVar3.a() : null, 0, true, iVar2 != null ? iVar2.a() : null, num, num2 != null ? num2.intValue() : 0, null, list, 264, null).c(o.f6752a);
}
public static final class o<T, R> implements b.a.d.g<T, R> {
public static final o f6752a = new o();
o() {
}
@Override
public final String apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
String j = xVar.j();
if (j != null) {
return j;
}
throw new RuntimeException("No text entered");
}
}
public static final b.a.l<String> a(Activity activity, int i2, Integer num, com.joaomgcd.taskerm.util.i iVar, Integer num2, Integer num3, List<String> list) {
c.f.b.k.b(activity, "activity");
Activity activity2 = activity;
return a(activity, new com.joaomgcd.taskerm.util.l(activity2, i2, new Object[0]), num != null ? new com.joaomgcd.taskerm.util.l(activity2, num.intValue(), new Object[0]) : null, iVar, num2, num3, list);
}
public static b.a.l a(Activity activity, int i2, Integer num, com.joaomgcd.taskerm.util.i iVar, Integer num2, Integer num3, List list, int i3, Object obj) {
return a(activity, i2, (i3 & 4) != 0 ? (Integer) null : num, (i3 & 8) != 0 ? (com.joaomgcd.taskerm.util.i) null : iVar, (i3 & 16) != 0 ? (Integer) null : num2, (i3 & 32) != 0 ? (Integer) null : num3, (List<String>) ((i3 & 64) != 0 ? (List) null : list));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, int i3, int i4, boolean z2, String str) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, i3, R.string.button_label_ok, R.string.button_label_cancel, i4, z2, 0, str, 0, (Integer) null, 1664, (c.f.b.g) null));
}
public static b.a.l a(Activity activity, int i2, int i3, int i4, boolean z2, String str, int i5, Object obj) {
int i6 = (i5 & 8) != 0 ? -1 : i4;
boolean z3 = (i5 & 16) != 0 ? false : z2;
if ((i5 & 32) != 0) {
str = (String) null;
}
return a(activity, i2, i3, i6, z3, str);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, int i3, int i4, boolean z2) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, i3, -1, R.string.button_label_cancel, i4, z2, 0, (String) null, 0, (Integer) null, 1920, (c.f.b.g) null));
}
public static b.a.l a(Activity activity, int i2, int i3, int i4, boolean z2, int i5, Object obj) {
if ((i5 & 8) != 0) {
i4 = -1;
}
if ((i5 & 16) != 0) {
z2 = false;
}
return a(activity, i2, i3, i4, z2);
}
public static b.a.l a(Activity activity, int i2, int i3, com.joaomgcd.taskerm.util.i iVar, int i4, Object obj) {
if ((i4 & 8) != 0) {
iVar = (com.joaomgcd.taskerm.util.i) null;
}
return a(activity, i2, i3, iVar);
}
public static final class bw extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
public static final bw f6714a = new bw();
bw() {
super(0);
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x(1, null, 2, null));
}
}
public static final class bx extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, Boolean> {
public static final bx f6715a = new bx();
bx() {
super(1);
}
@Override
public Boolean invoke(com.joaomgcd.taskerm.dialog.x xVar) {
return Boolean.valueOf(a(xVar));
}
public final boolean a(com.joaomgcd.taskerm.dialog.x xVar) {
return xVar.g();
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, int i3, com.joaomgcd.taskerm.util.i iVar) {
c.f.b.k.b(activity, "activity");
if (iVar == null) {
iVar = new com.joaomgcd.taskerm.util.l(activity, i3, new Object[0]);
}
return com.joaomgcd.taskerm.q.b.a(activity, iVar, bw.f6714a, bx.f6715a, null, new by(activity, i2, i3), 8, null);
}
public static final class by extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
final Activity f6716a;
final int f6717b;
final int f6718c;
by(Activity activity, int i, int i2) {
super(0);
this.f6716a = activity;
this.f6717b = i;
this.f6718c = i2;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return y.a(this.f6716a, this.f6717b, this.f6718c, R.string.button_label_stop_reminding);
}
}
public static final class a extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
public static final a f6581a = new a();
a() {
super(0);
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x(1, null, 2, null));
}
}
public static final class b extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, Boolean> {
public static final b f6639a = new b();
b() {
super(1);
}
@Override
public Boolean invoke(com.joaomgcd.taskerm.dialog.x xVar) {
return Boolean.valueOf(a(xVar));
}
public final boolean a(com.joaomgcd.taskerm.dialog.x xVar) {
return xVar.g();
}
}
public static b.a.l a(Activity activity, com.joaomgcd.taskerm.util.i iVar, com.joaomgcd.taskerm.util.i iVar2, com.joaomgcd.taskerm.util.i iVar3, com.joaomgcd.taskerm.util.i iVar4, com.joaomgcd.taskerm.util.i iVar5, com.joaomgcd.taskerm.util.i iVar6, SharedPreferences sharedPreferences, int i2, Object obj) {
SharedPreferences sharedPreferences2;
com.joaomgcd.taskerm.util.i iVar7 = (i2 & 32) != 0 ? iVar2 : iVar5;
com.joaomgcd.taskerm.util.i lVar = (i2 & 64) != 0 ? new com.joaomgcd.taskerm.util.l(activity, R.string.button_label_stop_reminding, new Object[0]) : iVar6;
if ((i2 & 128) != 0) {
SharedPreferences a2 = com.joaomgcd.taskerm.q.b.a(activity);
c.f.b.k.a((Object) a2, "activity.preferencesState");
sharedPreferences2 = a2;
} else {
sharedPreferences2 = sharedPreferences;
}
return a(activity, iVar, iVar2, iVar3, iVar4, iVar7, lVar, sharedPreferences2);
}
public static final class c extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
final Activity f6720a;
final com.joaomgcd.taskerm.util.i f6721b;
final com.joaomgcd.taskerm.util.i f6722c;
final com.joaomgcd.taskerm.util.i f6723d;
final com.joaomgcd.taskerm.util.i f6724e;
final com.joaomgcd.taskerm.util.i f6725f;
c(Activity activity, com.joaomgcd.taskerm.util.i iVar, com.joaomgcd.taskerm.util.i iVar2, com.joaomgcd.taskerm.util.i iVar3, com.joaomgcd.taskerm.util.i iVar4, com.joaomgcd.taskerm.util.i iVar5) {
super(0);
this.f6720a = activity;
this.f6721b = iVar;
this.f6722c = iVar2;
this.f6723d = iVar3;
this.f6724e = iVar4;
this.f6725f = iVar5;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return y.a(new com.joaomgcd.taskerm.dialog.h(this.f6720a, this.f6721b, this.f6722c, this.f6723d, this.f6724e, this.f6725f, false, 0, null, 0, null, null, null, 8128, null));
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, com.joaomgcd.taskerm.util.i iVar, com.joaomgcd.taskerm.util.i iVar2, com.joaomgcd.taskerm.util.i iVar3, com.joaomgcd.taskerm.util.i iVar4, com.joaomgcd.taskerm.util.i iVar5, com.joaomgcd.taskerm.util.i iVar6, SharedPreferences sharedPreferences) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(iVar, "title");
c.f.b.k.b(iVar2, "text");
c.f.b.k.b(iVar3, "positiveLabel");
c.f.b.k.b(iVar4, "negativeLabel");
c.f.b.k.b(iVar5, "overrideStopRemindingKey");
c.f.b.k.b(iVar6, "stopRemindingLabel");
c.f.b.k.b(sharedPreferences, "preferencesForStopReminding");
return com.joaomgcd.taskerm.q.b.a(activity, iVar5, a.f6581a, b.f6639a, sharedPreferences, new c(activity, iVar, iVar2, iVar3, iVar4, iVar6));
}
public static final class x extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
public static final x f6767a = new x();
x() {
super(0);
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x(1, null, 2, null));
}
}
public static final class C0143y extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, Boolean> {
public static final C0143y f6768a = new C0143y();
C0143y() {
super(1);
}
@Override
public Boolean invoke(com.joaomgcd.taskerm.dialog.x xVar) {
return Boolean.valueOf(a(xVar));
}
public final boolean a(com.joaomgcd.taskerm.dialog.x xVar) {
return xVar.g();
}
}
public static final class z extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
final Activity f6769a;
final int f6770b;
final String f6771c;
z(Activity activity, int i, String str) {
super(0);
this.f6769a = activity;
this.f6770b = i;
this.f6771c = str;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return y.a(this.f6769a, this.f6770b, this.f6771c, R.string.button_label_stop_reminding, false, (String) null, 48, (Object) null);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, String str) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "text");
return com.joaomgcd.taskerm.q.b.a(activity, new com.joaomgcd.taskerm.util.k(str), x.f6767a, C0143y.f6768a, null, new z(activity, i2, str), 8, null);
}
public static final class aa extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
public static final aa f6582a = new aa();
aa() {
super(0);
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x(1, null, 2, null));
}
}
public static final class ab extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, Boolean> {
public static final ab f6583a = new ab();
ab() {
super(1);
}
@Override
public Boolean invoke(com.joaomgcd.taskerm.dialog.x xVar) {
return Boolean.valueOf(a(xVar));
}
public final boolean a(com.joaomgcd.taskerm.dialog.x xVar) {
return xVar.g();
}
}
public static final class ac extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
final Activity f6584a;
final int f6585b;
final int f6586c;
ac(Activity activity, int i, int i2) {
super(0);
this.f6584a = activity;
this.f6585b = i;
this.f6586c = i2;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return y.a(this.f6584a, this.f6585b, this.f6586c, R.string.button_label_stop_reminding, false, (String) null, 48, (Object) null);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> b(Activity activity, int i2, int i3) {
c.f.b.k.b(activity, "activity");
Activity activity2 = activity;
return com.joaomgcd.taskerm.q.b.a(activity2, new com.joaomgcd.taskerm.util.l(activity2, i3, new Object[0]), aa.f6582a, ab.f6583a, null, new ac(activity, i2, i3), 8, null);
}
public static b.a.l a(Activity activity, int i2, int i3, int i4, int i5, String str, int i6, Object obj) {
int i7 = (i6 & 8) != 0 ? -1 : i4;
int i8 = (i6 & 16) != 0 ? R.string.button_label_ok : i5;
if ((i6 & 32) != 0) {
str = (String) null;
}
return a(activity, i2, i3, i7, i8, str);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, int i3, int i4, int i5, String str) {
c.f.b.k.b(activity, "activity");
String a2 = com.joaomgcd.taskerm.util.an.a(i3, activity, new Object[0]);
return a(activity, i2, a2, i4, i5, str != null ? str : a2);
}
public static final class ad extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
public static final ad f6587a = new ad();
ad() {
super(0);
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x(1, null, 2, null));
}
}
public static final class ae extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, Boolean> {
public static final ae f6588a = new ae();
ae() {
super(1);
}
@Override
public Boolean invoke(com.joaomgcd.taskerm.dialog.x xVar) {
return Boolean.valueOf(a(xVar));
}
public final boolean a(com.joaomgcd.taskerm.dialog.x xVar) {
return xVar.g();
}
}
public static b.a.l a(Activity activity, int i2, String str, int i3, int i4, String str2, int i5, Object obj) {
return a(activity, i2, str, (i5 & 8) != 0 ? -1 : i3, (i5 & 16) != 0 ? R.string.button_label_ok : i4, (i5 & 32) != 0 ? str : str2);
}
public static final class af extends c.f.b.l implements c.f.a.a<b.a.l<com.joaomgcd.taskerm.dialog.x>> {
final Activity f6589a;
final int f6590b;
final String f6591c;
final int f6592d;
final int f6593e;
af(Activity activity, int i, String str, int i2, int i3) {
super(0);
this.f6589a = activity;
this.f6590b = i;
this.f6591c = str;
this.f6592d = i2;
this.f6593e = i3;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> invoke() {
return y.a(new com.joaomgcd.taskerm.dialog.h(this.f6589a, this.f6590b, this.f6591c, this.f6592d, this.f6593e, R.string.button_label_stop_reminding, false, 0, (String) null, 0, (Integer) null, 1984, (c.f.b.g) null));
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, int i2, String str, int i3, int i4, String str2) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "text");
c.f.b.k.b(str2, "tipKey");
return com.joaomgcd.taskerm.q.b.a(activity, new com.joaomgcd.taskerm.util.k(str2), ad.f6587a, ae.f6588a, null, new af(activity, i2, str, i4, i3), 8, null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> b(Activity activity, int i2) {
c.f.b.k.b(activity, "activity");
return a(activity, R.string.tip_dialog_title, i2, 0, 0, (String) null, 56, (Object) null);
}
public static final class bu<T> implements b.a.d.f<com.joaomgcd.taskerm.dialog.x> {
final Activity f6711a;
final String f6712b;
bu(Activity activity, String str) {
this.f6711a = activity;
this.f6712b = str;
}
@Override
public final void accept(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.e()) {
com.joaomgcd.taskerm.util.al.a((Context) this.f6711a, this.f6712b, false, false, true, 6, (Object) null);
}
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> b(Activity activity, int i2, String str) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "learnMoreUrl");
b.a.l<com.joaomgcd.taskerm.dialog.x> b2 = a(activity, R.string.tip_dialog_title, i2, R.string.learn_more, 0, (String) null, 48, (Object) null).b(new bu(activity, str));
c.f.b.k.a((Object) b2, "dialogOkStopReminding(ac…reUrl, reuseTab = true)\n}");
return b2;
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, String str) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "text");
return a(activity, R.string.tip_dialog_title, str, 0, 0, (String) null, 56, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> c(Activity activity, int i2) {
c.f.b.k.b(activity, "activity");
return d(activity, R.string.tip_dialog_title, i2);
}
public static final b.a.b.b d(Activity activity, int i2) {
c.f.b.k.b(activity, "activity");
return com.joaomgcd.taskerm.rx.h.a(a(activity, R.string.warning_dialog_title, i2, 0, 0, (String) null, 56, (Object) null), activity, bq.f6707a);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> c(Activity activity, int i2, String str) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, str, R.string.button_label_ok, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (c.f.b.g) null));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, String str, String str2, com.joaomgcd.taskerm.util.i iVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "title");
return a(new com.joaomgcd.taskerm.dialog.h(activity, new com.joaomgcd.taskerm.util.k(str), str2 != null ? new com.joaomgcd.taskerm.util.k(str2) : null, new com.joaomgcd.taskerm.util.l(activity, R.string.button_label_ok, new Object[0]), iVar, null, false, 0, null, 0, null, null, null, 8160, null));
}
public static b.a.l a(Activity activity, String str, String str2, com.joaomgcd.taskerm.util.i iVar, int i2, Object obj) {
if ((i2 & 8) != 0) {
iVar = (com.joaomgcd.taskerm.util.i) null;
}
return a(activity, str, str2, iVar);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> d(Activity activity, int i2, int i3) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, i2, i3, R.string.button_label_ok, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (c.f.b.g) null));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> e(Activity activity, int i2) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.warning_dialog_title, com.joaomgcd.taskerm.util.g.f9751b.b(activity, i2), 0, 0, 0, false, 0, (String) null, 0, (Integer) null, 2040, (c.f.b.g) null));
}
public static b.a.l a(Activity activity, fz fzVar, String str, List list, boolean z2, int i2, Object obj) {
if ((i2 & 4) != 0) {
str = (String) null;
}
if ((i2 & 8) != 0) {
list = fzVar != null ? fzVar.b(-2, ft.c.Alpha) : null;
}
if ((i2 & 16) != 0) {
z2 = false;
}
return a(activity, fzVar, str, (List<? extends ft>) list, z2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.ae<ft>> a(Activity activity, fz fzVar, String str, List<? extends ft> list, boolean z2) {
Integer num;
boolean z3;
c.f.b.k.b(activity, "activity");
if (list == null) {
return null;
}
if (z2 && list.size() == 1) {
return b.a.l.a(new com.joaomgcd.taskerm.dialog.ae(new com.joaomgcd.taskerm.dialog.ab(3, null, 2, null), list.get(0), null, 4, null));
}
String str2 = str;
if (str2 == null || str2.length() == 0) {
num = null;
} else {
Iterator<? extends ft> it = list.iterator();
int i2 = 0;
while (true) {
if (!it.hasNext()) {
i2 = -1;
break;
}
ft next = it.next();
if (next.m() != null) {
String m2 = next.m();
c.f.b.k.a((Object) m2, "it.name");
if (m2 == null) {
throw new c.q("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = m2.toLowerCase();
c.f.b.k.a((Object) lowerCase, "(this as java.lang.String).toLowerCase()");
if (str == null) {
throw new c.q("null cannot be cast to non-null type java.lang.String");
}
String lowerCase2 = str.toLowerCase();
c.f.b.k.a((Object) lowerCase2, "(this as java.lang.String).toLowerCase()");
if (c.f.b.k.a((Object) lowerCase, (Object) lowerCase2)) {
z3 = true;
if (!z3) {
break;
}
i2++;
}
}
z3 = false;
if (!z3) {
}
}
num = Integer.valueOf(i2);
}
return com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.taskselect_title, list, true, bm.f6686a, null, null, null, null, null, num, null, null, null, null, null, 64480, null));
}
public static final class bm extends c.f.b.l implements c.f.a.b<ft, com.joaomgcd.taskerm.dialog.w> {
public static final bm f6686a = new bm();
bm() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(ft ftVar) {
c.f.b.k.b(ftVar, "it");
String m = ftVar.m();
c.f.b.k.a((Object) m, "it.name");
return new com.joaomgcd.taskerm.dialog.w(m, ftVar.f(), false, 4, null);
}
}
public static final class bo extends c.f.b.l implements c.f.a.b<String, com.joaomgcd.taskerm.dialog.w> {
public static final bo f6688a = new bo();
bo() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(String str) {
c.f.b.k.b(str, "it");
return new com.joaomgcd.taskerm.dialog.w(str, null, false, 6, null);
}
}
public static final b.a.l<String> a(Activity activity, List<String> list) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(list, "dataVars");
b.a.l<String> c2 = com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.dialog_title_variable_select, list, false, bo.f6688a, null, null, null, null, null, null, null, null, null, null, null, 65504, null)).c(bn.f6687a);
c.f.b.k.a((Object) c2, "dialogSingleChoice(args)…)\n\n selected\n }");
return c2;
}
public static final class bn<T, R> implements b.a.d.g<T, R> {
public static final bn f6687a = new bn();
bn() {
}
@Override
public final String apply(com.joaomgcd.taskerm.dialog.ae<String> aeVar) {
c.f.b.k.b(aeVar, "it");
String b2 = aeVar.b();
if (b2 != null) {
return !c.l.n.a(b2, "%", false, 2, (Object) null) ? di.a(b2) : b2;
}
throw new RuntimeException("No variable selected");
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_need_notification_listener, R.string.dc_need_notification_listener, R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null));
}
public static final class bc extends c.f.b.l implements c.f.a.a<cr> {
final Activity f6644a;
final com.joaomgcd.taskerm.securesettings.q f6645b;
final boolean f6646c;
bc(Activity activity, com.joaomgcd.taskerm.securesettings.q qVar, boolean z) {
super(0);
this.f6644a = activity;
this.f6645b = qVar;
this.f6646c = z;
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.b<Boolean, com.joaomgcd.taskerm.securesettings.aj> {
AnonymousClass1() {
super(1);
}
@Override
public com.joaomgcd.taskerm.securesettings.aj invoke(Boolean bool) {
return a(bool.booleanValue());
}
public static com.joaomgcd.taskerm.securesettings.aj a(AnonymousClass1 anonymousClass1, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
return anonymousClass1.a(z);
}
public final com.joaomgcd.taskerm.securesettings.aj a(boolean z) {
com.joaomgcd.taskerm.dialog.ac a2 = ac.a.a(com.joaomgcd.taskerm.dialog.ac.f6387a, bc.this.f6644a, R.string.dc_getting_settings, false, 4, null);
com.joaomgcd.taskerm.securesettings.aj b2 = com.joaomgcd.taskerm.securesettings.aj.f8799a.a(bc.this.f6644a, z ? bc.this.f6645b : null).b();
com.joaomgcd.taskerm.dialog.ac.a(a2, null, 1, null);
c.f.b.k.a((Object) b2, "result");
return b2;
}
}
@Override
public final cr invoke() {
AnonymousClass1 anonymousClass1 = new AnonymousClass1();
com.joaomgcd.taskerm.securesettings.aj ajVar = y.f6580a;
if (ajVar != null) {
y.f6580a = (com.joaomgcd.taskerm.securesettings.aj) null;
com.joaomgcd.taskerm.securesettings.ak b2 = AnonymousClass1.a(anonymousClass1, false, 1, null).a(ajVar).b();
if (b2.size() == 0) {
y.a(new com.joaomgcd.taskerm.dialog.h(this.f6644a, R.string.dialog_title_setting, R.string.no_differences_found, 0, 0, 0, false, 0, (String) null, 0, (Integer) null, 2040, (c.f.b.g) null)).b();
return new cs("no differences found");
}
Activity activity = this.f6644a;
c.f.b.k.a((Object) b2, "differences");
com.joaomgcd.taskerm.securesettings.t tVar = (com.joaomgcd.taskerm.securesettings.t) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.dialog_title_setting, b2, false, null, null, null, null, null, null, null, null, null, null, null, null, 65528, null)).b()).b();
if (tVar == null) {
return new cs("no setting selected");
}
if (this.f6646c && tVar.a().g() && tVar.b().g() && ((com.joaomgcd.taskerm.dialog.x) y.a(this.f6644a, R.string.dialog_title_setting, R.string.dc_is_toggle_custom_setting_want, 0, 8, (Object) null).b()).d()) {
tVar.b().a(com.joaomgcd.taskerm.securesettings.ab.f8780b);
}
return new cv(tVar.b());
}
if (!y.a(new com.joaomgcd.taskerm.dialog.h(this.f6644a, R.string.dialog_title_setting, R.string.dc_want_to_find_or_list_setting, R.string.ml_find, R.string.dialog_title_setting, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).b().e()) {
y.f6580a = AnonymousClass1.a(anonymousClass1, false, 1, null);
y.a(new com.joaomgcd.taskerm.dialog.h(this.f6644a, R.string.dialog_title_setting, R.string.dc_ok_change_setting_then_come_back_and_press_again, 0, 0, 0, false, 0, (String) null, 0, (Integer) null, 2040, (c.f.b.g) null)).b();
return new cu();
}
com.joaomgcd.taskerm.securesettings.s sVar = (com.joaomgcd.taskerm.securesettings.s) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6644a, R.string.dialog_title_setting, anonymousClass1.a(true), false, null, null, null, null, null, null, null, null, null, null, null, null, 65528, null)).b()).b();
if (sVar == null) {
return new cs("no setting selected");
}
return new cv(sVar);
}
}
public static final b.a.l<cr> a(Activity activity, com.joaomgcd.taskerm.securesettings.q qVar, boolean z2) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(qVar, "selectedSecureSettingType");
return com.joaomgcd.taskerm.rx.h.b(new bc(activity, qVar, z2));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> b(Activity activity) {
c.f.b.k.b(activity, "activity");
if (com.joaomgcd.taskerm.util.g.f9751b.r()) {
b.a.l<com.joaomgcd.taskerm.dialog.x> a2 = b.a.l.a((b.a.o) new bv(activity));
c.f.b.k.a((Object) a2, "Single.create<DialogMess…GATIVE_BUTTON))\n }");
return a2;
}
return a(activity, "volume_long_press_grant", "android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER", R.string.dc_volume_key_permission_explain, false, false, false, 112, (Object) null);
}
public static final class bv<T> implements b.a.o<T> {
final Activity f6713a;
bv(Activity activity) {
this.f6713a = activity;
}
@Override
public final void a(b.a.m<com.joaomgcd.taskerm.dialog.x> mVar) {
c.f.b.k.b(mVar, "it");
com.joaomgcd.taskerm.util.ao.c("Need at least Android 8 to handle long volume press events", this.f6713a);
mVar.a((b.a.m<com.joaomgcd.taskerm.dialog.x>) new com.joaomgcd.taskerm.dialog.x(1, null, 2, null));
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> c(Activity activity) {
c.f.b.k.b(activity, "activity");
if (com.joaomgcd.taskerm.util.g.f9751b.r()) {
b.a.l<com.joaomgcd.taskerm.dialog.x> a2 = b.a.l.a(new com.joaomgcd.taskerm.dialog.x(0, null, 2, null));
c.f.b.k.a((Object) a2, "Single.just(DialogMessag…nt.WHAT_POSITIVE_BUTTON))");
return a2;
}
return a(activity, "media_key_listener_grant", "android.permission.SET_MEDIA_KEY_LISTENER", R.string.dc_media_key_listener_permission_explain, false, false, false, 112, (Object) null);
}
public static final class g<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6739a;
g(Activity activity) {
this.f6739a = activity;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> apply(Boolean bool) {
c.f.b.k.b(bool, "isRootGiven");
if (bool.booleanValue()) {
return y.a(this.f6739a, R.string.an_adb_wifi, R.string.dc_adb_wifi_root_not_needed, 0, 0, (String) null, 56, (Object) null);
}
return y.a(this.f6739a, "adb_wifi", "android.permission.ADB_WIFI", R.string.dc_adb_wifi_permission_explain, false, false, false, 80, (Object) null);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> d(Activity activity) {
c.f.b.k.b(activity, "activity");
b.a.l a2 = net.dinglisch.android.taskerm.ba.b().a(new g(activity));
c.f.b.k.a((Object) a2, "Init.isRootGiven().flatM… = false)\n }\n }");
return a2;
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> e(Activity activity) {
c.f.b.k.b(activity, "activity");
return a(activity, "device_owner", "android.permission.BIND_DEVICE_ADMIN", R.string.dc_device_owner_permission_explain, false, false, false, 112, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> f(Activity activity) {
c.f.b.k.b(activity, "activity");
return a(activity, "dump_grant", "android.permission.DUMP", R.string.dc_dump_permission_explain, false, false, false, 112, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> g(Activity activity) {
c.f.b.k.b(activity, "activity");
return b(activity, R.string.an_screen_capture, R.string.dc_screencapture_permission_explain_short).a(new bb(activity));
}
public static final class bb<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6643a;
bb(Activity activity) {
this.f6643a = activity;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
return !xVar.d() ? b.a.l.a(xVar) : y.h(this.f6643a);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> h(Activity activity) {
c.f.b.k.b(activity, "activity");
return a(activity, "screencapture_grant", "PROJECT_MEDIA", R.string.dc_screencapture_permission_explain, false, false, true, 48, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> i(Activity activity) {
c.f.b.k.b(activity, "activity");
return f(activity, R.string.dc_read_logs_permission_logcat_explain);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> f(Activity activity, int i2) {
c.f.b.k.b(activity, "activity");
return a(activity, "read_logs_grant", "android.permission.READ_LOGS", i2, true, false, false, 96, (Object) null);
}
public static b.a.l a(Activity activity, String str, String str2, int i2, boolean z2, boolean z3, boolean z4, int i3, Object obj) {
if ((i3 & 2) != 0) {
str = "secure_setting_grant";
}
if ((i3 & 4) != 0) {
str2 = "android.permission.WRITE_SECURE_SETTINGS";
}
return a(activity, str, str2, (i3 & 8) != 0 ? R.string.dc_secure_settings_permission_explain : i2, (i3 & 16) != 0 ? false : z2, (i3 & 32) != 0 ? true : z3, (i3 & 64) != 0 ? false : z4);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(Activity activity, String str, String str2, int i2, boolean z2, boolean z3, boolean z4) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "helpId");
c.f.b.k.b(str2, "permission");
b.a.l a2 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(i2, activity, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new bd(activity, str, z3, z4, str2, z2));
c.f.b.k.a((Object) a2, "dialogTextBox(\n ArgsD… Single.just(it)\n }");
return a2;
}
public static final class bd<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6648a;
final String f6649b;
final boolean f6650c;
final boolean f6651d;
final String f6652e;
final boolean f6653f;
bd(Activity activity, String str, boolean z, boolean z2, String str2, boolean z3) {
this.f6648a = activity;
this.f6649b = str;
this.f6650c = z;
this.f6651d = z2;
this.f6652e = str2;
this.f6653f = z3;
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.d()) {
return com.joaomgcd.taskerm.rx.h.b(new AnonymousClass1());
}
return b.a.l.a(xVar);
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.dialog.x> {
AnonymousClass1() {
super(0);
}
public static final class C01401 extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.dialog.x> {
C01401() {
super(0);
}
@Override
public final com.joaomgcd.taskerm.dialog.x invoke() {
com.joaomgcd.taskerm.util.bw a2 = bw.a.a(com.joaomgcd.taskerm.util.bw.f9512c, (Context) bd.this.f6648a, 0, 2, (Object) null);
if (!a2.f()) {
y.d(bd.this.f6648a, R.string.dt_storage_access, R.string.dc_to_access_help_tasker_needs_storage).d(C01411.f6656a).b();
}
if (!a2.b(bd.this.f6648a).b().b()) {
return new com.joaomgcd.taskerm.dialog.x(1, null, 2, null);
}
ActionEdit.a(bd.this.f6648a, bd.this.f6649b, (String) null);
return new com.joaomgcd.taskerm.dialog.x(0, null, 2, null);
}
public static final class C01411<T, R> implements b.a.d.g<Throwable, b.a.p<? extends com.joaomgcd.taskerm.dialog.x>> {
public static final C01411 f6656a = ;
C01411() {
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.x> apply(Throwable th) {
c.f.b.k.b(th, "<anonymous parameter 0>");
return b.a.l.a(new com.joaomgcd.taskerm.dialog.x(0, null, 2, null));
}
}
}
@Override
public final com.joaomgcd.taskerm.dialog.x invoke() {
StringBuilder sb;
String str;
C01401 c01401 = new C01401();
if (!bd.this.f6650c || !net.dinglisch.android.taskerm.ba.b(bd.this.f6648a).b().booleanValue()) {
return c01401.invoke();
}
if (!y.a(new com.joaomgcd.taskerm.dialog.h(bd.this.f6648a, R.string.pl_use_root, R.string.dc_since_device_rooted_grant_perimssion, R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).b().d()) {
return c01401.invoke();
}
if (bd.this.f6651d) {
sb = new StringBuilder();
sb.append("appops set ");
sb.append(bd.this.f6648a.getPackageName());
sb.append(' ');
sb.append(bd.this.f6652e);
str = " allow";
} else {
sb = new StringBuilder();
sb.append("pm grant ");
sb.append(bd.this.f6648a.getPackageName());
sb.append(' ');
str = bd.this.f6652e;
}
sb.append(str);
if (cq.f9637a.a(new com.joaomgcd.taskerm.util.q(sb.toString(), true, 10000L, false, 8, null)).b().a()) {
y.a(new com.joaomgcd.taskerm.dialog.h(bd.this.f6648a, R.string.button_label_done, R.string.dc_permissions_granted, R.string.button_label_ok, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (c.f.b.g) null)).b();
}
if (bd.this.f6653f) {
y.d(bd.this.f6648a, R.string.dt_restart_needed, R.string.dc_restart_needed_permissions).b();
cq.f9637a.a(new com.joaomgcd.taskerm.util.q("am force-stop " + bd.this.f6648a.getPackageName(), true, 10000L, false, 8, null)).b();
}
return new com.joaomgcd.taskerm.dialog.x(0, null, 2, null);
}
}
}
public static b.a.l a(Activity activity, cs csVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
csVar = com.joaomgcd.taskerm.util.bw.f9512c.c(activity);
}
return a(activity, csVar);
}
public static final b.a.l<cr> a(Activity activity, cs csVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(csVar, "error");
Activity activity2 = activity;
if (bw.a.k(com.joaomgcd.taskerm.util.bw.f9512c, activity2, 0, 2, null).g()) {
b.a.l<cr> a2 = b.a.l.a(new cu());
c.f.b.k.a((Object) a2, "Single.just(SimpleResultSuccess())");
return a2;
}
b.a.l a3 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.dc_notification_access_permission_explain, activity2, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new v(activity, csVar));
c.f.b.k.a((Object) a3, "dialogTextBox(\n A…st(error)\n }\n }");
return a3;
}
public static final class v<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6764a;
final cs f6765b;
v(Activity activity, cs csVar) {
this.f6764a = activity;
this.f6765b = csVar;
}
@Override
public final b.a.l<? extends cr> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.d()) {
return new GenericActionActivityRequestNotificationAccess().run(this.f6764a);
}
return b.a.l.a(this.f6765b);
}
}
public static b.a.l b(Activity activity, cs csVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
csVar = com.joaomgcd.taskerm.util.bw.f9512c.c(activity);
}
return b(activity, csVar);
}
public static final b.a.l<cr> b(Activity activity, cs csVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(csVar, "error");
Activity activity2 = activity;
if (bw.a.l(com.joaomgcd.taskerm.util.bw.f9512c, activity2, 0, 2, null).g()) {
b.a.l<cr> a2 = b.a.l.a(new cu());
c.f.b.k.a((Object) a2, "Single.just(SimpleResultSuccess())");
return a2;
}
b.a.l a3 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.dc_manage_external_storage_permission_explain, activity2, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new u(activity, csVar));
c.f.b.k.a((Object) a3, "dialogTextBox(\n A…st(error)\n }\n }");
return a3;
}
public static final class u<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6762a;
final cs f6763b;
u(Activity activity, cs csVar) {
this.f6762a = activity;
this.f6763b = csVar;
}
@Override
public final b.a.l<? extends cr> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.d()) {
return new GenericActionActivityRequestManageExternalStorageAccess().run(this.f6762a);
}
return b.a.l.a(this.f6763b);
}
}
public static b.a.l c(Activity activity, cs csVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
csVar = com.joaomgcd.taskerm.util.bw.f9512c.c(activity);
}
return c(activity, csVar);
}
public static final b.a.l<cr> c(Activity activity, cs csVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(csVar, "error");
Activity activity2 = activity;
if (bw.a.l(com.joaomgcd.taskerm.util.bw.f9512c, activity2, 0, 2, null).g()) {
b.a.l<cr> a2 = b.a.l.a(new cu());
c.f.b.k.a((Object) a2, "Single.just(SimpleResultSuccess())");
return a2;
}
b.a.l a3 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.background_location_permission_justification, activity2, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new q(activity, csVar));
c.f.b.k.a((Object) a3, "dialogTextBox(\n A…st(error)\n }\n }");
return a3;
}
public static final class q<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6754a;
final cs f6755b;
q(Activity activity, cs csVar) {
this.f6754a = activity;
this.f6755b = csVar;
}
@Override
public final b.a.l<? extends cr> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.d()) {
return new GenericActionActivityRequestMissingPermissions(new String[]{"android.permission.ACCESS_BACKGROUND_LOCATION"}, null, 2, null).run(this.f6754a);
}
return b.a.l.a(this.f6755b);
}
}
public static b.a.l d(Activity activity, cs csVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
csVar = com.joaomgcd.taskerm.util.bw.f9512c.c(activity);
}
return d(activity, csVar);
}
public static final b.a.l<cr> d(Activity activity, cs csVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(csVar, "error");
if (com.joaomgcd.taskerm.util.g.f9751b.q()) {
b.a.l<cr> a2 = b.a.l.a(new cu());
c.f.b.k.a((Object) a2, "Single.just(SimpleResultSuccess())");
return a2;
}
Activity activity2 = activity;
if (bw.a.m(com.joaomgcd.taskerm.util.bw.f9512c, activity2, 0, 2, null).g()) {
b.a.l<cr> a3 = b.a.l.a(new cu());
c.f.b.k.a((Object) a3, "Single.just(SimpleResultSuccess())");
return a3;
}
b.a.l a4 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.dc_call_screener_explain, activity2, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new r(activity, csVar));
c.f.b.k.a((Object) a4, "dialogTextBox(\n A…st(error)\n }\n }");
return a4;
}
public static final class r<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6756a;
final cs f6757b;
r(Activity activity, cs csVar) {
this.f6756a = activity;
this.f6757b = csVar;
}
@Override
public final b.a.l<? extends cr> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.d()) {
return new GenericActionActivityRequestCallScreeningAccess().run(this.f6756a);
}
return b.a.l.a(this.f6757b);
}
}
public static b.a.l e(Activity activity, cs csVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
csVar = com.joaomgcd.taskerm.util.bw.f9512c.c(activity);
}
return e(activity, csVar);
}
public static final b.a.l<cr> e(Activity activity, cs csVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(csVar, "error");
Activity activity2 = activity;
if (bw.a.p(com.joaomgcd.taskerm.util.bw.f9512c, activity2, 0, 2, null).g()) {
b.a.l<cr> a2 = b.a.l.a(new cu());
c.f.b.k.a((Object) a2, "Single.just(SimpleResultSuccess())");
return a2;
}
b.a.l a3 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.dc_need_root_access, activity2, new Object[0]), R.string.button_label_ok, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (c.f.b.g) null)).a(new w(csVar));
c.f.b.k.a((Object) a3, "dialogTextBox(\n A… Single.just(error)\n }");
return a3;
}
public static final class w<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final cs f6766a;
w(cs csVar) {
this.f6766a = csVar;
}
@Override
public final b.a.l<cs> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
return b.a.l.a(this.f6766a);
}
}
public static b.a.l f(Activity activity, cs csVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
csVar = com.joaomgcd.taskerm.util.bw.f9512c.c(activity);
}
return f(activity, csVar);
}
public static final b.a.l<cr> f(Activity activity, cs csVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(csVar, "error");
Activity activity2 = activity;
if (bw.a.n(com.joaomgcd.taskerm.util.bw.f9512c, activity2, 0, 2, null).g()) {
b.a.l<cr> a2 = b.a.l.a(new cu());
c.f.b.k.a((Object) a2, "Single.just(SimpleResultSuccess())");
return a2;
}
b.a.l a3 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.dc_need_dnd_access, activity2, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new t(activity, csVar));
c.f.b.k.a((Object) a3, "dialogTextBox(\n A…st(error)\n }\n }");
return a3;
}
public static final class t<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6759a;
final cs f6760b;
t(Activity activity, cs csVar) {
this.f6759a = activity;
this.f6760b = csVar;
}
public static final class AnonymousClass1<T, R> implements b.a.d.g<Throwable, b.a.p<? extends cr>> {
AnonymousClass1() {
}
@Override
public final b.a.l<cs> apply(Throwable th) {
c.f.b.k.b(th, "it");
return b.a.l.a(t.this.f6760b);
}
}
@Override
public final b.a.l<? extends cr> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
if (xVar.d()) {
return new GenericActionActivityRequestDoNotDisturbAccess().run(this.f6759a).d(new b.a.d.g<Throwable, b.a.p<? extends cr>>() {
AnonymousClass1() {
}
@Override
public final b.a.l<cs> apply(Throwable th) {
c.f.b.k.b(th, "it");
return b.a.l.a(t.this.f6760b);
}
});
}
return b.a.l.a(this.f6760b);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> k(Activity activity) {
c.f.b.k.b(activity, "activity");
return a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, com.joaomgcd.taskerm.util.an.a(R.string.dc_draw_overlay_permission_explain, activity, new Object[0]), R.string.button_label_ok, R.string.button_label_no, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null));
}
public static final class s<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6758a;
s(Activity activity) {
this.f6758a = activity;
}
@Override
public final b.a.l<? extends cr> apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "dialogMessage");
if (xVar.e()) {
ActionEdit.a(this.f6758a, "secure_setting_grant", (String) null);
return b.a.l.a(new cu());
}
if (xVar.d()) {
return new GenericActionActivityRequestDigitalAssistantPermission().run(this.f6758a);
}
return b.a.l.a(ct.a("missing digital assistant permission"));
}
}
public static final b.a.l<cr> l(Activity activity) {
c.f.b.k.b(activity, "activity");
b.a.l a2 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.dt_missing_permissions, R.string.run_airplane_mode_no_root_or_adb_wifi, R.string.ml_android_settings_assistant_settings, R.string.dt_permission, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).a(new s(activity));
c.f.b.k.a((Object) a2, "dialogTextBox(ArgsDialog…stant permission\"))\n }");
return a2;
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> a(com.joaomgcd.taskerm.dialog.c cVar) {
c.f.b.k.b(cVar, "args");
return com.joaomgcd.taskerm.rx.h.b(new n(cVar));
}
public static final class n extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.dialog.x> {
final com.joaomgcd.taskerm.dialog.c f6751a;
n(com.joaomgcd.taskerm.dialog.c cVar) {
super(0);
this.f6751a = cVar;
}
@Override
public final com.joaomgcd.taskerm.dialog.x invoke() {
try {
new ActionDialogHTML(this.f6751a.b(), this.f6751a.c()).run(this.f6751a.a()).b();
return new com.joaomgcd.taskerm.dialog.x(0, null, 2, null);
} catch (Exception unused) {
return new com.joaomgcd.taskerm.dialog.x(1, null, 2, null);
}
}
}
public static final class i extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>>, c.s> {
final Activity f6741a;
i(Activity activity) {
super(1);
this.f6741a = activity;
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
a(ahVar);
return c.s.f2131a;
}
public final void a(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
c.f.b.k.b(ahVar, "it");
gn.a(this.f6741a, ahVar).a(this.f6741a);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> m(Activity activity) {
c.f.b.k.b(activity, "activity");
return a(new i(activity), (c.f.a.b) null, 2, (Object) null);
}
public static final b.a.l<cw<String, com.joaomgcd.taskerm.util.ah>> a(Context context) {
c.f.b.k.b(context, "context");
return a(context, net.dinglisch.android.taskerm.cr.a(), (List) null, false, (List) null, 28, (Object) null);
}
public static final b.a.l<cw<String, com.joaomgcd.taskerm.util.ah>> a(Context context, Intent intent, List<String> list, boolean z2, List<String> list2) {
c.f.b.k.b(context, "context");
b.a.l c2 = new GenericActionActivitySelectApp(intent, list, z2, list2).run(context).c(be.f6657a);
c.f.b.k.a((Object) c2, "GenericActionActivitySel…Unknown error\"))\n }\n\n}");
return c2;
}
public static b.a.l a(Context context, Intent intent, List list, boolean z2, List list2, int i2, Object obj) {
if ((i2 & 2) != 0) {
intent = (Intent) null;
}
if ((i2 & 4) != 0) {
list = (List) null;
}
if ((i2 & 8) != 0) {
z2 = false;
}
if ((i2 & 16) != 0) {
list2 = (List) null;
}
return a(context, intent, (List<String>) list, z2, (List<String>) list2);
}
public static final class be<T, R> implements b.a.d.g<T, R> {
public static final be f6657a = new be();
be() {
}
@Override
public final cw<String, com.joaomgcd.taskerm.util.ah> apply(cr crVar) {
c.f.b.k.b(crVar, "it");
return crVar instanceof cw ? (cw) crVar : crVar instanceof cs ? new cw<>(false, (String) null, new com.joaomgcd.taskerm.util.ah(((cs) crVar).c())) : new cw<>(false, (String) null, new com.joaomgcd.taskerm.util.ah("Unknown error"));
}
}
public static final class bl implements com.joaomgcd.taskerm.helper.x {
private final Context f6684a;
private final String f6685b;
public bl(Context context, String str) {
c.f.b.k.b(context, "context");
c.f.b.k.b(str, net.dinglisch.android.taskerm.bf.EXTRA_ID);
this.f6684a = context;
this.f6685b = str;
}
@Override
public String a() {
return this.f6685b;
}
public String toString() {
return com.joaomgcd.taskerm.util.bx.a(a(), this.f6684a) + " (" + c.l.n.a(a(), (CharSequence) "android.permission.") + ')';
}
}
public static final b.a.l<String> b(Activity activity, List<String> list) {
List<String> l2;
c.f.b.k.b(activity, "activity");
if (list != null) {
l2 = list;
} else {
String[] strArr = net.dinglisch.android.taskerm.bq.f12303e;
c.f.b.k.a((Object) strArr, "KNOWN_PERMS");
l2 = c.a.d.l(strArr);
c.a.j.a((Collection) l2, (Object[]) com.joaomgcd.taskerm.util.bw.f9512c.b());
}
List<String> list2 = l2;
ArrayList arrayList = new ArrayList(c.a.j.a((Iterable) list2, 10));
Iterator<T> it = list2.iterator();
while (it.hasNext()) {
arrayList.add(new bl(activity, (String) it.next()));
}
HashSet hashSet = new HashSet();
ArrayList arrayList2 = new ArrayList();
for (Object obj : arrayList) {
if (hashSet.add(((bl) obj).toString())) {
arrayList2.add(obj);
}
}
b.a.l<String> c2 = com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.app_class_permissions, arrayList2, false, null, null, null, true, null, null, null, null, null, null, null, null, 65400, null)).c(bk.f6683a);
c.f.b.k.a((Object) c2, "dialogSingleChoice(Dialo…sion selected\")\n }");
return c2;
}
public static final class bk<T, R> implements b.a.d.g<T, R> {
public static final bk f6683a = new bk();
bk() {
}
@Override
public final String apply(com.joaomgcd.taskerm.dialog.ae<bl> aeVar) {
String a2;
c.f.b.k.b(aeVar, "it");
bl b2 = aeVar.b();
if (b2 == null || (a2 = b2.a()) == null) {
throw new RuntimeException("No permission selected");
}
return a2;
}
}
@TargetApi(26)
public static b.a.l a(Activity activity, String str, int i2, Object obj) {
if ((i2 & 2) != 0) {
str = com.joaomgcd.taskerm.notification.aw.f8309b.d().a();
}
return b(activity, str);
}
public static final class bj extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.dialog.ae<NotificationChannel>> {
final Activity f6680a;
final String f6681b;
bj(Activity activity, String str) {
super(0);
this.f6680a = activity;
this.f6681b = str;
}
@Override
public final com.joaomgcd.taskerm.dialog.ae<NotificationChannel> invoke() {
List<NotificationChannel> a2;
com.joaomgcd.taskerm.dialog.ae<NotificationChannel> aeVar = new com.joaomgcd.taskerm.dialog.ae<>();
if (com.joaomgcd.taskerm.util.g.f9751b.r() || (a2 = com.joaomgcd.taskerm.notification.ao.a(this.f6680a, this.f6681b)) == null) {
return aeVar;
}
if (a2.isEmpty()) {
y.d(this.f6680a, R.string.dc_notification_category, R.string.dc_you_didnt_create_any_categories_yet).b();
return aeVar;
}
com.joaomgcd.taskerm.dialog.ae<NotificationChannel> aeVar2 = (com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6680a, R.string.dc_notification_category, a2, false, a.f6682a, Integer.valueOf(R.string.tip_long_click_to_delete), null, null, null, null, null, null, null, null, null, null, 65480, null)).b();
if (!aeVar2.a().o()) {
return aeVar2;
}
com.joaomgcd.taskerm.util.ao.b(com.joaomgcd.taskerm.util.an.a(R.string.message_deleted, this.f6680a, new Object[0]), this.f6680a);
y.a(this.f6680a, R.string.dc_notification_category, R.string.dc_delete_categories_doesnt_change_properties, 0, 0, (String) null, 56, (Object) null).b();
Activity activity = this.f6680a;
NotificationChannel b2 = aeVar2.b();
com.joaomgcd.taskerm.notification.ao.c(activity, b2 != null ? b2.getId() : null);
return (com.joaomgcd.taskerm.dialog.ae) y.a(this.f6680a, (String) null, 2, (Object) null).b();
}
public static final class a extends c.f.b.l implements c.f.a.b<NotificationChannel, com.joaomgcd.taskerm.dialog.w> {
public static final a f6682a = new a();
a() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(NotificationChannel notificationChannel) {
c.f.b.k.b(notificationChannel, "it");
return new com.joaomgcd.taskerm.dialog.w(notificationChannel.getName().toString(), null, false, 6, null);
}
}
}
@TargetApi(26)
public static final b.a.l<com.joaomgcd.taskerm.dialog.ae<NotificationChannel>> b(Activity activity, String str) {
c.f.b.k.b(activity, "activity");
return com.joaomgcd.taskerm.rx.h.b(new bj(activity, str));
}
public static final class bf extends c.f.b.l implements c.f.a.a<String> {
final Activity f6658a;
bf(Activity activity) {
super(0);
this.f6658a = activity;
}
@Override
public final String invoke() {
String invoke;
com.joaomgcd.taskerm.dialog.i iVar = (com.joaomgcd.taskerm.dialog.i) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6658a, R.string.dt_select_time_option, c.a.j.d(new com.joaomgcd.taskerm.dialog.i(this.f6658a, R.string.dc_wait_for_some_time_button_press, new a()), new com.joaomgcd.taskerm.dialog.i(this.f6658a, R.string.dc_trigger_every_second_while_button_pressed, new b())), false, null, null, null, null, null, null, null, null, null, null, null, null, 65520, null)).b()).b();
return (iVar == null || (invoke = iVar.b().invoke()) == null) ? "" : invoke;
}
public static final class a extends c.f.b.l implements c.f.a.a<String> {
a() {
super(0);
}
@Override
public final String invoke() {
return ((com.joaomgcd.taskerm.dialog.x) y.a(bf.this.f6658a, R.string.dc_how_much_time_to_wait_to_trigger, "1", 0, true, (String) null, 40, (Object) null).b()).j();
}
}
public static final class b extends c.f.b.l implements c.f.a.a<String> {
b() {
super(0);
}
@Override
public final String invoke() {
String j = ((com.joaomgcd.taskerm.dialog.x) y.a(bf.this.f6658a, R.string.dc_how_much_time_to_wait_to_trigger, "0", 0, true, (String) null, 40, (Object) null).b()).j();
String str = j;
if (str == null || str.length() == 0) {
return "";
}
String j2 = ((com.joaomgcd.taskerm.dialog.x) y.a(bf.this.f6658a, R.string.dc_stop_triggering_at_which_time, "", 0, true, (String) null, 40, (Object) null).b()).j();
if (j2 == null) {
j2 = "";
}
return com.joaomgcd.taskerm.media.a.f8025b.a(j, j2);
}
}
}
public static final b.a.l<String> n(Activity activity) {
c.f.b.k.b(activity, "activity");
return com.joaomgcd.taskerm.rx.h.b(new bf(activity));
}
@SuppressLint({"MissingPermission"})
public static final b.a.l<com.joaomgcd.taskerm.dialog.ae<BluetoothDevice>> o(Activity activity) {
c.f.b.k.b(activity, "activity");
if (!com.joaomgcd.taskerm.util.bw.f9512c.a(activity)) {
b.a.l<com.joaomgcd.taskerm.dialog.ae<BluetoothDevice>> b2 = b.a.l.b(new RuntimeException("Need Nearby devices permission"));
c.f.b.k.a((Object) b2, "Single.error(RuntimeExce…rby devices permission\"))");
return b2;
}
BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
c.f.b.k.a((Object) defaultAdapter, "BluetoothAdapter.getDefaultAdapter()");
Set<BluetoothDevice> bondedDevices = defaultAdapter.getBondedDevices();
c.f.b.k.a((Object) bondedDevices, "BluetoothAdapter.getDefaultAdapter().bondedDevices");
HashSet hashSet = new HashSet();
ArrayList arrayList = new ArrayList();
for (Object obj : bondedDevices) {
BluetoothDevice bluetoothDevice = (BluetoothDevice) obj;
c.f.b.k.a((Object) bluetoothDevice, "it");
if (hashSet.add(bluetoothDevice.getAddress())) {
arrayList.add(obj);
}
}
return com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.an_bluetooth_connection, c.a.j.i((Iterable) arrayList), true, ah.f6596a, null, null, null, null, null, null, null, null, null, null, null, 65504, null));
}
public static final class ah extends c.f.b.l implements c.f.a.b<BluetoothDevice, com.joaomgcd.taskerm.dialog.w> {
public static final ah f6596a = new ah();
ah() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(BluetoothDevice bluetoothDevice) {
c.f.b.k.a((Object) bluetoothDevice, "it");
return new com.joaomgcd.taskerm.dialog.w(com.joaomgcd.taskerm.util.an.h(bluetoothDevice), null, false, 6, null);
}
}
public static final class j<T, R> implements b.a.d.g<T, R> {
public static final j f6742a = new j();
j() {
}
@Override
public final String apply(com.joaomgcd.taskerm.dialog.ae<String> aeVar) {
c.f.b.k.b(aeVar, "it");
String b2 = aeVar.b();
if (b2 == null) {
throw new RuntimeException("Nothing selected");
}
if (b2 == null) {
throw new c.q("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = b2.toLowerCase();
c.f.b.k.a((Object) lowerCase, "(this as java.lang.String).toLowerCase()");
return String.valueOf(Boolean.parseBoolean(lowerCase));
}
}
public static final b.a.l<String> a(Activity activity, com.joaomgcd.taskerm.util.j jVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(jVar, "title");
Activity activity2 = activity;
String a2 = jVar.a(activity2);
Integer[] numArr = {Integer.valueOf(R.string.word_true), Integer.valueOf(R.string.word_false)};
ArrayList arrayList = new ArrayList(numArr.length);
for (Integer num : numArr) {
arrayList.add(com.joaomgcd.taskerm.util.an.a(num.intValue(), activity2, new Object[0]));
}
b.a.l<String> c2 = com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, a2, arrayList, false, null, null, null, null, null, null, null, null, null, null, null, null, null, 131064, null)).c(j.f6742a);
c.f.b.k.a((Object) c2, "dialogSingleChoice(Dialo…oolean().toString()\n }");
return c2;
}
private static final b.a.l<String> a(Activity activity, ax.a aVar, boolean z2) {
b.a.l<String> c2 = a(new k(activity, aVar, z2), (c.f.a.b) null, 2, (Object) null).c(new l(activity));
c.f.b.k.a((Object) c2, "withHandler({\n IconSe…ception(\"Invalid icon\")\n}");
return c2;
}
public static final class k extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>>, c.s> {
final Activity f6743a;
final ax.a f6744b;
final boolean f6745c;
k(Activity activity, ax.a aVar, boolean z) {
super(1);
this.f6743a = activity;
this.f6744b = aVar;
this.f6745c = z;
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
a(ahVar);
return c.s.f2131a;
}
public final void a(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
c.f.b.k.b(ahVar, "it");
net.dinglisch.android.taskerm.ax.a((Context) this.f6743a, (Handler) ahVar, this.f6744b, this.f6745c, false).a(this.f6743a);
}
}
public static final class l<T, R> implements b.a.d.g<T, R> {
final Activity f6746a;
l(Activity activity) {
this.f6746a = activity;
}
@Override
public final String apply(com.joaomgcd.taskerm.dialog.x xVar) {
Integer l;
String uri;
c.f.b.k.b(xVar, "it");
Bundle m = xVar.m();
if (m == null || (l = xVar.l()) == null || l.intValue() != 1) {
throw new RuntimeException("Not selected");
}
String string = m.getString(ProfileManager.EXTRA_PROFILE_NAME);
int i = m.getInt("tint", 0);
net.dinglisch.android.taskerm.g gVar = new net.dinglisch.android.taskerm.g(string);
if (i != 0) {
gVar.c(i);
}
Uri c2 = gVar.c(this.f6746a);
if (c2 == null || (uri = c2.toString()) == null) {
throw new RuntimeException("Invalid icon");
}
return uri;
}
}
public static final b.a.l<String> a(Activity activity, boolean z2) {
c.f.b.k.b(activity, "activity");
return a(activity, ax.a.Holo, z2);
}
public static b.a.l a(Activity activity, boolean z2, int i2, Object obj) {
if ((i2 & 2) != 0) {
z2 = false;
}
return a(activity, z2);
}
public static final b.a.l<String> b(Activity activity, boolean z2) {
c.f.b.k.b(activity, "activity");
return a(activity, ax.a.Material, z2);
}
public static b.a.l b(Activity activity, boolean z2, int i2, Object obj) {
if ((i2 & 2) != 0) {
z2 = false;
}
return b(activity, z2);
}
public static final b.a.l<String> c(Activity activity, boolean z2) {
c.f.b.k.b(activity, "activity");
return a(activity, ax.a.Misc, z2);
}
public static b.a.l c(Activity activity, boolean z2, int i2, Object obj) {
if ((i2 & 2) != 0) {
z2 = false;
}
return c(activity, z2);
}
public static b.a.l a(Activity activity, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8, int i2, Object obj) {
if ((i2 & 2) != 0) {
z2 = false;
}
if ((i2 & 4) != 0) {
z3 = true;
}
if ((i2 & 8) != 0) {
z4 = true;
}
if ((i2 & 16) != 0) {
z5 = true;
}
if ((i2 & 32) != 0) {
z6 = true;
}
if ((i2 & 64) != 0) {
z7 = false;
}
if ((i2 & 128) != 0) {
z8 = false;
}
return a(activity, z2, z3, z4, z5, z6, z7, z8);
}
public static final b.a.l<String[]> a(Activity activity, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8) {
c.f.b.k.b(activity, "activity");
return com.joaomgcd.taskerm.rx.h.b(new bi(z4, z5, z6, z3, z8, z7, activity, z2));
}
public static final class bi extends c.f.b.l implements c.f.a.a<String[]> {
final boolean f6672a;
final boolean f6673b;
final boolean f6674c;
final boolean f6675d;
final boolean f6676e;
final boolean f6677f;
final Activity g;
final boolean h;
bi(boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, Activity activity, boolean z7) {
super(0);
this.f6672a = z;
this.f6673b = z2;
this.f6674c = z3;
this.f6675d = z4;
this.f6676e = z5;
this.f6677f = z6;
this.g = activity;
this.h = z7;
}
@Override
public final String[] invoke() {
String[] strArr;
List a2;
String a3;
ArrayList arrayList = new ArrayList();
if (this.f6672a) {
arrayList.add(new c.k(Integer.valueOf(R.string.application_icon), Integer.valueOf(R.drawable.mw_browse_files_apps)));
}
if (!Kid.a()) {
c.a.j.a((Collection) arrayList, (Object[]) new c.k[]{new c.k(Integer.valueOf(R.string.word_holo), Integer.valueOf(R.drawable.hl_aaa_ext_android)), new c.k(Integer.valueOf(R.string.word_material), Integer.valueOf(R.drawable.mw_action_android)), new c.k(Integer.valueOf(R.string.settings_tab_misc), Integer.valueOf(R.drawable.cust_cookie))});
}
if (this.f6673b) {
arrayList.add(new c.k(Integer.valueOf(R.string.pl_file), Integer.valueOf(R.drawable.mw_browse_files_file)));
}
if (this.f6674c) {
arrayList.add(new c.k(Integer.valueOf(R.string.pl_url), Integer.valueOf(R.drawable.mw_browse_files_url)));
}
if (this.f6675d) {
arrayList.add(new c.k(Integer.valueOf(R.string.current_wallpaper), Integer.valueOf(R.drawable.mw_device_wallpaper)));
}
if (this.f6676e) {
arrayList.add(new c.k(Integer.valueOf(R.string.clipboard_image), Integer.valueOf(R.drawable.hd_content_paste)));
}
if (this.f6677f) {
arrayList.add(new c.k(Integer.valueOf(R.string.base64_image), Integer.valueOf(R.drawable.mw_action_code)));
}
c.k kVar = (c.k) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.g, R.string.cn_image, arrayList, false, new b(), null, null, null, null, null, null, null, null, null, null, null, 65504, null)).b()).b();
if (kVar == null) {
throw new RuntimeException("Didn't select image type");
}
int intValue = ((Number) kVar.a()).intValue();
switch (intValue) {
case R.string.pl_file:
strArr = (String[]) y.a((Context) this.g, "image/*", this.h, (String) null, false, false, false, 120, (Object) null).b();
break;
case R.string.pl_url:
String j = y.a(new com.joaomgcd.taskerm.dialog.h(this.g, R.string.pl_url, (String) null, 0, 0, 0, true, 0, (String) null, 0, (Integer) null, 1976, (c.f.b.g) null)).b().j();
if (j != null) {
return new String[]{j};
}
throw new RuntimeException("Didn't enter a URL");
case R.string.settings_tab_misc:
Object b2 = y.c(this.g, false, 2, (Object) null).b();
c.f.b.k.a(b2, "dialogBuiltInIconMisc(activity).blockingGet()");
return new String[]{(String) b2};
case R.string.word_holo:
Object b3 = y.a(this.g, false, 2, (Object) null).b();
c.f.b.k.a(b3, "dialogBuiltInIconHolo(activity).blockingGet()");
return new String[]{(String) b3};
case R.string.word_material:
Object b4 = y.b(this.g, false, 2, (Object) null).b();
c.f.b.k.a(b4, "dialogBuiltInIconMaterial(activity).blockingGet()");
return new String[]{(String) b4};
case R.string.application_icon:
strArr = new String[1];
String c2 = IconProvider.f8088a.c((String) ((cw) y.a((Context) this.g, (Intent) null, (List) null, false, (List) null, 30, (Object) null).b()).d());
if (c2 == null) {
throw new RuntimeException("Didn't select an app");
}
strArr[0] = c2;
break;
case R.string.base64_image:
String j2 = y.a(new com.joaomgcd.taskerm.dialog.h(this.g, com.joaomgcd.taskerm.util.an.a(R.string.base64_image, this.g), null, null, null, null, true, 0, com.joaomgcd.taskerm.util.an.a(R.string.base64_image_prompt, this.g, new Object[0]), 0, null, null, null, 7868, null)).b().j();
if (j2 != null) {
return new String[]{com.joaomgcd.taskerm.m.b.a() + com.joaomgcd.taskerm.m.a.f8011a.b(j2)};
}
throw new RuntimeException("Didn't enter anything");
case R.string.clipboard_image:
strArr = new String[]{IconProvider.f8088a.a()};
break;
case R.string.current_wallpaper:
List b5 = c.a.j.b(Integer.valueOf(R.string.launcher_wallpaper), Integer.valueOf(R.string.lockscreen_wallpaper));
a aVar = new a();
if (this.h) {
a2 = ((com.joaomgcd.taskerm.dialog.as) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.e(this.g, new com.joaomgcd.taskerm.util.l(this.g, intValue, new Object[0]), b5, false, aVar, null, null, null, null, null, null, null, null, 8168, null)).b()).b();
} else {
Integer num = (Integer) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.g, intValue, b5, false, aVar, null, null, null, null, null, null, null, null, null, null, null, 65512, null)).b()).b();
if (num != null) {
a2 = c.a.j.a(Integer.valueOf(num.intValue()));
} else {
throw new RuntimeException("Type of wallpaper not selected");
}
}
List list = a2;
ArrayList arrayList2 = new ArrayList(c.a.j.a((Iterable) list, 10));
Iterator it = list.iterator();
while (it.hasNext()) {
int intValue2 = ((Number) it.next()).intValue();
if (intValue2 == R.string.launcher_wallpaper) {
a3 = IconProvider.f8088a.a(hh.a.Launcher);
} else if (intValue2 == R.string.lockscreen_wallpaper) {
a3 = IconProvider.f8088a.a(hh.a.Lock);
} else {
throw new RuntimeException("Invalid type of wallpaper");
}
arrayList2.add(a3);
}
Object[] array = arrayList2.toArray(new String[0]);
if (array == null) {
throw new c.q("null cannot be cast to non-null type kotlin.Array<T>");
}
strArr = (String[]) array;
break;
default:
throw new RuntimeException("Not a valid type of image selection");
}
return strArr;
}
public static final class b extends c.f.b.l implements c.f.a.b<c.k<? extends Integer, ? extends Integer>, com.joaomgcd.taskerm.dialog.w> {
b() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(c.k<Integer, Integer> kVar) {
c.f.b.k.b(kVar, "it");
return new com.joaomgcd.taskerm.dialog.w(com.joaomgcd.taskerm.util.an.a(kVar.a().intValue(), bi.this.g, new Object[0]), new net.dinglisch.android.taskerm.g(bi.this.g.getResources(), kVar.b().intValue()), false, 4, null);
}
}
public static final class a extends c.f.b.l implements c.f.a.b<Integer, com.joaomgcd.taskerm.dialog.w> {
a() {
super(1);
}
@Override
public com.joaomgcd.taskerm.dialog.w invoke(Integer num) {
return a(num.intValue());
}
public final com.joaomgcd.taskerm.dialog.w a(int i) {
return new com.joaomgcd.taskerm.dialog.w(com.joaomgcd.taskerm.util.an.a(i, bi.this.g, new Object[0]), null, false, 6, null);
}
}
}
public static b.a.l a(Context context, String str, boolean z2, String str2, boolean z3, boolean z4, boolean z5, int i2, Object obj) {
if ((i2 & 2) != 0) {
str = "*/*";
}
boolean z6 = (i2 & 4) != 0 ? false : z2;
if ((i2 & 8) != 0) {
str2 = (String) null;
}
return a(context, str, z6, str2, (i2 & 16) == 0 ? z3 : false, (i2 & 32) != 0 ? true : z4, (i2 & 64) != 0 ? true : z5);
}
public static final class bh extends c.f.b.l implements c.f.a.a<String[]> {
final Context f6666a;
final boolean f6667b;
final boolean f6668c;
final String f6669d;
final String f6670e;
final boolean f6671f;
final boolean g;
bh(Context context, boolean z, boolean z2, String str, String str2, boolean z3, boolean z4) {
super(0);
this.f6666a = context;
this.f6667b = z;
this.f6668c = z2;
this.f6669d = str;
this.f6670e = str2;
this.f6671f = z3;
this.g = z4;
}
@Override
public final String[] invoke() {
Intent intent;
if ((this.f6666a instanceof Activity) && !(!((Boolean) bw.a.a(com.joaomgcd.taskerm.util.bw.f9512c, (Activity) this.f6666a, 0, 2, (Object) null).b()).booleanValue())) {
throw new RuntimeException("No file read permissions");
}
if (this.f6667b && !this.f6668c) {
intent = FileSelect.a(this.f6666a, null, this.f6669d, FileSelect.b.File, null, true, true);
} else {
intent = new Intent("android.intent.action.OPEN_DOCUMENT");
intent.setType(this.f6670e);
intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", this.f6668c);
intent.putExtra("android.provider.extra.INITIAL_URI", com.joaomgcd.taskerm.util.ao.C(this.f6669d));
intent.putExtra("android.intent.extra.LOCAL_ONLY", true);
}
c.k kVar = this.f6667b ? null : new c.k(Integer.valueOf(R.string.pick_file), Integer.valueOf(R.string.pick_file_dont_use_shortcuts_explanation));
c.f.b.k.a((Object) intent, "intent");
Object[] array = dq.a(com.joaomgcd.taskerm.util.an.a(intent, this.f6666a, kVar != null ? (Integer) kVar.a() : null, kVar != null ? (Integer) kVar.b() : null).b(), this.f6666a, this.f6667b, this.f6671f, this.g).toArray(new String[0]);
if (array != null) {
return (String[]) array;
}
throw new c.q("null cannot be cast to non-null type kotlin.Array<T>");
}
}
public static final b.a.l<String[]> a(Context context, String str, boolean z2, String str2, boolean z3, boolean z4, boolean z5) {
c.f.b.k.b(context, "context");
c.f.b.k.b(str, "type");
return com.joaomgcd.taskerm.rx.h.b(new bh(context, z3, z2, str2, str, z4, z5));
}
public static final class bg extends c.f.b.l implements c.f.a.a<String> {
final Context f6661a;
final boolean f6662b;
final String f6663c;
final boolean f6664d;
final boolean f6665e;
bg(Context context, boolean z, String str, boolean z2, boolean z3) {
super(0);
this.f6661a = context;
this.f6662b = z;
this.f6663c = str;
this.f6664d = z2;
this.f6665e = z3;
}
@Override
public final String invoke() {
Intent a2;
if ((this.f6661a instanceof Activity) && !(!((Boolean) bw.a.a(com.joaomgcd.taskerm.util.bw.f9512c, (Activity) this.f6661a, 0, 2, (Object) null).b()).booleanValue())) {
throw new RuntimeException("No file read permissions");
}
if (this.f6662b) {
a2 = FileSelect.a(this.f6661a, null, this.f6663c, FileSelect.b.Dir, null, true, true);
} else {
a2 = net.dinglisch.android.taskerm.at.a(true);
a2.putExtra("android.provider.extra.INITIAL_URI", com.joaomgcd.taskerm.util.ao.C(this.f6663c));
a2.putExtra("android.intent.extra.LOCAL_ONLY", true);
}
Intent intent = a2;
c.f.b.k.a((Object) intent, "intent");
Object[] array = dq.a((Intent) com.joaomgcd.taskerm.util.an.a(intent, this.f6661a, (Integer) null, (Integer) null, 6, (Object) null).b(), this.f6661a, this.f6662b, this.f6664d, this.f6665e).toArray(new String[0]);
if (array != null) {
return (String) c.a.d.c(array);
}
throw new c.q("null cannot be cast to non-null type kotlin.Array<T>");
}
}
public static final b.a.l<String> a(Context context, boolean z2, String str, boolean z3, boolean z4) {
c.f.b.k.b(context, "context");
return com.joaomgcd.taskerm.rx.h.b(new bg(context, z3, str, z2, z4));
}
public static final class aw<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
public static final aw f6626a = new aw();
aw() {
}
@Override
public final b.a.l<String> apply(cr crVar) {
c.f.b.k.b(crVar, "it");
if (!crVar.b()) {
return b.a.l.b(new RuntimeException("Couldn't get shortcut"));
}
Intent intent = (Intent) ((cw) crVar).d();
if (intent == null) {
return b.a.l.b(new RuntimeException("No shortcut data"));
}
return b.a.l.a(intent.toUri(0));
}
}
public static final b.a.l<String> b(Context context) {
c.f.b.k.b(context, "context");
b.a.l a2 = new GenericActionActivityPickShortcut().run(context).a(aw.f6626a);
c.f.b.k.a((Object) a2, "GenericActionActivityPic…payload.toUri(0))\n }\n}");
return a2;
}
public static b.a.l d(Activity activity, boolean z2, int i2, Object obj) {
if ((i2 & 2) != 0) {
z2 = true;
}
return d(activity, z2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.at> d(Activity activity, boolean z2) {
c.f.b.k.b(activity, "activity");
List<Sensor> af2 = com.joaomgcd.taskerm.util.al.af(activity);
if (af2 == null) {
b.a.l<com.joaomgcd.taskerm.dialog.at> b2 = b.a.l.b(new RuntimeException("Device has no sensors"));
c.f.b.k.a((Object) b2, "Single.error(RuntimeExce…\"Device has no sensors\"))");
return b2;
}
ArrayList arrayList = new ArrayList();
Iterator<T> it = af2.iterator();
while (true) {
boolean z3 = true;
if (!it.hasNext()) {
b.a.l<com.joaomgcd.taskerm.dialog.at> a2 = com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.cn_sensor, arrayList, false, at.f6620a, Integer.valueOf(R.string.tip_sensor_long_click_info), new au(activity), true, null, null, null, null, null, null, null, null, 65288, null)).a((b.a.d.g) new av(activity));
c.f.b.k.a((Object) a2, "dialogSingleChoice(Dialo…orString)\n }\n }");
return a2;
}
Object next = it.next();
Sensor sensor = (Sensor) next;
if (!z2) {
c.f.b.k.a((Object) sensor, "it");
if (com.joaomgcd.taskerm.util.an.d(sensor)) {
z3 = false;
}
}
if (z3) {
arrayList.add(next);
}
}
}
public static final class at extends c.f.b.l implements c.f.a.b<Sensor, com.joaomgcd.taskerm.dialog.w> {
public static final at f6620a = new at();
at() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(Sensor sensor) {
c.f.b.k.a((Object) sensor, "it");
return new com.joaomgcd.taskerm.dialog.w(com.joaomgcd.taskerm.util.an.c(sensor), null, false, 6, null);
}
}
public static final class au extends c.f.b.l implements c.f.a.b<Sensor, c.s> {
final Activity f6621a;
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, c.s> {
public static final AnonymousClass1 f6622a = new AnonymousClass1();
AnonymousClass1() {
super(1);
}
public final void a(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.x xVar) {
a(xVar);
return c.s.f2131a;
}
}
au(Activity activity) {
super(1);
this.f6621a = activity;
}
@Override
public c.s invoke(Sensor sensor) {
a(sensor);
return c.s.f2131a;
}
public final void a(Sensor sensor) {
Activity activity = this.f6621a;
c.f.b.k.a((Object) sensor, "it");
com.joaomgcd.taskerm.rx.h.a(y.c(activity, R.string.cn_sensor, com.joaomgcd.taskerm.util.an.b(sensor, this.f6621a)), this.f6621a, AnonymousClass1.f6622a);
}
}
public static final class av<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6623a;
av(Activity activity) {
this.f6623a = activity;
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.dialog.at> {
final com.joaomgcd.taskerm.dialog.ae f6625b;
AnonymousClass1(com.joaomgcd.taskerm.dialog.ae aeVar) {
super(0);
this.f6625b = aeVar;
}
@Override
public final com.joaomgcd.taskerm.dialog.at invoke() {
String valueOf;
Sensor sensor = (Sensor) this.f6625b.b();
if (sensor == null) {
throw new RuntimeException(com.joaomgcd.taskerm.util.an.a(R.string.word_cancelled, av.this.f6623a, new Object[0]));
}
com.joaomgcd.taskerm.dialog.x b2 = y.a(new com.joaomgcd.taskerm.dialog.h(av.this.f6623a, R.string.dt_name_or_type, R.string.dc_name_or_type, R.string.pl_name, R.string.pl_type, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).b();
if (b2.f()) {
throw new RuntimeException(com.joaomgcd.taskerm.util.an.a(R.string.word_cancelled, av.this.f6623a, new Object[0]));
}
if (b2.d()) {
valueOf = com.joaomgcd.taskerm.util.an.c(sensor);
} else {
valueOf = String.valueOf(sensor.getType());
}
return new com.joaomgcd.taskerm.dialog.at(sensor, valueOf);
}
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.at> apply(com.joaomgcd.taskerm.dialog.ae<Sensor> aeVar) {
c.f.b.k.b(aeVar, "it");
return com.joaomgcd.taskerm.rx.h.b(new AnonymousClass1(aeVar));
}
}
public static final b.a.l<net.dinglisch.android.taskerm.z> a(Activity activity, Sensor sensor, String str) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(sensor, "sensor");
c.f.b.k.b(str, "variableName");
com.joaomgcd.taskerm.util.al.a(activity, true);
return com.joaomgcd.taskerm.rx.h.b(new bp(activity, str, sensor));
}
public static final class bp extends c.f.b.l implements c.f.a.a<net.dinglisch.android.taskerm.z> {
final Activity f6689a;
final String f6690b;
final Sensor f6691c;
bp(Activity activity, String str, Sensor sensor) {
super(0);
this.f6689a = activity;
this.f6690b = str;
this.f6691c = sensor;
}
@Override
public final net.dinglisch.android.taskerm.z invoke() {
net.dinglisch.android.taskerm.z zVar;
SensorManager ae = com.joaomgcd.taskerm.util.al.ae(this.f6689a);
if (ae == null) {
return new net.dinglisch.android.taskerm.z();
}
AnonymousClass1 anonymousClass1 = new AnonymousClass1();
AnonymousClass2 anonymousClass2 = AnonymousClass2.f6693a;
com.joaomgcd.taskerm.util.bc a2 = com.joaomgcd.taskerm.util.bd.a("setup");
AnonymousClass3 anonymousClass3 = new AnonymousClass3(ae, a2, anonymousClass1);
try {
if (com.joaomgcd.taskerm.util.an.f(this.f6691c)) {
zVar = anonymousClass3.invoke();
} else {
w.d dVar = new w.d();
dVar.f2028a = new com.joaomgcd.taskerm.dialog.h(this.f6689a, "", "", 0, 0, 0, false, 0, null, 0, null, null, 4088, null);
ArrayList arrayList = new ArrayList();
a aVar = new a(arrayList, 5, dVar);
com.joaomgcd.taskerm.dialog.ac a3 = ac.a.a(com.joaomgcd.taskerm.dialog.ac.f6387a, this.f6689a, R.string.dc_getting_sensor_value, false, 4, null);
ae.registerListener(aVar, this.f6691c, 2, 200, a2.d());
int i = 0;
do {
try {
try {
if (arrayList.isEmpty()) {
ds.a(100L);
i++;
} else {
com.joaomgcd.taskerm.dialog.ac.a(a3, null, 1, null);
dVar.f2028a = new com.joaomgcd.taskerm.dialog.h(this.f6689a, String.valueOf(this.f6691c.getName()), anonymousClass2.invoke((float[]) c.a.j.a((List) arrayList, 0)), 0, 0, 0, false, 0, null, 0, null, null, 4088, null);
y.a((com.joaomgcd.taskerm.dialog.h) dVar.f2028a).b();
ae.unregisterListener(aVar);
if (arrayList.size() <= 5) {
ArrayList arrayList2 = arrayList;
ArrayList arrayList3 = new ArrayList(c.a.j.a((Iterable) arrayList2, 10));
Iterator it = arrayList2.iterator();
while (it.hasNext()) {
arrayList3.add(new c.k(new net.dinglisch.android.taskerm.y(as.b.Matches, anonymousClass1.a(0), c.a.d.a((float[]) it.next(), ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (c.f.a.b) null, 62, (Object) null)), z.a.Or));
}
ArrayList arrayList4 = arrayList3;
ArrayList arrayList5 = arrayList4;
ArrayList arrayList6 = new ArrayList(c.a.j.a((Iterable) arrayList5, 10));
Iterator it2 = arrayList5.iterator();
while (it2.hasNext()) {
arrayList6.add((net.dinglisch.android.taskerm.y) ((c.k) it2.next()).a());
}
ArrayList arrayList7 = arrayList6;
ArrayList arrayList8 = arrayList4;
ArrayList arrayList9 = new ArrayList(c.a.j.a((Iterable) arrayList8, 10));
Iterator it3 = arrayList8.iterator();
while (it3.hasNext()) {
arrayList9.add((z.a) ((c.k) it3.next()).b());
}
return new net.dinglisch.android.taskerm.z(arrayList7, arrayList9);
}
zVar = anonymousClass3.invoke();
}
} catch (Throwable th) {
com.joaomgcd.taskerm.util.ao.c(th.getMessage(), this.f6689a);
zVar = new net.dinglisch.android.taskerm.z();
com.joaomgcd.taskerm.dialog.ac.a(a3, null, 1, null);
}
} catch (Throwable th2) {
com.joaomgcd.taskerm.dialog.ac.a(a3, null, 1, null);
throw th2;
}
} while (i <= 30);
throw new RuntimeException("Couldn't get sensor value");
}
return zVar;
} finally {
a2.g();
com.joaomgcd.taskerm.util.al.a(this.f6689a, false);
}
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.b<Integer, String> {
AnonymousClass1() {
super(1);
}
@Override
public String invoke(Integer num) {
return a(num.intValue());
}
public final String a(int i) {
return '%' + bp.this.f6690b + (i + 1);
}
}
public static final class AnonymousClass2 extends c.f.b.l implements c.f.a.b<float[], String> {
public static final AnonymousClass2 f6693a = new AnonymousClass2();
AnonymousClass2() {
super(1);
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.b<Float, String> {
public static final AnonymousClass1 f6694a = new AnonymousClass1();
AnonymousClass1() {
super(1);
}
@Override
public String invoke(Float f2) {
return a(f2.floatValue());
}
public final String a(float f2) {
return com.joaomgcd.taskerm.util.an.b(f2, 5);
}
}
@Override
public final String invoke(float[] fArr) {
StringBuilder sb = new StringBuilder();
sb.append("\n");
sb.append(fArr != null ? c.a.d.a(fArr, "\n", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, AnonymousClass1.f6694a, 30, (Object) null) : null);
return sb.toString();
}
}
public static final class AnonymousClass3 extends c.f.b.l implements c.f.a.a<net.dinglisch.android.taskerm.z> {
final SensorManager f6696b;
final com.joaomgcd.taskerm.util.bc f6697c;
final AnonymousClass1 f6698d;
AnonymousClass3(SensorManager sensorManager, com.joaomgcd.taskerm.util.bc bcVar, AnonymousClass1 anonymousClass1) {
super(0);
this.f6696b = sensorManager;
this.f6697c = bcVar;
this.f6698d = anonymousClass1;
}
@Override
public final net.dinglisch.android.taskerm.z invoke() {
String j;
Float a2;
Float a3;
w.a aVar = new w.a();
aVar.f2025a = true;
w.d dVar = new w.d();
?? r5 = (float[]) 0;
dVar.f2028a = r5;
w.d dVar2 = new w.d();
dVar2.f2028a = r5;
w.d dVar3 = new w.d();
dVar3.f2028a = new com.joaomgcd.taskerm.dialog.h(bp.this.f6689a, bp.this.f6691c.getName() + " - First Situation", "", 0, 0, 0, false, 0, null, 0, null, null, 4088, null);
a aVar2 = new a(aVar, dVar, dVar2, dVar3);
this.f6696b.registerListener(aVar2, bp.this.f6691c, 2, 200, this.f6697c.d());
y.a((com.joaomgcd.taskerm.dialog.h) dVar3.f2028a).b();
aVar.f2025a = false;
dVar3.f2028a = new com.joaomgcd.taskerm.dialog.h(bp.this.f6689a, bp.this.f6691c.getName() + " - Second Situation", "", 0, 0, 0, false, 0, null, 0, null, null, 4088, null);
y.a((com.joaomgcd.taskerm.dialog.h) dVar3.f2028a).b();
this.f6696b.unregisterListener(aVar2);
this.f6697c.g();
com.joaomgcd.taskerm.dialog.x b2 = y.a(new com.joaomgcd.taskerm.dialog.h(bp.this.f6689a, R.string.cn_sensor, "0", 0, 0, 0, true, 0, "- First State: " + AnonymousClass2.f6693a.invoke((float[]) dVar.f2028a) + "\n\n- Second State: " + AnonymousClass2.f6693a.invoke((float[]) dVar2.f2028a) + "\n\nWhat margin of error do you want to give these values?", 0, (Integer) null, 1720, (c.f.b.g) null)).b();
if (b2 == null || (j = b2.j()) == null || (a2 = c.l.n.a(j)) == null) {
return new net.dinglisch.android.taskerm.z();
}
float floatValue = a2.floatValue();
float[] fArr = (float[]) dVar.f2028a;
if (fArr != null) {
ArrayList arrayList = new ArrayList(fArr.length);
int length = fArr.length;
int i = 0;
int i2 = 0;
while (i < length) {
float f2 = fArr[i];
int i3 = i2 + 1;
float[] fArr2 = (float[]) dVar2.f2028a;
arrayList.add((fArr2 == null || (a3 = c.a.d.a(fArr2, i2)) == null) ? null : com.joaomgcd.taskerm.util.an.a(bp.this.f6691c, this.f6698d.a(i2), f2, a3.floatValue(), floatValue));
i++;
i2 = i3;
}
List<net.dinglisch.android.taskerm.z> f3 = c.a.j.f((Iterable) arrayList);
if (f3 != null) {
net.dinglisch.android.taskerm.z zVar = new net.dinglisch.android.taskerm.z();
int i4 = 0;
for (net.dinglisch.android.taskerm.z zVar2 : f3) {
zVar.addAll(zVar2);
zVar.a(i4, i4 + 1, zVar2.a(0, 1));
i4 += zVar2.size();
}
return zVar;
}
}
return new net.dinglisch.android.taskerm.z();
}
public static final class a implements SensorEventListener {
final w.a f6699a;
final w.d f6700b;
final w.d f6701c;
final w.d f6702d;
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
a(w.a aVar, w.d dVar, w.d dVar2, w.d dVar3) {
this.f6699a = aVar;
this.f6700b = dVar;
this.f6701c = dVar2;
this.f6702d = dVar3;
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
float[] fArr;
String str;
float[] fArr2;
if (sensorEvent == null || (fArr2 = sensorEvent.values) == null) {
fArr = null;
} else {
ArrayList arrayList = new ArrayList();
int length = fArr2.length;
for (int i = 0; i < length; i++) {
float f2 = fArr2[i];
if (f2 != 0.0f) {
arrayList.add(Float.valueOf(f2));
}
}
fArr = c.a.j.d((Collection<Float>) arrayList);
}
?? r0 = fArr;
if (this.f6699a.f2025a) {
this.f6700b.f2028a = r0;
} else {
this.f6701c.f2028a = r0;
}
com.joaomgcd.taskerm.dialog.h hVar = (com.joaomgcd.taskerm.dialog.h) this.f6702d.f2028a;
if (r0 == 0 || (str = c.a.d.a((float[]) r0, "\n", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (c.f.a.b) null, 62, (Object) null)) == null) {
str = "No Value";
}
hVar.a(str);
}
}
}
public static final class a implements SensorEventListener {
final ArrayList f6703a;
final int f6704b;
final w.d f6705c;
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
a(ArrayList arrayList, int i, w.d dVar) {
this.f6703a = arrayList;
this.f6704b = i;
this.f6705c = dVar;
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
float[] fArr;
Object obj;
if (sensorEvent == null || (fArr = sensorEvent.values) == null) {
return;
}
float[] copyOf = Arrays.copyOf(fArr, fArr.length);
c.f.b.k.a((Object) copyOf, "java.util.Arrays.copyOf(this, size)");
if (copyOf != null) {
Iterator it = this.f6703a.iterator();
while (true) {
if (!it.hasNext()) {
obj = null;
break;
} else {
obj = it.next();
if (Arrays.equals((float[]) obj, copyOf)) {
break;
}
}
}
if (((float[]) obj) != null) {
return;
}
this.f6703a.add(copyOf);
if (this.f6703a.size() > this.f6704b) {
((com.joaomgcd.taskerm.dialog.h) this.f6705c.f2028a).a();
} else {
((com.joaomgcd.taskerm.dialog.h) this.f6705c.f2028a).a(c.a.j.a(this.f6703a, " or ", null, null, 0, null, C0142a.f6706a, 30, null));
}
}
}
static final class C0142a extends c.f.b.l implements c.f.a.b<float[], String> {
public static final C0142a f6706a = new C0142a();
C0142a() {
super(1);
}
@Override
public final String invoke(float[] fArr) {
c.f.b.k.b(fArr, "it");
return c.a.d.a(fArr, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (c.f.a.b) null, 62, (Object) null);
}
}
}
}
public static b.a.l a(Activity activity, int i2, String str, boolean z2, com.joaomgcd.taskerm.b.d dVar, int i3, Object obj) {
if ((i3 & 2) != 0) {
i2 = com.joaomgcd.taskerm.settings.ai.a((Context) activity);
}
if ((i3 & 4) != 0) {
str = "localhost";
}
if ((i3 & 8) != 0) {
z2 = false;
}
if ((i3 & 16) != 0) {
dVar = (com.joaomgcd.taskerm.b.d) null;
}
return a(activity, i2, str, z2, dVar);
}
public static final b.a.l<String> a(Activity activity, int i2, String str, boolean z2, com.joaomgcd.taskerm.b.d dVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "host");
if (!z2 || net.dinglisch.android.taskerm.ba.a((Context) activity, (Boolean) true)) {
b.a.l<String> b2 = com.joaomgcd.taskerm.util.al.b((Context) activity, 375).a((b.a.b) true).a((b.a.d.g) new d(dVar, activity)).a((b.a.d.g) new e(activity, i2, str, z2)).b(new f(activity));
c.f.b.k.a((Object) b2, "activity.unlockApi(Actio…tions.Consumer { })\n }");
return b2;
}
b.a.l<String> b3 = b.a.l.b(new RuntimeException("Sorry, this only works with a rooted device"));
c.f.b.k.a((Object) b3, "Single.error(RuntimeExce…s with a rooted device\"))");
return b3;
}
public static final class d<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final com.joaomgcd.taskerm.b.d f6730a;
final Activity f6731b;
d(com.joaomgcd.taskerm.b.d dVar, Activity activity) {
this.f6730a = dVar;
this.f6731b = activity;
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.b.d, com.joaomgcd.taskerm.dialog.w> {
AnonymousClass1() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(com.joaomgcd.taskerm.b.d dVar) {
c.f.b.k.b(dVar, "it");
return new com.joaomgcd.taskerm.dialog.w(dVar.b().a(d.this.f6731b), null, false, 6, null);
}
}
@Override
public final b.a.l<com.joaomgcd.taskerm.dialog.ae<com.joaomgcd.taskerm.b.d>> apply(Boolean bool) {
c.f.b.k.b(bool, "it");
return this.f6730a != null ? b.a.l.a(new com.joaomgcd.taskerm.dialog.ae(new com.joaomgcd.taskerm.dialog.ab(null, null, 3, null), this.f6730a, null, 4, null)) : com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6731b, R.string.pl_command, com.joaomgcd.taskerm.b.d.f6049a.a(), true, new AnonymousClass1(), null, null, null, null, null, null, null, null, null, null, null, 65504, null));
}
}
public static final class e<T, R> implements b.a.d.g<T, b.a.p<? extends R>> {
final Activity f6733a;
final int f6734b;
final String f6735c;
final boolean f6736d;
e(Activity activity, int i, String str, boolean z) {
this.f6733a = activity;
this.f6734b = i;
this.f6735c = str;
this.f6736d = z;
}
@Override
public final b.a.l<String> apply(com.joaomgcd.taskerm.dialog.ae<com.joaomgcd.taskerm.b.d> aeVar) {
c.f.b.k.b(aeVar, "it");
com.joaomgcd.taskerm.b.d b2 = aeVar.b();
if (b2 == null) {
throw new RuntimeException("No command type selected");
}
return b2.a(this.f6733a, this.f6734b, this.f6735c, this.f6736d, true);
}
}
public static final class f<T> implements b.a.d.f<String> {
final Activity f6737a;
public static final class AnonymousClass1<T> implements b.a.d.f<com.joaomgcd.taskerm.dialog.x> {
public static final AnonymousClass1 f6738a = ;
AnonymousClass1() {
}
@Override
public final void accept(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
}
}
f(Activity activity) {
this.f6737a = activity;
}
@Override
public final void accept(String str) {
c.f.b.k.b(str, "it");
com.joaomgcd.taskerm.rx.h.a(y.b(this.f6737a, R.string.tip_adb_wifi_command_depends_device), this.f6737a, AnonymousClass1.f6738a);
}
}
public static Object a(Class cls, Activity activity, String str, int i2, String str2, String str3, int i3, Object obj) {
if ((i3 & 8) != 0) {
str2 = (String) null;
}
String str4 = str2;
if ((i3 & 16) != 0) {
str3 = (String) null;
}
return a((Class<?>) cls, activity, str, i2, str4, str3);
}
public static final Object a(Class<?> cls, Activity activity, String str, int i2, String str2, String str3) {
String str4;
Integer c2;
Class<?> cls2 = cls;
String str5 = str2;
c.f.b.k.b(activity, "activity");
c.f.b.k.b(str, "methodName");
int i3 = i2 + 1;
String str6 = "Parameter " + i3;
if (str3 != null) {
str4 = str3;
} else {
str4 = com.joaomgcd.taskerm.util.ao.j(str) + ": " + str6;
}
if (c.f.b.k.a(cls2, String.class) || c.f.b.k.a(cls2, String[].class)) {
if (str4 == null) {
throw new c.q("null cannot be cast to non-null type java.lang.String");
}
String lowerCase = str4.toLowerCase();
c.f.b.k.a((Object) lowerCase, "(this as java.lang.String).toLowerCase()");
if (c.l.n.b((CharSequence) lowerCase, (CharSequence) "package", false, 2, (Object) null)) {
cls2 = AppBasic.class;
}
}
if (c.f.b.k.a(cls2, int[].class)) {
cls2 = Integer.TYPE;
} else if (c.f.b.k.a(cls2, long[].class)) {
cls2 = Long.TYPE;
} else if (c.f.b.k.a(cls2, float[].class)) {
cls2 = Float.TYPE;
}
if (c.f.b.k.a(cls2, Boolean.class) || c.f.b.k.a(cls2, Boolean.TYPE)) {
return Boolean.valueOf(c(activity, str4, str5, R.string.button_label_cancel).b().d());
}
if (c.f.b.k.a(cls2, Integer.TYPE) || c.f.b.k.a(cls2, Integer.class) || c.f.b.k.a(cls2, Long.TYPE) || c.f.b.k.a(cls2, Long.class)) {
if (str5 == null) {
str5 = com.joaomgcd.taskerm.util.an.a(R.string.f_zero_length_num, activity, str6);
}
String j2 = a(new com.joaomgcd.taskerm.dialog.h(activity, str4, null, 0, 0, 0, true, 0, str5, 2, null, null, 3256, null)).b().j();
if (j2 != null && (c2 = c.l.n.c(j2)) != null) {
return c2;
}
throw new RuntimeException("No number entered for parameter " + i3);
}
if (c.f.b.k.a(cls2, String.class) || c.f.b.k.a(cls2, CharSequence.class)) {
String j3 = a(new com.joaomgcd.taskerm.dialog.h(activity, str4, null, 0, 0, 0, true, 0, str2, 0, null, null, 3768, null)).b().j();
if (j3 != null) {
return j3;
}
throw new RuntimeException("No text entered for parameter " + i3);
}
if (!c.f.b.k.a(cls2, AppBasic.class)) {
return "";
}
String str7 = (String) ((cw) a((Context) activity, (Intent) null, (List) null, false, (List) null, 30, (Object) null).b()).d();
if (str7 != null) {
return str7;
}
throw new RuntimeException("No app selected for parameter " + i3);
}
public static final class br<T, R> implements b.a.d.g<T, R> {
final Activity f6708a;
br(Activity activity) {
this.f6708a = activity;
}
@Override
public final String apply(Integer num) {
c.f.b.k.b(num, "it");
return (String) c.a.d.k(com.joaomgcd.taskerm.k.a.f7816a.a(this.f6708a)).get(num.intValue());
}
}
public static final b.a.l<String> p(Activity activity) {
c.f.b.k.b(activity, "activity");
return q(activity).c(new br(activity));
}
public static final class bs extends c.f.b.l implements c.f.a.a<Integer> {
final Activity f6709a;
bs(Activity activity) {
super(0);
this.f6709a = activity;
}
@Override
public Integer invoke() {
return Integer.valueOf(a());
}
public final int a() {
if (!new com.joaomgcd.taskerm.util.bw(this.f6709a, 0, c.a.j.a("android.permission.READ_PHONE_STATE"), 2, (c.f.b.g) null).b(this.f6709a).b().b()) {
throw new RuntimeException("Need permission");
}
Integer c2 = ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6709a, R.string.pl_sim_card, c.a.d.k(com.joaomgcd.taskerm.k.a.f7816a.a(this.f6709a)), false, null, null, null, null, null, null, null, null, null, null, null, null, 65528, null)).b()).c();
if (c2 != null) {
return c2.intValue();
}
throw new RuntimeException("No SIM card selected");
}
}
public static final b.a.l<Integer> q(Activity activity) {
c.f.b.k.b(activity, "activity");
return com.joaomgcd.taskerm.rx.h.b(new bs(activity));
}
public static b.a.l a(Context context, String str, com.joaomgcd.taskerm.genericaction.b bVar, int i2, Object obj) {
if ((i2 & 2) != 0) {
str = (String) null;
}
if ((i2 & 4) != 0) {
bVar = (com.joaomgcd.taskerm.genericaction.b) null;
}
return a(context, str, bVar);
}
public static final class al extends c.f.b.l implements c.f.a.a<ContactData> {
final String f6603a;
final com.joaomgcd.taskerm.genericaction.b f6604b;
final Context f6605c;
al(String str, com.joaomgcd.taskerm.genericaction.b bVar, Context context) {
super(0);
this.f6603a = str;
this.f6604b = bVar;
this.f6605c = context;
}
@Override
public final ContactData invoke() {
ContactData contactData;
String str = this.f6603a;
cr b2 = (str == null || str.length() == 0 ? new GenericActionPickContact(this.f6604b) : new GenericActionPickContactWithMimeType(this.f6603a)).run(this.f6605c).b();
if (!b2.b()) {
throw new RuntimeException(b2.a());
}
if (!(b2 instanceof cw)) {
b2 = null;
}
cw cwVar = (cw) b2;
if (cwVar == null || (contactData = (ContactData) cwVar.d()) == null) {
throw new RuntimeException("Couldn't get contact");
}
return contactData;
}
}
public static final b.a.l<ContactData> a(Context context, String str, com.joaomgcd.taskerm.genericaction.b bVar) {
c.f.b.k.b(context, "context");
return com.joaomgcd.taskerm.rx.h.b(new al(str, bVar, context));
}
public static final class am extends c.f.b.l implements c.f.a.a<String> {
final Activity f6606a;
am(Activity activity) {
super(0);
this.f6606a = activity;
}
@Override
public final String invoke() {
Activity activity = this.f6606a;
String[] a2 = net.dinglisch.android.taskerm.ct.a(this.f6606a, R.array.contact_select_types);
c.f.b.k.a((Object) a2, "MyRes.getStringArray(act…ray.contact_select_types)");
Integer c2 = ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, R.string.an_contacts, c.a.d.k(a2), false, null, null, null, null, null, null, null, null, null, null, null, null, 65528, null)).b()).c();
if (c2 == null) {
throw new RuntimeException("Did not select a group");
}
switch (c2.intValue()) {
case 0:
String name = ((ContactData) y.a(this.f6606a, (String) null, com.joaomgcd.taskerm.genericaction.b.Contact, 2, (Object) null).b()).getName();
if (name != null) {
return name;
}
throw new RuntimeException("Contact doesn't have a name");
case 1:
return "C:FAV";
case 2:
String[] a3 = ce.a((Context) this.f6606a, false);
Activity activity2 = this.f6606a;
c.f.b.k.a((Object) a3, "groups");
String str = (String) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity2, R.string.an_contacts, c.a.d.k(a3), false, null, null, null, null, null, null, null, null, null, null, null, null, 65528, null)).b()).b();
if (str != null) {
String str2 = "CG:" + str;
if (str2 != null) {
return str2;
}
}
throw new RuntimeException("No contact group selected");
default:
return "C:ANY";
}
}
}
public static final b.a.l<String> r(Activity activity) {
c.f.b.k.b(activity, "activity");
return com.joaomgcd.taskerm.rx.h.b(new am(activity));
}
public static b.a.l a(Activity activity, com.joaomgcd.taskerm.dialog.aq aqVar, String str, String str2, int i2, Object obj) {
if ((i2 & 2) != 0) {
aqVar = (com.joaomgcd.taskerm.dialog.aq) null;
}
if ((i2 & 4) != 0) {
str = (String) null;
}
if ((i2 & 8) != 0) {
str2 = (String) null;
}
return a(activity, aqVar, str, str2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.aq> a(Activity activity, com.joaomgcd.taskerm.dialog.aq aqVar, String str, String str2) {
c.f.b.k.b(activity, "activity");
Calendar calendar = Calendar.getInstance();
b.a.k.d f2 = b.a.k.d.f();
c.f.b.k.a((Object) f2, "SingleSubject.create<PickedTime>()");
com.joaomgcd.taskerm.rx.h.e(new ay(activity, new az(f2), aqVar, calendar, str, str2, f2));
return f2;
}
public static final class az extends c.f.b.l implements c.f.a.q<TimePicker, Integer, Integer, c.s> {
final b.a.k.d f6638a;
az(b.a.k.d dVar) {
super(3);
this.f6638a = dVar;
}
@Override
public c.s a(TimePicker timePicker, Integer num, Integer num2) {
a(timePicker, num.intValue(), num2.intValue());
return c.s.f2131a;
}
public final void a(TimePicker timePicker, int i, int i2) {
c.f.b.k.b(timePicker, "view");
this.f6638a.d_(new com.joaomgcd.taskerm.dialog.aq(i, i2));
}
}
public static final class ay extends c.f.b.l implements c.f.a.a<c.s> {
final Activity f6630a;
final c.f.a.q f6631b;
final com.joaomgcd.taskerm.dialog.aq f6632c;
final Calendar f6633d;
final String f6634e;
final String f6635f;
final b.a.k.d g;
ay(Activity activity, c.f.a.q qVar, com.joaomgcd.taskerm.dialog.aq aqVar, Calendar calendar, String str, String str2, b.a.k.d dVar) {
super(0);
this.f6630a = activity;
this.f6631b = qVar;
this.f6632c = aqVar;
this.f6633d = calendar;
this.f6634e = str;
this.f6635f = str2;
this.g = dVar;
}
@Override
public c.s invoke() {
a();
return c.s.f2131a;
}
public final void a() {
Activity activity = this.f6630a;
c.f.a.q qVar = this.f6631b;
if (qVar != null) {
qVar = new com.joaomgcd.taskerm.dialog.aa(qVar);
}
TimePickerDialog.OnTimeSetListener onTimeSetListener = (TimePickerDialog.OnTimeSetListener) qVar;
com.joaomgcd.taskerm.dialog.aq aqVar = this.f6632c;
int a2 = aqVar != null ? aqVar.a() : this.f6633d.get(11);
com.joaomgcd.taskerm.dialog.aq aqVar2 = this.f6632c;
TimePickerDialog timePickerDialog = new TimePickerDialog(activity, onTimeSetListener, a2, aqVar2 != null ? aqVar2.b() : this.f6633d.get(12), true);
if (com.joaomgcd.taskerm.util.ao.z(this.f6634e)) {
timePickerDialog.setTitle(this.f6634e);
}
if (com.joaomgcd.taskerm.util.ao.z(this.f6635f)) {
timePickerDialog.setMessage(this.f6635f);
}
timePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
AnonymousClass1() {
}
@Override
public final void onCancel(DialogInterface dialogInterface) {
com.joaomgcd.taskerm.rx.h.a(ay.this.g, new RuntimeException("Cancelled"));
}
});
timePickerDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
AnonymousClass2() {
}
@Override
public final void onDismiss(DialogInterface dialogInterface) {
com.joaomgcd.taskerm.rx.h.a(ay.this.g, new RuntimeException("Dismissed"));
}
});
timePickerDialog.show();
}
public static final class AnonymousClass1 implements DialogInterface.OnCancelListener {
AnonymousClass1() {
}
@Override
public final void onCancel(DialogInterface dialogInterface) {
com.joaomgcd.taskerm.rx.h.a(ay.this.g, new RuntimeException("Cancelled"));
}
}
public static final class AnonymousClass2 implements DialogInterface.OnDismissListener {
AnonymousClass2() {
}
@Override
public final void onDismiss(DialogInterface dialogInterface) {
com.joaomgcd.taskerm.rx.h.a(ay.this.g, new RuntimeException("Dismissed"));
}
}
}
public static b.a.l a(Activity activity, com.joaomgcd.taskerm.dialog.ap apVar, String str, String str2, int i2, Object obj) {
if ((i2 & 2) != 0) {
apVar = (com.joaomgcd.taskerm.dialog.ap) null;
}
if ((i2 & 4) != 0) {
str = (String) null;
}
if ((i2 & 8) != 0) {
str2 = (String) null;
}
return a(activity, apVar, str, str2);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.ap> a(Activity activity, com.joaomgcd.taskerm.dialog.ap apVar, String str, String str2) {
c.f.b.k.b(activity, "activity");
Calendar calendar = Calendar.getInstance();
b.a.k.d f2 = b.a.k.d.f();
c.f.b.k.a((Object) f2, "SingleSubject.create<PickedDate>()");
com.joaomgcd.taskerm.rx.h.e(new an(activity, new ao(f2), apVar, calendar, str, str2, f2));
return f2;
}
public static final class ao extends c.f.b.l implements c.f.a.r<DatePicker, Integer, Integer, Integer, c.s> {
final b.a.k.d f6615a;
ao(b.a.k.d dVar) {
super(4);
this.f6615a = dVar;
}
@Override
public c.s a(DatePicker datePicker, Integer num, Integer num2, Integer num3) {
a(datePicker, num.intValue(), num2.intValue(), num3.intValue());
return c.s.f2131a;
}
public final void a(DatePicker datePicker, int i, int i2, int i3) {
c.f.b.k.b(datePicker, "view");
this.f6615a.d_(new com.joaomgcd.taskerm.dialog.ap(i, i2 + 1, i3));
}
}
public static final class an extends c.f.b.l implements c.f.a.a<c.s> {
final Activity f6607a;
final c.f.a.r f6608b;
final com.joaomgcd.taskerm.dialog.ap f6609c;
final Calendar f6610d;
final String f6611e;
final String f6612f;
final b.a.k.d g;
an(Activity activity, c.f.a.r rVar, com.joaomgcd.taskerm.dialog.ap apVar, Calendar calendar, String str, String str2, b.a.k.d dVar) {
super(0);
this.f6607a = activity;
this.f6608b = rVar;
this.f6609c = apVar;
this.f6610d = calendar;
this.f6611e = str;
this.f6612f = str2;
this.g = dVar;
}
@Override
public c.s invoke() {
a();
return c.s.f2131a;
}
public final void a() {
Activity activity = this.f6607a;
c.f.a.r rVar = this.f6608b;
if (rVar != null) {
rVar = new com.joaomgcd.taskerm.dialog.z(rVar);
}
DatePickerDialog.OnDateSetListener onDateSetListener = (DatePickerDialog.OnDateSetListener) rVar;
com.joaomgcd.taskerm.dialog.ap apVar = this.f6609c;
int a2 = apVar != null ? apVar.a() : this.f6610d.get(1);
com.joaomgcd.taskerm.dialog.ap apVar2 = this.f6609c;
int b2 = apVar2 != null ? apVar2.b() - 1 : this.f6610d.get(2);
com.joaomgcd.taskerm.dialog.ap apVar3 = this.f6609c;
DatePickerDialog datePickerDialog = new DatePickerDialog(activity, onDateSetListener, a2, b2, apVar3 != null ? apVar3.c() : this.f6610d.get(5));
if (com.joaomgcd.taskerm.util.ao.z(this.f6611e)) {
datePickerDialog.setTitle(this.f6611e);
}
if (com.joaomgcd.taskerm.util.ao.z(this.f6612f)) {
datePickerDialog.setMessage(this.f6612f);
}
datePickerDialog.setOnCancelListener(new a());
datePickerDialog.setOnDismissListener(new b());
datePickerDialog.show();
}
public static final class a implements DialogInterface.OnCancelListener {
a() {
}
@Override
public final void onCancel(DialogInterface dialogInterface) {
com.joaomgcd.taskerm.rx.h.a(an.this.g, new RuntimeException("Cancelled"));
}
}
public static final class b implements DialogInterface.OnDismissListener {
b() {
}
@Override
public final void onDismiss(DialogInterface dialogInterface) {
com.joaomgcd.taskerm.rx.h.a(an.this.g, new RuntimeException("Dismissed"));
}
}
}
public static final class as extends c.f.b.l implements c.f.a.b<dm, com.joaomgcd.taskerm.dialog.w> {
public static final as f6619a = new as();
as() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(dm dmVar) {
c.f.b.k.b(dmVar, "project");
String m = dmVar.m();
c.f.b.k.a((Object) m, "project.name");
return new com.joaomgcd.taskerm.dialog.w(m, dmVar.n(), false, 4, null);
}
}
public static b.a.l a(Activity activity, fy fyVar, int i2, List list, int i3, Object obj) {
if ((i3 & 8) != 0) {
List<dm> B = fyVar.B();
c.f.b.k.a((Object) B, "taskerData.projects");
list = c.a.j.i((Iterable) B);
}
return a(activity, fyVar, i2, (List<? extends dm>) list);
}
public static final b.a.l<c.k<Integer, dm>> a(Activity activity, fy fyVar, int i2, List<? extends dm> list) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(fyVar, "taskerData");
c.f.b.k.b(list, "projects");
Activity activity2 = activity;
b.a.l<c.k<Integer, dm>> c2 = com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, i2, list, false, as.f6619a, null, null, true, null, Integer.valueOf(go.c(activity2)), Integer.valueOf(com.joaomgcd.taskerm.settings.ai.e(activity2)), null, null, null, null, null, 63840, null)).c(ar.f6618a);
c.f.b.k.a((Object) c2, "dialogSingleChoice(args)…elected\")\n )\n }");
return c2;
}
public static final class ar<T, R> implements b.a.d.g<T, R> {
public static final ar f6618a = new ar();
ar() {
}
@Override
public final c.k<Integer, dm> apply(com.joaomgcd.taskerm.dialog.ae<dm> aeVar) {
c.f.b.k.b(aeVar, "it");
Integer c2 = aeVar.c();
if (c2 == null) {
throw new RuntimeException("No project selected");
}
Integer valueOf = Integer.valueOf(c2.intValue());
dm b2 = aeVar.b();
if (b2 != null) {
return new c.k<>(valueOf, b2);
}
throw new RuntimeException("No project selected");
}
}
public static final class ba extends c.f.b.l implements c.f.a.a<ScanResult> {
final Activity f6640a;
final c.f.a.b f6641b;
ba(Activity activity, c.f.a.b bVar) {
super(0);
this.f6640a = activity;
this.f6641b = bVar;
}
@Override
public final ScanResult invoke() {
if (!com.joaomgcd.taskerm.util.al.ak(this.f6640a)) {
if (!((com.joaomgcd.taskerm.dialog.x) y.a(this.f6640a, R.string.warning_dialog_title, R.string.dc_need_location_access_wifi_cell, 0, 8, (Object) null).b()).d()) {
throw new RuntimeException("Didn't want enable location");
}
cr b2 = new GenericActionActivityEnableLocation().run(this.f6640a).b();
if (!b2.b()) {
throw new RuntimeException(b2.a());
}
}
List<ScanResult> v = com.joaomgcd.taskerm.util.al.v(this.f6640a);
HashSet hashSet = new HashSet();
ArrayList arrayList = new ArrayList();
for (Object obj : v) {
ScanResult scanResult = (ScanResult) obj;
c.f.a.b bVar = this.f6641b;
c.f.b.k.a((Object) scanResult, "it");
if (hashSet.add((String) bVar.invoke(scanResult))) {
arrayList.add(obj);
}
}
ArrayList arrayList2 = new ArrayList();
for (Object obj2 : arrayList) {
ScanResult scanResult2 = (ScanResult) obj2;
c.f.a.b bVar2 = this.f6641b;
c.f.b.k.a((Object) scanResult2, "it");
if (com.joaomgcd.taskerm.util.ao.z((String) bVar2.invoke(scanResult2))) {
arrayList2.add(obj2);
}
}
ScanResult scanResult3 = (ScanResult) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6640a, R.string.pl_wifi, arrayList2, false, new a(), null, null, null, null, null, null, null, null, null, null, null, 65512, null)).b()).b();
if (scanResult3 != null) {
return scanResult3;
}
throw new RuntimeException("No network selected");
}
public static final class a extends c.f.b.l implements c.f.a.b<ScanResult, com.joaomgcd.taskerm.dialog.w> {
a() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(ScanResult scanResult) {
c.f.a.b bVar = ba.this.f6641b;
c.f.b.k.a((Object) scanResult, "it");
return new com.joaomgcd.taskerm.dialog.w((String) bVar.invoke(scanResult), null, false, 6, null);
}
}
}
public static final b.a.l<ScanResult> a(Activity activity, c.f.a.b<? super ScanResult, String> bVar) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(bVar, "scanResultToString");
return com.joaomgcd.taskerm.rx.h.b(new ba(activity, bVar));
}
public static final class ak extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>>, c.s> {
final Activity f6601a;
final int f6602b;
ak(Activity activity, int i) {
super(1);
this.f6601a = activity;
this.f6602b = i;
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
a(ahVar);
return c.s.f2131a;
}
public final void a(com.joaomgcd.taskerm.dialog.ah<b.a.k.d<com.joaomgcd.taskerm.dialog.x>> ahVar) {
c.f.b.k.b(ahVar, "it");
net.dinglisch.android.taskerm.o.a(this.f6601a, ahVar, this.f6602b).a(this.f6601a);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> g(Activity activity, int i2) {
c.f.b.k.b(activity, "context");
return a(new ak(activity, i2), (c.f.a.b) null, 2, (Object) null);
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.ae<String>> a(Activity activity, com.joaomgcd.taskerm.util.i iVar) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(iVar, "title");
return com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, iVar.a(), c.a.j.i(cb.a(activity.getContentResolver(), -1, true, true).keySet()), false, null, null, null, null, null, null, null, null, null, null, null, null, null, 131064, null));
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.ae<String>> b(Activity activity, com.joaomgcd.taskerm.util.i iVar) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(iVar, "title");
String a2 = iVar.a();
List<String> b2 = cb.b(activity.getContentResolver(), (String) null);
c.f.b.k.a((Object) b2, "MyCalendar.getTitleList(…xt.contentResolver, null)");
return com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, a2, b2, false, null, null, null, null, null, null, null, null, null, null, null, null, null, 131064, null));
}
public static final class ag extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.dialog.x, c.s> {
final c.f.a.a f6594a;
final Activity f6595b;
ag(c.f.a.a aVar, Activity activity) {
super(1);
this.f6594a = aVar;
this.f6595b = activity;
}
@Override
public c.s invoke(com.joaomgcd.taskerm.dialog.x xVar) {
a(xVar);
return c.s.f2131a;
}
public final void a(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.a.a aVar;
c.f.b.k.b(xVar, "it");
if (xVar.d() && (aVar = this.f6594a) != null) {
}
if (xVar.e()) {
c.f.a.a aVar2 = this.f6594a;
if (aVar2 != null) {
}
com.joaomgcd.taskerm.util.al.a((Context) this.f6595b, "https://tasker.joaoapps.com/userguide/en/variables.html#json", false, false, false, 14, (Object) null);
}
}
}
public static final b.a.b.b a(Activity activity, int i2, com.joaomgcd.taskerm.util.i iVar, c.f.a.a<c.s> aVar) {
c.f.b.k.b(activity, "activity");
c.f.b.k.b(iVar, "text");
Activity activity2 = activity;
return com.joaomgcd.taskerm.rx.h.a(a(activity, com.joaomgcd.taskerm.util.an.a(i2, activity2, new Object[0]), iVar.a(), new com.joaomgcd.taskerm.util.l(activity2, R.string.learn_more, new Object[0])), activity2, new ag(aVar, activity));
}
public static b.a.b.b a(Activity activity, int i2, com.joaomgcd.taskerm.util.i iVar, c.f.a.a aVar, int i3, Object obj) {
if ((i3 & 8) != 0) {
aVar = (c.f.a.a) null;
}
return a(activity, i2, iVar, (c.f.a.a<c.s>) aVar);
}
public static final class ap extends c.f.b.l implements c.f.a.b<Locale, com.joaomgcd.taskerm.dialog.w> {
public static final ap f6616a = new ap();
ap() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(Locale locale) {
StringBuilder sb = new StringBuilder();
c.f.b.k.a((Object) locale, "it");
sb.append(locale.getDisplayLanguage());
sb.append('/');
sb.append(locale.getDisplayCountry());
return new com.joaomgcd.taskerm.dialog.w(sb.toString(), null, false, 6, null);
}
}
public static final b.a.l<String> c(Activity activity, String str) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(str, "title");
Locale[] availableLocales = Locale.getAvailableLocales();
c.f.b.k.a((Object) availableLocales, "Locale.getAvailableLocales()");
ArrayList arrayList = new ArrayList();
for (Locale locale : availableLocales) {
c.f.b.k.a((Object) locale, "it");
if (com.joaomgcd.taskerm.util.ao.z(locale.getLanguage()) && com.joaomgcd.taskerm.util.ao.z(locale.getCountry())) {
arrayList.add(locale);
}
}
b.a.l<String> c2 = com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity, str, c.a.j.i((Iterable) arrayList), true, ap.f6616a, null, null, null, null, null, null, null, null, null, null, null, null, 131040, null)).c(aq.f6617a);
c.f.b.k.a((Object) c2, "dialogSingleChoice(Dialo…language selected\")\n }");
return c2;
}
public static final class aq<T, R> implements b.a.d.g<T, R> {
public static final aq f6617a = new aq();
aq() {
}
@Override
public final String apply(com.joaomgcd.taskerm.dialog.ae<Locale> aeVar) {
c.f.b.k.b(aeVar, "dialogResult");
Locale b2 = aeVar.b();
if (b2 != null) {
String str = b2.getLanguage() + '-' + b2.getCountry();
if (str != null) {
return str;
}
}
throw new RuntimeException("No language selected");
}
}
public static final class ax extends c.f.b.l implements c.f.a.a<String> {
final Activity f6627a;
final String f6628b;
ax(Activity activity, String str) {
super(0);
this.f6627a = activity;
this.f6628b = str;
}
@Override
public final String invoke() {
ResolveInfo resolveInfo;
ActivityInfo activityInfo;
ActivityInfo activityInfo2;
PackageManager packageManager = this.f6627a.getPackageManager();
List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(new Intent("android.speech.tts.engine.CHECK_TTS_DATA"), 0);
c.f.b.k.a((Object) queryIntentActivities, "packageManager.queryInte…CTION_CHECK_TTS_DATA), 0)");
ArrayList arrayList = new ArrayList();
Iterator<T> it = queryIntentActivities.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Object next = it.next();
ResolveInfo resolveInfo2 = (ResolveInfo) next;
if (((resolveInfo2 == null || (activityInfo2 = resolveInfo2.activityInfo) == null) ? null : activityInfo2.applicationInfo) != null) {
arrayList.add(next);
}
}
ArrayList arrayList2 = arrayList;
if (arrayList2.size() == 1) {
resolveInfo = (ResolveInfo) arrayList2.get(0);
} else {
resolveInfo = (ResolveInfo) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6627a, this.f6628b, arrayList2, true, new a(packageManager), null, null, null, null, null, null, null, null, null, null, null, null, 131040, null)).b()).b();
}
if (resolveInfo == null || (activityInfo = resolveInfo.activityInfo) == null) {
throw new RuntimeException("Could not get TTS engine");
}
String str = activityInfo.packageName;
Intent intent = new Intent();
intent.setComponent(new ComponentName(str, activityInfo.name));
intent.setAction("android.speech.tts.engine.CHECK_TTS_DATA");
ArrayList<String> stringArrayListExtra = ((Intent) com.joaomgcd.taskerm.util.an.a(intent, this.f6627a, (Integer) null, (Integer) null, 6, (Object) null).b()).getStringArrayListExtra("availableVoices");
if (stringArrayListExtra == null) {
throw new RuntimeException("Could not available TTS voices or no voices available");
}
String str2 = (String) ((com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(this.f6627a, this.f6628b, c.a.j.i((Iterable) stringArrayListExtra), true, null, null, null, null, null, null, null, null, null, null, null, null, null, 131056, null)).b()).b();
if (str2 == null) {
throw new RuntimeException("Could not get TTS engine");
}
return str + ':' + str2;
}
public static final class a extends c.f.b.l implements c.f.a.b<ResolveInfo, com.joaomgcd.taskerm.dialog.w> {
final PackageManager f6629a;
a(PackageManager packageManager) {
super(1);
this.f6629a = packageManager;
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(ResolveInfo resolveInfo) {
c.f.b.k.b(resolveInfo, "it");
return new com.joaomgcd.taskerm.dialog.w(this.f6629a.getApplicationLabel(resolveInfo.activityInfo.applicationInfo).toString(), null, false, 6, null);
}
}
}
public static final b.a.l<String> d(Activity activity, String str) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(str, "title");
return com.joaomgcd.taskerm.rx.h.b(new ax(activity, str));
}
public static final class m extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.j.d> {
final Activity f6747a;
m(Activity activity) {
super(0);
this.f6747a = activity;
}
public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.j.d, com.joaomgcd.taskerm.j.d> {
AnonymousClass1() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.j.d invoke(com.joaomgcd.taskerm.j.d dVar) {
c.f.b.k.b(dVar, "receiver$0");
File absoluteFile = dVar.g().getAbsoluteFile();
if (net.dinglisch.android.taskerm.at.a((Context) m.this.f6747a, absoluteFile, true, true)) {
return dVar;
}
if (!((com.joaomgcd.taskerm.dialog.x) y.a(m.this.f6747a, R.string.ml_grant_doctree_access, R.string.dc_need_document_tree_access, 0, false, (String) null, 56, (Object) null).b()).d()) {
throw new RuntimeException("Doesn't have needed permission");
}
cr b2 = new GenericActionActivityGrantUriPermission(dVar.g()).run(m.this.f6747a).b();
if (!b2.b()) {
throw new RuntimeException(b2.a());
}
if (!(b2 instanceof cw)) {
b2 = null;
}
cw cwVar = (cw) b2;
com.joaomgcd.taskerm.j.d dVar2 = cwVar != null ? (com.joaomgcd.taskerm.j.d) cwVar.d() : null;
if (dVar2 != null) {
return dVar2;
}
if (net.dinglisch.android.taskerm.at.a((Context) m.this.f6747a, absoluteFile, true, true)) {
return dVar;
}
throw new RuntimeException("Doesn't have access to " + absoluteFile);
}
}
@Override
public final com.joaomgcd.taskerm.j.d invoke() {
AnonymousClass1 anonymousClass1 = new AnonymousClass1();
ArrayList<String> a2 = net.dinglisch.android.taskerm.at.a(this.f6747a);
if (a2.size() == 1) {
Activity activity = this.f6747a;
c.f.b.k.a((Object) a2, "options");
Object e2 = c.a.j.e((List<? extends Object>) a2);
c.f.b.k.a(e2, "options.first()");
return anonymousClass1.invoke(com.joaomgcd.taskerm.j.a.a((Context) activity, (String) e2, false, 2, (Object) null));
}
Activity activity2 = this.f6747a;
c.f.b.k.a((Object) a2, "options");
com.joaomgcd.taskerm.dialog.ae aeVar = (com.joaomgcd.taskerm.dialog.ae) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.ad(activity2, R.string.external_storage, a2, true, com.joaomgcd.taskerm.util.g.f9751b.e() ? a.f6749a : new b(), null, null, null, null, null, null, null, null, null, null, false, 32736, null)).b();
Activity activity3 = this.f6747a;
String str = (String) aeVar.b();
if (str == null) {
throw new RuntimeException("Nothing selected");
}
return anonymousClass1.invoke(com.joaomgcd.taskerm.j.a.a((Context) activity3, str, false, 2, (Object) null));
}
public static final class a extends c.f.b.l implements c.f.a.b<String, com.joaomgcd.taskerm.dialog.w> {
public static final a f6749a = new a();
a() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(String str) {
c.f.b.k.b(str, "path");
return new com.joaomgcd.taskerm.dialog.w(str, null, false, 6, null);
}
}
public static final class b extends c.f.b.l implements c.f.a.b<String, com.joaomgcd.taskerm.dialog.w> {
b() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(String str) {
c.f.b.k.b(str, "path");
return new com.joaomgcd.taskerm.dialog.w(dq.a(dq.c(m.this.f6747a, str), m.this.f6747a, str), null, false, 6, null);
}
}
}
@TargetApi(30)
public static final b.a.l<com.joaomgcd.taskerm.j.d> s(Activity activity) {
c.f.b.k.b(activity, "context");
return com.joaomgcd.taskerm.rx.h.b(new m(activity));
}
public static final class ai<T, R> implements b.a.d.g<T, R> {
public static final ai f6597a = new ai();
ai() {
}
@Override
public final ComponentNameList apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
return new ComponentNameList();
}
}
public static final b.a.l<ComponentNameList> c(Activity activity, List<ComponentName> list) {
c.f.b.k.b(activity, "context");
c.f.b.k.b(list, "alreadySelected");
if (!com.joaomgcd.taskerm.util.al.m(activity)) {
b.a.l<ComponentNameList> c2 = a(activity, (String) null, (String) null, 0, false, false, false, 126, (Object) null).c(ai.f6597a);
c.f.b.k.a((Object) c2, "dialogSecureSettingsPerm…p { ComponentNameList() }");
return c2;
}
return com.joaomgcd.taskerm.rx.h.b(new aj(activity, list));
}
public static final class aj extends c.f.b.l implements c.f.a.a<ComponentNameList> {
final Activity f6598a;
final List f6599b;
aj(Activity activity, List list) {
super(0);
this.f6598a = activity;
this.f6599b = list;
}
public static final class a extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.util.a, com.joaomgcd.taskerm.dialog.w> {
a() {
super(1);
}
@Override
public final com.joaomgcd.taskerm.dialog.w invoke(com.joaomgcd.taskerm.util.a aVar) {
c.f.b.k.b(aVar, "it");
String c2 = aVar.c();
if (c2 == null) {
c2 = "Unknown Service";
}
return new com.joaomgcd.taskerm.dialog.w(c2, null, aj.this.f6599b.contains(aVar.d()), 2, null);
}
}
@Override
public final ComponentNameList invoke() {
List b2 = ((com.joaomgcd.taskerm.dialog.as) com.joaomgcd.taskerm.dialog.k.a(new com.joaomgcd.taskerm.dialog.e(this.f6598a, com.joaomgcd.taskerm.util.an.a(R.string.an_accessibility_services, this.f6598a), com.joaomgcd.taskerm.util.al.aL(this.f6598a), false, new a(), null, null, null, null, null, null, null, null, 8168, null)).b()).b();
ArrayList arrayList = new ArrayList(c.a.j.a((Iterable) b2, 10));
Iterator it = b2.iterator();
while (it.hasNext()) {
arrayList.add(((com.joaomgcd.taskerm.util.a) it.next()).d());
}
return new ComponentNameList(arrayList);
}
}
public static final b.a.l<com.joaomgcd.taskerm.dialog.x> t(Activity activity) {
c.f.b.k.b(activity, "activity");
return d(activity, R.string.insecure_task_request, R.string.invalid_task_request_explained);
}
public static final b.a.l<Boolean> u(Activity activity) {
c.f.b.k.b(activity, "activity");
Activity activity2 = activity;
com.joaomgcd.taskerm.util.l lVar = new com.joaomgcd.taskerm.util.l(activity2, R.string.insecure_task_request, new Object[0]);
com.joaomgcd.taskerm.util.l lVar2 = new com.joaomgcd.taskerm.util.l(activity2, R.string.insecure_task_request_explained, new Object[0]);
com.joaomgcd.taskerm.util.l lVar3 = new com.joaomgcd.taskerm.util.l(activity2, R.string.run_anyway, new Object[0]);
com.joaomgcd.taskerm.util.l lVar4 = new com.joaomgcd.taskerm.util.l(activity2, R.string.dont_run, new Object[0]);
com.joaomgcd.taskerm.util.k kVar = new com.joaomgcd.taskerm.util.k("PREF_ALLOW_INSECURE_TASK_RUN_REQUESTS");
com.joaomgcd.taskerm.util.l lVar5 = new com.joaomgcd.taskerm.util.l(activity2, R.string.always_run, new Object[0]);
SharedPreferences g2 = gs.g(activity2);
c.f.b.k.a((Object) g2, "Utils.getMyPrefs(activity)");
return a(activity, lVar, lVar2, lVar3, lVar4, kVar, lVar5, g2).c(p.f6753a);
}
public static final class p<T, R> implements b.a.d.g<T, R> {
public static final p f6753a = new p();
p() {
}
@Override
public Object apply(Object obj) {
return Boolean.valueOf(a((com.joaomgcd.taskerm.dialog.x) obj));
}
public final boolean a(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "dialogMessage");
return xVar.d() || xVar.g();
}
}
public static final b.a.l<com.joaomgcd.taskerm.f.g> v(Activity activity) {
c.f.b.k.b(activity, "activity");
if (com.joaomgcd.taskerm.settings.ai.i(activity)) {
b.a.l c2 = a(new com.joaomgcd.taskerm.dialog.h(activity, R.string.wrap_in_backticks, R.string.should_wrap_description_in_backticks_question, R.string.four_spaces, R.string.backticks, 0, false, 0, (String) null, 0, (Integer) null, 2016, (c.f.b.g) null)).c(h.f6740a);
c.f.b.k.a((Object) c2, "dialogTextBox(ArgsDialog…escriptionOptions(true) }");
return c2;
}
b.a.l<com.joaomgcd.taskerm.f.g> a2 = b.a.l.a(new com.joaomgcd.taskerm.f.g(false));
c.f.b.k.a((Object) a2, "Single.just(ExportDescriptionOptions(false))");
return a2;
}
public static final class h<T, R> implements b.a.d.g<T, R> {
public static final h f6740a = new h();
h() {
}
@Override
public final com.joaomgcd.taskerm.f.g apply(com.joaomgcd.taskerm.dialog.x xVar) {
c.f.b.k.b(xVar, "it");
return !xVar.e() ? new com.joaomgcd.taskerm.f.g(false) : new com.joaomgcd.taskerm.f.g(true);
}
}
}