fix #34, remember last value inserted at reminder minutes

This commit is contained in:
tibbi 2016-10-15 00:00:06 +02:00
parent 85484be708
commit c4f9aa46a8
3 changed files with 18 additions and 0 deletions

View File

@ -48,4 +48,12 @@ public class Config {
public void setDisplayWeekNumbers(boolean displayWeekNumbers) {
mPrefs.edit().putBoolean(Constants.WEEK_NUMBERS, displayWeekNumbers).apply();
}
public int getLastOtherReminderMins() {
return mPrefs.getInt(Constants.LAST_OTHER_REMINDER_MINS, 10);
}
public void setLastOtherReminderMins(int lastMins) {
mPrefs.edit().putInt(Constants.LAST_OTHER_REMINDER_MINS, lastMins).apply();
}
}

View File

@ -21,4 +21,5 @@ public class Constants {
public static final String WEEK_NUMBERS = "week_numbers";
public static final String WIDGET_BG_COLOR = "widget_bg_color";
public static final String WIDGET_TEXT_COLOR = "widget_text_color";
public static final String LAST_OTHER_REMINDER_MINS = "last_other_reminder_mins";
}

View File

@ -93,6 +93,7 @@ class EventActivity : SimpleActivity(), DBHelper.DBOperationsListener {
title = resources.getString(R.string.new_event)
mEventStartDateTime = Formatter.getDateTimeFromCode(dayCode).withZoneRetainFields(DateTimeZone.getDefault()).withHourOfDay(13)
mEventEndDateTime = mEventStartDateTime
event_reminder_other.setText(mConfig.lastOtherReminderMins.toString())
}
private fun hideKeyboard() {
@ -211,6 +212,14 @@ class EventActivity : SimpleActivity(), DBHelper.DBOperationsListener {
} else {
dbHelper.update(mEvent)
}
saveLastReminderMins()
}
private fun saveLastReminderMins() {
if (event_reminder.selectedItemPosition == 2) {
mConfig.lastOtherReminderMins = reminderMinutes
}
}
private val reminderMinutes: Int