From 6001d8422a91e396a7dd8799d54052e036fef39f Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 24 Oct 2018 20:48:50 +0200 Subject: [PATCH] add a button to the event type picker for selecting a custom color --- app/build.gradle | 2 +- .../dialogs/SelectEventTypeColorDialog.kt | 19 ++++++-- .../layout/dialog_select_event_type_color.xml | 43 +++++++++++++++++++ app/src/main/res/values-az/strings.xml | 1 + app/src/main/res/values-br/strings.xml | 1 + app/src/main/res/values-cs/strings.xml | 1 + app/src/main/res/values-da/strings.xml | 1 + app/src/main/res/values-de/strings.xml | 1 + app/src/main/res/values-el/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-gl/strings.xml | 1 + app/src/main/res/values-hi-rIN/strings.xml | 1 + app/src/main/res/values-hr/strings.xml | 1 + app/src/main/res/values-hu/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values-iw/strings.xml | 1 + app/src/main/res/values-ja/strings.xml | 1 + app/src/main/res/values-ko/strings.xml | 1 + app/src/main/res/values-lt/strings.xml | 1 + app/src/main/res/values-nb/strings.xml | 1 + app/src/main/res/values-nl/strings.xml | 1 + app/src/main/res/values-no/strings.xml | 1 + app/src/main/res/values-pl/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-pt/strings.xml | 1 + app/src/main/res/values-ru/strings.xml | 1 + app/src/main/res/values-sk/strings.xml | 1 + app/src/main/res/values-sv/strings.xml | 1 + app/src/main/res/values-tr/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 32 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 app/src/main/res/layout/dialog_select_event_type_color.xml diff --git a/app/build.gradle b/app/build.gradle index 1c856a5df..284049e06 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.2.2' + implementation 'com.simplemobiletools:commons:5.2.3' implementation 'joda-time:joda-time:2.9.9' implementation 'com.facebook.stetho:stetho:1.5.0' implementation 'androidx.multidex:multidex:2.0.0' diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/SelectEventTypeColorDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/SelectEventTypeColorDialog.kt index 922390560..274b46b76 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/SelectEventTypeColorDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/dialogs/SelectEventTypeColorDialog.kt @@ -9,9 +9,10 @@ import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.extensions.config import com.simplemobiletools.calendar.helpers.CalDAVHandler import com.simplemobiletools.calendar.models.EventType +import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.extensions.setFillWithStroke import com.simplemobiletools.commons.extensions.setupDialogStuff -import kotlinx.android.synthetic.main.dialog_select_radio_group.view.* +import kotlinx.android.synthetic.main.dialog_select_event_type_color.view.* import kotlinx.android.synthetic.main.radio_button_with_color.view.* class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventType, val callback: (color: Int) -> Unit) { @@ -21,8 +22,11 @@ class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventTyp private val colors = CalDAVHandler(activity.applicationContext).getAvailableCalDAVCalendarColors(eventType) init { - val view = activity.layoutInflater.inflate(R.layout.dialog_select_radio_group, null) as ViewGroup - radioGroup = view.dialog_radio_group + val view = activity.layoutInflater.inflate(R.layout.dialog_select_event_type_color, null) as ViewGroup + radioGroup = view.dialog_select_event_type_color_radio + view.dialog_select_event_type_other_value.setOnClickListener { + showCustomColorPicker() + } colors.forEachIndexed { index, value -> addRadioButton(index, value) @@ -57,4 +61,13 @@ class SelectEventTypeColorDialog(val activity: Activity, val eventType: EventTyp callback(colors[colorKey]) dialog?.dismiss() } + + private fun showCustomColorPicker() { + ColorPickerDialog(activity, activity.config.primaryColor) { wasPositivePressed, color -> + if (wasPositivePressed) { + callback(color) + dialog?.dismiss() + } + } + } } diff --git a/app/src/main/res/layout/dialog_select_event_type_color.xml b/app/src/main/res/layout/dialog_select_event_type_color.xml new file mode 100644 index 000000000..7d1d662fa --- /dev/null +++ b/app/src/main/res/layout/dialog_select_event_type_color.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index 88ed4c034..87f6a705e 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -182,6 +182,7 @@ Təqvimi dəyişmək alınmadı Sinxronlaşdırılır… Sinxronlaşma bitdi + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-br/strings.xml b/app/src/main/res/values-br/strings.xml index 7389f6602..c95a1cc82 100644 --- a/app/src/main/res/values-br/strings.xml +++ b/app/src/main/res/values-br/strings.xml @@ -182,6 +182,7 @@ C\'hwitadenn en ur embann an deiziataer O c\'houbredañ… Echuet gant ar goubredañ + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 456a9eedc..ea686370f 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -182,6 +182,7 @@ Editování kalendáře se nezdařilo Synchronizuji… Synchronizace dokončena + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 8c56dba89..4c034c272 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -182,6 +182,7 @@ Redigering af kalenderen mislykkedes Synkroniserer… Synkronisering gennemført + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 8bd150937..937242a91 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -182,6 +182,7 @@ Ändern des Kalenders fehlgeschlagen Wird synchronisiert… Synchronisation erfolgreich + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index 65f68008f..5b24ea7e2 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -182,6 +182,7 @@ Η επεξεργασία του ημερολογίου απέτυχε Συγχρονισμός… Ο συγχρονισμός ολοκληρώθηκε + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 2ba93abd5..4df453bf1 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -182,6 +182,7 @@ Edición de calendario fallida Sincronizando… Sincronización completa + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 6507e2f4a..3c2dd738a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -182,6 +182,7 @@ Édition du calendrier échouée Synchronisation… Synchronisation terminée + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 07924a24b..70f94bad3 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -182,6 +182,7 @@ Fallou a edición do calendario Sincronizando… Sincronización completa + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index 4fc0711e2..67494f83c 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -183,6 +183,7 @@ Editing calendar failed Syncing… Sync completed + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 164d244a0..84fc916d6 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -182,6 +182,7 @@ Uređivanje kalendara nije uspjelo Sinkronizacija… Sinkronizacija završena + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index ef6bc0c46..d14070583 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -182,6 +182,7 @@ Editing calendar failed Syncing… Sync completed + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 55500f41a..15fc0bb7c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -182,6 +182,7 @@ Impossibile modificare il calendario Sincronizzazione in corso… Sincronizzazione completata + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 50e352fb2..07d42003e 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -183,6 +183,7 @@ Editing calendar failed Syncing… Sync completed + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index d52cfb51d..481966cfa 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -182,6 +182,7 @@ カレンダーを編集できませんでした 同期中… 同期が完了しました + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index f15d08449..264f6ae28 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -182,6 +182,7 @@ 변경 실패 동기화중… 동기화 완료 + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 86765c8c3..f4c0aa9e0 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -182,6 +182,7 @@ Kalendoriaus redagavimas nepavyko Sinchronizuojama… Sinchronizacija baigta + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index 2da312404..cd5144eeb 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -182,6 +182,7 @@ Redigering av kalender feilet Synkroniserer… Synkronisering fullført + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index d187567a4..31c4f9d26 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -182,6 +182,7 @@ Agenda bijwerken mislukt Synchroniseren… Synchroniseren voltooid + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index c7b3d9609..618996121 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -182,6 +182,7 @@ Redigering av kalender feilet Synkroniserer… Synkronisering fullført + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 1329dc499..a741af3d9 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -182,6 +182,7 @@ Edytowanie kalendarza nie powiodło się Synchronizowanie… Synchronizacja zakończona + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 75eee642a..abd11c4a5 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -182,6 +182,7 @@ A edição do calendário falhou Sincronizando… Sincronização completa + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index a27d9d345..0316f9f08 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -182,6 +182,7 @@ Falha ao editar o calendário A sincronizar… Sincronização terminada + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 66229b1cb..3ab1eaf20 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -182,6 +182,7 @@ Не удалось изменить календарь Синхронизация… Синхронизация завершена + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml index ab0027a41..e32e57b3b 100644 --- a/app/src/main/res/values-sk/strings.xml +++ b/app/src/main/res/values-sk/strings.xml @@ -182,6 +182,7 @@ Úprava kalendára zlyhala Synchronizujem… Synchronizácia ukončená + Zvoliť inú farbu (možno bude aplikovaná iba lokálne) diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b45645e2d..466a0ac9a 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -182,6 +182,7 @@ Det gick inte att redigera kalendern Synkroniserar… Synkroniseringen är klar + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index b26f42923..859e8697c 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -182,6 +182,7 @@ Takvim düzenlenme başarısız Senkronize ediliyor… Senkronizasyon tamamlandı + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 578a23e93..3fd0b36f2 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -182,6 +182,7 @@ 編輯行事曆失敗 同步中… 同步完成 + Select a different color (might be applied locally only) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 43e2fa53d..edf383596 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -182,6 +182,7 @@ Editing calendar failed Syncing… Sync completed + Select a different color (might be applied locally only)