mirror of
https://github.com/libretro/RetroArch
synced 2025-04-23 11:43:20 +00:00
Merge pull request #1225 from lioncash/android
Android: Use apply instead of commit for applying SharedPreference changes
This commit is contained in:
commit
21ad0d4300
@ -45,7 +45,7 @@ public final class DisplayRefreshRateTest extends Activity {
|
|||||||
SharedPreferences prefs = UserPreferences.getPreferences(DisplayRefreshRateTest.this);
|
SharedPreferences prefs = UserPreferences.getPreferences(DisplayRefreshRateTest.this);
|
||||||
SharedPreferences.Editor edit = prefs.edit();
|
SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putString("video_refresh_rate", Double.toString(fps));
|
edit.putString("video_refresh_rate", Double.toString(fps));
|
||||||
edit.commit();
|
edit.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -252,7 +252,7 @@ public class DirectoryFragment extends DialogFragment
|
|||||||
SharedPreferences settings = UserPreferences.getPreferences(getActivity());
|
SharedPreferences settings = UserPreferences.getPreferences(getActivity());
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putString(pathSettingKey, path);
|
editor.putString(pathSettingKey, path);
|
||||||
editor.commit();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onClosedListener != null)
|
if (onClosedListener != null)
|
||||||
|
@ -45,7 +45,7 @@ public final class MainMenuActivity extends FragmentActivity
|
|||||||
SharedPreferences.Editor edit = prefs.edit();
|
SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putString("libretro_path", core_path);
|
edit.putString("libretro_path", core_path);
|
||||||
edit.putString("libretro_name", core_name);
|
edit.putString("libretro_name", core_name);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
|
|
||||||
// Set the title section to contain the name of the selected core.
|
// Set the title section to contain the name of the selected core.
|
||||||
setCoreTitle(core_name);
|
setCoreTitle(core_name);
|
||||||
|
@ -78,7 +78,7 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
|
|||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
|
||||||
if (!prefs.getBoolean("first_time_refreshrate_calculate", false))
|
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).apply();
|
||||||
|
|
||||||
AlertDialog.Builder alert = new AlertDialog.Builder(ctx)
|
AlertDialog.Builder alert = new AlertDialog.Builder(ctx)
|
||||||
.setTitle(R.string.welcome_to_retroarch)
|
.setTitle(R.string.welcome_to_retroarch)
|
||||||
|
@ -48,7 +48,7 @@ public final class VideoPreferenceFragment extends PreferenceListFragment implem
|
|||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
final SharedPreferences.Editor edit = prefs.edit();
|
final SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putString("video_refresh_rate", Double.toString(rate));
|
edit.putString("video_refresh_rate", Double.toString(rate));
|
||||||
edit.commit();
|
edit.apply();
|
||||||
|
|
||||||
Toast.makeText(getActivity(), String.format(getString(R.string.using_os_reported_refresh_rate), rate), Toast.LENGTH_LONG).show();
|
Toast.makeText(getActivity(), String.format(getString(R.string.using_os_reported_refresh_rate), rate), Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public final class UserPreferences
|
|||||||
readbackBool(config, edit, "savefile_directory_enable"); // Ignored by RetroArch
|
readbackBool(config, edit, "savefile_directory_enable"); // Ignored by RetroArch
|
||||||
readbackBool(config, edit, "savestate_directory_enable"); // Ignored by RetroArch
|
readbackBool(config, edit, "savestate_directory_enable"); // Ignored by RetroArch
|
||||||
|
|
||||||
edit.commit();
|
edit.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,7 +162,7 @@ public class RetroActivityCamera extends RetroActivityCommon
|
|||||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||||
SharedPreferences.Editor edit = prefs.edit();
|
SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putBoolean("CAMERA_UPDATES_ON", false);
|
edit.putBoolean("CAMERA_UPDATES_ON", false);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
|
|
||||||
camera_service_running = false;
|
camera_service_running = false;
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ public class RetroActivityCamera extends RetroActivityCommon
|
|||||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||||
SharedPreferences.Editor edit = prefs.edit();
|
SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putBoolean("CAMERA_UPDATES_ON", camera_service_running);
|
edit.putBoolean("CAMERA_UPDATES_ON", camera_service_running);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
|
|
||||||
onCameraStop();
|
onCameraStop();
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@ -203,7 +203,7 @@ public class RetroActivityCamera extends RetroActivityCommon
|
|||||||
else // Otherwise, turn off camera updates
|
else // Otherwise, turn off camera updates
|
||||||
{
|
{
|
||||||
edit.putBoolean("CAMERA_UPDATES_ON", false);
|
edit.putBoolean("CAMERA_UPDATES_ON", false);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
camera_service_running = false;
|
camera_service_running = false;
|
||||||
}
|
}
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -276,7 +276,7 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
|
|||||||
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
SharedPreferences prefs = UserPreferences.getPreferences(this);
|
||||||
SharedPreferences.Editor edit = prefs.edit();
|
SharedPreferences.Editor edit = prefs.edit();
|
||||||
edit.putBoolean("LOCATION_UPDATES_ON", mUpdatesRequested);
|
edit.putBoolean("LOCATION_UPDATES_ON", mUpdatesRequested);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
|
|
||||||
super.onPause();
|
super.onPause();
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
|
|||||||
else // Otherwise, turn off location updates
|
else // Otherwise, turn off location updates
|
||||||
{
|
{
|
||||||
edit.putBoolean("LOCATION_UPDATES_ON", false);
|
edit.putBoolean("LOCATION_UPDATES_ON", false);
|
||||||
edit.commit();
|
edit.apply();
|
||||||
location_service_running = false;
|
location_service_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user