Support when the home directory is not configured or valid
This commit is contained in:
parent
e28b08c3d2
commit
6e30aa3ce7
|
@ -139,8 +139,26 @@ public class FileBrowser extends Fragment {
|
|||
* findViewById(R.id.about).setOnTouchListener(viblist);
|
||||
*/
|
||||
|
||||
File home = new File(home_directory);
|
||||
if (!home.exists() || !home.isDirectory()) {
|
||||
Toast.makeText(getActivity(), "Please configure a home directory",
|
||||
Toast.LENGTH_LONG).show();
|
||||
OptionsFragment optsFrag = (OptionsFragment) getActivity()
|
||||
.getSupportFragmentManager().findFragmentByTag(
|
||||
"OPTIONS_FRAG");
|
||||
if (optsFrag != null) {
|
||||
if (optsFrag.isVisible()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
optsFrag = new OptionsFragment();
|
||||
getActivity().getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fragment_container, optsFrag, "OPTIONS_FRAG")
|
||||
.addToBackStack(null).commit();
|
||||
}
|
||||
|
||||
if (!ImgBrowse) {
|
||||
navigate(new File(home_directory));
|
||||
navigate(sdcard);
|
||||
} else {
|
||||
generate(ExternalFiles(sdcard));
|
||||
}
|
||||
|
@ -176,6 +194,27 @@ public class FileBrowser extends Fragment {
|
|||
// current activity
|
||||
parentActivity.finish();
|
||||
}
|
||||
})
|
||||
.setNegativeButton("Options",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog,
|
||||
int id) {
|
||||
OptionsFragment optsFrag = (OptionsFragment) getActivity()
|
||||
.getSupportFragmentManager()
|
||||
.findFragmentByTag("OPTIONS_FRAG");
|
||||
if (optsFrag != null) {
|
||||
if (optsFrag.isVisible()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
optsFrag = new OptionsFragment();
|
||||
getActivity()
|
||||
.getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container,
|
||||
optsFrag, "OPTIONS_FRAG")
|
||||
.addToBackStack(null).commit();
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
|
|
Loading…
Reference in New Issue