This commit is contained in:
ShirosakiMio 2024-08-12 12:41:23 +08:00
parent c45f144b10
commit c72429aa67
2 changed files with 7 additions and 1 deletions

View File

@ -33,6 +33,7 @@ public class FileBrowser implements Serializable {
private String initDir = Environment.getExternalStorageDirectory().getAbsolutePath(); private String initDir = Environment.getExternalStorageDirectory().getAbsolutePath();
private ArrayList<String> suffix = new ArrayList<>(); private ArrayList<String> suffix = new ArrayList<>();
private String title; private String title;
private int code;
public FileBrowser(String title) { public FileBrowser(String title) {
this.title = title; this.title = title;
@ -58,11 +59,16 @@ public class FileBrowser implements Serializable {
return title; return title;
} }
public int getCode() {
return code;
}
public void browse(Activity activity, int code, ResultListener.Listener listener) { public void browse(Activity activity, int code, ResultListener.Listener listener) {
Intent intent = new Intent(activity, FileBrowserActivity.class); Intent intent = new Intent(activity, FileBrowserActivity.class);
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putSerializable("config", this); bundle.putSerializable("config", this);
intent.putExtras(bundle); intent.putExtras(bundle);
this.code = code;
ResultListener.startActivityForResult(activity, intent, code, listener); ResultListener.startActivityForResult(activity, intent, code, listener);
} }

View File

@ -132,7 +132,7 @@ public class FileBrowserActivity extends FCLActivity implements View.OnClickList
listView = findViewById(R.id.list); listView = findViewById(R.id.list);
refreshList(currentPath != null ? currentPath : new File(fileBrowser.getInitDir()).toPath()); refreshList(currentPath != null ? currentPath : new File(fileBrowser.getInitDir()).toPath());
if (fileBrowser.getLibMode() != LibMode.FILE_CHOOSER) { if (fileBrowser.getLibMode() != LibMode.FILE_CHOOSER || fileBrowser.getCode() != 400) {
selectExternal.setVisibility(View.GONE); selectExternal.setVisibility(View.GONE);
} }
} }