[Android] Remove some functions I missed when cleaning up MainMenuActivity.java. These are moved into UserPreferences. They aren't needed in here any more.

This commit is contained in:
Lioncash 2013-10-08 22:22:40 -04:00
parent ed649b44ab
commit da6b6f4f50

View File

@ -7,7 +7,6 @@ import org.retroarch.browser.preferences.UserPreferences;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
@ -23,8 +22,6 @@ import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import android.widget.Toast;
public final class MainMenuActivity extends PreferenceActivity {
@ -65,20 +62,22 @@ public final class MainMenuActivity extends PreferenceActivity {
super.onCreate(savedInstanceState);
instance = this;
// Get libretro path and name.
SharedPreferences prefs = getPreferences();
libretro_path = prefs.getString("libretro_path", getApplicationInfo().nativeLibraryDir);
libretro_name = prefs.getString("libretro_name", getString(R.string.no_core));
// Refresh the prefscreen and reload preferences.
refreshPreferenceScreen();
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
// Bind audio stream to hardware controls.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
// Extract assets.
extractAssets();
if (!prefs.getBoolean("first_time_refreshrate_calculate", false)) {
prefs.edit().putBoolean("first_time_refreshrate_calculate", true)
.commit();
prefs.edit().putBoolean("first_time_refreshrate_calculate", true).commit();
if (!detectDevice(false)) {
AlertDialog.Builder alert = new AlertDialog.Builder(this)
@ -90,10 +89,8 @@ public final class MainMenuActivity extends PreferenceActivity {
}
Intent startedByIntent = getIntent();
if (null != startedByIntent.getStringExtra("ROM")
&& null != startedByIntent.getStringExtra("LIBRETRO")) {
if (null == savedInstanceState
|| !savedInstanceState.getBoolean("romexec"))
if (startedByIntent.getStringExtra("ROM") != null && startedByIntent.getStringExtra("LIBRETRO") != null) {
if (savedInstanceState == null || !savedInstanceState.getBoolean("romexec"))
loadRomExternal(startedByIntent.getStringExtra("ROM"),
startedByIntent.getStringExtra("LIBRETRO"));
else
@ -105,39 +102,6 @@ public final class MainMenuActivity extends PreferenceActivity {
return instance;
}
private final double getDisplayRefreshRate() {
// Android is *very* likely to screw this up.
// It is rarely a good value to use, so make sure it's not
// completely wrong. Some phones return refresh rates that are
// completely bogus
// (like 0.3 Hz, etc), so try to be very conservative here.
final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
final Display display = wm.getDefaultDisplay();
double rate = display.getRefreshRate();
if (rate > 61.0 || rate < 58.0)
rate = 59.95;
return rate;
}
public static final double getRefreshRate() {
double rate = 0;
SharedPreferences prefs = getPreferences();
String refresh_rate = prefs.getString("video_refresh_rate", "");
if (!refresh_rate.isEmpty()) {
try {
rate = Double.parseDouble(refresh_rate);
} catch (NumberFormatException e) {
Log.e(TAG, "Cannot parse: " + refresh_rate + " as a double!");
rate = getInstance().getDisplayRefreshRate();
}
} else {
rate = getInstance().getDisplayRefreshRate();
}
Log.i(TAG, "Using refresh rate: " + rate + " Hz.");
return rate;
}
public static String readCPUInfo() {
String result = "";
@ -431,11 +395,6 @@ public final class MainMenuActivity extends PreferenceActivity {
return retval;
}
@Override
protected void onStart() {
super.onStart();
}
@Override
public void startActivity(Intent intent) {
if (intent.getComponent().getClassName()