forked from upstream-mirrors/OpenTracks
Review suggestions:
- Standard style in XML - Fixing strict mode violation
This commit is contained in:
@@ -175,8 +175,9 @@ limitations under the License.
|
||||
</PreferenceScreen>
|
||||
|
||||
<!-- Reset to defaults -->
|
||||
<Preference android:title="@string/settings_reset"
|
||||
android:key="@string/reset_key"
|
||||
android:summary="@string/settings_reset_summary"
|
||||
android:persistent="false" />
|
||||
<Preference
|
||||
android:title="@string/settings_reset"
|
||||
android:key="@string/reset_key"
|
||||
android:summary="@string/settings_reset_summary"
|
||||
android:persistent="false" />
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -354,16 +354,32 @@ public class MyTracksSettings extends PreferenceActivity {
|
||||
|
||||
/** Callback for when user confirms resetting all settings. */
|
||||
private void onResetPreferencesConfirmed() {
|
||||
Log.i(TAG, "Resetting all settings");
|
||||
// Change preferences in a separate thread.
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i(TAG, "Resetting all settings");
|
||||
|
||||
// Actually wipe preferences.
|
||||
preferences.edit().clear().commit();
|
||||
// Actually wipe preferences (and save synchronously).
|
||||
preferences.edit().clear().commit();
|
||||
|
||||
Toast.makeText(this, R.string.settings_reset_done, Toast.LENGTH_SHORT).show();
|
||||
// Give UI feedback in the UI thread.
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Give feedback to the user.
|
||||
Toast.makeText(
|
||||
MyTracksSettings.this,
|
||||
R.string.settings_reset_done,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Restart the settings activity so all changes are loaded.
|
||||
Intent intent = getIntent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
// Restart the settings activity so all changes are loaded.
|
||||
Intent intent = getIntent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user