正在查看: Tasker v6.5.11 应用的 Search.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.5.11 应用的 Search.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.text.Html;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import android.widget.ToggleButton;
import cyanogenmod.alarmclock.ClockContract;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.dinglisch.android.taskerm.bm;
import net.dinglisch.android.taskerm.cm;
import net.dinglisch.android.taskerm.g6;
public class Search extends MyActivity {
private static final int[] B = {2131886821, 2131886797, 2131886822, 2131886796};
private static final int[] C = {2131297679, 2131296895, 2131297680, 2131296891};
private static final String[] D = {"searchUserdata", "searchFeatures", "searchUserguide", "searchFAQs"};
private static final boolean[] E = {true, true, false, false};
public static volatile cm F = null;
private static ProgressDialog G = null;
private Spinner A;
private ImageButton v;
private EditText w;
private ListView y;
private j x = null;
private ToggleButton[] z = new ToggleButton[h.values().length];
class a implements View.OnClickListener {
a() {
}
@Override
public void onClick(View view) {
Search.this.M0();
Search.this.K0();
}
}
class b implements AdapterView.OnItemSelectedListener {
b() {
}
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long j) {
dq.R0(view.getContext()).edit().putInt("searchMatchType", i).commit();
}
@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
}
class c implements TextWatcher {
c() {
}
@Override
public void afterTextChanged(Editable editable) {
Search.this.B0();
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
}
class d implements TextView.OnEditorActionListener {
d() {
}
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i != 3) {
return false;
}
Search.this.M0();
Search.this.K0();
return false;
}
}
class e implements View.OnClickListener {
final int i;
e(int i) {
this.i = i;
}
@Override
public void onClick(View view) {
dq.R0(view.getContext()).edit().putBoolean(Search.D[this.i], Search.this.z[this.i].isChecked()).commit();
}
}
class f implements DialogInterface.OnCancelListener {
f() {
}
@Override
public void onCancel(DialogInterface dialogInterface) {
Search.this.M0();
}
}
static class g {
static final int[] a;
static {
int[] iArr = new int[cm.a.values().length];
a = iArr;
try {
iArr[cm.a.UserProject.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[cm.a.UserguideFile.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[cm.a.FAQFile.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[cm.a.FeatureAction.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
a[cm.a.FeatureEvent.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
a[cm.a.FeatureState.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
a[cm.a.FeatureVar.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
a[cm.a.FileExcerpt.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
}
}
public enum h {
UserData,
Features,
UserGuide,
FAQs
}
private class i extends BaseAdapter {
private LayoutInflater i;
private List<cm> q;
class a implements View.OnClickListener {
final cm i;
final int q;
a(cm cmVar, int i) {
this.i = cmVar;
this.q = i;
}
@Override
public void onClick(View view) {
this.i.j = !r2.j;
i.this.notifyDataSetInvalidated();
Search.this.y.setSelection(this.q);
}
}
class b implements View.OnClickListener {
final cm i;
b(cm cmVar) {
this.i = cmVar;
}
@Override
public void onClick(View view) {
int i = g.a[this.i.d.ordinal()];
if (i == 2 || i == 3) {
HTMLView.G0(Search.this, (String) this.i.c);
return;
}
if (i == 4 || i == 5 || i == 6) {
return;
}
if (i == 8) {
HTMLView.G0(Search.this, (String) this.i.c);
return;
}
Search.F = this.i;
Search.this.setResult(-1);
Search.this.z0(true);
}
}
class c {
TextView a;
TextView b;
TextView c;
LinearLayout d;
LinearLayout e;
ImageView f;
ImageView g;
c() {
}
}
public i(Context context, List<cm> list) {
this.i = LayoutInflater.from(context);
this.q = list;
}
private void a(LinearLayout linearLayout, cm cmVar, int i) {
List<cm> list = cmVar.b;
if (list != null) {
Iterator<cm> it = list.iterator();
while (it.hasNext()) {
b(linearLayout, it.next(), i + 1);
}
}
}
private void b(LinearLayout linearLayout, cm cmVar, int i) {
LinearLayout linearLayout2 = (LinearLayout) this.i.inflate(2131494225, (ViewGroup) null);
linearLayout.addView(linearLayout2);
linearLayout2.setPadding(i * 20, 0, 0, 0);
TextView textView = (TextView) linearLayout2.findViewById(2131297163);
if (cmVar.m()) {
textView.setText("");
} else {
textView.setText(cmVar.e);
}
j((TextView) linearLayout2.findViewById(2131297664), cmVar);
TextView textView2 = (TextView) linearLayout2.findViewById(2131296827);
g(textView2, cmVar);
f(linearLayout2.findViewById(2131296953), textView2, cmVar);
h((ImageView) linearLayout2.findViewById(2131296972), cmVar);
i(Search.this.getResources(), textView, cmVar);
a(linearLayout, cmVar, i);
}
private int d() {
return tp.L(Search.this);
}
private int e() {
return tp.M(Search.this);
}
private void f(View view, View view2, cm cmVar) {
if (cmVar.k()) {
b bVar = new b(cmVar);
view.setOnClickListener(bVar);
view2.setOnClickListener(bVar);
}
}
private void g(TextView textView, cm cmVar) {
int i;
if (cmVar.j()) {
textView.setText(Html.fromHtml(cmVar.f));
textView.setTextColor(d());
i = 0;
} else {
i = 8;
}
textView.setVisibility(i);
}
private void h(ImageView imageView, cm cmVar) {
int i;
Drawable G;
net.dinglisch.android.taskerm.g gVar = cmVar.i;
if (gVar == null || (G = gVar.G(Search.this, 32, 32)) == null) {
i = 4;
} else {
up.r(imageView.getContext(), cmVar.i, G, up.b(imageView.getContext()));
imageView.setImageDrawable(G);
i = 0;
}
imageView.setVisibility(i);
}
private void i(Resources resources, TextView textView, cm cmVar) {
textView.setTextColor(cmVar.g ? d() : e());
}
private void j(TextView textView, cm cmVar) {
if (cmVar.m()) {
textView.setText(cl.b5());
return;
}
String i = cm.i(Search.this.getResources(), cmVar.d);
if (!TextUtils.isEmpty(i)) {
i = i + ": ";
}
textView.setText(i);
textView.setTextColor(cmVar.h ? d() : e());
}
public void c() {
this.q.clear();
notifyDataSetChanged();
}
@Override
public final int getCount() {
return this.q.size();
}
@Override
public final Object getItem(int i) {
return this.q.get(i);
}
@Override
public final long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
c cVar;
int J;
boolean z;
if (view == null) {
view = this.i.inflate(2131494225, (ViewGroup) null);
cVar = new c();
cVar.a = (TextView) view.findViewById(2131297664);
cVar.b = (TextView) view.findViewById(2131297163);
cVar.c = (TextView) view.findViewById(2131296827);
cVar.d = (LinearLayout) view.findViewById(2131297324);
cVar.e = (LinearLayout) view.findViewById(2131296953);
cVar.f = (ImageView) view.findViewById(2131296972);
ImageView imageView = (ImageView) view.findViewById(2131296882);
cVar.g = imageView;
Search search = Search.this;
up.x(search, imageView, up.b(search));
view.setTag(cVar);
} else {
cVar = (c) view.getTag();
}
for (int childCount = cVar.d.getChildCount() - 1; childCount > 1; childCount--) {
cVar.d.removeViewAt(childCount);
}
cm cmVar = this.q.get(i);
cVar.b.setText(cmVar.e);
j(cVar.a, cmVar);
h(cVar.f, cmVar);
i(Search.this.getResources(), cVar.b, cmVar);
f(cVar.e, cVar.c, cmVar);
switch (g.a[cmVar.d.ordinal()]) {
case 1:
case 2:
case 3:
J = tp.J(Search.this, cmVar.j ? 2130969204 : 2130969174);
z = false;
break;
case 4:
case 5:
case ClockContract.InstancesColumns.MISSED_STATE:
case 7:
J = cmVar.j() ? tp.J(Search.this, cmVar.j ? 2130969204 : 2130969174) : -1;
z = true;
break;
default:
J = -1;
z = false;
break;
}
if (J == -1) {
cVar.g.setVisibility(8);
} else {
cVar.g.setImageResource(J);
cVar.g.setVisibility(0);
cVar.g.setOnClickListener(new a(cmVar, i));
}
if (J == -1 || cmVar.j) {
a(cVar.d, cmVar, 1);
}
if (!z || cmVar.j) {
g(cVar.c, cmVar);
} else {
cVar.c.setVisibility(8);
}
return view;
}
}
public class j extends AsyncTask<Boolean, Integer, List<cm>> {
Context a;
public j(Context context) {
this.a = context;
}
@Override
public List<cm> doInBackground(Boolean... boolArr) {
boolean z = true;
LinkedList linkedList = new LinkedList();
r7.f("Search", "do in background");
to h2 = to.h2(this.a);
bm bmVar = new bm(bm.a.values()[Search.this.A.getSelectedItemPosition()], dq.m1(Search.this.w));
r7.f("Search", "start search");
if (Search.this.O0()) {
r7.f("Search", "search data");
h2.I4(Search.this, bmVar, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
r7.f("Search", "search data done");
}
boolean z0 = HTMLView.z0(this.a);
if (Search.this.Q0()) {
r7.f("Search", "search features");
a1.s1(this.a, bmVar, z0, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
j2.c0(this.a, bmVar, z0, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
on.P(this.a, bmVar, z0, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
kq.z1(this.a, bmVar, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
r7.f("Search", "search features done");
}
if (z0) {
if (Search.this.R0()) {
r7.f("Search", "search userguide");
HTMLView.E0(this.a, bmVar, null, cm.a.UserguideFile, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
r7.f("Search", "search userguide done");
}
if (Search.this.P0()) {
r7.f("Search", "search faqs");
HTMLView.E0(this.a, bmVar, "faqs", cm.a.FAQFile, linkedList);
publishProgress(Integer.valueOf(linkedList.size()));
r7.f("Search", "search faqs done");
}
}
r7.f("Search", "results: " + linkedList.size());
Iterator it = linkedList.iterator();
while (true) {
if (!it.hasNext()) {
z = false;
break;
}
cm cmVar = (cm) it.next();
List<cm> list = cmVar.b;
if ((list != null && list.size() > 4) || (cmVar.l() && cmVar.j())) {
break;
}
}
r7.f("Search", "contract all: " + z);
if (z) {
Iterator it2 = linkedList.iterator();
while (it2.hasNext()) {
((cm) it2.next()).j = false;
}
}
r7.f("Search", "done");
return linkedList;
}
@Override
public void onPostExecute(List<cm> list) {
Search.L0();
Search.this.x = null;
ListView listView = Search.this.y;
if (listView == null) {
return;
}
if (dq.F(list)) {
dq.j0(Search.this, 2131887867, new Object[0]);
} else {
listView.setAdapter((ListAdapter) Search.this.new i(this.a, list));
dq.c3(this.a, Search.this.w, false, -1, -1L);
Search.this.I0();
}
Search.this.w.setFocusable(true);
Search.this.w.setFocusableInTouchMode(true);
Search.y0(Search.this);
}
@Override
public void onProgressUpdate(Integer... numArr) {
if (Search.G != null) {
Search.G.incrementProgressBy(1);
}
}
}
private void A0() {
boolean z0 = HTMLView.z0(this);
if (this.z[0] != null) {
boolean z = z0 && w6.b(dq.R0(this)).equals("en");
ToggleButton[] toggleButtonArr = this.z;
h hVar = h.FAQs;
toggleButtonArr[hVar.ordinal()].setEnabled(z);
ToggleButton[] toggleButtonArr2 = this.z;
h hVar2 = h.UserGuide;
toggleButtonArr2[hVar2.ordinal()].setEnabled(z0);
if (z0) {
return;
}
this.z[hVar.ordinal()].setChecked(z);
this.z[hVar2.ordinal()].setChecked(false);
}
}
public void B0() {
ImageButton imageButton = this.v;
if (imageButton != null) {
imageButton.setEnabled(x0());
}
}
public static cm C0() {
cm cmVar = F;
F = null;
return cmVar;
}
private void D0() {
B0();
A0();
}
private boolean E0() {
return dq.S0(this).getInt("searchLast", -1) != -1;
}
private void F0() {
SharedPreferences R0 = dq.R0(this);
findViewById(2131297344).setOnClickListener(new a());
this.y = (ListView) findViewById(2131297312);
Spinner spinner = (Spinner) findViewById(2131297090);
this.A = spinner;
spinner.setAdapter((SpinnerAdapter) dq.h1(this, bm.a(getResources())));
this.A.setOnItemSelectedListener(new b());
this.A.setSelection(R0.getInt("searchMatchType", g6.i.a), false);
EditText editText = (EditText) findViewById(2131296905);
this.w = editText;
editText.addTextChangedListener(new c());
this.w.setOnEditorActionListener(new d());
this.w.setText(R0.getString("searchFilterText", ""));
this.w.selectAll();
for (h hVar : h.values()) {
int ordinal = hVar.ordinal();
boolean z = R0.getBoolean(D[ordinal], E[ordinal]);
this.z[ordinal] = (ToggleButton) findViewById(C[ordinal]);
String g2 = vh.g(this, B[ordinal], new Object[0]);
this.z[ordinal].setTextOn(g2);
this.z[ordinal].setTextOff(g2);
this.z[ordinal].setChecked(z);
this.z[ordinal].setOnClickListener(new e(ordinal));
}
dq.M2(this, 2131297638, 2131887544);
if (tp.e0()) {
View findViewById = findViewById(2131296952);
if (findViewById != null) {
findViewById.setVisibility(0);
findViewById.setElevation(tp.w(this, 2131166027));
}
View findViewById2 = findViewById(2131296951);
if (findViewById2 != null) {
findViewById2.setVisibility(0);
}
View findViewById3 = findViewById(2131296436);
if (findViewById3 != null) {
up.D(findViewById3);
}
}
}
private void G0() {
H0(this, this.y.getFirstVisiblePosition(), this.y.getCount());
}
private static void H0(Context context, int i2, int i3) {
SharedPreferences.Editor edit = dq.S0(context).edit();
edit.putInt("searchLast", i2);
edit.putInt("searchLastCount", i3);
edit.commit();
}
public void I0() {
int i2 = dq.S0(this).getInt("searchLast", -1);
int i3 = dq.S0(this).getInt("searchLastCount", 0);
if (i2 == -1 || i3 != this.y.getCount()) {
return;
}
this.y.setSelection(i2);
}
private void J0() {
ProgressDialog progressDialog = new ProgressDialog(this);
G = progressDialog;
progressDialog.setProgressStyle(1);
?? R0 = R0();
int i2 = R0;
if (P0()) {
i2 = R0 + 1;
}
int i3 = i2;
if (Q0()) {
i3 = i2 + 4;
}
int i4 = i3;
if (O0()) {
i4 = i3 + 1;
}
G.setMax(i4);
G.setCancelable(true);
G.setOnCancelListener(new f());
G.show();
}
public void K0() {
M0();
F = null;
i iVar = (i) this.y.getAdapter();
if (iVar != null) {
iVar.c();
}
J0();
j jVar = new j(this);
this.x = jVar;
jVar.execute(new Boolean[0]);
}
public static void L0() {
ProgressDialog progressDialog = G;
if (progressDialog != null) {
progressDialog.dismiss();
G = null;
}
}
public void M0() {
j jVar = this.x;
if (jVar != null) {
jVar.cancel(true);
this.x = null;
}
L0();
}
private boolean N0(h hVar) {
ToggleButton[] toggleButtonArr = this.z;
if (toggleButtonArr == null) {
return false;
}
return toggleButtonArr[hVar.ordinal()].isChecked();
}
public boolean O0() {
return N0(h.UserData);
}
public boolean P0() {
return N0(h.FAQs);
}
public boolean Q0() {
return N0(h.Features);
}
public boolean R0() {
return N0(h.UserGuide);
}
private boolean x0() {
return dq.m1(this.w).length() >= 3;
}
public static void y0(Context context) {
H0(context, -1, 0);
}
public void z0(boolean z) {
if (z) {
G0();
} else {
y0(this);
}
finish();
}
@Override
public void onBackPressed() {
M0();
z0(false);
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
String obj = this.w.getText().toString();
int selectedItemPosition = this.A.getSelectedItemPosition();
i iVar = (i) this.y.getAdapter();
setContentView(2131494224);
F0();
this.w.setText(obj);
this.A.setSelection(selectedItemPosition, false);
D0();
if (iVar != null) {
this.y.setAdapter((ListAdapter) iVar);
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setResult(0);
setContentView(2131494224);
F0();
D0();
net.dinglisch.android.taskerm.a.T(this, true);
setTitle(vh.g(this, 2131887544, new Object[0]));
if (E0()) {
this.y.requestFocus();
this.w.setFocusable(false);
K0();
}
}
@Override
public void onDestroy() {
super.onDestroy();
this.v = null;
this.w = null;
this.x = null;
this.y = null;
F = null;
G = null;
this.z = null;
this.A = null;
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() != 16908332) {
return true;
}
M0();
z0(false);
return true;
}
@Override
public void onPause() {
super.onPause();
M0();
dq.R0(this).edit().putString("searchFilterText", dq.m1(this.w)).commit();
}
}