正在查看: Minits v4.9.3.32 应用的 XoneFileBrowser.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Minits v4.9.3.32 应用的 XoneFileBrowser.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.xone.android.browser.activities;
import android.R;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import androidx.activity.result.a;
import androidx.appcompat.widget.AppCompatAutoCompleteTextView;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.xone.android.browser.activities.XoneFileBrowser;
import com.xone.android.utils.Utils;
import e.C1983c;
import fa.d;
import fa.j;
import fb.k;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Stack;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import p7.AbstractActivityC2812n;
import p7.DialogInterfaceOnClickListenerC2811m;
import p7.z;
import q7.b;
import q7.c;
import r7.e;
import ua.K0;
import ua.L0;
import v1.t;
public class XoneFileBrowser extends AbstractActivityC2812n implements TextWatcher {
public c f17905A;
public b f17906B;
public File f17907C;
public File f17908D;
public Future f17909E;
public final Stack f17910F = new Stack();
public int f17911G;
public boolean f17912H;
public e f17913I;
public e f17914J;
public ExecutorService f17915K;
public androidx.activity.result.c f17916L;
public String f17917m;
public boolean f17918n;
public String f17919o;
public int f17920p;
public boolean f17921q;
public boolean f17922r;
public boolean f17923s;
public boolean f17924t;
public boolean f17925u;
public RecyclerView f17926v;
public AppCompatSpinner f17927w;
public AppCompatAutoCompleteTextView f17928x;
public AppCompatImageButton f17929y;
public View f17930z;
public static boolean A1(File file) {
File externalStorageDirectory;
if (file == null || (externalStorageDirectory = Environment.getExternalStorageDirectory()) == null || !externalStorageDirectory.exists()) {
return false;
}
return file.getAbsolutePath().startsWith(externalStorageDirectory.getAbsolutePath());
}
public void P1() {
N1();
}
public static boolean V1(TextView textView, int i8, KeyEvent keyEvent) {
if (textView != null) {
((InputMethodManager) textView.getContext().getSystemService("input_method")).hideSoftInputFromWindow(textView.getWindowToken(), 0);
}
return false;
}
private DisplayMetrics o1() {
return getResources().getDisplayMetrics();
}
private ExecutorService p1() {
if (this.f17915K == null) {
this.f17915K = Executors.newSingleThreadExecutor(new d("FileBrowserExecutor"));
}
return this.f17915K;
}
public boolean B1() {
return this.f17912H;
}
public boolean C1(File file, File file2) {
if (file == null && file2 == null) {
return true;
}
if (file != null && file2 != null) {
String absolutePath = file.getAbsolutePath();
String absolutePath2 = file2.getAbsolutePath();
if (TextUtils.isEmpty(absolutePath) && TextUtils.isEmpty(absolutePath2)) {
return true;
}
if (!TextUtils.isEmpty(absolutePath) && !TextUtils.isEmpty(absolutePath2)) {
return absolutePath.equals(absolutePath2);
}
}
return false;
}
public boolean D1() {
return this.f17910F.empty();
}
public final void E1(e eVar, DialogInterface dialogInterface, int i8) {
T1(eVar);
}
public final void F1(File file, e eVar, File file2, DialogInterface dialogInterface, int i8) {
try {
dialogInterface.dismiss();
if (this.f17905A != null && this.f17926v != null) {
if (file.isFile()) {
if (!file.delete()) {
throw new IOException("Cannot overwrite target file");
}
} else {
if (!file.isDirectory()) {
throw new IllegalArgumentException("Unknown path type");
}
Utils.q0(file);
}
j1(eVar, file2, file);
x1();
}
} catch (Exception e8) {
b(e8);
}
}
public final void H1(File file, e eVar, File file2, DialogInterface dialogInterface, int i8) {
try {
dialogInterface.dismiss();
if (this.f17905A != null && this.f17926v != null) {
if (file.isFile()) {
if (!file.delete()) {
throw new IOException("Cannot overwrite target file");
}
} else {
if (!file.isDirectory()) {
throw new IllegalArgumentException("Unknown path type");
}
Utils.q0(file);
}
this.f17905A.S(file);
l1(eVar, file2, file);
x1();
}
} catch (Exception e8) {
b(e8);
}
}
public final void J1(c cVar, e eVar) {
this.f17926v.F1(cVar.L(eVar));
}
public final void K1(e eVar) {
this.f17926v.F1(this.f17905A.L(eVar));
}
public final void L1(e eVar, AppCompatEditText appCompatEditText, DialogInterface dialogInterface, int i8) {
U1(dialogInterface, eVar, appCompatEditText);
}
public final boolean M1(e eVar, AlertDialog alertDialog, TextView textView, int i8, KeyEvent keyEvent) {
return W1(textView, eVar, alertDialog);
}
public final void N1() {
try {
File e22 = e2();
if (e22 == null) {
finish();
} else {
this.f17908D = e22;
h2();
}
} catch (Exception e8) {
b(e8);
}
}
public final void O1(View view) {
N1();
}
public final void G1(final ProgressDialog progressDialog, final e eVar, File file, final File file2) {
try {
try {
final c cVar = (c) this.f17926v.getAdapter();
if (cVar == null) {
progressDialog.dismiss();
return;
}
j.p(new Runnable() {
@Override
public final void run() {
q7.c.this.S(file2);
}
});
if (file.isFile()) {
Utils.Z(file, file2);
} else {
if (!file.isDirectory()) {
throw new IllegalArgumentException("Unknown path type");
}
progressDialog.setIndeterminate(false);
progressDialog.setProgress(0);
progressDialog.setMax(q1(file));
Utils.Y(new O8.c() {
public final void a() {
r0.setProgress(progressDialog.getProgress() + 1);
}
}, file, file2, true);
progressDialog.setProgress(100);
}
eVar.v(file2);
j.p(new Runnable() {
@Override
public final void run() {
XoneFileBrowser.this.J1(cVar, eVar);
}
});
progressDialog.dismiss();
} catch (Exception e8) {
b(e8);
progressDialog.dismiss();
}
} catch (Throwable th) {
progressDialog.dismiss();
throw th;
}
}
public final void I1(final ProgressDialog progressDialog, final e eVar, File file, File file2) {
try {
try {
if (!file.equals(file2) && !file.renameTo(file2)) {
if (file.isDirectory()) {
progressDialog.setMax(q1(file));
Utils.Y(new O8.c() {
public final void a() {
r0.setProgress(progressDialog.getProgress() + 1);
}
}, file, file2, true);
Utils.n0(file);
} else {
Utils.Z(file, file2);
Utils.k0(file);
}
}
eVar.v(file2);
j.p(new Runnable() {
@Override
public final void run() {
XoneFileBrowser.this.K1(eVar);
}
});
progressDialog.dismiss();
} catch (Exception e8) {
b(e8);
progressDialog.dismiss();
}
} catch (Throwable th) {
progressDialog.dismiss();
throw th;
}
}
public final void S1(View view) {
try {
this.f17912H = true;
this.f17911G = u1(72);
GridLayoutManager s12 = s1();
t.a(this.f17926v);
s12.t3(4);
this.f17905A.notifyDataSetChanged();
} catch (Exception e8) {
b(e8);
}
}
public final void T1(e eVar) {
try {
File c8 = eVar.c();
if (!c8.exists()) {
throw new FileNotFoundException("File " + c8.getAbsolutePath() + " does not exist");
}
if (c8.isDirectory()) {
Utils.q0(c8);
} else if (!c8.delete()) {
throw new IOException("Cannot delete file " + c8.getAbsolutePath());
}
this.f17905A.T(eVar);
} catch (Exception e8) {
b(e8);
}
}
public final void U1(DialogInterface dialogInterface, e eVar, EditText editText) {
if (c()) {
return;
}
try {
eVar.a(this.f17905A, editText);
dialogInterface.dismiss();
} catch (Exception e8) {
b(e8);
}
}
public final boolean W1(TextView textView, e eVar, AlertDialog alertDialog) {
if (c()) {
return true;
}
try {
eVar.a(this.f17905A, textView);
alertDialog.dismiss();
return true;
} catch (Exception e8) {
b(e8);
return true;
}
}
public final void X1(View view) {
try {
finish();
} catch (Exception e8) {
b(e8);
}
}
public final void Y1(a aVar) {
boolean isExternalStorageManager;
if (Build.VERSION.SDK_INT < 30) {
return;
}
isExternalStorageManager = Environment.isExternalStorageManager();
if (isExternalStorageManager) {
h2();
} else if (A1(this.f17908D)) {
N1();
}
}
public final void Z1(View view) {
try {
this.f17912H = false;
this.f17911G = u1(72);
GridLayoutManager s12 = s1();
t.a(this.f17926v);
s12.t3(1);
this.f17905A.notifyDataSetChanged();
} catch (Exception e8) {
b(e8);
}
}
public final void a2(View view) {
try {
this.f17912H = true;
this.f17911G = u1(96);
GridLayoutManager s12 = s1();
t.a(this.f17926v);
s12.t3(3);
this.f17905A.notifyDataSetChanged();
} catch (Exception e8) {
b(e8);
}
}
@Override
public void afterTextChanged(Editable editable) {
}
public final void b2(View view) {
boolean k12;
try {
e eVar = this.f17913I;
if (eVar != null) {
k12 = i1(eVar);
} else {
e eVar2 = this.f17914J;
k12 = eVar2 != null ? k1(eVar2) : false;
}
if (k12) {
this.f17913I = null;
this.f17914J = null;
x1();
}
} catch (Exception e8) {
b(e8);
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
}
public final void c2(View view) {
try {
this.f17912H = true;
this.f17911G = u1(144);
GridLayoutManager s12 = s1();
t.a(this.f17926v);
s12.t3(2);
this.f17905A.notifyDataSetChanged();
} catch (Exception e8) {
b(e8);
}
}
public final void d2(View view) {
try {
int i8 = this.f17920p;
if ((i8 & 1) != 0 && ((i8 & 2) <= 0 || this.f17907C.equals(this.f17908D))) {
return;
}
m1();
} catch (Exception e8) {
b(e8);
}
}
public final File e2() {
File file;
if (this.f17910F.empty() || (file = (File) this.f17910F.pop()) == null) {
return null;
}
if (this.f17908D.equals(file)) {
if (this.f17910F.empty()) {
return null;
}
file = (File) this.f17910F.pop();
}
return (file == null || !file.exists()) ? e2() : file;
}
public void f2(final e eVar) {
if (eVar != null && eVar.r() && eVar.u()) {
File c8 = eVar.c();
if (!c8.exists()) {
throw new FileNotFoundException("File " + c8.getAbsolutePath() + " does not exist");
}
if (!c8.canWrite()) {
throw new IOException("Cannot delete file " + c8.getAbsolutePath() + ", insufficient permissions");
}
String name = c8.getName();
Typeface p02 = p0();
int applyDimension = (int) TypedValue.applyDimension(1, 15.0f, o1());
final AppCompatEditText appCompatEditText = new AppCompatEditText(this);
appCompatEditText.setInputType(524288);
appCompatEditText.setSingleLine(true);
appCompatEditText.setTypeface(p02);
appCompatEditText.setText(name);
AlertDialog.Builder g8 = eb.a.g(this);
g8.setTitle(o7.d.f22783H);
g8.setView(appCompatEditText);
g8.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i8) {
XoneFileBrowser.this.L1(eVar, appCompatEditText, dialogInterface, i8);
}
});
g8.setOnCancelListener(new z());
final AlertDialog create = g8.create();
Window window = create.getWindow();
if (window != null) {
window.setSoftInputMode(4);
}
appCompatEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i8, KeyEvent keyEvent) {
boolean M12;
M12 = XoneFileBrowser.this.M1(eVar, create, textView, i8, keyEvent);
return M12;
}
});
create.setOwnerActivity(this);
create.show();
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) appCompatEditText.getLayoutParams();
marginLayoutParams.setMargins(applyDimension, 0, applyDimension, 0);
appCompatEditText.setLayoutParams(marginLayoutParams);
TextView textView = (TextView) create.findViewById(R.id.message);
if (textView != null) {
textView.setTypeface(p02);
}
if (appCompatEditText.requestFocus()) {
int lastIndexOf = name.lastIndexOf(".");
if (lastIndexOf < 0) {
lastIndexOf = name.length();
}
appCompatEditText.setSelection(lastIndexOf);
}
}
}
public void g1(File file) {
this.f17910F.push(file);
}
public void g2() {
Intent intent = new Intent("android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION");
intent.setData(Uri.fromParts("package", getPackageName(), null));
this.f17916L.a(intent);
}
public void h1(final e eVar) {
G0(o7.d.f22793f, o7.d.f22790c, new DialogInterfaceOnClickListenerC2811m(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i8) {
XoneFileBrowser.this.E1(eVar, dialogInterface, i8);
}
});
}
public void h2() {
AppCompatAutoCompleteTextView appCompatAutoCompleteTextView = this.f17928x;
String text = appCompatAutoCompleteTextView != null ? appCompatAutoCompleteTextView.getText() : "";
i2(TextUtils.isEmpty(text) ? "" : text);
}
public final boolean i1(final e eVar) {
final File c8 = eVar.c();
final File file = new File(n1(), c8.getName());
if (c8.equals(file)) {
Utils.d4(this, o7.d.f22777B);
return false;
}
if (file.exists()) {
G0(o7.d.f22808u, o7.d.f22788a, new DialogInterfaceOnClickListenerC2811m(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i8) {
XoneFileBrowser.this.F1(file, eVar, c8, dialogInterface, i8);
}
});
return false;
}
j1(eVar, c8, file);
return true;
}
public void i2(CharSequence charSequence) {
n2();
this.f17909E = new v7.c(this.f17905A, this.f17910F, this.f17908D, this.f17917m, charSequence, this.f17921q, this.f17922r, this.f17923s, this.f17924t).k();
o2();
}
public final void j1(final e eVar, final File file, final File file2) {
final ProgressDialog I02 = I0(Integer.valueOf(o7.d.f22792e), null, null, null);
p1().submit(new Runnable() {
@Override
public final void run() {
XoneFileBrowser.this.G1(I02, eVar, file, file2);
}
});
}
public void j2(e eVar) {
this.f17913I = eVar;
this.f17914J = null;
m2();
}
public final boolean k1(final e eVar) {
final File c8 = eVar.c();
final File file = new File(n1(), c8.getName());
if (c8.equals(file)) {
Utils.d4(this, o7.d.f22777B);
return false;
}
if (file.exists()) {
G0(o7.d.f22808u, o7.d.f22788a, new DialogInterfaceOnClickListenerC2811m(), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i8) {
XoneFileBrowser.this.H1(file, eVar, c8, dialogInterface, i8);
}
});
return false;
}
l1(eVar, c8, file);
return true;
}
public void k2(File file) {
this.f17908D = file;
}
public final void l1(final e eVar, final File file, final File file2) {
final ProgressDialog I02 = I0(Integer.valueOf(o7.d.f22810w), null, null, null);
p1().submit(new Runnable() {
@Override
public final void run() {
XoneFileBrowser.this.I1(I02, eVar, file, file2);
}
});
}
public void l2(e eVar) {
this.f17913I = null;
this.f17914J = eVar;
m2();
}
public final void m1() {
File file = this.f17908D;
if (file == null) {
this.f17908D = new File("/");
} else {
File parentFile = file.getParentFile();
if (parentFile == null) {
parentFile = new File("/");
if (C1(parentFile, this.f17908D)) {
return;
}
}
this.f17908D = parentFile;
}
g1(this.f17908D);
h2();
}
public final void m2() {
this.f17929y.setVisibility(0);
this.f17930z.setVisibility(0);
}
public File n1() {
return this.f17908D;
}
public final void n2() {
Future future = this.f17909E;
if (future == null) {
return;
}
future.cancel(true);
}
public final void o2() {
File file;
if (this.f17927w == null || (file = this.f17908D) == null) {
return;
}
String absolutePath = file.getAbsolutePath();
if (TextUtils.isEmpty(absolutePath)) {
return;
}
if (!this.f17908D.exists()) {
absolutePath = absolutePath + " " + getString(o7.d.f22778C);
} else if (!this.f17908D.canRead()) {
absolutePath = absolutePath + " " + getString(o7.d.f22811x);
}
this.f17906B.n(absolutePath);
}
@Override
public void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
setContentView(o7.c.f22771a);
t1();
y1();
z1();
h2();
this.f17916L = registerForActivityResult(new C1983c(), new androidx.activity.result.b() {
@Override
public final void a(Object obj) {
XoneFileBrowser.this.Y1((androidx.activity.result.a) obj);
}
});
getOnBackPressedDispatcher().h(new L0(new K0() {
public final void a() {
XoneFileBrowser.this.P1();
}
}));
}
@Override
public void onDestroy() {
super.onDestroy();
n2();
}
@Override
public void onTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
if (charSequence == null) {
charSequence = "";
}
i2(charSequence.toString());
}
public final int q1(File file) {
File[] listFiles = file.listFiles();
if (listFiles == null || listFiles.length == 0) {
return 0;
}
int i8 = 0;
for (File file2 : listFiles) {
i8 = !file2.isDirectory() ? i8 + 1 : i8 + q1(file2);
}
return i8;
}
public int r1() {
return this.f17920p;
}
public final GridLayoutManager s1() {
return (GridLayoutManager) this.f17926v.getLayoutManager();
}
public final void t1() {
Bundle f8 = k.f(getIntent());
this.f17917m = fb.e.j(f8, "extensions", "*.*");
this.f17918n = fb.e.a(f8, "pictureonly", false);
this.f17919o = fb.e.j(f8, "path", (String) null);
this.f17920p = fb.e.d(f8, "flags", 0);
this.f17921q = fb.e.a(f8, "readAllowed", false);
this.f17922r = fb.e.a(f8, "writeAllowed", false);
this.f17923s = fb.e.a(f8, "openOnSingleTap", false);
this.f17924t = fb.e.a(f8, "showLongTapMenu", false);
this.f17925u = fb.e.a(f8, "showSearch", false);
}
public final int u1(int i8) {
return (int) TypedValue.applyDimension(1, i8, getResources().getDisplayMetrics());
}
public int v1() {
return this.f17911G;
}
public void w1() {
View currentFocus;
try {
Window window = getWindow();
if (window == null || (currentFocus = window.getCurrentFocus()) == null) {
return;
}
((InputMethodManager) getSystemService("input_method")).hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
} catch (Exception e8) {
e8.printStackTrace();
}
}
public void x1() {
this.f17929y.setVisibility(8);
this.f17930z.setVisibility(8);
}
public final void y1() {
if (this.f17918n) {
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), "Camera");
if (file.exists()) {
this.f17908D = file;
}
}
if (!TextUtils.isEmpty(this.f17919o)) {
File file2 = new File(this.f17919o);
if (file2.exists() && file2.isDirectory()) {
this.f17908D = file2;
}
}
if (this.f17908D == null) {
this.f17908D = Environment.getExternalStorageDirectory();
}
File file3 = this.f17908D;
this.f17907C = file3;
g1(file3);
}
public final void z1() {
this.f17926v = (RecyclerView) findViewById(o7.b.f22755j);
this.f17905A = new c(this);
this.f17912H = true;
this.f17911G = u1(144);
this.f17926v.setLayoutManager(new GridLayoutManager(this, 2));
this.f17926v.setAdapter(this.f17905A);
int i8 = this.f17920p;
if ((i8 & 1) == 0 || (i8 & 2) > 0) {
((ImageButton) findViewById(o7.b.f22765t)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.d2(view);
}
});
}
((ImageButton) findViewById(o7.b.f22758m)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.Z1(view);
}
});
((ImageButton) findViewById(o7.b.f22764s)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.c2(view);
}
});
((ImageButton) findViewById(o7.b.f22759n)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.a2(view);
}
});
((ImageButton) findViewById(o7.b.f22751f)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.S1(view);
}
});
((ImageButton) findViewById(o7.b.f22750e)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.O1(view);
}
});
((ImageButton) findViewById(o7.b.f22754i)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.X1(view);
}
});
this.f17927w = (AppCompatSpinner) findViewById(o7.b.f22752g);
b bVar = new b(this.f17927w);
this.f17906B = bVar;
this.f17927w.setAdapter((SpinnerAdapter) bVar);
this.f17927w.setDropDownWidth(-1);
if (this.f17906B.getCount() <= 1) {
this.f17927w.setBackgroundDrawable(null);
}
AppCompatAutoCompleteTextView appCompatAutoCompleteTextView = (AppCompatAutoCompleteTextView) findViewById(o7.b.f22763r);
this.f17928x = appCompatAutoCompleteTextView;
appCompatAutoCompleteTextView.addTextChangedListener(this);
this.f17928x.setVisibility(this.f17925u ? 0 : 8);
this.f17928x.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public final boolean onEditorAction(TextView textView, int i9, KeyEvent keyEvent) {
boolean V12;
V12 = XoneFileBrowser.V1(textView, i9, keyEvent);
return V12;
}
});
this.f17929y = (AppCompatImageButton) findViewById(o7.b.f22760o);
this.f17930z = findViewById(o7.b.f22761p);
this.f17929y.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
XoneFileBrowser.this.b2(view);
}
});
}
}