Loading src/com/android/settings/location/LocationSettingsBase.java +25 −4 Original line number Diff line number Diff line Loading @@ -38,12 +38,29 @@ public abstract class LocationSettingsBase extends SettingsPreferenceFragment private static final int LOADER_ID_LOCATION_MODE = 1; /** * Whether the fragment is actively running. */ private boolean mActive = false; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); getLoaderManager().initLoader(LOADER_ID_LOCATION_MODE, null, this); } @Override public void onResume() { super.onResume(); mActive = true; } @Override public void onPause() { super.onPause(); mActive = false; } /** Called when location mode has changed. */ public abstract void onModeChanged(int mode, boolean restricted); Loading @@ -61,7 +78,9 @@ public abstract class LocationSettingsBase extends SettingsPreferenceFragment } mode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); if (mActive) { onModeChanged(mode, true); } return; } Settings.Secure.putInt(getContentResolver(), Settings.Secure.LOCATION_MODE, mode); Loading @@ -69,10 +88,12 @@ public abstract class LocationSettingsBase extends SettingsPreferenceFragment } public void refreshLocationMode() { if (mActive) { int mode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); onModeChanged(mode, isRestricted()); } } @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { Loading Loading
src/com/android/settings/location/LocationSettingsBase.java +25 −4 Original line number Diff line number Diff line Loading @@ -38,12 +38,29 @@ public abstract class LocationSettingsBase extends SettingsPreferenceFragment private static final int LOADER_ID_LOCATION_MODE = 1; /** * Whether the fragment is actively running. */ private boolean mActive = false; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); getLoaderManager().initLoader(LOADER_ID_LOCATION_MODE, null, this); } @Override public void onResume() { super.onResume(); mActive = true; } @Override public void onPause() { super.onPause(); mActive = false; } /** Called when location mode has changed. */ public abstract void onModeChanged(int mode, boolean restricted); Loading @@ -61,7 +78,9 @@ public abstract class LocationSettingsBase extends SettingsPreferenceFragment } mode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); if (mActive) { onModeChanged(mode, true); } return; } Settings.Secure.putInt(getContentResolver(), Settings.Secure.LOCATION_MODE, mode); Loading @@ -69,10 +88,12 @@ public abstract class LocationSettingsBase extends SettingsPreferenceFragment } public void refreshLocationMode() { if (mActive) { int mode = Settings.Secure.getInt(getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); onModeChanged(mode, isRestricted()); } } @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { Loading