From 6ab9f0716b6ac5597526cc9dee671106e041828e Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Fri, 10 Jan 2014 12:37:34 -0800 Subject: [PATCH] Fix startup sequence to set the preferred unit if not set --- .../apps/mytracks/TrackListActivity.java | 4 ++-- .../android/apps/mytracks/util/EulaUtils.java | 19 ------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java b/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java index 7808be0f7..32a2e84de 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java +++ b/MyTracks/src/com/google/android/apps/mytracks/TrackListActivity.java @@ -659,12 +659,12 @@ public class TrackListActivity extends AbstractSendToGoogleActivity .show(getSupportFragmentManager(), EulaDialogFragment.EULA_DIALOG_TAG); } } else { - if (!EulaUtils.hasDefaultUnits(this)) { + // If stats_units_key is undefined, set it + if (PreferencesUtils.getString(this, R.string.stats_units_key, "").equals("")) { String statsUnits = getString( Locale.US.equals(Locale.getDefault()) ? R.string.stats_units_imperial : R.string.stats_units_metric); PreferencesUtils.setString(this, R.string.stats_units_key, statsUnits); - EulaUtils.setDefaultUnits(this); } checkGooglePlayServices(); } diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java index 9bca36f74..8e9afe17f 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java +++ b/MyTracks/src/com/google/android/apps/mytracks/util/EulaUtils.java @@ -31,7 +31,6 @@ public class EulaUtils { // Accepting Google mobile terms of service private static final String ACCEPT_EULA_PREFERENCE_KEY = "eula.google_mobile_tos_accepted"; - private static final String DEFAULT_UNITS_PREFERENCE_KEY = "defaultUnits"; private static final String SHOW_ENABLE_SYNC_PREFERENCE_KEY = "showEnableSync"; private EulaUtils() {} @@ -53,24 +52,6 @@ public class EulaUtils { setValue(context, ACCEPT_EULA_PREFERENCE_KEY, true); } - /** - * Returns true if the default units is initialized. - * - * @param context the context - */ - public static boolean hasDefaultUnits(Context context) { - return getValue(context, DEFAULT_UNITS_PREFERENCE_KEY, false); - } - - /** - * Sets to true that the default units is initialized. - * - * @param context the context - */ - public static void setDefaultUnits(Context context) { - setValue(context, DEFAULT_UNITS_PREFERENCE_KEY, true); - } - /** * Returns true if show enable sync is needed. *