diff options
author | Roman Birg <roman@cyngn.com> | 2014-03-03 18:12:51 -0800 |
---|---|---|
committer | DvTonder <david.vantonder@gmail.com> | 2014-03-09 16:49:36 -0500 |
commit | 25c510af6883393e53476c1c4eb918e6b1598a7a (patch) | |
tree | 220e44a53187c0fa9de055a5eb52e19e64a6a46a /src/com/cyanogenmod/lockclock/preference | |
parent | 95c886e1e2f313d9c31f0ab122446e1df4ead8b7 (diff) | |
download | android_packages_apps_LockClock-25c510af6883393e53476c1c4eb918e6b1598a7a.tar.gz android_packages_apps_LockClock-25c510af6883393e53476c1c4eb918e6b1598a7a.tar.bz2 android_packages_apps_LockClock-25c510af6883393e53476c1c4eb918e6b1598a7a.zip |
LockClock: detect default units based on locale
US, Malasia, and Sri Lanka are the only countries
which still use imperial units, so do not use
metric units as defualt if possible.
Change-Id: Ie3d7de33fc3120926a5871b3814f488b145cd464
Signed-off-by: Roman Birg <roman@cyngn.com>
Diffstat (limited to 'src/com/cyanogenmod/lockclock/preference')
-rw-r--r-- | src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java b/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java index 9b06246..94537c0 100644 --- a/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java +++ b/src/com/cyanogenmod/lockclock/preference/WeatherPreferences.java @@ -81,6 +81,12 @@ public class WeatherPreferences extends PreferenceFragment implements mUseMetric = (CheckBoxPreference) findPreference(Constants.WEATHER_USE_METRIC); mUseCustomlocation = (CheckBoxPreference) findPreference(Constants.WEATHER_USE_CUSTOM_LOCATION); + // At first placement/start default the use of Metric units based on locale + // If we had a previously set value already, this will just reset the same value + Boolean defValue = Preferences.useMetricUnits(mContext); + Preferences.setUseMetricUnits(mContext, defValue); + mUseMetric.setChecked(defValue); + // Show a warning if location manager is disabled and there is no custom location set LocationManager lm = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); if (!lm.isProviderEnabled(LocationManager.NETWORK_PROVIDER) && !mUseCustomLoc.isChecked()) { @@ -91,6 +97,7 @@ public class WeatherPreferences extends PreferenceFragment implements @Override public void onResume() { super.onResume(); + getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); updateLocationSummary(); updateFontColorsSummary(); |