diff options
| author | lioncash <mathew1900@hotmail.com> | 2013-07-15 09:58:54 -0400 |
|---|---|---|
| committer | lioncash <mathew1900@hotmail.com> | 2013-07-15 09:58:54 -0400 |
| commit | 0ba25943394ec94ff22bb8e5a56abec4180b794d (patch) | |
| tree | e42b8a2c96418fb9c10210685c3b80adfafc615c /Source/Android/src | |
| parent | 13f30d1d1d2a7124c1046daf0ff59a2b26b0a7b6 (diff) | |
Use HashSets in FolderBrowser as well, like the last commit for GameListFragment.
Should have originally done this with the first refactor. My bad.
Diffstat (limited to 'Source/Android/src')
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index 3b9fe9a0e5..9947e95d36 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -12,9 +12,12 @@ import android.widget.ListView; import android.widget.Toast; import java.io.File; +import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; public class FolderBrowser extends ListActivity { private FolderBrowserAdapter adapter; @@ -28,6 +31,10 @@ public class FolderBrowser extends ListActivity { List<GameListItem>dir = new ArrayList<GameListItem>(); List<GameListItem>fls = new ArrayList<GameListItem>(); + // Supported extensions to filter by + Set<String> validExts = new HashSet<String>(Arrays.asList(".gcm", ".iso", ".wbfs", ".gcz", ".dol", ".elf")); + Set<String> archiveExts = new HashSet<String>(Arrays.asList(".zip", ".rar", ".7z")); + // Search for any directories or supported files within the current dir. try { @@ -43,17 +50,14 @@ public class FolderBrowser extends ListActivity { } else { - if (entryName.toLowerCase().contains(".gcm") || - entryName.toLowerCase().contains(".iso") || - entryName.toLowerCase().contains(".wbfs") || - entryName.toLowerCase().contains(".gcz") || - entryName.toLowerCase().contains(".dol") || - entryName.toLowerCase().contains(".elf")) - fls.add(new GameListItem(getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true)); - else if (entryName.toLowerCase().contains(".zip") || - entryName.toLowerCase().contains(".rar") || - entryName.toLowerCase().contains(".7z")) - fls.add(new GameListItem(getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), false)); + if (validExts.contains(entryName.toLowerCase())) + { + fls.add(new GameListItem(getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true)); + } + else if (archiveExts.contains(entryName.toLowerCase())) + { + fls.add(new GameListItem(getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), false)); + } } } } |
