From 20ca68a344b975333500bf570cbdabb9b0708149 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Mon, 27 Oct 2014 00:21:26 +0100 Subject: [PATCH] WeatherInformation: widget configuration no using PreferenceFragment --- .../de/example/exampletdd/WidgetIntentService.java | 91 ++++++----- .../fragment/current/CurrentFragment.java | 10 +- .../example/exampletdd/widget/WidgetConfigure.java | 141 +++++++++++++--- .../exampletdd/widget/WidgetPreferences.java | 182 --------------------- .../example/exampletdd/widget/WidgetProvider.java | 64 ++++++-- app/src/main/res/layout/appwidget_configure.xml | 19 ++- app/src/main/res/values/strings.xml | 11 +- app/src/main/res/xml/appwidget_preferences.xml | 4 +- 8 files changed, 239 insertions(+), 283 deletions(-) delete mode 100644 app/src/main/java/de/example/exampletdd/widget/WidgetPreferences.java diff --git a/app/src/main/java/de/example/exampletdd/WidgetIntentService.java b/app/src/main/java/de/example/exampletdd/WidgetIntentService.java index 32228fe..386f08e 100644 --- a/app/src/main/java/de/example/exampletdd/WidgetIntentService.java +++ b/app/src/main/java/de/example/exampletdd/WidgetIntentService.java @@ -25,6 +25,7 @@ import java.net.URL; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Calendar; +import java.util.Date; import java.util.Locale; import de.example.exampletdd.httpclient.CustomHTTPClient; @@ -39,7 +40,7 @@ import de.example.exampletdd.widget.WidgetConfigure; public class WidgetIntentService extends IntentService { private static final String TAG = "WidgetIntentService"; - + private static final long UPDATE_TIME_RATE = 86400000L; public WidgetIntentService() { super("WIS-Thread"); @@ -49,7 +50,7 @@ public class WidgetIntentService extends IntentService { protected void onHandleIntent(final Intent intent) { Log.i(TAG, "onHandleIntent"); final int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); - final boolean isUpdateByApp = intent.getBooleanExtra("updateByApp", false); + final boolean isForceRefreshAppWidget = intent.getBooleanExtra("forceRefreshAppWidget", false); if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { // Nothing to do. Something went wrong. Show error. @@ -66,42 +67,35 @@ public class WidgetIntentService extends IntentService { this.updateWidget(view, appWidgetId); return; } - - if (isUpdateByApp) { - this.updateByApp(weatherLocation, appWidgetId); - } else { - this.updateByTimeout(weatherLocation, appWidgetId); - } - - } - - private void updateByApp(final WeatherLocation weatherLocation, final int appWidgetId) { - final PermanentStorage store = new PermanentStorage(this.getApplicationContext()); - final Current current = store.getCurrent(); - - this.updateWidget(current, weatherLocation, appWidgetId); - } - - private void updateByTimeout(final WeatherLocation weatherLocation, final int appWidgetId) { - - final Current current = this.getRemoteCurrent(weatherLocation); - - this.updateWidget(current, weatherLocation, appWidgetId); - } - - private void updateWidget(final Current current, final WeatherLocation weatherLocation, final int appWidgetId) { - if (current != null) { - final RemoteViews view = this.makeView(current, weatherLocation, appWidgetId); - this.updateWidget(view, appWidgetId); + // TODO: improve this code. Too tired right now... + if (!isForceRefreshAppWidget && this.isDataFresh(weatherLocation.getLastCurrentUIUpdate())) { + RemoteViews view; + + final PermanentStorage store = new PermanentStorage(this.getApplicationContext()); + final Current current = store.getCurrent(); + if (current != null) { + // Update UI. + view = this.makeView(current, weatherLocation, appWidgetId); + } else { + // Show error. + view = this.makeErrorView(appWidgetId); + } + this.updateWidget(view, appWidgetId); } else { - // Show error. - final RemoteViews view = this.makeErrorView(appWidgetId); - this.updateWidget(view, appWidgetId); + RemoteViews view; + + final Current current = this.getRemoteCurrent(weatherLocation); + if (current != null) { + // Update UI. + view = this.makeView(current, weatherLocation, appWidgetId); + } else { + // Show error. + view = this.makeErrorView(appWidgetId); + } + this.updateWidget(view, appWidgetId); } } - - private Current getRemoteCurrent(final WeatherLocation weatherLocation) { @@ -159,16 +153,14 @@ public class WidgetIntentService extends IntentService { // TODO: repeating the same code in Overview, Specific and Current!!! // 1. Update units of measurement. - String tempSymbol; + UnitsConversor tempUnitsConversor; - String keyPreference = this.getApplicationContext().getString(R.string.widget_preferences_temperature_key); + String keyPreference = this.getApplicationContext().getString(R.string.widget_preferences_temperature_units_key); String realKeyPreference = keyPreference + "_" + appWidgetId; // What was saved to permanent storage (or default values if it is the first time) - final String tempValue = this.getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE) - .getString(realKeyPreference, this.getString(R.string.weather_preferences_temperature_celsius)); - final String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature); - if (tempValue.equals(values[0])) { - tempSymbol = values[0]; + final int tempValue = this.getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE).getInt(realKeyPreference, 0); + final String tempSymbol = this.getResources().getStringArray(R.array.weather_preferences_temperature)[tempValue]; + if (tempValue == 0) { tempUnitsConversor = new UnitsConversor(){ @Override @@ -177,8 +169,7 @@ public class WidgetIntentService extends IntentService { } }; - } else if (tempValue.equals(values[1])) { - tempSymbol = values[1]; + } else if (tempValue == 1) { tempUnitsConversor = new UnitsConversor(){ @Override @@ -188,7 +179,6 @@ public class WidgetIntentService extends IntentService { }; } else { - tempSymbol = values[2]; tempUnitsConversor = new UnitsConversor(){ @Override @@ -324,6 +314,19 @@ public class WidgetIntentService extends IntentService { final AppWidgetManager manager = AppWidgetManager.getInstance(this.getApplicationContext()); manager.updateAppWidget(appWidgetId, remoteView); } + + private boolean isDataFresh(final Date lastUpdate) { + if (lastUpdate == null) { + return false; + } + + final Date currentTime = new Date(); + if (((currentTime.getTime() - lastUpdate.getTime())) < UPDATE_TIME_RATE) { + return true; + } + + return false; + } // private void updateWidgets(final RemoteViews remoteView) { // diff --git a/app/src/main/java/de/example/exampletdd/fragment/current/CurrentFragment.java b/app/src/main/java/de/example/exampletdd/fragment/current/CurrentFragment.java index e0423d5..5245658 100644 --- a/app/src/main/java/de/example/exampletdd/fragment/current/CurrentFragment.java +++ b/app/src/main/java/de/example/exampletdd/fragment/current/CurrentFragment.java @@ -120,15 +120,7 @@ public class CurrentFragment extends Fragment { // 4. If is new data (new location) update widgets. if (weatherLocation.getIsNew()) { - final ComponentName widgets = new ComponentName(context.getApplicationContext(), WidgetProvider.class); - final AppWidgetManager manager = AppWidgetManager.getInstance(context.getApplicationContext()); - final int[] appWidgetIds = manager.getAppWidgetIds(widgets); - for (final int appWidgetId : appWidgetIds) { - final Intent intentWidget = new Intent(context.getApplicationContext(), WidgetIntentService.class); - intentWidget.putExtra("updateByApp", true); - intentWidget.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - context.getApplicationContext().startService(intentWidget); - } + WidgetProvider.updateAllAppWidgets(context); } // 5. Update location data. diff --git a/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java b/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java index 711adf1..410a847 100644 --- a/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java +++ b/app/src/main/java/de/example/exampletdd/widget/WidgetConfigure.java @@ -3,18 +3,23 @@ package de.example.exampletdd.widget; import android.app.ActionBar; import android.app.Activity; import android.appwidget.AppWidgetManager; +import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; +import android.widget.CompoundButton; +import android.widget.Spinner; +import android.widget.Switch; + import de.example.exampletdd.R; public class WidgetConfigure extends Activity { private int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID; - private View.OnClickListener mOnClickListener; @Override - public void onCreate(final Bundle icicle) { - super.onCreate(icicle); + public void onCreate(final Bundle savedInstanceState) { + super.onCreate(savedInstanceState); // Find the widget id from the intent. final Intent intent = getIntent(); @@ -42,31 +47,60 @@ public class WidgetConfigure extends Activity { // Set the view layout resource to use. this.setContentView(R.layout.appwidget_configure); + /******************* Show/hide country field *******************/ + String keyPreference = this.getApplicationContext().getString( + R.string.widget_preferences_country_switch_key); + String realKeyPreference = keyPreference + "_" + mAppWidgetId; + + // What was saved to permanent storage (or default values if it is the first time) + final boolean isShowCountry = this.getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE) + .getBoolean(realKeyPreference, false); + + // What is shown on the screen + final Switch countrySwitch = (Switch) this.findViewById(R.id.weather_appwidget_configure_country); + countrySwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){ + @Override + public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { + if (isChecked) { + buttonView.setText(WidgetConfigure.this.getString(R.string.widget_preferences_country_switch_on_summary)); + } else { + buttonView.setText(WidgetConfigure.this.getString(R.string.widget_preferences_country_switch_off_summary)); + } + } + }); + if (isShowCountry) { + countrySwitch.setChecked(true); + countrySwitch.setText(this.getString(R.string.widget_preferences_country_switch_on_summary)); + } else { + countrySwitch.setChecked(false); + countrySwitch.setText(this.getString(R.string.widget_preferences_country_switch_off_summary)); + } - mOnClickListener = new View.OnClickListener() { - public void onClick(View v) { + /********************* Temperature units **********************/ + keyPreference = this.getApplicationContext().getString( + R.string.widget_preferences_temperature_units_key); + realKeyPreference = keyPreference + "_" + mAppWidgetId; - // Save to permanent storage + // What was saved to permanent storage (or default values if it is the first time) + final int tempValue = this.getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE).getInt(realKeyPreference, 0); - // Push widget update to surface with newly set prefix - final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance( - WidgetConfigure.this.getApplicationContext()); - WidgetProvider.updateAppWidget( - WidgetConfigure.this.getApplicationContext(), - appWidgetManager, - mAppWidgetId); + // What is shown on the screen + final Spinner tempUnits = (Spinner) this.findViewById(R.id.weather_appwidget_configure_temperature_units); + tempUnits.setSelection(tempValue); - // Make sure we pass back the original appWidgetId - final Intent resultValue = new Intent(); - resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); - WidgetConfigure.this.setResult(RESULT_OK, resultValue); - finish(); - } - }; - // Bind the action for the save button. - this.findViewById(R.id.weather_appwidget_configure_save_button).setOnClickListener(mOnClickListener); + /** + * android:saveEnabled + * Controls whether the saving of this view's state is enabled (that is, whether its onSaveInstanceState() method will be called). + * + * After onStart the onSaveInstanceState method will be called for every widget, so + * I do not need to do anything else to retrieve the UI's state after changing orientation. + * + * I do not know if this is a good pattern, it does not look like that. I guess, I should use + * on Resume instead of onCreate/onStart and implement my own onSaveInstanceState method. + * But I am tired... + */ } - + @Override public void onResume() { super.onResume(); @@ -74,4 +108,65 @@ public class WidgetConfigure extends Activity { final ActionBar actionBar = this.getActionBar(); actionBar.setTitle(this.getString(R.string.widget_preferences_action_settings)); } + + + public void onClickRefresh(final View view) { + // Push widget update to surface + WidgetProvider.forceRefreshAppWidget(this.getApplicationContext(), mAppWidgetId); + } + + public void onClickOk(final View view) { + // Save to permanent storage + final SharedPreferences.Editor prefs = this.getSharedPreferences( + "WIDGET_PREFERENCES", + Context.MODE_PRIVATE).edit(); + + /******************* Show/hide country field *******************/ + // What is shown on the screen + final Switch countrySwitch = (Switch) this.findViewById(R.id.weather_appwidget_configure_country); + String keyPreference = this.getApplicationContext().getString( + R.string.widget_preferences_country_switch_key); + String realKeyPreference = keyPreference + "_" + mAppWidgetId; + prefs.putBoolean(realKeyPreference, countrySwitch.isChecked()); + + /********************* Temperature units **********************/ + // What is shown on the screen + final Spinner tempUnits = (Spinner) this.findViewById(R.id.weather_appwidget_configure_temperature_units); + keyPreference = this.getApplicationContext().getString( + R.string.widget_preferences_temperature_units_key); + realKeyPreference = keyPreference + "_" + mAppWidgetId; + prefs.putInt(realKeyPreference, tempUnits.getSelectedItemPosition()); + + /****************** Saving to permanent storage ***************/ + prefs.commit(); + + // Push widget update to surface with newly set prefix + WidgetProvider.updateAppWidget(this.getApplicationContext(), mAppWidgetId); + + // Make sure we pass back the original appWidgetId + final Intent resultValue = new Intent(); + resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId); + this.setResult(RESULT_OK, resultValue); + finish(); + } + + public static void deletePreference(final Context context, final int appWidgetId) { + final SharedPreferences.Editor prefs = context.getApplicationContext() + .getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE).edit(); + + /******************* Show/hide country field *******************/ + String keyPreference = context.getApplicationContext().getString( + R.string.widget_preferences_country_switch_key); + String realKeyPreference = keyPreference + "_" + appWidgetId; + prefs.remove(realKeyPreference); + + /********************* Temperature units **********************/ + keyPreference = context.getApplicationContext().getString( + R.string.widget_preferences_temperature_units_key); + realKeyPreference = keyPreference + "_" + appWidgetId; + prefs.remove(realKeyPreference); + + /****************** Updating permanent storage ***************/ + prefs.commit(); + } } diff --git a/app/src/main/java/de/example/exampletdd/widget/WidgetPreferences.java b/app/src/main/java/de/example/exampletdd/widget/WidgetPreferences.java deleted file mode 100644 index 9907b4d..0000000 --- a/app/src/main/java/de/example/exampletdd/widget/WidgetPreferences.java +++ /dev/null @@ -1,182 +0,0 @@ -package de.example.exampletdd.widget; - -import android.appwidget.AppWidgetManager; -import android.content.Context; -import android.content.SharedPreferences; -import android.content.SharedPreferences.OnSharedPreferenceChangeListener; -import android.os.Bundle; -import android.preference.ListPreference; -import android.preference.PreferenceFragment; -import android.preference.SwitchPreference; -import de.example.exampletdd.R; - -/** - * TODO: - * IT DOES NOT WORK IF USER IS WORKING WITH TWO OR MORE WIDGET PREFERENCE WINDOWS AT THE SAME TIME - * (hopefully nobody will realize...) - * How to implement custom preference activities (no extending from PreferenceActivity or PreferenceFragment) - * without pain? - */ -public class WidgetPreferences extends PreferenceFragment implements OnSharedPreferenceChangeListener { - private int mAppWidgetId; - private boolean mIsCountry; - private String mTempUnits; - - @Override - public void onCreate(final Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Do not retain this fragment across configuration changes because I am tired for following - // the fragment lifecycle (I am going to loose the instance field values but I DON'T CARE!!!) - this.setRetainInstance(false); - - final Bundle bundle = this.getArguments(); - mAppWidgetId = bundle.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); - - // Load the preferences from an XML resource - this.addPreferencesFromResource(R.xml.appwidget_preferences); - - - /******************* Show/hide country field *******************/ - String keyPreference = this.getActivity().getApplicationContext().getString( - R.string.widget_preferences_country_switch_key); - String realKeyPreference = keyPreference + "_" + mAppWidgetId; - - // What was saved to permanent storage (or default values if it is the first time) - final boolean countryValue = this.getActivity().getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE) - .getBoolean(realKeyPreference, false); - - // Update temporal value - mIsCountry = countryValue; - - // What is shown on the screen - final SwitchPreference countryPref = (SwitchPreference) this.findPreference(keyPreference); - countryPref.setChecked(countryValue); - - /********************* Temperature units **********************/ - final String[] values = this.getResources().getStringArray(R.array.weather_preferences_temperature); - final String[] humanValues = this.getResources().getStringArray(R.array.weather_preferences_temperature_human_value); - - keyPreference = this.getActivity().getApplicationContext().getString( - R.string.widget_preferences_temperature_key); - realKeyPreference = keyPreference + "_" + mAppWidgetId; - - - // What was saved to permanent storage (or default values if it is the first time) - final String tempValue = this.getActivity().getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE) - .getString(realKeyPreference, this.getString(R.string.weather_preferences_temperature_celsius)); - String humanValue = this.getString(R.string.weather_preferences_temperature_celsius_human_value); - int index = 0; - if (tempValue.equals(values[0])) { - index = 0; - humanValue = humanValues[0]; - } else if (tempValue.equals(values[1])) { - index = 1; - humanValue = humanValues[1]; - } else if (tempValue.equals(values[2])) { - index = 2; - humanValue = humanValues[2]; - } - - // Update temporal value - mTempUnits = tempValue; - - // What is shown on the screen - final ListPreference listPref = (ListPreference) this.findPreference(keyPreference); - listPref.setSummary(humanValue); - listPref.setValueIndex(index); - listPref.setValue(tempValue); - } - - @Override - public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) { - - /******************* Show/hide country field *******************/ - String keyPreference = this.getActivity().getApplicationContext().getString( - R.string.widget_preferences_country_switch_key); - if (key.equals(keyPreference)) { - // What is shown on the screen - final SwitchPreference preference = (SwitchPreference) this.findPreference(key); - // Update temporal value - mIsCountry = preference.isChecked(); - - return; - } - - /********************* Temperature units **********************/ - keyPreference = this.getActivity().getApplicationContext().getString( - R.string.widget_preferences_temperature_key); - if (key.equals(keyPreference)) { - final String[] values = this.getResources().getStringArray( - R.array.weather_preferences_temperature); - final String[] humanValues = this.getResources().getStringArray( - R.array.weather_preferences_temperature_human_value); - - // What is shown on the screen - final ListPreference listPref = (ListPreference) this.findPreference(key); - final String value = listPref.getValue(); - 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]; - } - // Update data on screen - listPref.setSummary(humanValue); - - // Update temporal value - mTempUnits = value; - - return; - } - } - - @Override - public void onResume() { - super.onResume(); - this.getPreferenceManager().getSharedPreferences() - .registerOnSharedPreferenceChangeListener(this); - } - - @Override - public void onPause() { - super.onPause(); - this.getPreferenceManager().getSharedPreferences() - .unregisterOnSharedPreferenceChangeListener(this); - } - - public void onSavePreferences() { - final SharedPreferences.Editor prefs = - this.getActivity().getSharedPreferences( - "WIDGET_PREFERENCES", - Context.MODE_PRIVATE).edit(); - - /******************* Show/hide country field *******************/ - String keyPreference = this.getActivity().getApplicationContext().getString( - R.string.widget_preferences_country_switch_key); - String realKeyPreference = keyPreference + "_" + mAppWidgetId; - prefs.putBoolean(realKeyPreference, mIsCountry); - - - /********************* Temperature units **********************/ - keyPreference = this.getActivity().getApplicationContext().getString( - R.string.widget_preferences_temperature_key); - realKeyPreference = keyPreference + "_" + mAppWidgetId; - prefs.putString(realKeyPreference, mTempUnits); - - // Saving to permanent storage. - prefs.commit(); - } - - public static void deletePreference(final Context context, final int appWidgetId) { - final String keyPreference = context.getApplicationContext().getString( - R.string.widget_preferences_temperature_key); - final String realKeyPreference = keyPreference + "_" + appWidgetId; - - final SharedPreferences.Editor prefs = context.getSharedPreferences("WIDGET_PREFERENCES", Context.MODE_PRIVATE).edit(); - prefs.remove(realKeyPreference); - prefs.commit(); - } -} diff --git a/app/src/main/java/de/example/exampletdd/widget/WidgetProvider.java b/app/src/main/java/de/example/exampletdd/widget/WidgetProvider.java index 91263f2..06970e7 100644 --- a/app/src/main/java/de/example/exampletdd/widget/WidgetProvider.java +++ b/app/src/main/java/de/example/exampletdd/widget/WidgetProvider.java @@ -4,6 +4,7 @@ package de.example.exampletdd.widget; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProvider; import android.appwidget.AppWidgetProviderInfo; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -23,7 +24,7 @@ public class WidgetProvider extends AppWidgetProvider { // To prevent any ANR timeouts, we perform the update in a service final Intent intent = new Intent(context.getApplicationContext(), WidgetIntentService.class); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); - intent.putExtra("updateByApp", false); + intent.putExtra("forceRefreshAppWidget", true); context.startService(intent); } } @@ -33,11 +34,54 @@ public class WidgetProvider extends AppWidgetProvider { // When the user deletes the widget, delete the preference associated with it. final int N = appWidgetIds.length; for (int i=0; i @@ -32,7 +33,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" - android:text="Country" + android:text="@string/widget_preferences_country" android:padding="5dp" android:layout_gravity="start" /> @@ -49,16 +50,17 @@ + android:checked="false" + android:text="@string/widget_preferences_country_switch_off_summary" + android:textOff="@string/widget_preferences_country_switch_off" + android:textOn="@string/widget_preferences_country_switch_on" /> @@ -81,7 +83,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" - android:text="Refresh" + android:text="@string/widget_preferences_button_refresh" android:padding="5dp" android:layout_gravity="start" /> @@ -100,7 +102,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" - android:text="Refresh data" + android:text="@string/widget_configure_button_refresh_summary" android:padding="5dp" android:layout_gravity="start" /> @@ -109,7 +111,8 @@ android:layout_height="wrap_content" android:layout_gravity="end" android:textAlignment="center" - android:text="Refresh"/> + android:onClick="onClickRefresh" + android:text="@string/widget_preferences_button_refresh"/> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ec32311..746757d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -63,12 +63,13 @@ Settings Refresh + Refresh values + Temperature units + widget_preferences_temperature Country - Units - widget_preferences_temperature - widget_preferences_countries_switch - Hide - Show + widget_preferences_country_switch + Hide country + Show country OFF ON diff --git a/app/src/main/res/xml/appwidget_preferences.xml b/app/src/main/res/xml/appwidget_preferences.xml index db489da..85320c2 100644 --- a/app/src/main/res/xml/appwidget_preferences.xml +++ b/app/src/main/res/xml/appwidget_preferences.xml @@ -12,8 +12,8 @@ android:disableDependentsState="false" android:persistent="true"/> - - +