Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Android] Since we don't show invalid filetypes in the file browser a…
…nymore, there's no need to check if a file is valid or not since they're all valid now.
  • Loading branch information
lioncash committed Aug 23, 2013
1 parent 70dab0d commit c2aef25
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 52 deletions.
1 change: 0 additions & 1 deletion Source/Android/res/values-ja/strings.xml
Expand Up @@ -17,7 +17,6 @@
<string name="parent_directory">親ディレクトリ</string>
<string name="folder">フォルダ</string>
<string name="file_size">ファイルサイズ: </string>
<string name="cant_use_compressed_filetypes">圧縮ファイル形式はサポートされていません</string>

<!-- Game List Activity -->
<string name="game_list">ゲームリスト</string>
Expand Down
1 change: 0 additions & 1 deletion Source/Android/res/values/strings.xml
Expand Up @@ -17,7 +17,6 @@
<string name="parent_directory">Parent Directory</string>
<string name="folder">Folder</string>
<string name="file_size">File Size: </string>
<string name="cant_use_compressed_filetypes">Can not use compressed file types</string>

<!-- Game List Activity -->
<string name="game_list">Game List</string>
Expand Down
Expand Up @@ -36,8 +36,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
String no = getString(R.string.no);

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.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no, "", 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, ""));

adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input);
mMainList.setAdapter(adapter);
Expand Down
Expand Up @@ -10,7 +10,6 @@
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;

import java.io.File;
import java.util.*;
Expand Down Expand Up @@ -64,13 +63,13 @@ private void Fill(File currDir)
{
if(entry.isDirectory())
{
dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath(), true));
dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath()));
}
else if (entry.isFile() && hasExtension)
{
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()));
}
}
}
Expand All @@ -87,7 +86,7 @@ else if (entry.isFile() && hasExtension)

// Check for a parent directory to the one we're currently in.
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);
mDrawerList = (ListView) rootView.findViewById(R.id.gamelist);
Expand Down Expand Up @@ -119,10 +118,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)
}
else
{
if (item.isValid())
FolderSelected();
else
Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show();
FolderSelected();
}
}
};
Expand Down
Expand Up @@ -58,11 +58,6 @@ public View getView(int position, View convertView, ViewGroup parent)
if(mainText != null)
{
mainText.setText(item.getName());

if (!item.isValid())
{
mainText.setTextColor(0xFFFF0000);
}
}

if(subtitleText != null)
Expand Down
Expand Up @@ -10,7 +10,6 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
private final String name;
private final String subtitle;
private final String path;
private final boolean isValid;
private final File underlyingFile;

/**
Expand All @@ -19,14 +18,12 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
* @param name The name of the file/folder represented by this item.
* @param subtitle The subtitle of this FolderBrowserItem to display.
* @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.subtitle = subtitle;
this.path = path;
this.isValid = isValid;
this.underlyingFile = new File(path);
}

Expand All @@ -35,14 +32,12 @@ public FolderBrowserItem(String name, String subtitle, String path, boolean isVa
*
* @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 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.subtitle = "";
this.path = path;
this.isValid = isValid;
this.underlyingFile = new File(path);
}

Expand Down Expand Up @@ -76,20 +71,6 @@ public String getPath()
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
* represented by this FolderBrowserItem.
Expand Down
Expand Up @@ -77,7 +77,7 @@ private void Fill()
if (!entry.isDirectory())
{
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()));
}
}
}
Expand Down
Expand Up @@ -25,7 +25,6 @@ public final class GameListItem implements Comparable<GameListItem>
private String name;
private final String data;
private final String path;
private final boolean isValid;
private Bitmap image;

/**
Expand All @@ -37,12 +36,11 @@ public final class GameListItem implements Comparable<GameListItem>
* @param path The file path for the game represented by this GameListItem.
* @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.data = data;
this.path = path;
this.isValid = isValid;

File file = new File(path);
if (!file.isDirectory() && !path.equals(""))
Expand Down Expand Up @@ -115,16 +113,6 @@ public Bitmap getImage()
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)
{
if (this.name != null)
Expand Down

0 comments on commit c2aef25

Please sign in to comment.