正在查看: Tasker v6.6.3 应用的 FileSelect.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tasker v6.6.3 应用的 FileSelect.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package net.dinglisch.android.taskerm;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Environment;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class FileSelect extends MyActivity implements AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener {
private d B;
private GridView C;
private EditText D;
private LayoutInflater E;
private View G;
private View H;
private BroadcastReceiver J;
private e v;
private String w = null;
private File x = null;
private boolean y = true;
private boolean z = true;
private int A = -1;
private int F = -1;
private List<rf.d> I = new ArrayList();
class a implements TextView.OnEditorActionListener {
a() {
}
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (i != 6) {
return false;
}
FileSelect.this.w0(textView.getText().toString().trim());
return false;
}
}
class b extends BroadcastReceiver {
b() {
}
@Override
public void onReceive(Context context, Intent intent) {
FileSelect.this.G0();
}
}
class c implements Runnable {
final String i;
final String q;
c(String str, String str2) {
this.i = str;
this.q = str2;
}
@Override
public void run() {
if (FileSelect.this.D != null) {
o7.f("FileSelectDialogFragment", "SET run base: " + this.i + " name: " + this.q + " current: " + FileSelect.this.D.getText().toString());
FileSelect.this.D.requestFocus();
try {
FileSelect.this.D.setSelection(this.i.length() - this.q.length(), this.i.length());
} catch (IndexOutOfBoundsException unused) {
}
}
}
}
public class d extends BaseAdapter {
List<rf.d> i;
class a {
LinearLayout a;
ImageView b;
TextView c;
TextView d;
a() {
}
}
public d(List<rf.d> list) {
this.i = list;
}
public void a() {
this.i = null;
}
@Override
public final int getCount() {
return this.i.size();
}
@Override
public final Object getItem(int i) {
return this.i.get(i);
}
@Override
public final long getItemId(int i) {
return i;
}
@Override
public android.view.View getView(int r12, android.view.View r13, android.view.ViewGroup r14) {
throw new UnsupportedOperationException("Method not decompiled: net.dinglisch.android.taskerm.FileSelect.d.getView(int, android.view.View, android.view.ViewGroup):android.view.View");
}
}
public enum e {
File,
Dir
}
public void A0(final rf.d dVar) throws Exception {
xg.e2.b1(new Runnable() {
@Override
public final void run() {
FileSelect.this.z0(dVar);
}
});
}
public void B0(Throwable th2) throws Exception {
xg.e2.R1(this, th2);
}
public void C0(View view) {
com.joaomgcd.taskerm.dialog.a.K2(this).I(new yi.d() {
@Override
public final void accept(Object obj) {
FileSelect.this.A0((rf.d) obj);
}
}, new yi.d() {
@Override
public final void accept(Object obj) {
FileSelect.this.B0((Throwable) obj);
}
});
}
public void D0(String str) {
try {
this.D.append(str);
this.D.setSelection(this.D.length() - str.length(), this.D.length());
} catch (Exception e2) {
o7.l("FileSelectDialogFragment", "error setting selection", e2);
}
}
private void E0(boolean z, File file, String str) {
List<rf.d> list = this.I;
if (list == null) {
return;
}
if (file == null) {
o7.G("FileSelectDialogFragment", "attempt to load null dir");
file = new File(File.separator);
}
rf.d a2 = rf.a.a(this, file);
if (!a2.F()) {
file = a2.c0();
}
this.x = file;
list.clear();
list.addAll(rf.a.f(this, this.x, this.v == e.Dir, true));
this.B.notifyDataSetChanged();
this.C.invalidate();
G0();
F0(a2);
invalidateOptionsMenu();
}
private void F0(rf.d dVar) {
final String str;
String str2;
String B2 = pp.B2(dVar.toString());
if (!dVar.F()) {
String name = dVar.getName();
pp.W2(this.D, B2);
this.D.post(new c(B2, name));
return;
}
if (this.D.hasSelection()) {
str = this.D.getText().subSequence(this.D.getSelectionStart(), this.D.getSelectionEnd()).toString();
} else {
str = null;
}
EditText editText = this.D;
if (B2.length() == 0) {
str2 = "";
} else {
str2 = B2 + File.separatorChar;
}
pp.W2(editText, str2);
if (str != null) {
this.D.post(new Runnable() {
@Override
public final void run() {
FileSelect.this.D0(str);
}
});
}
}
public void G0() {
List<String> M = com.joaomgcd.taskerm.util.ph.M(this);
int size = M.size();
String str = size >= 1 ? M.get(0) : null;
File file = this.x;
int i = (str == null || (size <= 1 && file != null && str.equals(file.getAbsolutePath()))) ? 8 : 0;
File c1 = pp.c1();
this.G.setVisibility((c1 == null || c1.equals(file)) ? 8 : 0);
this.H.setVisibility(i);
}
private void H0() {
if (this.J == null) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.MEDIA_MOUNTED");
intentFilter.addAction("android.intent.action.MEDIA_UNMOUNTED");
b bVar = new b();
this.J = bVar;
ExtensionsContextKt.V3(this, bVar, intentFilter);
}
}
private void I0() {
BroadcastReceiver broadcastReceiver = this.J;
if (broadcastReceiver != null) {
unregisterReceiver(broadcastReceiver);
this.J = null;
}
}
private void t0(rf.d dVar) {
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("path", dVar.toString());
intent.putExtras(bundle);
setResult(-1, intent);
finish();
}
public static Intent u0(Context context, String str, String str2, e eVar, String str3, boolean z, boolean z2) {
o7.f("FileSelectDialogFragment", "Getting launch intent: " + str + "; " + str2 + "; " + eVar + "; " + str3 + "; " + z + "; " + z2);
Intent intent = new Intent();
intent.setComponent(new ComponentName(context, FileSelect.class.getName()));
if (str != null) {
intent.putExtra("title", str);
}
String str4 = null;
try {
o7.f("FileSelectDialogFragment", "testing dirOrFile: " + str2);
File file = new File(str2);
if (!file.isDirectory()) {
file = file.getParentFile();
}
boolean exists = file.exists();
o7.f("FileSelectDialogFragment", "dirOrFile exists: " + exists);
if (!exists) {
str2 = null;
}
str4 = str2;
} catch (Throwable th2) {
o7.f("FileSelectDialogFragment", "error checking dirOrFile: " + th2);
}
if (str4 != null) {
intent.putExtra("dir", str4);
}
intent.putExtra("mode", eVar.toString());
intent.putExtra("match", str3);
intent.putExtra("hidden", z);
intent.putExtra("ext", z2);
return intent;
}
private void v0() {
if (this.x.equals(File.separator)) {
finish();
} else {
E0(true, this.x.getParentFile(), "handleBack");
}
}
public boolean w0(String str) {
rf.b bVar = str.startsWith(File.separator) ? new rf.b(new File(str)) : new rf.b(new File(Environment.getExternalStorageDirectory(), str));
if (this.v == e.Dir || this.w == null || bVar.getName().toString().contains(this.w)) {
t0(bVar);
return true;
}
pp.a0(this, 2131887769, this.w.toString());
return true;
}
private void x0(Bundle bundle) {
this.v = e.valueOf(bundle.getString("mode"));
this.w = bundle.getString("match");
if (bundle.containsKey("title")) {
setTitle(bundle.getString("title"));
} else if (this.v == e.Dir) {
setTitle(oh.g(this, 2131887491, new Object[0]));
} else {
setTitle(oh.g(this, 2131887492, new Object[0]));
}
getActionBar().setDisplayOptions(12);
this.y = bundle.getBoolean("hidden");
this.z = bundle.getBoolean("ext");
if (bundle.containsKey("dir")) {
E0(true, new File(bundle.getString("dir")), "initFromBundle");
} else {
E0(true, pp.c1(), "initFromBundle2");
}
}
public void y0(View view) {
E0(true, pp.c1(), "primaryVolButton");
}
public void z0(rf.d dVar) {
E0(true, dVar.A(), "externalVolButton");
}
@Override
public void onBackPressed() {
w0(this.D.getText().toString().trim());
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setResult(0);
setContentView(2131493237);
net.dinglisch.android.taskerm.a.T(this, true);
this.E = LayoutInflater.from(this);
this.B = new d(this.I);
this.C = (GridView) findViewById(2131296946);
this.D = (EditText) findViewById(2131296862);
this.G = findViewById(2131297266);
this.H = findViewById(2131296885);
pp.T2(this.G, 2131886813, true);
pp.T2(this.H, 2131886816, true);
this.G.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FileSelect.this.y0(view);
}
});
this.H.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
FileSelect.this.C0(view);
}
});
if (fp.e0()) {
this.F = gp.f(this);
}
this.D.setOnEditorActionListener(new a());
this.C.setOnItemLongClickListener(this);
this.C.setOnItemClickListener(this);
if (bundle == null) {
bundle = getIntent().getExtras();
}
x0(bundle);
this.C.setAdapter((ListAdapter) this.B);
if (this.v == e.Dir) {
xo.d(this, 2131890911);
}
}
@Override
public void onDestroy() {
super.onDestroy();
I0();
this.B.a();
this.B = null;
this.C = null;
this.D = null;
this.E = null;
this.I = null;
this.G = null;
this.H = null;
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
rf.d dVar = this.I.get(i);
File file = new File(this.x, dVar.getName());
if (dVar.F()) {
E0(true, file, "onItemClick");
} else {
t0(dVar);
}
}
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) {
rf.d dVar = this.I.get(i);
if (this.x.isDirectory()) {
t0(dVar);
} else {
e eVar = this.v;
e eVar2 = e.File;
if ((eVar == eVar2) == this.x.isFile()) {
t0(dVar);
} else if (this.v == eVar2) {
pp.a0(this, 2131887900, new Object[0]);
}
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == 1) {
finish();
} else if (itemId == 2) {
v0();
} else if (itemId == 16908332) {
w0(this.D.getText().toString().trim());
}
return true;
}
@Override
public void onPause() {
super.onPause();
I0();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
menu.clear();
File file = this.x;
if (file != null && !file.toString().equals(File.separator)) {
net.dinglisch.android.taskerm.a.m(this, 2, menu);
}
net.dinglisch.android.taskerm.a.d(this, 1, menu);
return true;
}
@Override
public void onResume() {
super.onResume();
G0();
H0();
}
@Override
public void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
bundle.putString("mode", this.v.toString());
CharSequence title = getTitle();
if (title != null) {
bundle.putString("title", title.toString());
}
bundle.putBoolean("hidden", this.y);
bundle.putBoolean("ext", this.z);
File file = this.x;
if (file != null) {
bundle.putString("dir", file.toString());
}
String str = this.w;
if (str != null) {
bundle.putString("match", str);
}
}
}