summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-08-24 09:12:17 -0400
committerLioncash <mathew1800@gmail.com>2013-08-24 09:12:17 -0400
commit528a7333597b357784e5482c792ced5cefa86e31 (patch)
treefba2d2f3c34df97055a8715bfddbadb026347313 /Source/Android
parent857ce47de28546d78c8204d6571149f742996024 (diff)
[Android] Don't create a new GCMPath entry in the Dolphin config if it another existing GCMPath entry already has the same directory path.
Also, fix a 'bug' with the clear all items function. Make sure we set GCMPathes to 0, so that GCMPath entries start adding at GCMPath0 again. This change also allows me to remove the duplicate checking code from GameListFragment, since the items in the game list are loaded based on the GCMEntries in the Dolphin config.
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java31
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java2
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java16
3 files changed, 29 insertions, 20 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
index 027a2f837e..56fe57cb2e 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
@@ -137,15 +137,38 @@ public final class FolderBrowser extends Fragment
// Cache the activity instance.
m_activity = activity;
}
-
-
+
+
private void FolderSelected()
{
String Directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0");
int intDirectories = Integer.parseInt(Directories);
Directories = Integer.toString(intDirectories + 1);
- NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPathes", Directories);
- NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPath" + Integer.toString(intDirectories), currentDir.getPath());
+
+ // Check to see if a path set in the Dolphin config
+ // matches the one the user is trying to add. If it's
+ // already set, then don't add it to the list again.
+ boolean pathNotPresent = true;
+ for (int i = 0; i < intDirectories; i++)
+ {
+ String gcmPath = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPath" + i, "");
+
+ if (gcmPath.equals(currentDir.getPath()))
+ {
+ pathNotPresent = false;
+ }
+ else
+ {
+ pathNotPresent = true;
+ }
+ }
+
+ // User doesn't have this path in the config, so add it.
+ if (pathNotPresent)
+ {
+ NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPathes", Integer.toString(intDirectories+1));
+ NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPath" + Integer.toString(intDirectories), currentDir.getPath());
+ }
((GameListActivity)m_activity).SwitchPage(0);
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
index 3678cf7637..f1d5fbc170 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
@@ -293,6 +293,8 @@ public final class GameListActivity extends Activity
NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPath" + i, "");
}
+ NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPathes", "0");
+
ArrayAdapter<GameListItem> adapter = ((GameListFragment)GameListActivity.this.mCurFragment).getAdapter();
adapter.clear();
adapter.notifyDataSetChanged();
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
index b72509419f..6d4a4bfe22 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
@@ -98,22 +98,6 @@ public final class GameListFragment extends Fragment
}
Collections.sort(fls);
- // Remove any duplicate items from the list.
- // We don't need to index these in the game list more than once.
- //
- // This works by comparing the paths of items in the file list for equality,
- // so there should be no worries about accidentally removing a valid game.
- for (int i = 0; i < fls.size(); i++)
- {
- for (int j = i+1; j < fls.size(); j++)
- {
- if (fls.get(j).getPath().equals(fls.get(i).getPath()))
- {
- fls.remove(j);
- }
- }
- }
-
mGameAdapter = new GameListAdapter(mMe, R.layout.gamelist_layout, fls);
mMainList.setAdapter(mGameAdapter);