mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-03 00:28:27 +00:00
[Android] Get rid of getPreferences from MainMenuActivity.java. No longer needed. Now located within UserPreferences.java.
This commit is contained in:
parent
8112c1e36f
commit
c7ff040bf3
@ -4,6 +4,7 @@ import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import org.retroarch.R;
|
||||
import org.retroarch.browser.preferences.UserPreferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.SharedPreferences;
|
||||
@ -37,7 +38,7 @@ public final class DisplayRefreshRateTest extends Activity {
|
||||
}
|
||||
|
||||
private void setFPSSetting(double fps) {
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(DisplayRefreshRateTest.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.valueOf(fps).toString());
|
||||
edit.commit();
|
||||
@ -118,7 +119,7 @@ public final class DisplayRefreshRateTest extends Activity {
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||
String fps = prefs.getString("video_refresh_rate", "ERROR");
|
||||
Toast.makeText(this, String.format(getString(R.string.refresh_rate_measured_to), fps), Toast.LENGTH_LONG).show();
|
||||
super.onDestroy();
|
||||
|
@ -46,7 +46,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
UserPreferences.updateConfigFile(MainMenuActivity.this);
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(MainMenuActivity.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("global_config_enable", param.isChecked());
|
||||
edit.commit();
|
||||
@ -63,7 +63,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
instance = this;
|
||||
|
||||
// Get libretro path and name.
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||
libretro_path = prefs.getString("libretro_path", getApplicationInfo().nativeLibraryDir);
|
||||
libretro_name = prefs.getString("libretro_name", getString(R.string.no_core));
|
||||
|
||||
@ -102,8 +102,6 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private byte[] loadAsset(String asset) throws IOException {
|
||||
InputStream stream = getAssets().open(asset);
|
||||
int len = stream.available();
|
||||
@ -234,17 +232,13 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static SharedPreferences getPreferences() {
|
||||
return PreferenceManager.getDefaultSharedPreferences(getInstance().getBaseContext());
|
||||
}
|
||||
|
||||
public void setModule(String core_path, String core_name) {
|
||||
UserPreferences.updateConfigFile(this);
|
||||
|
||||
libretro_path = core_path;
|
||||
libretro_name = core_name;
|
||||
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("libretro_path", libretro_path);
|
||||
edit.putString("libretro_name", libretro_name);
|
||||
@ -280,7 +274,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(MainMenuActivity.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.toString(60.00d));
|
||||
edit.putBoolean("input_overlay_enable", false);
|
||||
@ -300,7 +294,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(MainMenuActivity.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("input_overlay_enable", false);
|
||||
edit.putBoolean("input_autodetect_enable", true);
|
||||
@ -319,7 +313,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(MainMenuActivity.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("input_overlay_enable", false);
|
||||
edit.putBoolean("input_autodetect_enable", true);
|
||||
@ -338,7 +332,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(MainMenuActivity.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putBoolean("video_threaded", false);
|
||||
edit.putBoolean("input_overlay_enable", false);
|
||||
@ -359,7 +353,7 @@ public final class MainMenuActivity extends PreferenceActivity {
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
SharedPreferences prefs = getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(MainMenuActivity.this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.toString(59.65));
|
||||
edit.putString("audio_latency", "64");
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.retroarch.browser;
|
||||
|
||||
import org.retroarch.R;
|
||||
import org.retroarch.browser.preferences.UserPreferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@ -19,7 +20,7 @@ public final class RefreshRateSetOS extends Activity {
|
||||
final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
final Display display = wm.getDefaultDisplay();
|
||||
double rate = display.getRefreshRate();
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||
SharedPreferences.Editor edit = prefs.edit();
|
||||
edit.putString("video_refresh_rate", Double.valueOf(rate).toString());
|
||||
edit.commit();
|
||||
|
@ -3,7 +3,7 @@ package org.retroarch.browser.diractivities;
|
||||
import org.retroarch.R;
|
||||
import org.retroarch.browser.FileWrapper;
|
||||
import org.retroarch.browser.IconAdapter;
|
||||
import org.retroarch.browser.MainMenuActivity;
|
||||
import org.retroarch.browser.preferences.UserPreferences;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
@ -108,7 +108,7 @@ public class DirectoryActivity extends Activity implements AdapterView.OnItemCli
|
||||
|
||||
private void finishWithPath(String path) {
|
||||
if (pathSettingKey != null && !pathSettingKey.isEmpty()) {
|
||||
SharedPreferences settings = MainMenuActivity.getPreferences();
|
||||
SharedPreferences settings = UserPreferences.getPreferences(this);
|
||||
SharedPreferences.Editor editor = settings.edit();
|
||||
editor.putString(pathSettingKey, path);
|
||||
editor.commit();
|
||||
|
@ -2,7 +2,7 @@ package org.retroarch.browser.diractivities;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.retroarch.browser.MainMenuActivity;
|
||||
import org.retroarch.browser.preferences.UserPreferences;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
@ -11,7 +11,7 @@ public final class ROMActivity extends DirectoryActivity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
SharedPreferences prefs = MainMenuActivity.getPreferences();
|
||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||
String startPath = prefs.getString("rgui_browser_directory", "");
|
||||
if (!startPath.isEmpty() && new File(startPath).exists())
|
||||
super.setStartDirectory(startPath);
|
||||
|
Loading…
Reference in New Issue
Block a user