[Android] FolderBrowserItem objects don't need to store a context.

Removed the requirement to pass a context in the constructors.
Also cleaned out unnecessary imports.
This commit is contained in:
Lioncash 2013-08-17 10:50:31 -04:00
parent 8190565313
commit 5047eeb263
4 changed files with 8 additions and 17 deletions

View File

@ -41,8 +41,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(m_activity, getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true)); Input.add(new FolderBrowserItem(getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true));
Input.add(new FolderBrowserItem(m_activity, getString(R.string.supports_gles3), PrefsFragment.SupportsGLES3() ? yes : no, "", true)); Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), PrefsFragment.SupportsGLES3() ? yes : no, "", true));
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

@ -45,17 +45,17 @@ public final class FolderBrowser extends Fragment
{ {
if(entry.isDirectory()) if(entry.isDirectory())
{ {
dir.add(new FolderBrowserItem(m_activity, entryName, entry.getAbsolutePath(), true)); dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath(), true));
} }
else else
{ {
if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{ {
fls.add(new FolderBrowserItem(m_activity, 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(), true));
} }
else if (invalidExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) else if (invalidExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{ {
fls.add(new FolderBrowserItem(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), false)); fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath(), false));
} }
} }
} }
@ -71,7 +71,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(m_activity, "..", getString(R.string.parent_directory), currDir.getParent(), true)); dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent(), true));
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);

View File

@ -1,7 +1,6 @@
package org.dolphinemu.dolphinemu; package org.dolphinemu.dolphinemu;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;

View File

@ -2,16 +2,11 @@ package org.dolphinemu.dolphinemu;
import java.io.File; import java.io.File;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
/** /**
* Represents an item in the folder browser list. * Represents an item in the folder browser list.
*/ */
public final class FolderBrowserItem implements Comparable<FolderBrowserItem> public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
{ {
private final Context ctx;
private final String name; private final String name;
private final String subtitle; private final String subtitle;
private final String path; private final String path;
@ -21,15 +16,13 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
/** /**
* Constructor * Constructor
* *
* @param ctx Context this FolderBrowserItem is being used in.
* @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. * @param isValid Whether or not this item represents a file type that can be handled.
*/ */
public FolderBrowserItem(Context ctx, String name, String subtitle, String path, boolean isValid) public FolderBrowserItem(String name, String subtitle, String path, boolean isValid)
{ {
this.ctx = ctx;
this.name = name; this.name = name;
this.subtitle = subtitle; this.subtitle = subtitle;
this.path = path; this.path = path;
@ -45,9 +38,8 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
* @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. * @param isValid Whether or not this item represents a file type that can be handled.
*/ */
public FolderBrowserItem(Context ctx, String name, String path, boolean isValid) public FolderBrowserItem(String name, String path, boolean isValid)
{ {
this.ctx = ctx;
this.name = name; this.name = name;
this.subtitle = ""; this.subtitle = "";
this.path = path; this.path = path;