From 5047eeb2633e8a811c6d5e5ea70dab574c93885d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 17 Aug 2013 10:50:31 -0400 Subject: [PATCH] [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. --- .../src/org/dolphinemu/dolphinemu/AboutFragment.java | 4 ++-- .../src/org/dolphinemu/dolphinemu/FolderBrowser.java | 8 ++++---- .../dolphinemu/dolphinemu/FolderBrowserAdapter.java | 1 - .../org/dolphinemu/dolphinemu/FolderBrowserItem.java | 12 ++---------- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index e05d1c7db2..07e36fa459 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -41,8 +41,8 @@ public final class AboutFragment extends Fragment String no = getString(R.string.no); List Input = new ArrayList(); - Input.add(new FolderBrowserItem(m_activity, 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.build_revision), NativeLibrary.GetVersionString(), "", 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); mMainList.setAdapter(adapter); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index 3e2c93a3eb..46cf586f83 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -45,17 +45,17 @@ public final class FolderBrowser extends Fragment { if(entry.isDirectory()) { - dir.add(new FolderBrowserItem(m_activity, entryName, entry.getAbsolutePath(), true)); + dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath(), true)); } else { 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('.')))) { - 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. 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); mDrawerList = (ListView) rootView.findViewById(R.id.gamelist); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java index 979ad35865..c2c2849b26 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java @@ -1,7 +1,6 @@ package org.dolphinemu.dolphinemu; import android.content.Context; -import android.content.res.Resources; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java index a895da8c43..3d0b0ba621 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java @@ -2,16 +2,11 @@ package org.dolphinemu.dolphinemu; 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. */ public final class FolderBrowserItem implements Comparable { - private final Context ctx; private final String name; private final String subtitle; private final String path; @@ -21,15 +16,13 @@ public final class FolderBrowserItem implements Comparable /** * Constructor * - * @param ctx Context this FolderBrowserItem is being used in. * @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(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.subtitle = subtitle; this.path = path; @@ -45,9 +38,8 @@ public final class FolderBrowserItem implements Comparable * @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(Context ctx, String name, String path, boolean isValid) + public FolderBrowserItem(String name, String path, boolean isValid) { - this.ctx = ctx; this.name = name; this.subtitle = ""; this.path = path;