add a button to the event type picker for selecting a custom color
This commit is contained in:
parent
f0b300f423
commit
6001d8422a
|
@ -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'
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dialog_select_event_type_color_scrollview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/dialog_select_event_type_other_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/dialog_select_event_type_other_value"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="@dimen/big_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:text="@string/select_a_different_caldav_color"
|
||||
android:textSize="@dimen/normal_text_size"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dialog_select_event_type_other_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_below="@+id/dialog_select_event_type_other_value"
|
||||
android:background="@color/divider_grey"
|
||||
android:importantForAccessibility="no"/>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/dialog_select_event_type_color_radio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/dialog_select_event_type_other_divider"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/normal_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/normal_margin"/>
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Təqvimi dəyişmək alınmadı</string>
|
||||
<string name="syncing">Sinxronlaşdırılır…</string>
|
||||
<string name="synchronization_completed">Sinxronlaşma bitdi</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">C\'hwitadenn en ur embann an deiziataer</string>
|
||||
<string name="syncing">O c\'houbredañ…</string>
|
||||
<string name="synchronization_completed">Echuet gant ar goubredañ</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Editování kalendáře se nezdařilo</string>
|
||||
<string name="syncing">Synchronizuji…</string>
|
||||
<string name="synchronization_completed">Synchronizace dokončena</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Redigering af kalenderen mislykkedes</string>
|
||||
<string name="syncing">Synkroniserer…</string>
|
||||
<string name="synchronization_completed">Synkronisering gennemført</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Ändern des Kalenders fehlgeschlagen</string>
|
||||
<string name="syncing">Wird synchronisiert…</string>
|
||||
<string name="synchronization_completed">Synchronisation erfolgreich</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Η επεξεργασία του ημερολογίου απέτυχε</string>
|
||||
<string name="syncing">Συγχρονισμός…</string>
|
||||
<string name="synchronization_completed">Ο συγχρονισμός ολοκληρώθηκε</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Edición de calendario fallida</string>
|
||||
<string name="syncing">Sincronizando…</string>
|
||||
<string name="synchronization_completed">Sincronización completa</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Édition du calendrier échouée</string>
|
||||
<string name="syncing">Synchronisation…</string>
|
||||
<string name="synchronization_completed">Synchronisation terminée</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Fallou a edición do calendario</string>
|
||||
<string name="syncing">Sincronizando…</string>
|
||||
<string name="synchronization_completed">Sincronización completa</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
<string name="editing_calendar_failed">Editing calendar failed</string>
|
||||
<string name="syncing">Syncing…</string>
|
||||
<string name="synchronization_completed">Sync completed</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Uređivanje kalendara nije uspjelo</string>
|
||||
<string name="syncing">Sinkronizacija…</string>
|
||||
<string name="synchronization_completed">Sinkronizacija završena</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Editing calendar failed</string>
|
||||
<string name="syncing">Syncing…</string>
|
||||
<string name="synchronization_completed">Sync completed</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Impossibile modificare il calendario</string>
|
||||
<string name="syncing">Sincronizzazione in corso…</string>
|
||||
<string name="synchronization_completed">Sincronizzazione completata</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -183,6 +183,7 @@
|
|||
<string name="editing_calendar_failed">Editing calendar failed</string>
|
||||
<string name="syncing">Syncing…</string>
|
||||
<string name="synchronization_completed">Sync completed</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">カレンダーを編集できませんでした</string>
|
||||
<string name="syncing">同期中…</string>
|
||||
<string name="synchronization_completed">同期が完了しました</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">변경 실패</string>
|
||||
<string name="syncing">동기화중…</string>
|
||||
<string name="synchronization_completed">동기화 완료</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Kalendoriaus redagavimas nepavyko</string>
|
||||
<string name="syncing">Sinchronizuojama…</string>
|
||||
<string name="synchronization_completed">Sinchronizacija baigta</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Redigering av kalender feilet</string>
|
||||
<string name="syncing">Synkroniserer…</string>
|
||||
<string name="synchronization_completed">Synkronisering fullført</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Agenda bijwerken mislukt</string>
|
||||
<string name="syncing">Synchroniseren…</string>
|
||||
<string name="synchronization_completed">Synchroniseren voltooid</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Redigering av kalender feilet</string>
|
||||
<string name="syncing">Synkroniserer…</string>
|
||||
<string name="synchronization_completed">Synkronisering fullført</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Edytowanie kalendarza nie powiodło się</string>
|
||||
<string name="syncing">Synchronizowanie…</string>
|
||||
<string name="synchronization_completed">Synchronizacja zakończona</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">A edição do calendário falhou</string>
|
||||
<string name="syncing">Sincronizando…</string>
|
||||
<string name="synchronization_completed">Sincronização completa</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Falha ao editar o calendário</string>
|
||||
<string name="syncing">A sincronizar…</string>
|
||||
<string name="synchronization_completed">Sincronização terminada</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Не удалось изменить календарь</string>
|
||||
<string name="syncing">Синхронизация…</string>
|
||||
<string name="synchronization_completed">Синхронизация завершена</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Úprava kalendára zlyhala</string>
|
||||
<string name="syncing">Synchronizujem…</string>
|
||||
<string name="synchronization_completed">Synchronizácia ukončená</string>
|
||||
<string name="select_a_different_caldav_color">Zvoliť inú farbu (možno bude aplikovaná iba lokálne)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Det gick inte att redigera kalendern</string>
|
||||
<string name="syncing">Synkroniserar…</string>
|
||||
<string name="synchronization_completed">Synkroniseringen är klar</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Takvim düzenlenme başarısız</string>
|
||||
<string name="syncing">Senkronize ediliyor…</string>
|
||||
<string name="synchronization_completed">Senkronizasyon tamamlandı</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">編輯行事曆失敗</string>
|
||||
<string name="syncing">同步中…</string>
|
||||
<string name="synchronization_completed">同步完成</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
<string name="editing_calendar_failed">Editing calendar failed</string>
|
||||
<string name="syncing">Syncing…</string>
|
||||
<string name="synchronization_completed">Sync completed</string>
|
||||
<string name="select_a_different_caldav_color">Select a different color (might be applied locally only)</string>
|
||||
|
||||
<!-- alternative versions for some languages, use the same translations if you are not sure what this means -->
|
||||
<!-- used in repetition, like "Every last Sunday" -->
|
||||
|
|
Loading…
Reference in New Issue