diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt index 0fea0b14a..abc541e7c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/SettingsActivity.kt @@ -20,14 +20,11 @@ import com.google.api.client.util.ExponentialBackOff import com.google.api.services.calendar.CalendarScopes import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.asynctasks.FetchGoogleEventsTask +import com.simplemobiletools.calendar.dialogs.EventReminderDialog import com.simplemobiletools.calendar.extensions.config -import com.simplemobiletools.calendar.extensions.getDefaultReminderTypeIndex -import com.simplemobiletools.calendar.extensions.getDefaultReminderValue -import com.simplemobiletools.calendar.extensions.setupReminderPeriod -import com.simplemobiletools.calendar.helpers.DAY_MINS -import com.simplemobiletools.calendar.helpers.HOUR_MINS -import com.simplemobiletools.calendar.helpers.REMINDER_CUSTOM -import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.calendar.extensions.getReminderText +import com.simplemobiletools.commons.extensions.toast +import com.simplemobiletools.commons.extensions.updateTextColors import kotlinx.android.synthetic.main.activity_settings.* class SettingsActivity : SimpleActivity() { @@ -169,45 +166,17 @@ class SettingsActivity : SimpleActivity() { } private fun setupEventReminder() { - val reminderType = config.defaultReminderType - settings_default_reminder.setSelection(getDefaultReminderTypeIndex()) - custom_reminder_save.setTextColor(custom_reminder_other_val.currentTextColor) - setupReminderPeriod(custom_reminder_other_period, custom_reminder_value) - - settings_custom_reminder_holder.beVisibleIf(reminderType == REMINDER_CUSTOM) - custom_reminder_save.setOnClickListener { saveReminder() } - - settings_default_reminder.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { - override fun onItemSelected(p0: AdapterView<*>?, p1: View?, itemIndex: Int, p3: Long) { - settings_custom_reminder_holder.beVisibleIf(itemIndex == 2) - if (itemIndex == 2) { - showKeyboard(custom_reminder_value) - } else { - hideKeyboard() - } - - config.defaultReminderType = getDefaultReminderValue(itemIndex) - } - - override fun onNothingSelected(p0: AdapterView<*>?) { + var reminderMinutes = config.defaultReminderMinutes + settings_default_reminder.text = getReminderText(reminderMinutes) + settings_default_reminder_holder.setOnClickListener { + EventReminderDialog(this, reminderMinutes) { + config.defaultReminderMinutes = it + reminderMinutes = it + settings_default_reminder.text = getReminderText(it) } } } - private fun saveReminder() { - val multiplier = when (custom_reminder_other_period.selectedItemPosition) { - 1 -> HOUR_MINS - 2 -> DAY_MINS - else -> 1 - } - - val value = custom_reminder_value.value - config.defaultReminderMinutes = Integer.valueOf(if (value.isEmpty()) "0" else value) * multiplier - config.defaultReminderType = REMINDER_CUSTOM - toast(R.string.reminder_saved) - hideKeyboard() - } - private fun getWeeklyAdapter(): ArrayAdapter { val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item) for (i in 0..24) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt index 561e42376..d8dd7d5b0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Context.kt @@ -109,14 +109,6 @@ fun Context.getDefaultReminderTypeIndex(): Int { } } -fun Context.getDefaultReminderValue(index: Int): Int { - return when (index) { - 0 -> REMINDER_OFF - 1 -> REMINDER_AT_START - else -> REMINDER_CUSTOM - } -} - fun Context.setupReminderPeriod(otherPeriod: AppCompatSpinner, otherValue: EditText) { val mins = config.defaultReminderMinutes var value = mins diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index f58c33cd8..499a0009c 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -211,10 +211,10 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/medium_margin" - android:paddingBottom="@dimen/activity_margin" + android:paddingBottom="@dimen/bigger_margin" android:paddingLeft="@dimen/activity_margin" - android:paddingRight="@dimen/medium_margin" - android:paddingTop="@dimen/activity_margin"> + android:paddingRight="@dimen/activity_margin" + android:paddingTop="@dimen/bigger_margin"> - + android:layout_marginEnd="@dimen/small_margin" + android:layout_marginRight="@dimen/small_margin" + android:background="@null" + android:clickable="false"/> - - - - - - - - - - - - - - diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f36c789c8..98186e3ea 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -90,7 +90,6 @@ Vibration ein bei Errinerung Erinnerungs Ton Standard Termin Erinnerung - Erinnerung gespeichert Benachrichtigungs Ton No app capable of setting ringtone found Kein Klingelton gewählt diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 7ee2763dd..46aa6e03f 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -90,7 +90,6 @@ Vibrate on reminder notification Reminder sound Recordatorio predeterminado de un evento - Recordatorio guardado Notification sound No app capable of setting ringtone found None diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index d2b274f4c..ae5af08c7 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -90,7 +90,6 @@ Vibrer à la notification de rappel Son de rappel Rappel d\'événement par défaut - Rappel sauvegardé Son de notification Aucune application capable de configurer la sonnerie trouvée None diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index 5bb8773e4..39a0c10f6 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -90,7 +90,6 @@ Vibrate on reminder notification Reminder sound Default event reminder - Reminder saved Notification sound No app capable of setting ringtone found None diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 07395f7a7..adc8fcb45 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -90,7 +90,6 @@ Emlékeztetőnél rezgés Reminder sound Alapértelmezett emlékeztetés - Emlékeztető elmentve Notification sound No app capable of setting ringtone found None diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 2853ad303..02abe17aa 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -90,7 +90,6 @@ Vibrate on reminder notification Reminder sound Default event reminder - Reminder saved Notification sound No app capable of setting ringtone found None diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 2b0b275d4..9bcd7433b 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -90,7 +90,6 @@ רטט בהתראת תזכורת צליל תזכורת תזכורת קבועה לאירוע - התזכורת נשמרה צליל התראה לא נמצאה אפליקציה להגדרת רינגטון ללא diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index a64c08c42..af609c085 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -90,7 +90,6 @@ リマインダー通知で振動 Reminder sound デフォルトのイベント リマインダー - リマインダーを保存しました Notification sound No app capable of setting ringtone found None diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index e5825a9ec..4bfc561ed 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -90,7 +90,6 @@ Vibrar ao notificar sobre o lembrete Som do lembrete Lembrete padrão - Lembrete guardado Som da notificação Não foi encontrada qualquer aplicação capaz de definir o som Nenhum diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 9a49ff1c0..a5cf4721b 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -90,7 +90,6 @@ Вибрация при напоминании Звук напоминания Напоминание для событий по умолчанию - Напоминание сохранено Звук уведомления Не найдено приложение для выбора рингтона Нет diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index 6e554a6fa..7799325ed 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -90,7 +90,6 @@ Vibrera vid påminnelseaviseringen Påminnelseljud Standard händelsepåminnare - Påminnelse sparad Aviseringsljud Hittade ingen app som kan ställa in ljudet Ingen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 18f6a737a..519139c3c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -90,7 +90,6 @@ Vibrate on reminder notification Reminder sound Default event reminder - Reminder saved Notification sound No app capable of setting ringtone found None