summaryrefslogtreecommitdiff
path: root/Source/Android/src/org
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-11-14 10:45:45 -0500
committerLioncash <mathew1800@gmail.com>2013-11-14 10:45:45 -0500
commitf15a0c17d03e8846867d92c0c3a6945016f397e1 (patch)
tree2f7a2683b0f56953a7da9f9cdb0cfc91b659fbf1 /Source/Android/src/org
parent1942d79c5b2971e3c7bb8c6d62593985fe67c909 (diff)
[Android] Get rid of some unnecessary onAttach overrides in AboutFragment, VideoSettingsFragment, and FolderBrowser. These can just be replaced with calls to getActivity().
Diffstat (limited to 'Source/Android/src/org')
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java14
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java20
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java13
3 files changed, 7 insertions, 40 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
index 3695bfa40b..922dab0e8d 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
@@ -6,7 +6,6 @@
package org.dolphinemu.dolphinemu;
-import android.app.Activity;
import android.app.ListFragment;
import android.content.Context;
import android.os.Bundle;
@@ -27,8 +26,6 @@ import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment;
*/
public final class AboutFragment extends ListFragment
{
- private static Activity m_activity;
-
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
@@ -42,22 +39,13 @@ public final class AboutFragment extends ListFragment
Input.add(new AboutFragmentItem(getString(R.string.build_revision), NativeLibrary.GetVersionString()));
Input.add(new AboutFragmentItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no));
- AboutFragmentAdapter adapter = new AboutFragmentAdapter(m_activity, R.layout.about_layout, Input);
+ AboutFragmentAdapter adapter = new AboutFragmentAdapter(getActivity(), R.layout.about_layout, Input);
mMainList.setAdapter(adapter);
mMainList.setEnabled(false); // Makes the list view non-clickable.
return mMainList;
}
- @Override
- public void onAttach(Activity activity)
- {
- super.onAttach(activity);
-
- // Cache the activity instance.
- m_activity = activity;
- }
-
// Represents an item in the AboutFragment.
private static final class AboutFragmentItem
{
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
index 1697311fe3..2258bdb41f 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
@@ -6,7 +6,6 @@
package org.dolphinemu.dolphinemu.folderbrowser;
-import android.app.Activity;
import android.app.ListFragment;
import android.os.Bundle;
import android.os.Environment;
@@ -37,7 +36,6 @@ import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
*/
public final class FolderBrowser extends ListFragment
{
- private Activity m_activity;
private FolderBrowserAdapter adapter;
private ListView mFolderBrowserList;
private ListView rootView;
@@ -46,7 +44,9 @@ public final class FolderBrowser extends ListFragment
// Populates the FolderView with the given currDir's contents.
private void Fill(File currDir)
{
- m_activity.setTitle(String.format(getString(R.string.current_dir), currDir.getName()));
+ // Change the activity title to reflect the current directory the FolderBrowser is in.
+ getActivity().setTitle(String.format(getString(R.string.current_dir), currDir.getName()));
+
File[] dirs = currDir.listFiles();
List<FolderBrowserItem> dir = new ArrayList<FolderBrowserItem>();
List<FolderBrowserItem> fls = new ArrayList<FolderBrowserItem>();
@@ -96,7 +96,7 @@ public final class FolderBrowser extends ListFragment
if (!currDir.getPath().equalsIgnoreCase("/"))
dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent()));
- adapter = new FolderBrowserAdapter(m_activity, R.layout.gamelist_folderbrowser_list, dir);
+ adapter = new FolderBrowserAdapter(getActivity(), R.layout.gamelist_folderbrowser_list, dir);
mFolderBrowserList = (ListView) rootView.findViewById(R.id.gamelist);
mFolderBrowserList.setAdapter(adapter);
}
@@ -128,16 +128,6 @@ public final class FolderBrowser extends ListFragment
return mFolderBrowserList;
}
- @Override
- public void onAttach(Activity activity)
- {
- super.onAttach(activity);
-
- // Cache the activity instance.
- m_activity = activity;
- }
-
-
private void FolderSelected()
{
String Directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0");
@@ -168,6 +158,6 @@ public final class FolderBrowser extends ListFragment
NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPath" + Integer.toString(intDirectories), currentDir.getPath());
}
- ((GameListActivity)m_activity).SwitchPage(0);
+ ((GameListActivity)getActivity()).SwitchPage(0);
}
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java
index 97ed412d8d..69b647a45c 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java
@@ -6,7 +6,6 @@
package org.dolphinemu.dolphinemu.settings.video;
-import android.app.Activity;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
@@ -28,7 +27,6 @@ public final class VideoSettingsFragment extends PreferenceFragment
public static String m_GLVendor;
public static String m_GLRenderer;
public static String m_GLExtensions;
- private Activity m_activity;
/**
* Class which provides a means to retrieve various
@@ -225,7 +223,7 @@ public final class VideoSettingsFragment extends PreferenceFragment
// denotes the placement on the UI. So if more elements are
// added to the video settings, these may need to change.
//
- final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(m_activity);
+ final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
final PreferenceScreen mainScreen = getPreferenceScreen();
if (videoBackends.getValue().equals("Software Renderer"))
@@ -266,13 +264,4 @@ public final class VideoSettingsFragment extends PreferenceFragment
}
});
}
-
- @Override
- public void onAttach(Activity activity)
- {
- super.onAttach(activity);
-
- // Cache the activity instance.
- m_activity = activity;
- }
}