add a repeat interval picker dialog
This commit is contained in:
parent
af885f2b16
commit
83594dd47e
|
@ -9,6 +9,7 @@ import android.view.MenuItem
|
|||
import android.view.WindowManager
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.dialogs.EventReminderDialog
|
||||
import com.simplemobiletools.calendar.dialogs.EventRepeatIntervalDialog
|
||||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.extensions.getAppropriateTheme
|
||||
import com.simplemobiletools.calendar.extensions.scheduleNotification
|
||||
|
@ -102,7 +103,10 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||
}
|
||||
|
||||
private fun showRepeatIntervalDialog() {
|
||||
|
||||
EventRepeatIntervalDialog(this, mRepeatInterval) {
|
||||
mRepeatInterval = it
|
||||
updateRepetitionText()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateReminderText() {
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.simplemobiletools.calendar.dialogs
|
||||
|
||||
import android.app.Activity
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.RadioGroup
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.helpers.*
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import kotlinx.android.synthetic.main.dialog_change_views.view.*
|
||||
|
||||
class EventRepeatIntervalDialog(val activity: Activity, val repeatInterval: Int, val callback: (mins: Int) -> Unit) : AlertDialog.Builder(activity),
|
||||
RadioGroup.OnCheckedChangeListener {
|
||||
val dialog: AlertDialog?
|
||||
|
||||
init {
|
||||
val view = LayoutInflater.from(activity).inflate(R.layout.dialog_event_repeat_interval, null).dialog_radio_view.apply {
|
||||
check(getCheckedItem())
|
||||
setOnCheckedChangeListener(this@EventRepeatIntervalDialog)
|
||||
}
|
||||
|
||||
dialog = AlertDialog.Builder(activity)
|
||||
.create().apply {
|
||||
activity.setupDialogStuff(view, this, R.string.select_repeat_interval)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCheckedItem() = when (repeatInterval) {
|
||||
DAY -> R.id.dialog_radio_daily
|
||||
WEEK -> R.id.dialog_radio_weekly
|
||||
BIWEEK -> R.id.dialog_radio_biweekly
|
||||
MONTH -> R.id.dialog_radio_monthly
|
||||
YEAR -> R.id.dialog_radio_yearly
|
||||
else -> R.id.dialog_radio_no_repetition
|
||||
}
|
||||
|
||||
override fun onCheckedChanged(group: RadioGroup?, checkedId: Int) {
|
||||
callback.invoke(getSelectionValue(checkedId))
|
||||
dialog?.dismiss()
|
||||
}
|
||||
|
||||
private fun getSelectionValue(id: Int) = when (id) {
|
||||
R.id.dialog_radio_daily -> DAY
|
||||
R.id.dialog_radio_weekly -> WEEK
|
||||
R.id.dialog_radio_biweekly -> BIWEEK
|
||||
R.id.dialog_radio_monthly -> MONTH
|
||||
R.id.dialog_radio_yearly -> YEAR
|
||||
else -> 0
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RadioGroup
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dialog_radio_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/dialog_radio_no_repetition"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/no_repetition"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/dialog_radio_daily"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/daily"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/dialog_radio_weekly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/weekly"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/dialog_radio_biweekly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/biweekly"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/dialog_radio_monthly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/monthly"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||
android:id="@+id/dialog_radio_yearly"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:text="@string/yearly"/>
|
||||
</RadioGroup>
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Termin erfolgreich hinzugefügt</string>
|
||||
<string name="past_event_added">Termin erfolgreich in der Vergangenheit hinzugefügt</string>
|
||||
<string name="event_updated">Termin erfolgreich aktualisiert</string>
|
||||
<string name="reminder">Erinnerung</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Zu Beginn</string>
|
||||
<string name="custom">Benutzerdefiniert</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Wiederholung</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Täglich</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Erinnerung</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Zu Beginn</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Benutzerdefiniert</string>
|
||||
<string name="before">vorher</string>
|
||||
<string name="minutes">Minuten</string>
|
||||
<string name="hours">Stunden</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">El evento se ha añadido con éxito</string>
|
||||
<string name="past_event_added">El evento en el pasado se ha añadido con éxito</string>
|
||||
<string name="event_updated">El evento se ha actualizado con éxito</string>
|
||||
<string name="reminder">Recordatorio</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Al inicio</string>
|
||||
<string name="custom">Personalizado</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Repetición</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Diario</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Recordatorio</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Al inicio</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Personalizado</string>
|
||||
<string name="before">antes de</string>
|
||||
<string name="minutes">minutos</string>
|
||||
<string name="hours">horas</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Evénement ajouté avec succès</string>
|
||||
<string name="past_event_added">Evénement dans le passé ajouté avec succès</string>
|
||||
<string name="event_updated">Evénement ajouté avec succès</string>
|
||||
<string name="reminder">Rappel</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Au démarrage</string>
|
||||
<string name="custom">Personnalisé</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Répétition</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Quotidienne</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Rappel</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Au démarrage</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Personnalisé</string>
|
||||
<string name="before">avant</string>
|
||||
<string name="minutes">minutes</string>
|
||||
<string name="hours">heures</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">इवेंट सफलतापूर्वक जोड़ा गया</string>
|
||||
<string name="past_event_added">भुत में इवेंट सफलतापूर्वक जोड़ा गया</string>
|
||||
<string name="event_updated">इवेंट सफलतापूर्वक अपडेट किया गया</string>
|
||||
<string name="reminder">रिमाइंडर</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">शुरुआत के समय</string>
|
||||
<string name="custom">Custom</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">दुहराव</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">रोज</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">रिमाइंडर</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">शुरुआत के समय</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Custom</string>
|
||||
<string name="before">before</string>
|
||||
<string name="minutes">minutes</string>
|
||||
<string name="hours">hours</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Bejegyzés hozzáadva</string>
|
||||
<string name="past_event_added">Korábbi bejegyzés hozzáadva</string>
|
||||
<string name="event_updated">Bejegyzés frissítve</string>
|
||||
<string name="reminder">Emlékeztető</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">A kezdetekor</string>
|
||||
<string name="custom">Egyedi</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Ismétlés</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Naponta</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Emlékeztető</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">A kezdetekor</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Egyedi</string>
|
||||
<string name="before">korábban</string>
|
||||
<string name="minutes">perccel</string>
|
||||
<string name="hours">órával</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Evento aggiunto correttamente</string>
|
||||
<string name="past_event_added">Event in the past added successfully</string>
|
||||
<string name="event_updated">Evento aggiornato correttamente</string>
|
||||
<string name="reminder">Promemoria</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">All\'inizio</string>
|
||||
<string name="custom">Custom</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Repetition</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Daily</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Promemoria</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">All\'inizio</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Custom</string>
|
||||
<string name="before">before</string>
|
||||
<string name="minutes">minutes</string>
|
||||
<string name="hours">hours</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">האירוע הוסף בהצלחה</string>
|
||||
<string name="past_event_added">אירוע בעבר הוסף בהצלחה</string>
|
||||
<string name="event_updated">האירוע עודכן בהצלחה</string>
|
||||
<string name="reminder">תזכורת</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">בהתחלה</string>
|
||||
<string name="custom">מותאם אישית</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Repetition</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">יום-יומית</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">תזכורת</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">בהתחלה</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">מותאם אישית</string>
|
||||
<string name="before">לפני</string>
|
||||
<string name="minutes">דקות</string>
|
||||
<string name="hours">שעות</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">イベントを正常に追加しました</string>
|
||||
<string name="past_event_added">過去のイベントを正常に追加しました</string>
|
||||
<string name="event_updated">イベントを正常に更新しました</string>
|
||||
<string name="reminder">リマインダー</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">開始時</string>
|
||||
<string name="custom">カスタム</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">繰り返し</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">毎日</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">リマインダー</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">開始時</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">カスタム</string>
|
||||
<string name="before">前</string>
|
||||
<string name="minutes">分</string>
|
||||
<string name="hours">時間</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Evento adicionado com sucesso</string>
|
||||
<string name="past_event_added">Evento no passado adicionado com sucesso</string>
|
||||
<string name="event_updated">Evento atualizado com sucesso</string>
|
||||
<string name="reminder">Lembrete</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">No início</string>
|
||||
<string name="custom">Personalizado</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Repetição</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Diária</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Lembrete</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">No início</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Personalizado</string>
|
||||
<string name="before">antes</string>
|
||||
<string name="minutes">minutos</string>
|
||||
<string name="hours">horas</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Событие успешно добавлено</string>
|
||||
<string name="past_event_added">Событие в прошлом успешно создано</string>
|
||||
<string name="event_updated">Событие успешно обновлено</string>
|
||||
<string name="reminder">Напоминание</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">С наступлением события</string>
|
||||
<string name="custom">Настраиваемое</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Повторять</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Ежедневно</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Напоминание</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">С наступлением события</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Настраиваемое</string>
|
||||
<string name="before">до события</string>
|
||||
<string name="minutes">минут</string>
|
||||
<string name="hours">часов</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Händelsen tillagd</string>
|
||||
<string name="past_event_added">Händelsen ät tillagd</string>
|
||||
<string name="event_updated">Händelsen uppdaterad</string>
|
||||
<string name="reminder">Påminnelse</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Vid start</string>
|
||||
<string name="custom">Egen</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Repetition</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Dagligen</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Påminnelse</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">Vid start</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Egen</string>
|
||||
<string name="before">före</string>
|
||||
<string name="minutes">minuter</string>
|
||||
<string name="hours">timmar</string>
|
||||
|
|
|
@ -25,10 +25,9 @@
|
|||
<string name="event_added">Event added successfully</string>
|
||||
<string name="past_event_added">Event in the past added successfully</string>
|
||||
<string name="event_updated">Event updated successfully</string>
|
||||
<string name="reminder">Reminder</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">At start</string>
|
||||
<string name="custom">Custom</string>
|
||||
|
||||
<!-- Event Repetition -->
|
||||
<string name="select_repeat_interval">Select a repeat interval</string>
|
||||
<string name="repetition">Repetition</string>
|
||||
<string name="no_repetition">No repetition</string>
|
||||
<string name="daily">Daily</string>
|
||||
|
@ -39,8 +38,12 @@
|
|||
|
||||
<!-- Event Reminders -->
|
||||
<string name="select_event_reminder">Select an event reminder</string>
|
||||
<string name="reminder">Reminder</string>
|
||||
<string name="no_reminder">No reminder</string>
|
||||
<string name="at_start">At start</string>
|
||||
<string name="mins_before_10">10 minutes before</string>
|
||||
<string name="mins_before_30">30 minutes before</string>
|
||||
<string name="custom">Custom</string>
|
||||
<string name="before">before</string>
|
||||
<string name="minutes">minutes</string>
|
||||
<string name="hours">hours</string>
|
||||
|
|
Loading…
Reference in New Issue