[Android] Since we don't show invalid filetypes in the file browser anymore, there's no need to check if a file is valid or not since they're all valid now.

This commit is contained in:
Lioncash 2013-08-23 10:26:15 -04:00
parent 70dab0d839
commit c2aef25f4c
8 changed files with 10 additions and 52 deletions

View File

@ -17,7 +17,6 @@
<string name="parent_directory">親ディレクトリ</string> <string name="parent_directory">親ディレクトリ</string>
<string name="folder">フォルダ</string> <string name="folder">フォルダ</string>
<string name="file_size">ファイルサイズ: </string> <string name="file_size">ファイルサイズ: </string>
<string name="cant_use_compressed_filetypes">圧縮ファイル形式はサポートされていません</string>
<!-- Game List Activity --> <!-- Game List Activity -->
<string name="game_list">ゲームリスト</string> <string name="game_list">ゲームリスト</string>

View File

@ -17,7 +17,6 @@
<string name="parent_directory">Parent Directory</string> <string name="parent_directory">Parent Directory</string>
<string name="folder">Folder</string> <string name="folder">Folder</string>
<string name="file_size">File Size: </string> <string name="file_size">File Size: </string>
<string name="cant_use_compressed_filetypes">Can not use compressed file types</string>
<!-- Game List Activity --> <!-- Game List Activity -->
<string name="game_list">Game List</string> <string name="game_list">Game List</string>

View File

@ -36,8 +36,8 @@ public final class AboutFragment extends Fragment
String no = getString(R.string.no); String no = getString(R.string.no);
List<FolderBrowserItem> Input = new ArrayList<FolderBrowserItem>(); List<FolderBrowserItem> Input = new ArrayList<FolderBrowserItem>();
Input.add(new FolderBrowserItem(getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true)); Input.add(new FolderBrowserItem(getString(R.string.build_revision), NativeLibrary.GetVersionString(), ""));
Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no, "", true)); Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no, ""));
adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input); adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input);
mMainList.setAdapter(adapter); mMainList.setAdapter(adapter);

View File

@ -10,7 +10,6 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ListView; import android.widget.ListView;
import android.widget.Toast;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
@ -64,13 +63,13 @@ public final class FolderBrowser extends Fragment
{ {
if(entry.isDirectory()) if(entry.isDirectory())
{ {
dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath(), true)); dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath()));
} }
else if (entry.isFile() && hasExtension) else if (entry.isFile() && hasExtension)
{ {
if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{ {
fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath(), true)); fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath()));
} }
} }
} }
@ -87,7 +86,7 @@ public final class FolderBrowser extends Fragment
// Check for a parent directory to the one we're currently in. // Check for a parent directory to the one we're currently in.
if (!currDir.getPath().equalsIgnoreCase("/")) if (!currDir.getPath().equalsIgnoreCase("/"))
dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent(), true)); dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent()));
adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir);
mDrawerList = (ListView) rootView.findViewById(R.id.gamelist); mDrawerList = (ListView) rootView.findViewById(R.id.gamelist);
@ -119,10 +118,7 @@ public final class FolderBrowser extends Fragment
} }
else else
{ {
if (item.isValid())
FolderSelected(); FolderSelected();
else
Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show();
} }
} }
}; };

View File

@ -58,11 +58,6 @@ public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
if(mainText != null) if(mainText != null)
{ {
mainText.setText(item.getName()); mainText.setText(item.getName());
if (!item.isValid())
{
mainText.setTextColor(0xFFFF0000);
}
} }
if(subtitleText != null) if(subtitleText != null)

View File

@ -10,7 +10,6 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
private final String name; private final String name;
private final String subtitle; private final String subtitle;
private final String path; private final String path;
private final boolean isValid;
private final File underlyingFile; private final File underlyingFile;
/** /**
@ -19,14 +18,12 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
* @param name The name of the file/folder represented by this item. * @param name The name of the file/folder represented by this item.
* @param subtitle The subtitle of this FolderBrowserItem to display. * @param subtitle The subtitle of this FolderBrowserItem to display.
* @param path The path of the file/folder represented by this item. * @param path The path of the file/folder represented by this item.
* @param isValid Whether or not this item represents a file type that can be handled.
*/ */
public FolderBrowserItem(String name, String subtitle, String path, boolean isValid) public FolderBrowserItem(String name, String subtitle, String path)
{ {
this.name = name; this.name = name;
this.subtitle = subtitle; this.subtitle = subtitle;
this.path = path; this.path = path;
this.isValid = isValid;
this.underlyingFile = new File(path); this.underlyingFile = new File(path);
} }
@ -35,14 +32,12 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
* *
* @param name The name of the file/folder represented by this item. * @param name The name of the file/folder represented by this item.
* @param path The path of the file/folder represented by this item. * @param path The path of the file/folder represented by this item.
* @param isValid Whether or not this item represents a file type that can be handled.
*/ */
public FolderBrowserItem(String name, String path, boolean isValid) public FolderBrowserItem(String name, String path)
{ {
this.name = name; this.name = name;
this.subtitle = ""; this.subtitle = "";
this.path = path; this.path = path;
this.isValid = isValid;
this.underlyingFile = new File(path); this.underlyingFile = new File(path);
} }
@ -76,20 +71,6 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
return path; return path;
} }
/**
* Gets whether or not the file represented
* by this FolderBrowserItem is supported
* and can be handled correctly.
*
* @return whether or not the file represented
* by this FolderBrowserItem is supported
* and can be handled correctly.
*/
public boolean isValid()
{
return isValid;
}
/** /**
* Gets the {@link File} representation of the underlying file/folder * Gets the {@link File} representation of the underlying file/folder
* represented by this FolderBrowserItem. * represented by this FolderBrowserItem.

View File

@ -77,7 +77,7 @@ public final class GameListFragment extends Fragment
if (!entry.isDirectory()) if (!entry.isDirectory())
{ {
if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath()));
} }
} }
} }

View File

@ -25,7 +25,6 @@ public final class GameListItem implements Comparable<GameListItem>
private String name; private String name;
private final String data; private final String data;
private final String path; private final String path;
private final boolean isValid;
private Bitmap image; private Bitmap image;
/** /**
@ -37,12 +36,11 @@ public final class GameListItem implements Comparable<GameListItem>
* @param path The file path for the game represented by this GameListItem. * @param path The file path for the game represented by this GameListItem.
* @param isValid Whether or not the emulator can handle this file. * @param isValid Whether or not the emulator can handle this file.
*/ */
public GameListItem(Context ctx, String name, String data, String path, boolean isValid) public GameListItem(Context ctx, String name, String data, String path)
{ {
this.name = name; this.name = name;
this.data = data; this.data = data;
this.path = path; this.path = path;
this.isValid = isValid;
File file = new File(path); File file = new File(path);
if (!file.isDirectory() && !path.equals("")) if (!file.isDirectory() && !path.equals(""))
@ -115,16 +113,6 @@ public final class GameListItem implements Comparable<GameListItem>
return image; return image;
} }
/**
* Gets whether or not the emulator can handle this GameListItem.
*
* @return true, if this GameListItem can be handled by the emulator; false, otherwise.
*/
public boolean isValid()
{
return isValid;
}
public int compareTo(GameListItem o) public int compareTo(GameListItem o)
{ {
if (this.name != null) if (this.name != null)