WeatherInformation: tabs text as string resource
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 16 Nov 2014 16:01:15 +0000 (17:01 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 16 Nov 2014 16:01:15 +0000 (17:01 +0100)
Android/WeatherInformation/app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java
Android/WeatherInformation/app/src/main/res/values/strings.xml

index 11a3c5f..afe06c5 100644 (file)
@@ -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);
     }
index b9893b8..75e2b5d 100644 (file)
     <string name="app_name">Weather Information</string>
     <string name="icon_weather_description">Icon weather</string>
 
-    <!-- Activities Current, Overview and Specific -->
+    <!-- Activities Current, Overview and Specific< -->
+    <string name="text_tab_five_days_forecast">5 DAY FORECAST</string>
+    <string name="text_tab_ten_days_forecast">10 DAY FORECAST</string>
+    <string name="text_tab_fourteen_days_forecast">14 DAY FORECAST</string>
     <string name="text_field_sun_rise">SUN RISE</string>
     <string name="text_field_sun_set">SUN SET</string>
     <string name="text_field_feels_like">FEELS LIKE</string>