WeatherInformation: trying to improve string resources (values and identifiers)
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Wed, 15 Oct 2014 18:09:06 +0000 (20:09 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Wed, 15 Oct 2014 18:09:06 +0000 (20:09 +0200)
16 files changed:
Android/WeatherInformation/res/menu/main.xml
Android/WeatherInformation/res/menu/weather_main_menu.xml
Android/WeatherInformation/res/values/arrays.xml
Android/WeatherInformation/res/values/strings.xml
Android/WeatherInformation/res/xml/appwidget_preferences.xml
Android/WeatherInformation/res/xml/weather_preferences.xml
Android/WeatherInformation/src/de/example/exampletdd/NotificationIntentService.java
Android/WeatherInformation/src/de/example/exampletdd/WeatherInformationPreferencesActivity.java
Android/WeatherInformation/src/de/example/exampletdd/WidgetIntentService.java
Android/WeatherInformation/src/de/example/exampletdd/fragment/ErrorDialogFragment.java
Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java
Android/WeatherInformation/src/de/example/exampletdd/fragment/overview/OverviewFragment.java
Android/WeatherInformation/src/de/example/exampletdd/fragment/preferences/WeatherInformationPreferencesFragment.java
Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java
Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetConfigure.java
Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetPreferences.java

index f7ea2b7..5d21935 100644 (file)
@@ -6,6 +6,6 @@
         android:id="@+id/action_settings"
         android:orderInCategory="100"
         android:showAsAction="never"
-        android:title="@string/action_settings"/>
+        android:title="@string/weather_preferences_action_settings"/>
 
 </menu>
index e75d3cf..f3f36c8 100644 (file)
@@ -5,8 +5,8 @@
     <item
         android:id="@+id/weather_menu_settings"
         android:menuCategory="system"
-        android:title="@string/action_settings"
-        android:titleCondensed="@string/action_settings"
+        android:title="@string/weather_preferences_action_settings"
+        android:titleCondensed="@string/weather_preferences_action_settings"
         android:checked="false"
         android:visible="true"
         android:checkable="false"
@@ -22,8 +22,8 @@
         android:checkable="false"
         android:enabled="true"
         android:checked="false"
-        android:title="@string/action_map"
-        android:titleCondensed="@string/action_map">
+        android:title="@string/weather_map_action_map"
+        android:titleCondensed="@string/weather_map_action_map">
     </item>
     
 
index af804e7..2de335e 100644 (file)
         <item>half day</item>
         <item>one day</item>
     </string-array>
-    <string-array name="weather_preferences_units_value">
+    <string-array name="weather_preferences_temperature">
         <item>@string/weather_preferences_temperature_celsius</item>
         <item>@string/weather_preferences_temperature_fahrenheit</item>
         <item>@string/weather_preferences_temperature_kelvin</item>
     </string-array>
-    <string-array name="weather_preferences_units_human_value">
+    <string-array name="weather_preferences_temperature_human_value">
         <item>@string/weather_preferences_temperature_celsius_human_value</item>
         <item>@string/weather_preferences_temperature_fahrenheit_human_value</item>
         <item>@string/weather_preferences_temperature_kelvin_human_value</item>
index 53195da..138f8e8 100644 (file)
@@ -2,11 +2,10 @@
 <resources xmlns:android="http://schemas.android.com/apk/res/android">
 
     <string name="app_name">Weather Information</string>
-    <string name="action_settings">Settings</string>
-    <string name="action_map">Select Location</string>
-    <string name="uri_api_weather_today">http://api.openweathermap.org/data/{0}/weather?lat={1}&amp;lon={2}&amp;cnt=1</string>
-    <string name="uri_api_weather_forecast">http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&amp;lon={2}&amp;cnt={3}&amp;mode=json</string>
-    <string name="api_version">2.5</string>
+    <string name="icon_weather_description">Icon weather</string> 
+
+
+    <!-- Activities Current, Overview and Specific -->
     <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>
     <string name="text_field_snow">SNOW</string>
     <string name="text_field_pressure">PRESSURE</string>
     <string name="text_field_humidity">HUMIDITY</string>
-    <string name="button_ok">OK</string>
-    <string name="icon_weather_description">Icon weather</string>
-    <string name="weather_preferences_actionbar_title">Settings</string>
+    <string name="text_units_mm3h">mm 3h</string>
+    <string name="text_units_percent">%</string>
+    <string name="text_field_remote_error">No data available</string>
+
+
+    <!-- Preferences Acitivity -->
+    <string name="weather_preferences_action_settings">Settings</string>
     <string name="weather_preferences_units">Units</string>
     <string name="weather_preferences_temperature_key">weather_preferences_temperature</string>
     <string name="weather_preferences_temperature">Temperature</string>
     <string name="weather_preferences_pressure_standard_atm">atm</string>
     <string name="weather_preferences_pressure_human_value_pascal">pascal</string>
     <string name="weather_preferences_pressure_human_value_standard_atm">standard atmosphere</string>
+
+
+    <!-- Widget Preferences Activity -->
+    <string name="widget_preferences_action_settings">Settings</string>
     <string name="widget_preferences_units">Units</string>
-    <string name="widget_preferences_units_key">widget_preferences_units</string>
+    <string name="widget_preferences_temperature_key">widget_preferences_temperature</string>
     <string name="widget_preferences_refresh_interval_key">widget_preferences_refresh_interval</string>
     <string name="widget_preferences_refresh_interval">Refresh interval</string>
+
+
+    <!-- Map Activity -->
+    <string name="weather_map_action_map">Select Location</string>
     <string name="city_not_found">city not found</string>
     <string name="country_not_found">country not found</string>
     <string name="progress_dialog_generic_message">Please wait&#8230;</string>
-    <string name="title_section1">Section 1</string>
-    <string name="title_section2">Section 2</string>
-    <string name="title_section3">Section 3</string>
     <string name="weather_map_button_savelocation">Save Location</string>
        <string name="weather_map_button_getlocation">Get Location</string>
-       <string name="text_units_mm3h">mm 3h</string>
-       <string name="text_units_percent">%</string>
-       <string name="text_field_remote_error">No data available</string>
+       
+       
+       <!-- DO NOT TRANSLATE -->
+       <string name="uri_api_weather_today">http://api.openweathermap.org/data/{0}/weather?lat={1}&amp;lon={2}&amp;cnt=1</string>
+    <string name="uri_api_weather_forecast">http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&amp;lon={2}&amp;cnt={3}&amp;mode=json</string>
+    <string name="api_version">2.5</string>
 </resources>
index 4ab359e..b7510a0 100644 (file)
@@ -9,11 +9,11 @@
         android:defaultValue="300000"
         android:summary="five minutes" />
     <PreferenceCategory android:title="@string/widget_preferences_units">
-        <ListPreference android:key="@string/widget_preferences_units_key"
+        <ListPreference android:key="@string/widget_preferences_temperature_key"
             android:title="@string/weather_preferences_temperature"
             android:summary="celsius"
-            android:entries="@array/weather_preferences_units_human_value"
-            android:entryValues="@array/weather_preferences_units_value"
+            android:entries="@array/weather_preferences_temperature_human_value"
+            android:entryValues="@array/weather_preferences_temperature"
             android:selectable="true"
             android:persistent="true"
             android:defaultValue="ÂșC" />
index adf3d00..baaa006 100644 (file)
@@ -20,8 +20,8 @@
         <ListPreference android:key="@string/weather_preferences_temperature_key"
             android:title="@string/weather_preferences_temperature"
             android:summary="@string/weather_preferences_temperature_celsius_human_value"
-            android:entries="@array/weather_preferences_units_human_value"
-            android:entryValues="@array/weather_preferences_units_value"
+            android:entries="@array/weather_preferences_temperature_human_value"
+            android:entryValues="@array/weather_preferences_temperature"
             android:selectable="true"
             android:persistent="true"
             android:defaultValue="@string/weather_preferences_temperature_celsius" />
index 1773b9c..596b43f 100644 (file)
@@ -115,7 +115,7 @@ public class NotificationIntentService extends IntentService {
         UnitsConversor tempUnitsConversor;
         String keyPreference = this.getResources().getString(R.string.weather_preferences_temperature_key);
         String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
         if (unitsPreferenceValue.equals(values[0])) {
                tempSymbol = values[0];
                tempUnitsConversor = new UnitsConversor(){
index 1ba899e..1e9b0d4 100644 (file)
@@ -22,6 +22,6 @@ public class WeatherInformationPreferencesActivity extends Activity {
         super.onResume();
 
         final ActionBar actionBar = this.getActionBar();
-        actionBar.setTitle(this.getString(R.string.weather_preferences_actionbar_title));
+        actionBar.setTitle(this.getString(R.string.weather_preferences_action_settings));
     }
 }
index 91eedee..8845f22 100644 (file)
@@ -159,7 +159,7 @@ public class WidgetIntentService extends IntentService {
         UnitsConversor tempUnitsConversor;
         String keyPreference = this.getResources().getString(R.string.weather_preferences_temperature_key);
         String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
         if (unitsPreferenceValue.equals(values[0])) {
                tempSymbol = values[0];
                tempUnitsConversor = new UnitsConversor(){
index 2728bc6..5d00707 100644 (file)
@@ -5,7 +5,6 @@ import android.app.Dialog;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v4.app.DialogFragment;
-import de.example.exampletdd.R;
 
 public class ErrorDialogFragment extends DialogFragment {
 
@@ -26,7 +25,7 @@ public class ErrorDialogFragment extends DialogFragment {
         return new AlertDialog.Builder(this.getActivity())
         .setIcon(android.R.drawable.ic_dialog_alert)
         .setTitle(title)
-        .setPositiveButton(R.string.button_ok,
+        .setPositiveButton(android.R.string.ok,
                 new DialogInterface.OnClickListener() {
             @Override
             public void onClick(final DialogInterface dialog,
index 0e7fb9b..ac7e3b9 100644 (file)
@@ -214,7 +214,7 @@ public class CurrentFragment extends Fragment {
         UnitsConversor tempUnitsConversor;
         String keyPreference = this.getResources().getString(R.string.weather_preferences_temperature_key);
         String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
         if (unitsPreferenceValue.equals(values[0])) {
                tempSymbol = values[0];
                tempUnitsConversor = new UnitsConversor(){
index 9d16694..682e5bd 100644 (file)
@@ -215,7 +215,7 @@ public class OverviewFragment extends ListFragment {
         String keyPreference = this.getResources().getString(
                 R.string.weather_preferences_temperature_key);
         final String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
         if (unitsPreferenceValue.equals(values[0])) {
                symbol = values[0];
                unitsConversor = new UnitsConversor(){
index aa1c8ac..ba19c5e 100644 (file)
@@ -26,8 +26,8 @@ public class WeatherInformationPreferencesFragment extends PreferenceFragment
         
         
         // Temperature units
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
-        String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_units_human_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
+        String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value);
         String keyPreference = this.getActivity().getApplicationContext().getString(
                 R.string.weather_preferences_temperature_key);
         Preference connectionPref = this.findPreference(keyPreference);
@@ -156,8 +156,8 @@ public class WeatherInformationPreferencesFragment extends PreferenceFragment
             final SharedPreferences sharedPreferences, final String key) {
        
        // Temperature units
-       String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
-       String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_units_human_value);
+       String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
+       String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value);
         String keyValue = this.getActivity().getApplicationContext().getString(
                 R.string.weather_preferences_temperature_key);
         if (key.equals(keyValue)) {
index 3497db4..e355c71 100644 (file)
@@ -122,7 +122,7 @@ public class SpecificFragment extends Fragment {
         String keyPreference = this.getResources().getString(
                 R.string.weather_preferences_temperature_key);
         String unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
         if (unitsPreferenceValue.equals(values[0])) {
                tempSymbol = values[0];
                tempUnitsConversor = new UnitsConversor(){
index 6a89c70..ce20fce 100644 (file)
@@ -78,6 +78,6 @@ public class WidgetConfigure extends Activity {
         super.onResume();
 
         final ActionBar actionBar = this.getActionBar();
-        actionBar.setTitle(this.getString(R.string.weather_preferences_actionbar_title));
+        actionBar.setTitle(this.getString(R.string.widget_preferences_action_settings));
     }
 }
index 0edf6e2..4f3191b 100644 (file)
@@ -23,8 +23,8 @@ public class WidgetPreferences extends PreferenceFragment {
         this.addPreferencesFromResource(R.xml.appwidget_preferences);
         
         // Temperature units
-        String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
-        String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_units_human_value);
+        String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
+        String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value);
         String keyPreference = this.getActivity().getApplicationContext().getString(
                 R.string.weather_preferences_temperature_key);
         Preference connectionPref = this.findPreference(keyPreference);
@@ -70,8 +70,8 @@ public class WidgetPreferences extends PreferenceFragment {
        public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) {
                
        // Temperature units
-       String[] values = this.getResources().getStringArray(R.array.weather_preferences_units_value);
-       String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_units_human_value);
+       String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
+       String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value);
         String keyValue = this.getActivity().getApplicationContext().getString(
                 R.string.weather_preferences_temperature_key);
         if (key.equals(keyValue)) {