String tempSymbol;
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_temperature);
+ String unitsPreferenceValue = sharedPreferences.getString(
+ keyPreference, this.getString(R.string.weather_preferences_temperature_celsius));
if (unitsPreferenceValue.equals(values[0])) {
tempSymbol = values[0];
tempUnitsConversor = new UnitsConversor(){
String windSymbol;
UnitsConversor windUnitsConversor;
keyPreference = this.getResources().getString(R.string.weather_preferences_wind_key);
- unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
values = this.getResources().getStringArray(R.array.weather_preferences_wind);
+ unitsPreferenceValue = sharedPreferences.getString(
+ keyPreference, this.getString(R.string.weather_preferences_wind_meters));
if (unitsPreferenceValue.equals(values[0])) {
windSymbol = values[0];
windUnitsConversor = new UnitsConversor(){
String pressureSymbol;
UnitsConversor pressureUnitsConversor;
keyPreference = this.getResources().getString(R.string.weather_preferences_pressure_key);
- unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
values = this.getResources().getStringArray(R.array.weather_preferences_pressure);
+ unitsPreferenceValue = sharedPreferences.getString(
+ keyPreference, this.getString(R.string.weather_preferences_pressure_pascal));
if (unitsPreferenceValue.equals(values[0])) {
pressureSymbol = values[0];
pressureUnitsConversor = new UnitsConversor(){
R.string.weather_preferences_temperature_key);
Preference connectionPref = this.findPreference(keyPreference);
String value = this.getPreferenceManager().getSharedPreferences()
- .getString(keyPreference, "");
+ .getString(keyPreference, this.getString(R.string.weather_preferences_temperature_celsius));
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
humanValues = this.getResources().getStringArray(R.array.weather_preferences_wind_human_value);
keyPreference = this.getString(R.string.weather_preferences_wind_key);
connectionPref = this.findPreference(keyPreference);
- value = this.getPreferenceManager().getSharedPreferences().getString(keyPreference, "");
+ value = this.getPreferenceManager().getSharedPreferences()
+ .getString(keyPreference, this.getString(R.string.weather_preferences_wind_meters));
humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
humanValues = this.getResources().getStringArray(R.array.weather_preferences_pressure_human_value);
keyPreference = this.getString(R.string.weather_preferences_pressure_key);
connectionPref = this.findPreference(keyPreference);
- value = this.getPreferenceManager().getSharedPreferences().getString(keyPreference, "");
+ value = this.getPreferenceManager().getSharedPreferences()
+ .getString(keyPreference, this.getString(R.string.weather_preferences_pressure_pascal));
humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
keyPreference = this.getActivity().getApplicationContext().getString(
R.string.weather_preferences_day_forecast_key);
connectionPref = this.findPreference(keyPreference);
- value = this.getPreferenceManager().getSharedPreferences().getString(keyPreference, "");
+ value = this.getPreferenceManager().getSharedPreferences().getString(keyPreference, values[0]);
humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
keyPreference = this.getActivity().getApplicationContext().getString(
R.string.weather_preferences_refresh_interval_key);
connectionPref = this.findPreference(keyPreference);
- value = this.getPreferenceManager().getSharedPreferences().getString(keyPreference, "");
+ value = this.getPreferenceManager().getSharedPreferences().getString(keyPreference, values[0]);
humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
R.string.weather_preferences_update_time_rate_key);
connectionPref = this.findPreference(keyPreference);
value = this.getPreferenceManager().getSharedPreferences()
- .getString(keyPreference, "");
+ .getString(keyPreference, values[0]);
humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
humanValue = humanValues[4];
}
connectionPref.setSummary(humanValue);
+
+ // Notifications temperature units
+ values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
+ humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value);
+ keyPreference = this.getActivity().getApplicationContext().getString(
+ R.string.weather_preferences_notifications_temperature_key);
+ connectionPref = this.findPreference(keyPreference);
+ value = this.getPreferenceManager().getSharedPreferences()
+ .getString(keyPreference, this.getString(R.string.weather_preferences_temperature_celsius));
+ humanValue = "";
+ if (value.equals(values[0])) {
+ humanValue = humanValues[0];
+ } else if (value.equals(values[1])) {
+ humanValue = humanValues[1];
+ } else if (value.equals(values[2])) {
+ humanValue = humanValues[2];
+ }
+ connectionPref.setSummary(humanValue);
}
@Override
R.string.weather_preferences_temperature_key);
if (key.equals(keyValue)) {
final Preference connectionPref = this.findPreference(key);
- final String value = sharedPreferences.getString(key, "");
+ final String value = sharedPreferences.getString(key, values[0]);
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
keyValue = this.getString(R.string.weather_preferences_wind_key);
if (key.equals(keyValue)) {
final Preference connectionPref = this.findPreference(key);
- final String value = sharedPreferences.getString(key, "");
+ final String value = sharedPreferences.getString(key, values[0]);
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
keyValue = this.getString(R.string.weather_preferences_pressure_key);
if (key.equals(keyValue)) {
final Preference connectionPref = this.findPreference(key);
- final String value = sharedPreferences.getString(key, "");
+ final String value = sharedPreferences.getString(key, values[0]);
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
R.string.weather_preferences_day_forecast_key);
if (key.equals(keyValue)) {
final Preference connectionPref = this.findPreference(key);
- final String value = sharedPreferences.getString(key, "");
+ final String value = sharedPreferences.getString(key, values[0]);
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
R.string.weather_preferences_refresh_interval_key);
if (key.equals(keyValue)) {
final Preference connectionPref = this.findPreference(key);
- final String value = sharedPreferences.getString(key, "");
+ final String value = sharedPreferences.getString(key, values[0]);
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
}
// Notification switch
+ values = this.getResources().getStringArray(R.array.weather_preferences_update_time_rate);
keyValue = this.getActivity().getApplicationContext().getString(
R.string.weather_preferences_notifications_switch_key);
if (key.equals(keyValue)) {
{
keyValue = this.getActivity().getApplicationContext().getString(
R.string.weather_preferences_update_time_rate_key);
- final String value = sharedPreferences.getString(keyValue, "");
+ final String value = sharedPreferences.getString(keyValue, values[0]);
this.updateNotification(value);
} else {
this.cancelNotification();
R.string.weather_preferences_update_time_rate_key);
if (key.equals(keyValue)) {
final Preference connectionPref = this.findPreference(key);
- final String value = sharedPreferences.getString(key, "");
+ final String value = sharedPreferences.getString(key, values[0]);
String humanValue = "";
if (value.equals(values[0])) {
humanValue = humanValues[0];
connectionPref.setSummary(humanValue);
return;
}
+
+ // Temperature units
+ values = this.getResources().getStringArray(R.array.weather_preferences_temperature);
+ humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value);
+ keyValue = this.getActivity().getApplicationContext().getString(
+ R.string.weather_preferences_notifications_temperature_key);
+ if (key.equals(keyValue)) {
+ final Preference connectionPref = this.findPreference(key);
+ final String value = sharedPreferences.getString(key, values[0]);
+ String humanValue = "";
+ if (value.equals(values[0])) {
+ humanValue = humanValues[0];
+ } else if (value.equals(values[1])) {
+ humanValue = humanValues[1];
+ } else if (value.equals(values[2])) {
+ humanValue = humanValues[2];
+ }
+
+ connectionPref.setSummary(humanValue);
+ return;
+ }
}
private void updateNotification(final String updateTimeRate) {
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_temperature);
+ String unitsPreferenceValue = sharedPreferences.getString(
+ keyPreference, this.getString(R.string.weather_preferences_temperature_celsius));
if (unitsPreferenceValue.equals(values[0])) {
tempSymbol = values[0];
tempUnitsConversor = new UnitsConversor(){
String windSymbol;
UnitsConversor windUnitsConversor;
keyPreference = this.getResources().getString(R.string.weather_preferences_wind_key);
- unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
values = this.getResources().getStringArray(R.array.weather_preferences_wind);
+ unitsPreferenceValue = sharedPreferences.getString(
+ keyPreference, this.getString(R.string.weather_preferences_wind_meters));
if (unitsPreferenceValue.equals(values[0])) {
windSymbol = values[0];
windUnitsConversor = new UnitsConversor(){
String pressureSymbol;
UnitsConversor pressureUnitsConversor;
keyPreference = this.getResources().getString(R.string.weather_preferences_pressure_key);
- unitsPreferenceValue = sharedPreferences.getString(keyPreference, "");
values = this.getResources().getStringArray(R.array.weather_preferences_pressure);
+ unitsPreferenceValue = sharedPreferences.getString(
+ keyPreference, this.getString(R.string.weather_preferences_pressure_pascal));
if (unitsPreferenceValue.equals(values[0])) {
pressureSymbol = values[0];
pressureUnitsConversor = new UnitsConversor(){