From: gu.martinm@gmail.com Date: Wed, 15 Oct 2014 18:09:06 +0000 (+0200) Subject: WeatherInformation: trying to improve string resources (values and identifiers) X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=9dd6c1a73524682f17d81cd0bf5d81dec5b05ca2;p=JavaForFun WeatherInformation: trying to improve string resources (values and identifiers) --- diff --git a/Android/WeatherInformation/res/menu/main.xml b/Android/WeatherInformation/res/menu/main.xml index f7ea2b7..5d21935 100644 --- a/Android/WeatherInformation/res/menu/main.xml +++ b/Android/WeatherInformation/res/menu/main.xml @@ -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"/> diff --git a/Android/WeatherInformation/res/menu/weather_main_menu.xml b/Android/WeatherInformation/res/menu/weather_main_menu.xml index e75d3cf..f3f36c8 100644 --- a/Android/WeatherInformation/res/menu/weather_main_menu.xml +++ b/Android/WeatherInformation/res/menu/weather_main_menu.xml @@ -5,8 +5,8 @@ + android:title="@string/weather_map_action_map" + android:titleCondensed="@string/weather_map_action_map"> diff --git a/Android/WeatherInformation/res/values/arrays.xml b/Android/WeatherInformation/res/values/arrays.xml index af804e7..2de335e 100644 --- a/Android/WeatherInformation/res/values/arrays.xml +++ b/Android/WeatherInformation/res/values/arrays.xml @@ -42,12 +42,12 @@ half day one day - + @string/weather_preferences_temperature_celsius @string/weather_preferences_temperature_fahrenheit @string/weather_preferences_temperature_kelvin - + @string/weather_preferences_temperature_celsius_human_value @string/weather_preferences_temperature_fahrenheit_human_value @string/weather_preferences_temperature_kelvin_human_value diff --git a/Android/WeatherInformation/res/values/strings.xml b/Android/WeatherInformation/res/values/strings.xml index 53195da..138f8e8 100644 --- a/Android/WeatherInformation/res/values/strings.xml +++ b/Android/WeatherInformation/res/values/strings.xml @@ -2,11 +2,10 @@ Weather Information - Settings - Select Location - http://api.openweathermap.org/data/{0}/weather?lat={1}&lon={2}&cnt=1 - http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&lon={2}&cnt={3}&mode=json - 2.5 + Icon weather + + + SUN RISE SUN SET FEELS LIKE @@ -16,9 +15,13 @@ SNOW PRESSURE HUMIDITY - OK - Icon weather - Settings + mm 3h + % + No data available + + + + Settings Units weather_preferences_temperature Temperature @@ -52,19 +55,27 @@ atm pascal standard atmosphere + + + + Settings Units - widget_preferences_units + widget_preferences_temperature widget_preferences_refresh_interval Refresh interval + + + + Select Location city not found country not found Please wait… - Section 1 - Section 2 - Section 3 Save Location Get Location - mm 3h - % - No data available + + + + http://api.openweathermap.org/data/{0}/weather?lat={1}&lon={2}&cnt=1 + http://api.openweathermap.org/data/{0}/forecast/daily?lat={1}&lon={2}&cnt={3}&mode=json + 2.5 diff --git a/Android/WeatherInformation/res/xml/appwidget_preferences.xml b/Android/WeatherInformation/res/xml/appwidget_preferences.xml index 4ab359e..b7510a0 100644 --- a/Android/WeatherInformation/res/xml/appwidget_preferences.xml +++ b/Android/WeatherInformation/res/xml/appwidget_preferences.xml @@ -9,11 +9,11 @@ android:defaultValue="300000" android:summary="five minutes" /> - diff --git a/Android/WeatherInformation/res/xml/weather_preferences.xml b/Android/WeatherInformation/res/xml/weather_preferences.xml index adf3d00..baaa006 100644 --- a/Android/WeatherInformation/res/xml/weather_preferences.xml +++ b/Android/WeatherInformation/res/xml/weather_preferences.xml @@ -20,8 +20,8 @@ diff --git a/Android/WeatherInformation/src/de/example/exampletdd/NotificationIntentService.java b/Android/WeatherInformation/src/de/example/exampletdd/NotificationIntentService.java index 1773b9c..596b43f 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/NotificationIntentService.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/NotificationIntentService.java @@ -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(){ diff --git a/Android/WeatherInformation/src/de/example/exampletdd/WeatherInformationPreferencesActivity.java b/Android/WeatherInformation/src/de/example/exampletdd/WeatherInformationPreferencesActivity.java index 1ba899e..1e9b0d4 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/WeatherInformationPreferencesActivity.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/WeatherInformationPreferencesActivity.java @@ -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)); } } diff --git a/Android/WeatherInformation/src/de/example/exampletdd/WidgetIntentService.java b/Android/WeatherInformation/src/de/example/exampletdd/WidgetIntentService.java index 91eedee..8845f22 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/WidgetIntentService.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/WidgetIntentService.java @@ -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(){ diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/ErrorDialogFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/ErrorDialogFragment.java index 2728bc6..5d00707 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/ErrorDialogFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/ErrorDialogFragment.java @@ -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, diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java index 0e7fb9b..ac7e3b9 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/current/CurrentFragment.java @@ -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(){ diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/overview/OverviewFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/overview/OverviewFragment.java index 9d16694..682e5bd 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/overview/OverviewFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/overview/OverviewFragment.java @@ -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(){ diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/preferences/WeatherInformationPreferencesFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/preferences/WeatherInformationPreferencesFragment.java index aa1c8ac..ba19c5e 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/preferences/WeatherInformationPreferencesFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/preferences/WeatherInformationPreferencesFragment.java @@ -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)) { diff --git a/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java b/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java index 3497db4..e355c71 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/fragment/specific/SpecificFragment.java @@ -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(){ diff --git a/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetConfigure.java b/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetConfigure.java index 6a89c70..ce20fce 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetConfigure.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetConfigure.java @@ -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)); } } diff --git a/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetPreferences.java b/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetPreferences.java index 0edf6e2..4f3191b 100644 --- a/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetPreferences.java +++ b/Android/WeatherInformation/src/de/example/exampletdd/widget/WidgetPreferences.java @@ -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)) {