Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use HashSets in FolderBrowser as well, like the last commit for GameL…
…istFragment.

Should have originally done this with the first refactor. My bad.
  • Loading branch information
lioncash committed Jul 15, 2013
1 parent 13f30d1 commit 0ba2594
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
Expand Up @@ -12,9 +12,12 @@
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;
Expand All @@ -28,6 +31,10 @@ private void Fill(File currDir)
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
{
Expand All @@ -43,17 +50,14 @@ private void Fill(File currDir)
}
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));
}
}
}
}
Expand Down

0 comments on commit 0ba2594

Please sign in to comment.