[Android] Get rid of some unnecessary onAttach overrides in AboutFragment, VideoSettingsFragment, and FolderBrowser. These can just be replaced with calls to getActivity().
This commit is contained in:
parent
1942d79c5b
commit
f15a0c17d0
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue