Android: Proper home detection during initial startup

This commit is contained in:
Ender's Games 2018-08-06 21:58:22 -04:00
parent 1de9930cf4
commit ce447e220c
2 changed files with 5 additions and 6 deletions

View File

@ -172,13 +172,12 @@ public class FileBrowser extends Fragment {
* findViewById(R.id.about).setOnTouchListener(viblist);
*/
File home = new File(mPrefs.getString(Config.pref_home, home_directory));
if (!home.exists() || !home.isDirectory()) {
String temp = mPrefs.getString(Config.pref_home, null);
if (temp == null || !new File(temp).isDirectory()) {
showToastMessage(getActivity().getString(R.string.config_home), Snackbar.LENGTH_LONG);
} else {
installButtons();
}
if (!ImgBrowse && !games) {
new LocateGames(R.array.flash).execute(home_directory);
} else {

View File

@ -259,9 +259,9 @@ public class MainActivity extends AppCompatActivity implements
builder.setPositiveButton(R.string.browse,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
onMainBrowseSelected(false,
Environment.getExternalStorageDirectory().getAbsolutePath(),
false, null);
String home_directory = mPrefs.getString(Config.pref_home,
Environment.getExternalStorageDirectory().getAbsolutePath());
onMainBrowseSelected(false, home_directory, false, null);
}
});
builder.setNegativeButton(R.string.gdrive,