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>
|
</PreferenceScreen>
|
||||||
|
|
||||||
<!-- Reset to defaults -->
|
<!-- Reset to defaults -->
|
||||||
<Preference android:title="@string/settings_reset"
|
<Preference
|
||||||
android:key="@string/reset_key"
|
android:title="@string/settings_reset"
|
||||||
android:summary="@string/settings_reset_summary"
|
android:key="@string/reset_key"
|
||||||
android:persistent="false" />
|
android:summary="@string/settings_reset_summary"
|
||||||
|
android:persistent="false" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -354,16 +354,32 @@ public class MyTracksSettings extends PreferenceActivity {
|
|||||||
|
|
||||||
/** Callback for when user confirms resetting all settings. */
|
/** Callback for when user confirms resetting all settings. */
|
||||||
private void onResetPreferencesConfirmed() {
|
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.
|
// Actually wipe preferences (and save synchronously).
|
||||||
preferences.edit().clear().commit();
|
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.
|
// Restart the settings activity so all changes are loaded.
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user