diff --git a/app/src/main/java/org/andstatus/todoagenda/EnvironmentChangedReceiver.java b/app/src/main/java/org/andstatus/todoagenda/EnvironmentChangedReceiver.java index f29c6da6..7a5e0159 100644 --- a/app/src/main/java/org/andstatus/todoagenda/EnvironmentChangedReceiver.java +++ b/app/src/main/java/org/andstatus/todoagenda/EnvironmentChangedReceiver.java @@ -16,10 +16,12 @@ import org.andstatus.todoagenda.provider.EventProviderType; import org.andstatus.todoagenda.util.DateUtil; import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import static org.andstatus.todoagenda.AppWidgetProvider.getWidgetIds; @@ -48,13 +50,14 @@ public static void registerReceivers(Map instances) { if (oldReceiver != null) { oldReceiver.unRegister(context); } - scheduleNextAlarms(context, instances); + scheduleMidnightAlarms(context, instances); + schedulePeriodicAlarms(context, instances); Log.i(TAG, "Registered receivers from " + instanceSettings.getContext().getClass().getName()); } } - private static void scheduleNextAlarms(Context context, Map instances) { + private static void scheduleMidnightAlarms(Context context, Map instances) { Set alarmTimes = new HashSet<>(); for (InstanceSettings settings : instances.values()) { alarmTimes.add(DateUtil.now(settings.getTimeZone()).withTimeAtStartOfDay().plusDays(1)); @@ -67,11 +70,39 @@ private static void scheduleNextAlarms(Context context, Map instances) { + DateTime now = DateUtil.now(DateTimeZone.UTC).plusMinutes(1); + int periodMinutes = (int) TimeUnit.DAYS.toMinutes(1); + for (InstanceSettings settings : instances.values()) { + int period = settings.getRefreshPeriodMinutes(); + if (period > 0 && period < periodMinutes) { + periodMinutes = period; + } + } + DateTime alarmTime = new DateTime(now.getYear(), now.getMonthOfYear(), + now.getDayOfMonth(), now.getHourOfDay(), now.getMinuteOfHour()) + .plusMinutes(periodMinutes); + + Intent intent = new Intent(context, EnvironmentChangedReceiver.class); + intent.setAction(RemoteViewsFactory.ACTION_PERIODIC_ALARM); + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, + RemoteViewsFactory.REQUEST_CODE_PERIODIC_ALARM, + intent, + PendingIntent.FLAG_UPDATE_CURRENT); + AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + if (am != null) { + am.setInexactRepeating(AlarmManager.RTC, alarmTime.getMillis(), + TimeUnit.MINUTES.toMillis(periodMinutes), pendingIntent); + } + } + public static void forget() { registeredReceiver.set(null); } @@ -98,6 +129,9 @@ public void onReceive(Context context, Intent intent) { } gotoPosition(context, widgetId, position2); break; + case RemoteViewsFactory.ACTION_PERIODIC_ALARM: + updateAllWidgets(context); + break; default: int widgetId2 = intent == null ? 0 diff --git a/app/src/main/java/org/andstatus/todoagenda/RemoteViewsFactory.java b/app/src/main/java/org/andstatus/todoagenda/RemoteViewsFactory.java index fd3dfbc3..8d7b5f4a 100644 --- a/app/src/main/java/org/andstatus/todoagenda/RemoteViewsFactory.java +++ b/app/src/main/java/org/andstatus/todoagenda/RemoteViewsFactory.java @@ -54,11 +54,14 @@ public class RemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory private static final int REQUEST_CODE_EMPTY = 1; private static final int REQUEST_CODE_ADD_EVENT = 2; static final int REQUEST_CODE_MIDNIGHT_ALARM = REQUEST_CODE_ADD_EVENT + MAX_NUMBER_OF_WIDGETS; + static final int REQUEST_CODE_PERIODIC_ALARM = REQUEST_CODE_MIDNIGHT_ALARM + MAX_NUMBER_OF_WIDGETS; static final String EXTRA_WIDGET_LIST_POSITION1 = "widgetListPosition1"; static final String EXTRA_WIDGET_LIST_POSITION2 = "widgetListPosition2"; + private static final String PACKAGE = "org.andstatus.todoagenda"; static final String ACTION_GOTO_POSITIONS = PACKAGE + ".action.GOTO_TODAY"; static final String ACTION_REFRESH = PACKAGE + ".action.REFRESH"; + static final String ACTION_PERIODIC_ALARM = PACKAGE + ".action.PERIODIC_ALARM"; private final Context context; private final int widgetId; diff --git a/app/src/main/java/org/andstatus/todoagenda/prefs/AllSettings.java b/app/src/main/java/org/andstatus/todoagenda/prefs/AllSettings.java index d9f50b26..aec4f372 100644 --- a/app/src/main/java/org/andstatus/todoagenda/prefs/AllSettings.java +++ b/app/src/main/java/org/andstatus/todoagenda/prefs/AllSettings.java @@ -119,6 +119,7 @@ public static void saveFromApplicationPreferences(Context context, Integer widge settings.logMe(AllSettings.class, "saveFromApplicationPreferences put", widgetId); instances.put(widgetId, settings); } + EnvironmentChangedReceiver.registerReceivers(instances); } @NonNull diff --git a/app/src/main/java/org/andstatus/todoagenda/prefs/ApplicationPreferences.java b/app/src/main/java/org/andstatus/todoagenda/prefs/ApplicationPreferences.java index 66862589..dff3ba18 100644 --- a/app/src/main/java/org/andstatus/todoagenda/prefs/ApplicationPreferences.java +++ b/app/src/main/java/org/andstatus/todoagenda/prefs/ApplicationPreferences.java @@ -39,6 +39,8 @@ import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_MULTILINE_TITLE_DEFAULT; import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_PAST_EVENTS_BACKGROUND_COLOR; import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_PAST_EVENTS_BACKGROUND_COLOR_DEFAULT; +import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_REFRESH_PERIOD_MINUTES; +import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_REFRESH_PERIOD_MINUTES_DEFAULT; import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_SHOW_DATE_ON_WIDGET_HEADER; import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_SHOW_DAYS_WITHOUT_EVENTS; import static org.andstatus.todoagenda.prefs.InstanceSettings.PREF_SHOW_DAY_HEADERS; @@ -93,12 +95,13 @@ public static void fromInstanceSettings(Context context, Integer widgetId) { setString(context, PREF_DATE_FORMAT, settings.getDateFormat()); setAbbreviateDates(context, settings.getAbbreviateDates()); setLockedTimeZoneId(context, settings.getLockedTimeZoneId()); + setRefreshPeriodMinutes(context, settings.getRefreshPeriodMinutes()); setString(context, PREF_EVENT_ENTRY_LAYOUT, settings.getEventEntryLayout().value); setBoolean(context, PREF_MULTILINE_TITLE, settings.isMultilineTitle()); setBoolean(context, PREF_MULTILINE_DETAILS, settings.isMultilineDetails()); setBoolean(context, PREF_SHOW_ONLY_CLOSEST_INSTANCE_OF_RECURRING_EVENT, settings .getShowOnlyClosestInstanceOfRecurringEvent()); - setBoolean(context, PREF_HIDE_DUPLICATES, settings.getHideDuplicates()); + setHideDuplicates(context, settings.getHideDuplicates()); setBoolean(context, PREF_INDICATE_ALERTS, settings.getIndicateAlerts()); setBoolean(context, PREF_INDICATE_RECURRING, settings.getIndicateRecurring()); for (Map.Entry entry: settings.shadings.entrySet()) { @@ -117,7 +120,7 @@ public static void save(Context context, int wigdetId) { } public static int getWidgetId(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getInt(PREF_WIDGET_ID, 0); + return getInt(context, PREF_WIDGET_ID, 0); } public static void setWidgetId(Context context, int value) { @@ -163,8 +166,7 @@ public static void setEventsEnded(Context context, EndedSomeTimeAgo value) { } public static boolean getFillAllDayEvents(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_FILL_ALL_DAY, PREF_FILL_ALL_DAY_DEFAULT); + return getBoolean(context, PREF_FILL_ALL_DAY, PREF_FILL_ALL_DAY_DEFAULT); } private static void setFillAllDayEvents(Context context, boolean value) { @@ -180,32 +182,27 @@ private static void setHideBasedOnKeywords(Context context, String value) { } public static int getWidgetHeaderBackgroundColor(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getInt( - PREF_WIDGET_HEADER_BACKGROUND_COLOR, + return getInt(context, PREF_WIDGET_HEADER_BACKGROUND_COLOR, PREF_WIDGET_HEADER_BACKGROUND_COLOR_DEFAULT); } public static int getPastEventsBackgroundColor(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getInt( - PREF_PAST_EVENTS_BACKGROUND_COLOR, + return getInt(context, PREF_PAST_EVENTS_BACKGROUND_COLOR, PREF_PAST_EVENTS_BACKGROUND_COLOR_DEFAULT); } public static int getTodaysEventsBackgroundColor(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getInt( - PREF_TODAYS_EVENTS_BACKGROUND_COLOR, + return getInt(context, PREF_TODAYS_EVENTS_BACKGROUND_COLOR, PREF_TODAYS_EVENTS_BACKGROUND_COLOR_DEFAULT); } public static int getEventsBackgroundColor(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getInt( - PREF_EVENTS_BACKGROUND_COLOR, + return getInt(context, PREF_EVENTS_BACKGROUND_COLOR, PREF_EVENTS_BACKGROUND_COLOR_DEFAULT); } public static boolean getHorizontalLineBelowDayHeader(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_HORIZONTAL_LINE_BELOW_DAY_HEADER, false); + return getBoolean(context, PREF_HORIZONTAL_LINE_BELOW_DAY_HEADER, false); } private static void setHorizontalLineBelowDayHeader(Context context, boolean value) { @@ -213,8 +210,7 @@ private static void setHorizontalLineBelowDayHeader(Context context, boolean val } public static boolean getShowDaysWithoutEvents(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_DAYS_WITHOUT_EVENTS, false); + return getBoolean(context, PREF_SHOW_DAYS_WITHOUT_EVENTS, false); } private static void setShowDaysWithoutEvents(Context context, boolean value) { @@ -222,8 +218,7 @@ private static void setShowDaysWithoutEvents(Context context, boolean value) { } public static boolean getShowDayHeaders(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_DAY_HEADERS, true); + return getBoolean(context, PREF_SHOW_DAY_HEADERS, true); } private static void setShowDayHeaders(Context context, boolean value) { @@ -231,8 +226,7 @@ private static void setShowDayHeaders(Context context, boolean value) { } public static boolean getShowPastEventsUnderOneHeader(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_PAST_EVENTS_UNDER_ONE_HEADER, false); + return getBoolean(context, PREF_SHOW_PAST_EVENTS_UNDER_ONE_HEADER, false); } private static void setShowPastEventsUnderOneHeader(Context context, boolean value) { @@ -240,13 +234,11 @@ private static void setShowPastEventsUnderOneHeader(Context context, boolean val } public static boolean getShowEventIcon(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_EVENT_ICON, false); + return getBoolean(context, PREF_SHOW_EVENT_ICON, false); } public static boolean getShowNumberOfDaysToEvent(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_NUMBER_OF_DAYS_TO_EVENT, false); + return getBoolean(context, PREF_SHOW_NUMBER_OF_DAYS_TO_EVENT, false); } public static void setShowEventIcon(Context context, boolean value) { @@ -258,8 +250,7 @@ public static void setShowNumberOfDaysToEvent(Context context, boolean value) { } public static boolean getShowPastEventsWithDefaultColor(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_PAST_EVENTS_WITH_DEFAULT_COLOR, false); + return getBoolean(context, PREF_SHOW_PAST_EVENTS_WITH_DEFAULT_COLOR, false); } public static void setShowPastEventsWithDefaultColor(Context context, boolean value) { @@ -267,23 +258,19 @@ public static void setShowPastEventsWithDefaultColor(Context context, boolean va } public static boolean getShowEndTime(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_END_TIME, PREF_SHOW_END_TIME_DEFAULT); + return getBoolean(context, PREF_SHOW_END_TIME, PREF_SHOW_END_TIME_DEFAULT); } public static boolean getShowLocation(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_LOCATION, PREF_SHOW_LOCATION_DEFAULT); + return getBoolean(context, PREF_SHOW_LOCATION, PREF_SHOW_LOCATION_DEFAULT); } public static String getDateFormat(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getString( - PREF_DATE_FORMAT, PREF_DATE_FORMAT_DEFAULT); + return getString(context, PREF_DATE_FORMAT, PREF_DATE_FORMAT_DEFAULT); } public static boolean getAbbreviateDates(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_ABBREVIATE_DATES, PREF_ABBREVIATE_DATES_DEFAULT); + return getBoolean(context, PREF_ABBREVIATE_DATES, PREF_ABBREVIATE_DATES_DEFAULT); } public static void setAbbreviateDates(Context context, boolean value) { @@ -298,28 +285,36 @@ public static void setLockedTimeZoneId(Context context, String value) { setString(context, PREF_LOCKED_TIME_ZONE_ID, value); } + public static void setRefreshPeriodMinutes(Context context, int value) { + setString(context, PREF_REFRESH_PERIOD_MINUTES, Integer.toString(value > 0 + ? value + : PREF_REFRESH_PERIOD_MINUTES_DEFAULT)); + } + + public static int getRefreshPeriodMinutes(Context context) { + int stored = getIntStoredAsString(context, PREF_REFRESH_PERIOD_MINUTES, PREF_REFRESH_PERIOD_MINUTES_DEFAULT); + return stored > 0 ? stored : PREF_REFRESH_PERIOD_MINUTES_DEFAULT; + } + public static boolean isTimeZoneLocked(Context context) { return !TextUtils.isEmpty(getLockedTimeZoneId(context)); } public static EventEntryLayout getEventEntryLayout(Context context) { - return EventEntryLayout.fromValue(PreferenceManager.getDefaultSharedPreferences(context).getString( - PREF_EVENT_ENTRY_LAYOUT, "")); + return EventEntryLayout.fromValue( + getString(context, PREF_EVENT_ENTRY_LAYOUT, "")); } public static boolean isMultilineTitle(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_MULTILINE_TITLE, PREF_MULTILINE_TITLE_DEFAULT); + return getBoolean(context, PREF_MULTILINE_TITLE, PREF_MULTILINE_TITLE_DEFAULT); } public static boolean isMultilineDetails(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_MULTILINE_DETAILS, PREF_MULTILINE_DETAILS_DEFAULT); + return getBoolean(context, PREF_MULTILINE_DETAILS, PREF_MULTILINE_DETAILS_DEFAULT); } public static boolean getShowOnlyClosestInstanceOfRecurringEvent(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(PREF_SHOW_ONLY_CLOSEST_INSTANCE_OF_RECURRING_EVENT, false); + return getBoolean(context, PREF_SHOW_ONLY_CLOSEST_INSTANCE_OF_RECURRING_EVENT, false); } public static void setShowOnlyClosestInstanceOfRecurringEvent(Context context, boolean value) { @@ -327,7 +322,7 @@ public static void setShowOnlyClosestInstanceOfRecurringEvent(Context context, b } public static boolean getHideDuplicates(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PREF_HIDE_DUPLICATES, false); + return getBoolean(context, PREF_HIDE_DUPLICATES, false); } public static void setHideDuplicates(Context context, boolean value) { @@ -341,6 +336,17 @@ private static void setString(Context context, String key, String value) { editor.apply(); } + public static int getIntStoredAsString(Context context, String key, int defaultValue) { + try { + String stringValue = getString(context, key, ""); + if (TextUtils.isEmpty(stringValue)) return defaultValue; + + return Integer.parseInt(stringValue); + } catch (Exception e) { + return defaultValue; + } + } + public static String getString(Context context, String key, String defaultValue) { return PreferenceManager.getDefaultSharedPreferences(context).getString(key, defaultValue); } @@ -363,6 +369,11 @@ private static void setInt(Context context, String key, int value) { editor.apply(); } + public static int getInt(Context context, String key, int defaultValue) { + return PreferenceManager.getDefaultSharedPreferences(context) + .getInt(key, defaultValue); + } + public static String getWidgetInstanceName(Context context) { return getString(context, PREF_WIDGET_INSTANCE_NAME, ""); } diff --git a/app/src/main/java/org/andstatus/todoagenda/prefs/InstanceSettings.java b/app/src/main/java/org/andstatus/todoagenda/prefs/InstanceSettings.java index 3dccf3df..388a74b9 100644 --- a/app/src/main/java/org/andstatus/todoagenda/prefs/InstanceSettings.java +++ b/app/src/main/java/org/andstatus/todoagenda/prefs/InstanceSettings.java @@ -6,6 +6,9 @@ import android.util.Log; import android.view.ContextThemeWrapper; +import androidx.annotation.ColorInt; +import androidx.annotation.NonNull; + import org.andstatus.todoagenda.Alignment; import org.andstatus.todoagenda.EndedSomeTimeAgo; import org.andstatus.todoagenda.TextShading; @@ -28,9 +31,6 @@ import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; -import androidx.annotation.ColorInt; -import androidx.annotation.NonNull; - import static org.andstatus.todoagenda.prefs.SettingsStorage.saveJson; /** @@ -145,6 +145,9 @@ public class InstanceSettings { static final String PREF_LOCK_TIME_ZONE = "lockTimeZone"; static final String PREF_LOCKED_TIME_ZONE_ID = "lockedTimeZoneId"; private String lockedTimeZoneId = ""; + public final static String PREF_REFRESH_PERIOD_MINUTES = "refreshPeriodMinutes"; + public final static int PREF_REFRESH_PERIOD_MINUTES_DEFAULT = 10; + private int refreshPeriodMinutes = PREF_REFRESH_PERIOD_MINUTES_DEFAULT; public static InstanceSettings fromJson(Context context, JSONObject json) throws JSONException { InstanceSettings settings = new InstanceSettings(context, json.optInt(PREF_WIDGET_ID), @@ -224,6 +227,9 @@ private InstanceSettings setFromJson(JSONObject json) { if (json.has(PREF_LOCKED_TIME_ZONE_ID)) { setLockedTimeZoneId(json.getString(PREF_LOCKED_TIME_ZONE_ID)); } + if (json.has(PREF_REFRESH_PERIOD_MINUTES)) { + setRefreshPeriodMinutes(json.getInt(PREF_REFRESH_PERIOD_MINUTES)); + } if (json.has(PREF_EVENT_ENTRY_LAYOUT)) { eventEntryLayout = EventEntryLayout.fromValue(json.getString(PREF_EVENT_ENTRY_LAYOUT)); } @@ -295,6 +301,7 @@ static InstanceSettings fromApplicationPreferences(Context context, int widgetId settings.dateFormat = ApplicationPreferences.getDateFormat(context); settings.abbreviateDates = ApplicationPreferences.getAbbreviateDates(context); settings.setLockedTimeZoneId(ApplicationPreferences.getLockedTimeZoneId(context)); + settings.setRefreshPeriodMinutes(ApplicationPreferences.getRefreshPeriodMinutes(context)); settings.eventEntryLayout = ApplicationPreferences.getEventEntryLayout(context); settings.multilineTitle = ApplicationPreferences.isMultilineTitle(context); settings.multilineDetails = ApplicationPreferences.isMultilineDetails(context); @@ -372,6 +379,7 @@ public JSONObject toJson() { json.put(PREF_DATE_FORMAT, dateFormat); json.put(PREF_ABBREVIATE_DATES, abbreviateDates); json.put(PREF_LOCKED_TIME_ZONE_ID, lockedTimeZoneId); + json.put(PREF_REFRESH_PERIOD_MINUTES, refreshPeriodMinutes); json.put(PREF_EVENT_ENTRY_LAYOUT, eventEntryLayout.value); json.put(PREF_MULTILINE_TITLE, multilineTitle); json.put(PREF_MULTILINE_DETAILS, multilineDetails); @@ -502,6 +510,16 @@ public String getLockedTimeZoneId() { return lockedTimeZoneId; } + public void setRefreshPeriodMinutes(int refreshPeriodMinutes) { + if (refreshPeriodMinutes > 0) { + this.refreshPeriodMinutes = refreshPeriodMinutes; + } + } + + public int getRefreshPeriodMinutes() { + return refreshPeriodMinutes; + } + public boolean isTimeZoneLocked() { return !TextUtils.isEmpty(lockedTimeZoneId); } diff --git a/app/src/main/java/org/andstatus/todoagenda/prefs/OtherPreferencesFragment.java b/app/src/main/java/org/andstatus/todoagenda/prefs/OtherPreferencesFragment.java index e737d1dc..a83aa7e8 100644 --- a/app/src/main/java/org/andstatus/todoagenda/prefs/OtherPreferencesFragment.java +++ b/app/src/main/java/org/andstatus/todoagenda/prefs/OtherPreferencesFragment.java @@ -3,6 +3,7 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.CheckBoxPreference; +import android.preference.EditTextPreference; import android.preference.Preference; import android.preference.PreferenceFragment; import android.preference.PreferenceScreen; @@ -28,6 +29,7 @@ public void onResume() { super.onResume(); showLockTimeZone(true); showWidgetInstanceName(); + showRefreshPeriod(); getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this); } @@ -47,6 +49,15 @@ private void showLockTimeZone(boolean setAlso) { } } + private void showRefreshPeriod() { + EditTextPreference preference = (EditTextPreference) findPreference(InstanceSettings.PREF_REFRESH_PERIOD_MINUTES); + + if (preference != null) { + int value = ApplicationPreferences.getRefreshPeriodMinutes(getActivity()); + preference.setSummary(String.format(getText(R.string.refresh_period_minutes_desc).toString(), value)); + } + } + @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { switch (preference.getKey()) { @@ -78,6 +89,9 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin startActivity(MainActivity.intentToConfigure(getActivity(), ApplicationPreferences .getWidgetId(getActivity()))); break; + case InstanceSettings.PREF_REFRESH_PERIOD_MINUTES: + showRefreshPeriod(); + break; default: break; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2d6f743d..3c79abf2 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -198,6 +198,10 @@ Show only the closest instance of a recurring event Hide duplicates + + Auto refresh period, minutes + Automatically refresh the widget every %d minute(s) + Feedback and Backup Get in touch with us, backup and restore settings diff --git a/app/src/main/res/xml/preferences_other.xml b/app/src/main/res/xml/preferences_other.xml index 613e894c..0340db1f 100644 --- a/app/src/main/res/xml/preferences_other.xml +++ b/app/src/main/res/xml/preferences_other.xml @@ -36,4 +36,9 @@ android:title="@string/lock_time_zone_title"> + +