diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt index dc164a652..95d3a1175 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/EventActivity.kt @@ -47,8 +47,8 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { } else { mEvent = Event() mReminder1Minutes = config.defaultReminderMinutes - mReminder2Minutes = 0 - mReminder3Minutes = 0 + mReminder2Minutes = -1 + mReminder3Minutes = -1 val startTS = intent.getIntExtra(NEW_EVENT_START_TS, 0) if (startTS == 0) return @@ -56,9 +56,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { setupNewEvent(Formatter.getDateTimeFromTS(startTS)) } - updateReminder1Text() - updateReminder2Text() - updateReminder3Text() + checkReminderTexts() updateRepetitionText() updateStartDate() updateStartTime() @@ -113,21 +111,21 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { private fun showReminder1Dialog() { EventReminderDialog(this, mReminder1Minutes) { mReminder1Minutes = it - updateReminder1Text() + checkReminderTexts() } } private fun showReminder2Dialog() { EventReminderDialog(this, mReminder2Minutes) { mReminder2Minutes = it - updateReminder2Text() + checkReminderTexts() } } private fun showReminder3Dialog() { EventReminderDialog(this, mReminder3Minutes) { mReminder3Minutes = it - updateReminder3Text() + checkReminderTexts() } } @@ -171,16 +169,45 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener { } } + private fun checkReminderTexts() { + updateReminder1Text() + updateReminder2Text() + updateReminder3Text() + } + private fun updateReminder1Text() { event_reminder_1.text = getReminderText(mReminder1Minutes) + if (mReminder1Minutes == REMINDER_OFF) { + mReminder2Minutes = REMINDER_OFF + mReminder3Minutes = REMINDER_OFF + } } private fun updateReminder2Text() { - event_reminder_2.text = getReminderText(mReminder2Minutes) + event_reminder_2.apply { + beGoneIf(mReminder1Minutes == REMINDER_OFF) + if (mReminder2Minutes == REMINDER_OFF) { + text = resources.getString(R.string.add_another_reminder) + alpha = 0.4f + mReminder3Minutes = REMINDER_OFF + } else { + text = getReminderText(mReminder2Minutes) + alpha = 1f + } + } } private fun updateReminder3Text() { - event_reminder_2.text = getReminderText(mReminder3Minutes) + event_reminder_3.apply { + beGoneIf(mReminder2Minutes == REMINDER_OFF || mReminder1Minutes == REMINDER_OFF) + if (mReminder3Minutes == REMINDER_OFF) { + text = resources.getString(R.string.add_another_reminder) + alpha = 0.4f + } else { + text = getReminderText(mReminder3Minutes) + alpha = 1f + } + } } private fun updateRepetitionText() { diff --git a/app/src/main/res/layout/activity_event.xml b/app/src/main/res/layout/activity_event.xml index 794fbe41a..add983671 100644 --- a/app/src/main/res/layout/activity_event.xml +++ b/app/src/main/res/layout/activity_event.xml @@ -169,8 +169,8 @@ android:layout_toEndOf="@+id/event_reminder_image" android:layout_toRightOf="@+id/event_reminder_image" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/normal_margin" - android:paddingTop="@dimen/normal_margin" + android:paddingBottom="@dimen/activity_margin" + android:paddingTop="@dimen/activity_margin" android:textSize="@dimen/day_text_size"/> @@ -197,8 +197,8 @@ android:layout_below="@+id/event_reminder_2" android:alpha="0.4" android:background="?attr/selectableItemBackground" - android:paddingBottom="@dimen/normal_margin" - android:paddingTop="@dimen/normal_margin" + android:paddingBottom="@dimen/activity_margin" + android:paddingTop="@dimen/activity_margin" android:text="@string/add_another_reminder" android:textSize="@dimen/day_text_size" android:visibility="gone"/>