Configure visibility for each chip type

pull/1004/head
Alex Baker 4 years ago
parent aeda918160
commit 89ebfd88c0

@ -60,6 +60,11 @@ class Upgrader @Inject constructor(
run(from, V8_10) { migrateWidgets() }
run(from, V9_3) { applyCaldavOrder() }
run(from, V9_6) {
val chips = preferences.getBoolean("show_list_indicators", true)
preferences.showSubtaskChip = chips
preferences.showPlaceChip = chips
preferences.showListChip = chips
preferences.showTagChip = chips
preferences.setBoolean(R.string.p_astrid_sort_enabled, true)
taskMover.migrateLocalTasks()
}

@ -453,6 +453,22 @@ class Preferences @JvmOverloads constructor(private val context: Context, name:
val themeBase: Int
get() = getInt(R.string.p_theme, ThemeBase.DEFAULT_BASE_THEME)
var showSubtaskChip: Boolean
get() = getBoolean(R.string.p_subtask_chips, true)
set(value) = setBoolean(R.string.p_subtask_chips, value)
var showPlaceChip: Boolean
get() = getBoolean(R.string.p_place_chips, true)
set(value) = setBoolean(R.string.p_place_chips, value)
var showListChip: Boolean
get() = getBoolean(R.string.p_list_chips, true)
set(value) = setBoolean(R.string.p_list_chips, value)
var showTagChip: Boolean
get() = getBoolean(R.string.p_tag_chips, true)
set(value) = setBoolean(R.string.p_tag_chips, value)
fun alreadyNotified(account: String?, scope: String?): Boolean {
return getBoolean(context.getString(R.string.p_notified_oauth_error, account, scope), false)
}

@ -63,33 +63,31 @@ class ChipProvider @Inject constructor(
fun getChips(filter: Filter?, isSubtask: Boolean, task: TaskContainer): List<Chip> {
AndroidUtilities.assertMainThread()
val chips = ArrayList<Chip>()
if (task.hasChildren()) {
if (task.hasChildren() && preferences.showSubtaskChip) {
chips.add(newSubtaskChip(task, !showText))
}
if (preferences.getBoolean(R.string.p_show_list_indicators, true)) {
if (task.hasLocation() && filter !is PlaceFilter) {
val location = task.getLocation()
newChip(PlaceFilter(location.place), R.drawable.ic_outline_place_24px)?.let(chips::add)
}
if (!isSubtask) {
if (!isNullOrEmpty(task.googleTaskList) && filter !is GtasksFilter) {
newChip(lists.getGoogleTaskList(task.googleTaskList), R.drawable.ic_list_24px)
?.let(chips::add)
} else if (!isNullOrEmpty(task.caldav) && filter !is CaldavFilter) {
newChip(lists.getCaldavList(task.caldav), R.drawable.ic_list_24px)?.let(chips::add)
}
if (task.hasLocation() && filter !is PlaceFilter && preferences.showPlaceChip) {
val location = task.getLocation()
newChip(PlaceFilter(location.place), R.drawable.ic_outline_place_24px)?.let(chips::add)
}
if (!isSubtask && preferences.showListChip) {
if (!isNullOrEmpty(task.googleTaskList) && filter !is GtasksFilter) {
newChip(lists.getGoogleTaskList(task.googleTaskList), R.drawable.ic_list_24px)
?.let(chips::add)
} else if (!isNullOrEmpty(task.caldav) && filter !is CaldavFilter) {
newChip(lists.getCaldavList(task.caldav), R.drawable.ic_list_24px)?.let(chips::add)
}
val tagString = task.tagsString
if (!isNullOrEmpty(tagString)) {
val tags = tagString.split(",").toHashSet()
if (filter is TagFilter) {
tags.remove(filter.uuid)
}
tags.mapNotNull(lists::getTag)
.sortedBy(TagFilter::listingTitle)
.map { newChip(it, R.drawable.ic_outline_label_24px)!! }
.let(chips::addAll)
}
val tagString = task.tagsString
if (!isNullOrEmpty(tagString) && preferences.showTagChip) {
val tags = tagString.split(",").toHashSet()
if (filter is TagFilter) {
tags.remove(filter.uuid)
}
tags.mapNotNull(lists::getTag)
.sortedBy(TagFilter::listingTitle)
.map { newChip(it, R.drawable.ic_outline_label_24px)!! }
.let(chips::addAll)
}
return chips
}

@ -449,7 +449,6 @@
<string name="show_full_description">Покажи пълното описание</string>
<string name="linkify">Покажи линкове</string>
<string name="linkify_description">Добавете връзки към уебсайтове, адреси и телефонни номера</string>
<string name="show_list_indicators">Показване на индикатори в списъци</string>
<string name="location_remind_arrival">Напомни при пристигане</string>
<string name="location_remind_departure">Напомни при заминаване</string>
<string name="visit_website">Посетете уебсайта</string>

@ -441,7 +441,6 @@
<string name="show_full_description">Gesamte Beschreibung anzeigen</string>
<string name="linkify">Links anzeigen</string>
<string name="linkify_description">Links zu Websites, Adressen und Telefonnummern beifügen</string>
<string name="show_list_indicators">Schlagwörter und Listen anzeigen</string>
<string name="location_remind_arrival">Bei Ankunft erinnern</string>
<string name="location_remind_departure">Bei Abreise erinnern</string>
<string name="visit_website">Website öffnen</string>

@ -449,7 +449,6 @@
<string name="show_full_description">Mostrar descripción completa</string>
<string name="linkify">Mostrar enlaces</string>
<string name="linkify_description">Añade enlaces a sitios web, direcciones y número de teléfono</string>
<string name="show_list_indicators">Mostrar fichas de lista</string>
<string name="location_remind_arrival">Recordar a la llegada</string>
<string name="location_remind_departure">Recordar a la salida</string>
<string name="visit_website">Visitar página web</string>

@ -455,7 +455,6 @@
<string name="show_full_description">Erakutsi deskripzio osoa</string>
<string name="linkify">Erakutsi estekak</string>
<string name="linkify_description">Gehitu web-estekak, helbideak, eta telefono zenbakiak</string>
<string name="show_list_indicators">Erakutsi zerrenda-buletak</string>
<string name="location_remind_arrival">Gogorarazi heltzerakoan</string>
<string name="location_remind_departure">Gogorarazi ateratzerakoan</string>
<string name="visit_website">Bisitatu webgunea</string>

@ -404,7 +404,6 @@
<string name="add_place">Lisää paikka</string>
<string name="hide_unused_places">Piilota käyttämättömät paikat</string>
<string name="hide_unused_tags">Piilota käyttämättömät tunnistimet</string>
<string name="show_list_indicators">Näytä lisätietolaput listassa</string>
<string name="reinitialize_account">Uudelleenalustus</string>
<string name="calendar_event_created">Kalenterimerkintä luotu %s varten</string>
<string name="auto_dismiss_datetime_summary">Päivämäärän ja kellonajan valitsimet sulkeutuvat itsestään valittuasi ajan</string>

@ -431,7 +431,6 @@
<string name="show_full_description">Montrer la description complète</string>
<string name="linkify">Afficher les liens</string>
<string name="linkify_description">Ajouter des liens vers des sites Web, des adresses et des numéros de téléphone</string>
<string name="show_list_indicators">Afficher la liste des puces</string>
<string name="location_remind_arrival">Rappel à l\'arrivée</string>
<string name="location_remind_departure">Rappel au départ</string>
<string name="visit_website">Visiter le site internet</string>

@ -450,7 +450,6 @@
<string name="show_full_description">Teljes leírás megjelenítése</string>
<string name="linkify">Linkek megjelenítése</string>
<string name="linkify_description">Weboldalakra, címekre és telefonszámokra mutató linkek hozzáadása</string>
<string name="show_list_indicators">Listajelölők megjelenítése</string>
<string name="location_remind_arrival">Induláskor emlékeztet</string>
<string name="location_remind_departure">Érkezéskor emlékeztet</string>
<string name="visit_website">Weboldal megnyitása</string>

@ -385,7 +385,6 @@
<string name="show_full_description">Tampilkan keseluruhan deskripsi</string>
<string name="linkify">Tampilkan tautan</string>
<string name="linkify_description">Menambahkan tautan ke situs web, alamat, dan nomor telepon</string>
<string name="show_list_indicators">Tampilkan indikator daftar</string>
<string name="visit_website">Kunjungi situs web</string>
<string name="choose_a_location">Pilih lokasi</string>
<string name="pick_this_location">Pilih lokasi ini</string>

@ -446,7 +446,6 @@
<string name="show_full_description">Mostra la descrizione completa</string>
<string name="linkify">Mostra link</string>
<string name="linkify_description">Aggiungi link a siti web, indirizzi, numeri telefonici</string>
<string name="show_list_indicators">Mostra lista chip</string>
<string name="location_remind_arrival">Ricorda all\'arrivo</string>
<string name="location_remind_departure">Ricorda alla partenza</string>
<string name="visit_website">Visita sito web</string>

@ -484,7 +484,6 @@
<string name="show_full_description">הצג תיאור מלא</string>
<string name="linkify">הצג קישורים</string>
<string name="linkify_description">הוסף קישורים לאתרים, כתובות, ומספרי טלפון</string>
<string name="show_list_indicators">הצג שבבי רשימה</string>
<string name="location_remind_arrival">הזכר ברגע ההגעה</string>
<string name="location_remind_departure">הזכר ברגע העזיבה</string>
<string name="visit_website">מעבר לאתר האינטרנט</string>

@ -447,7 +447,6 @@
<string name="show_full_description">すべての説明を表示</string>
<string name="linkify">リンクを表示</string>
<string name="linkify_description">ウェブサイト、住所、電話番号へのリンクを追加</string>
<string name="show_list_indicators">リストチップを表示</string>
<string name="location_remind_arrival">到着時に通知する</string>
<string name="location_remind_departure">出発時に通知する</string>
<string name="visit_website">Webサイトを参照</string>

@ -448,7 +448,6 @@
<string name="show_full_description">전체 설명 보기</string>
<string name="linkify">링크 보기</string>
<string name="linkify_description">웹사이트, 주소, 전화번호에 링크 걸기</string>
<string name="show_list_indicators">칩 보기</string>
<string name="location_remind_arrival">도착 시 알림</string>
<string name="location_remind_departure">출발 시 알림</string>
<string name="location_arrived">%s 에 도착</string>

@ -446,7 +446,6 @@
<string name="show_full_description">Rodyti pilną aprašymą</string>
<string name="linkify">Rodyti nuorodas</string>
<string name="linkify_description">Pridėti nuorodas į puslapius, adresus ir telefono numerius</string>
<string name="show_list_indicators">Rodyti sąrašą lustų</string>
<string name="location_remind_arrival">Priminti atvykus</string>
<string name="location_remind_departure">Priminti išvykstant</string>
<string name="visit_website">Aplankyti svetainę</string>

@ -455,7 +455,6 @@
<string name="show_full_description">Vis full beskrivelse</string>
<string name="linkify">Vis lenker</string>
<string name="linkify_description">Legg til lenker til nettsider, adresser, og telefonnumre</string>
<string name="show_list_indicators">Vis listeindikatorer</string>
<string name="location_remind_arrival">Påminn ved ankomst</string>
<string name="location_remind_departure">Påminn ved avgang</string>
<string name="visit_website">Besøk nettside</string>

@ -439,7 +439,6 @@
<string name="show_full_description">Toon volledige beschrijving</string>
<string name="linkify">Toon links</string>
<string name="linkify_description">Voeg links toe nar websites, adressen en telefoonnummers</string>
<string name="show_list_indicators">Toon lijst-fiches</string>
<string name="location_remind_arrival">Herinner bij aankomst</string>
<string name="location_remind_departure">Herinner bij vertrek</string>
<string name="visit_website">Bezoek website</string>

@ -484,7 +484,6 @@
<string name="list_separator_with_space">", "</string>
<string name="caldav_home_set_not_found">Nie znaleziono zestawu domowego</string>
<string name="pro_dashclock_extension">Rozszerzenie do Dashclock</string>
<string name="show_list_indicators">Pokaż listy</string>
<string name="invalid_backup_file">Nieprawidłowy plik kopii zapasowej</string>
<string name="google_tasks_add_to_top">Nowe zadania na górze</string>
<string name="icon">Ikona</string>

@ -447,7 +447,6 @@
<string name="show_full_description">Mostrar descrição completa</string>
<string name="linkify">Mostrar links</string>
<string name="linkify_description">Adicionar links para websites, endereços e números de telefone</string>
<string name="show_list_indicators">Mostrar fichas de listas</string>
<string name="location_remind_arrival">Lembrar ao chegar</string>
<string name="location_remind_departure">Lembrar ao sair</string>
<string name="visit_website">Visitar website</string>

@ -491,7 +491,6 @@
<string name="url">URL</string>
<string name="error_adding_account">Ошибка: %s</string>
<string name="list_separator_with_space">", "</string>
<string name="show_list_indicators">Показать списки</string>
<string name="building_notifications">Генерация уведомлений</string>
<string name="manage_subscription_summary">Повысить, понизить уровень подписки или отменить ее</string>
<string name="button_downgrade">Понизить уровень подписки</string>

@ -446,7 +446,6 @@
<string name="show_full_description">Ukázať plný popis</string>
<string name="linkify">Ukázať prepojenia</string>
<string name="linkify_description">Pridať prepojenia do stránok, adries a telefónnych čísel</string>
<string name="show_list_indicators">Ukázať zoznamy</string>
<string name="location_remind_arrival">Pripomenúť pri príchode</string>
<string name="location_remind_departure">Pripomenúť pri odchode</string>
<string name="visit_website">Navštíviť stránky</string>

@ -450,7 +450,6 @@
<string name="show_full_description">Visa fullständig beskrivning</string>
<string name="linkify">Visa länkar</string>
<string name="linkify_description">Lägg till länkar till webbplatser, adresser och telefonnummer</string>
<string name="show_list_indicators">Visa listindikatörer</string>
<string name="location_remind_arrival">Påminn vid ankomst</string>
<string name="location_remind_departure">Påminn om avgång</string>
<string name="visit_website">Besök hemsida</string>

@ -452,7 +452,6 @@
<string name="show_full_description">Tam açıklamayı göster</string>
<string name="linkify">Bağlantıları göster</string>
<string name="linkify_description">Web sitelerine, adreslere ve telefon numaralarına bağlantı ekle</string>
<string name="show_list_indicators">Liste yongalarını göster</string>
<string name="location_remind_arrival">Varışta hatırlat</string>
<string name="location_remind_departure">Kalkışta hatırlat</string>
<string name="visit_website">Web siteyi ziyaret et</string>

@ -465,7 +465,6 @@
<string name="show_full_description">Показувати повний опис</string>
<string name="linkify">Показувати посилання</string>
<string name="linkify_description">Виділяти посилання на веб-сайти, адреси та телефони</string>
<string name="show_list_indicators">Відображати індикатори списків</string>
<string name="location_remind_arrival">Нагадати по прибуттю</string>
<string name="location_remind_departure">Нагадати при відправці</string>
<string name="visit_website">Відвідати сторінку</string>

@ -432,7 +432,6 @@
<string name="show_full_description">显示完整描述</string>
<string name="linkify">显示链接</string>
<string name="linkify_description">增加链接至网站,地址,电话号码</string>
<string name="show_list_indicators">显示列表指示器</string>
<string name="TEA_control_location">位置</string>
<string name="EPr_default_location_reminder_title">默认位置提醒</string>
<string name="EPr_default_location_radius">默认半径</string>

@ -340,7 +340,6 @@
<string name="p_show_full_description">show_full_description</string>
<string name="p_linkify_task_list">linkify_task_list</string>
<string name="p_linkify_task_edit">linkify_task_edit</string>
<string name="p_show_list_indicators">show_list_indicators</string>
<string name="map_provider_mapbox">Mapbox</string>
<string name="map_provider_google">Google</string>
<string name="p_map_provider">map_provider</string>
@ -357,6 +356,10 @@
<string name="p_notified_oauth_error">notified_oauth_error_%1$s_%2$s</string>
<string name="p_chip_style">chip_style</string>
<string name="p_chip_appearance">chip_appearance</string>
<string name="p_subtask_chips">chips_subtask</string>
<string name="p_place_chips">chips_place</string>
<string name="p_list_chips">chips_list</string>
<string name="p_tag_chips">chips_tag</string>
<string name="p_desaturate_colors">desaturate_colors</string>
<string name="p_collapse_filters">collapse_filters</string>
<string name="p_collapse_tags">collapse_tags</string>

@ -507,7 +507,6 @@ File %1$s contained %2$s.\n\n
<string name="show_full_description">Show full description</string>
<string name="linkify">Show links</string>
<string name="linkify_description">Add links to websites, addresses, and phone numbers</string>
<string name="show_list_indicators">Show list chips</string>
<string name="location_remind_arrival">Remind on arrival</string>
<string name="location_remind_departure">Remind on departure</string>
<string name="visit_website">Visit website</string>

@ -78,11 +78,6 @@
android:key="@string/p_show_full_description"
android:title="@string/show_full_description" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_show_list_indicators"
android:title="@string/show_list_indicators" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_linkify_task_list"
@ -130,6 +125,26 @@
android:key="@string/p_chip_appearance"
android:title="@string/chip_appearance" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_subtask_chips"
android:title="@string/subtasks" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_place_chips"
android:title="@string/places" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_list_chips"
android:title="@string/lists" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="@string/p_tag_chips"
android:title="@string/tags" />
</PreferenceCategory>
</PreferenceCategory>

Loading…
Cancel
Save