Permission aware file browsing, Restore menu size

Since the BIOS cannot be stored on external storage, there is
absolutely no reason to begin a search from that folder.

It makes more sense to start from a user-defined folder than the
default simply because an external card exists. A check has been added
to see if the preference is a default.
This commit is contained in:
TwistedUmbrella 2015-07-13 23:49:50 -04:00
parent 70b93b4d86
commit 627d5eb301
3 changed files with 18 additions and 16 deletions

View File

@ -21,8 +21,8 @@
<ImageView <ImageView
android:id="@+id/item_icon" android:id="@+id/item_icon"
android:layout_width="48dp" android:layout_width="32dp"
android:layout_height="48dp" android:layout_height="32dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:layout_marginLeft="6dp" android:layout_marginLeft="6dp"

View File

@ -16,8 +16,8 @@
<ImageView <ImageView
android:id="@+id/item_icon" android:id="@+id/item_icon"
android:layout_width="48dp" android:layout_width="32dp"
android:layout_height="48dp" android:layout_height="32dp"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:layout_marginLeft="6dp" android:layout_marginLeft="6dp"

View File

@ -279,21 +279,23 @@ public class FileBrowser extends Fragment {
} }
private void browseStorage(boolean images) { private void browseStorage(boolean images) {
HashSet<String> extStorage = FileBrowser.getExternalMounts();
if (extStorage != null && !extStorage.isEmpty()) {
for (Iterator<String> sd = extStorage.iterator(); sd.hasNext();) {
String sdCardPath = sd.next().replace("mnt/media_rw", "storage");
if (!sdCardPath.equals(sdcard.getAbsolutePath())) {
if (new File(sdCardPath).canRead()) {
navigate(new File(sdCardPath));
return;
}
}
}
}
if (images) { if (images) {
navigate(new File(home_directory)); navigate(new File(home_directory));
} else { } else {
if (game_directory.equals(sdcard.getAbsolutePath().replace("emulated/0", "sdcard0"))) {
HashSet<String> extStorage = FileBrowser.getExternalMounts();
if (extStorage != null && !extStorage.isEmpty()) {
for (Iterator<String> sd = extStorage.iterator(); sd.hasNext();) {
String sdCardPath = sd.next().replace("mnt/media_rw", "storage");
if (!sdCardPath.equals(sdcard.getAbsolutePath())) {
if (new File(sdCardPath).canRead()) {
navigate(new File(sdCardPath));
return;
}
}
}
}
}
navigate(new File(game_directory)); navigate(new File(game_directory));
} }
} }