From c64a5631d99f6e776b78c41a90b492803abebb9f Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 16 Nov 2014 17:01:15 +0100 Subject: [PATCH] WeatherInformation: tabs text as string resource --- .../weather/information/activity/MainTabsActivity.java | 10 +++++----- Android/WeatherInformation/app/src/main/res/values/strings.xml | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Android/WeatherInformation/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java b/Android/WeatherInformation/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java index 11a3c5f..afe06c5 100644 --- a/Android/WeatherInformation/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java +++ b/Android/WeatherInformation/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java @@ -117,7 +117,7 @@ public class MainTabsActivity extends FragmentActivity { if (itemId == R.id.weather_menu_settings) { intent = new Intent("name.gumartinm.weather.information.WEATHERINFO") .setComponent(new ComponentName("name.gumartinm.weather.information", - "name.gumartinm.weather.information.activity.WeatherInformationPreferencesActivity")); + "name.gumartinm.weather.information.activity.PreferencesActivity")); this.startActivity(intent); return true; } else if (itemId == R.id.weather_menu_map) { @@ -167,16 +167,16 @@ public class MainTabsActivity extends FragmentActivity { // 2. Update forecast tab text. final SharedPreferences sharedPreferences = PreferenceManager - .getDefaultSharedPreferences(this); + .getDefaultSharedPreferences(this.getApplicationContext()); final String keyPreference = this.getString(R.string.weather_preferences_day_forecast_key); final String value = sharedPreferences.getString(keyPreference, ""); String humanValue = ""; if (value.equals("5")) { - humanValue = "5 DAY FORECAST"; + humanValue = this.getString(R.string.text_tab_five_days_forecast); } else if (value.equals("10")) { - humanValue = "10 DAY FORECAST"; + humanValue = this.getString(R.string.text_tab_ten_days_forecast); } else if (value.equals("14")) { - humanValue = "14 DAY FORECAST"; + humanValue = this.getString(R.string.text_tab_fourteen_days_forecast); } actionBar.getTabAt(1).setText(humanValue); } diff --git a/Android/WeatherInformation/app/src/main/res/values/strings.xml b/Android/WeatherInformation/app/src/main/res/values/strings.xml index b9893b8..75e2b5d 100644 --- a/Android/WeatherInformation/app/src/main/res/values/strings.xml +++ b/Android/WeatherInformation/app/src/main/res/values/strings.xml @@ -19,7 +19,10 @@ Weather Information Icon weather - + + 5 DAY FORECAST + 10 DAY FORECAST + 14 DAY FORECAST SUN RISE SUN SET FEELS LIKE -- 2.1.4