diff --git a/shell/android/res/layout/configure_fragment.xml b/shell/android/res/layout/configure_fragment.xml
index 689e1cbe3..3b7b8030b 100644
--- a/shell/android/res/layout/configure_fragment.xml
+++ b/shell/android/res/layout/configure_fragment.xml
@@ -40,7 +40,7 @@
android:id="@+id/browse_main_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="Browse" />
+ android:text="@string/locate" />
@@ -51,7 +51,7 @@
android:orientation="vertical" >
+ android:text="@string/browse" />
@@ -121,7 +121,7 @@
android:orientation="vertical" >
24
- 32
+
+
+ - bin
+
- HDMI
diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml
index 5aad9a8f8..6507a831e 100644
--- a/shell/android/res/values/strings.xml
+++ b/shell/android/res/values/strings.xml
@@ -9,6 +9,8 @@
Please configure a home directory.
Please configure a game directory.
Unsupported kernel version!
+ Locate
+ Browse
Boot Dreamcast BIOS
Missing Dreamcast BIOS
diff --git a/shell/android/src/com/reicast/emulator/FileBrowser.java b/shell/android/src/com/reicast/emulator/FileBrowser.java
index d77d4c418..86a65ab16 100644
--- a/shell/android/src/com/reicast/emulator/FileBrowser.java
+++ b/shell/android/src/com/reicast/emulator/FileBrowser.java
@@ -156,9 +156,16 @@ public class FileBrowser extends Fragment {
}
if (!ImgBrowse) {
- navigate(sdcard);
+// navigate(sdcard);
+ LocateGames mLocateGames = new LocateGames(R.array.flash);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ mLocateGames
+ .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, home_directory);
+ } else {
+ mLocateGames.execute(home_directory);
+ }
} else {
- LocateGames mLocateGames = new LocateGames();
+ LocateGames mLocateGames = new LocateGames(R.array.images);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mLocateGames
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, game_directory);
@@ -169,13 +176,19 @@ public class FileBrowser extends Fragment {
}
private final class LocateGames extends AsyncTask> {
+
+ private int array;
+
+ public LocateGames(int arrayType) {
+ this.array = arrayType;
+ }
@Override
protected List doInBackground(String... paths) {
File storage = new File(paths[0]);
// array of valid image file extensions
- String[] mediaTypes = parentActivity.getResources().getStringArray(R.array.images);
+ String[] mediaTypes = parentActivity.getResources().getStringArray(array);
FilenameFilter[] filter = new FilenameFilter[mediaTypes.length];
int i = 0;
@@ -209,10 +222,10 @@ public class FileBrowser extends Fragment {
}
String heading = parentActivity.getString(R.string.games_listing);
- createListHeader(heading, list, true);
+ createListHeader(heading, list, array == R.array.images);
if (items != null && !items.isEmpty()) {
for (int i = 0; i < items.size(); i++) {
- createListItem(list, items.get(i), i);
+ createListItem(list, items.get(i), i, array == R.array.images);
}
} else {
Toast.makeText(parentActivity, R.string.config_game, Toast.LENGTH_LONG).show();
@@ -286,7 +299,7 @@ public class FileBrowser extends Fragment {
}
- private void createListItem(LinearLayout list, final File game, final int index) {
+ private void createListItem(LinearLayout list, final File game, final int index, final boolean isGame) {
final View childview = parentActivity.getLayoutInflater().inflate(
R.layout.app_list_item, null, false);
@@ -301,6 +314,7 @@ public class FileBrowser extends Fragment {
childview.findViewById(R.id.childview).setOnClickListener(
new OnClickListener() {
public void onClick(View view) {
+ if (isGame) {
vib.vibrate(50);
if (mPrefs.getBoolean(Config.pref_gamedetails, false)) {
final AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
@@ -332,6 +346,16 @@ public class FileBrowser extends Fragment {
.fromFile(game) : Uri.EMPTY);
vib.vibrate(250);
}
+ } else {
+ vib.vibrate(50);
+ mCallback.onFolderSelected(game != null ? Uri
+ .fromFile(game) : Uri.EMPTY);
+ home_directory = game.getAbsolutePath().substring(0,
+ game.getAbsolutePath().lastIndexOf(File.separator));
+ mPrefs.edit().putString("home_directory",
+ home_directory.replace("/data", "")).commit();
+ JNIdc.config(home_directory.replace("/data", ""));
+ }
}
});
diff --git a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java
index fe88e74e3..22733e374 100644
--- a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java
+++ b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java
@@ -101,10 +101,6 @@ public class OptionsFragment extends Fragment {
mainBrowse.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
- if (editBrowse.getText() != null) {
- home_directory = editBrowse.getText().toString();
- //mPrefs.edit().putString("home_directory", home_directory).commit();
- }
mCallback.onMainBrowseSelected(home_directory, false);
}
});