From 611aabe732115a03e4dc783effc574bdb0ba472e Mon Sep 17 00:00:00 2001 From: "gu.martinm@gmail.com" Date: Mon, 21 Apr 2014 21:35:12 +0200 Subject: [PATCH] Weather information: fixing locale to Locale.US --- src/de/example/exampletdd/WeatherInformationMapActivity.java | 3 +-- .../fragment/current/WeatherInformationCurrentDataFragment.java | 6 ++---- .../fragment/overview/WeatherInformationOverviewFragment.java | 7 +++---- .../fragment/specific/WeatherInformationSpecificDataFragment.java | 5 ++--- src/de/example/exampletdd/service/WeatherServiceParser.java | 6 +++--- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/de/example/exampletdd/WeatherInformationMapActivity.java b/src/de/example/exampletdd/WeatherInformationMapActivity.java index 64f2a80..bc77aa9 100644 --- a/src/de/example/exampletdd/WeatherInformationMapActivity.java +++ b/src/de/example/exampletdd/WeatherInformationMapActivity.java @@ -169,8 +169,7 @@ public class WeatherInformationMapActivity extends Activity { } private GeocodingData getGeocodingData(final double latitude, final double longitude) throws IOException { - final Geocoder geocoder = new Geocoder( - WeatherInformationMapActivity.this, Locale.getDefault()); + final Geocoder geocoder = new Geocoder(WeatherInformationMapActivity.this, Locale.US); final List
addresses = geocoder.getFromLocation(latitude, longitude, 1); if (addresses == null) { diff --git a/src/de/example/exampletdd/fragment/current/WeatherInformationCurrentDataFragment.java b/src/de/example/exampletdd/fragment/current/WeatherInformationCurrentDataFragment.java index 7c63d53..b60121a 100644 --- a/src/de/example/exampletdd/fragment/current/WeatherInformationCurrentDataFragment.java +++ b/src/de/example/exampletdd/fragment/current/WeatherInformationCurrentDataFragment.java @@ -128,11 +128,9 @@ public class WeatherInformationCurrentDataFragment extends ListFragment { public void updateCurrentWeatherData(final CurrentWeatherData currentWeatherData) { - final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale - .getDefault()); + final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); tempFormatter.applyPattern("#####.#####"); - final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss Z", - Locale.getDefault()); + final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss Z", Locale.US); final double tempUnits = this.mIsFahrenheit ? 0 : 273.15; final String symbol = this.mIsFahrenheit ? "ºF" : "ºC"; diff --git a/src/de/example/exampletdd/fragment/overview/WeatherInformationOverviewFragment.java b/src/de/example/exampletdd/fragment/overview/WeatherInformationOverviewFragment.java index a9c2e77..088b684 100644 --- a/src/de/example/exampletdd/fragment/overview/WeatherInformationOverviewFragment.java +++ b/src/de/example/exampletdd/fragment/overview/WeatherInformationOverviewFragment.java @@ -173,11 +173,10 @@ public class WeatherInformationOverviewFragment extends ListFragment implements R.layout.weather_main_entry_list); - final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.getDefault()); + final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); tempFormatter.applyPattern("#####.##"); - final SimpleDateFormat dayNameFormatter = new SimpleDateFormat("EEE", Locale.getDefault()); - final SimpleDateFormat monthAndDayNumberormatter = new SimpleDateFormat("MMM d", - Locale.getDefault()); + final SimpleDateFormat dayNameFormatter = new SimpleDateFormat("EEE", Locale.US); + final SimpleDateFormat monthAndDayNumberormatter = new SimpleDateFormat("MMM d", Locale.US); final double tempUnits = this.mIsFahrenheit ? 0 : 273.15; final String symbol = this.mIsFahrenheit ? "ºF" : "ºC"; diff --git a/src/de/example/exampletdd/fragment/specific/WeatherInformationSpecificDataFragment.java b/src/de/example/exampletdd/fragment/specific/WeatherInformationSpecificDataFragment.java index 3b1ed4b..089146f 100644 --- a/src/de/example/exampletdd/fragment/specific/WeatherInformationSpecificDataFragment.java +++ b/src/de/example/exampletdd/fragment/specific/WeatherInformationSpecificDataFragment.java @@ -110,8 +110,7 @@ public class WeatherInformationSpecificDataFragment extends ListFragment impleme public void updateForecastWeatherData(final ForecastWeatherData forecastWeatherData, final int chosenDay) { - final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale - .getDefault()); + final DecimalFormat tempFormatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US); tempFormatter.applyPattern("#####.#####"); final double tempUnits = this.mIsFahrenheit ? 0 : 273.15; final String symbol = this.mIsFahrenheit ? "ºF" : "ºC"; @@ -129,7 +128,7 @@ public class WeatherInformationSpecificDataFragment extends ListFragment impleme final de.example.exampletdd.model.forecastweather.List forecast = forecastWeatherData .getList().get((chosenDay)); - final SimpleDateFormat dayFormatter = new SimpleDateFormat("EEEE - MMM d", Locale.getDefault()); + final SimpleDateFormat dayFormatter = new SimpleDateFormat("EEEE - MMM d", Locale.US); final Calendar calendar = Calendar.getInstance(); final Long forecastUNIXDate = (Long) forecast.getDt(); calendar.setTimeInMillis(forecastUNIXDate * 1000L); diff --git a/src/de/example/exampletdd/service/WeatherServiceParser.java b/src/de/example/exampletdd/service/WeatherServiceParser.java index 9b95e08..847707d 100644 --- a/src/de/example/exampletdd/service/WeatherServiceParser.java +++ b/src/de/example/exampletdd/service/WeatherServiceParser.java @@ -30,7 +30,7 @@ public class WeatherServiceParser { public String createURIAPIForecastWeather(final String urlAPI, final String APIVersion, final double latitude, final double longitude, final String resultsNumber) { - final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.ENGLISH); + final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.US); final Object[] values = new Object[4]; values[0] = APIVersion; values[1] = latitude; @@ -43,7 +43,7 @@ public class WeatherServiceParser { public String createURIAPITodayWeather(final String urlAPI, final String APIVersion, final double latitude, final double longitude) { - final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.ENGLISH); + final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.US); final Object[] values = new Object[3]; values[0] = APIVersion; values[1] = latitude; @@ -54,7 +54,7 @@ public class WeatherServiceParser { public String createURIAPIicon(final String icon, final String urlAPI) { - final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.ENGLISH); + final MessageFormat formatURIAPI = new MessageFormat(urlAPI, Locale.US); final Object[] values = new Object[1]; values[0] = icon; -- 2.1.4