Merge pull request #455 from Aga-C/add-checklist-top

Added new checklist items at the top (#439)
This commit is contained in:
Tibor Kaputa 2021-09-28 23:26:56 +02:00 committed by GitHub
commit 450c411976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 76 additions and 1 deletions

View File

@ -48,6 +48,7 @@ class SettingsActivity : SimpleActivity() {
setupCustomizeWidgetColors()
updateTextColors(settings_scrollview)
setupSectionColors()
setupAddNewChecklistItemsTop()
invalidateOptionsMenu()
}
@ -251,4 +252,12 @@ class SettingsActivity : SimpleActivity() {
config.useIncognitoMode = settings_use_incognito_mode.isChecked
}
}
private fun setupAddNewChecklistItemsTop() {
settings_add_checklist_top.isChecked = config.addNewChecklistItemsTop
settings_add_checklist_top_holder.setOnClickListener {
settings_add_checklist_top.toggle()
config.addNewChecklistItemsTop = settings_add_checklist_top.isChecked
}
}
}

View File

@ -136,14 +136,21 @@ class ChecklistFragment : NoteFragment(), ChecklistItemsListener {
private fun showNewItemDialog() {
NewChecklistItemDialog(activity as SimpleActivity) { titles ->
var currentMaxId = items.maxByOrNull { item -> item.id }?.id ?: 0
val newItems = ArrayList<ChecklistItem>()
titles.forEach { title ->
title.split("\n").map { it.trim() }.filter { it.isNotBlank() }.forEach { row ->
items.add(ChecklistItem(currentMaxId + 1, row, false))
newItems.add(ChecklistItem(currentMaxId + 1, row, false))
currentMaxId++
}
}
if (config?.addNewChecklistItemsTop == true) {
items.addAll(0, newItems)
} else {
items.addAll(newItems)
}
saveNote()
setupAdapter()
}

View File

@ -89,4 +89,8 @@ class Config(context: Context) : BaseConfig(context) {
var fontSizePercentage: Int
get() = prefs.getInt(FONT_SIZE_PERCENTAGE, 100)
set(fontSizePercentage) = prefs.edit().putInt(FONT_SIZE_PERCENTAGE, fontSizePercentage).apply()
var addNewChecklistItemsTop: Boolean
get() = prefs.getBoolean(ADD_NEW_CHECKLIST_ITEMS_TOP, false)
set(addNewCheckListItemsTop) = prefs.edit().putBoolean(ADD_NEW_CHECKLIST_ITEMS_TOP, addNewCheckListItemsTop).apply()
}

View File

@ -31,6 +31,7 @@ const val USE_INCOGNITO_MODE = "use_incognito_mode"
const val LAST_CREATED_NOTE_TYPE = "last_created_note_type"
const val MOVE_DONE_CHECKLIST_ITEMS = "move_undone_checklist_items" // it has been replaced from moving undone items at the top to moving done to bottom
const val FONT_SIZE_PERCENTAGE = "font_size_percentage"
const val ADD_NEW_CHECKLIST_ITEMS_TOP = "add_new_checklist_items_top"
// gravity
const val GRAVITY_LEFT = 0

View File

@ -244,6 +244,29 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_add_checklist_top_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_add_checklist_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/add_new_checklist_items_top"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/startup_label"
android:layout_width="wrap_content"

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">تفعيل التفاف الخط</string>
<string name="use_incognito_mode">استخدام وضع التصفح المتخفي للوحات المفاتيح</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">قائمة تدقيق</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Cız sarğısını göstər</string>
<string name="use_incognito_mode">Use Incognito mode of keyboards</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Povolit zalamování řádků</string>
<string name="use_incognito_mode">Použít Inkognito mód klávesnic</string>
<string name="move_done_checklist_items">Přesunout splněné položky seznamu položek nadol</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Seznam položek</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Galluogi amlapio llinellau</string>
<string name="use_incognito_mode">Defnyddio modd cyfrinachol bysellfyrddau</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Rhestr wirio</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Aktiver tekstombrydning</string>
<string name="use_incognito_mode">Anvend inkognito-tilstand til tastatur</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Tjekliste</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Zeilenumbruch aktivieren</string>
<string name="use_incognito_mode">Benutze den Inkognitomodus von Tastaturen</string>
<string name="move_done_checklist_items">Verschiebe erledigte Checklisteneinträge nach unten</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checkliste</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Ενεργοποίηση αναδίπλωσης γραμμής</string>
<string name="use_incognito_mode">Χρήση λειτουργίας Incognito πληκτρολόγιου</string>
<string name="move_done_checklist_items">Μετακίνηση ανεπιτυχών λίστας ελέγχου στο επάνω μέρος</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Λίστα ελέγχου</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Activar ajuste de línea</string>
<string name="use_incognito_mode">Usar modo incógnito de los teclados</string>
<string name="move_done_checklist_items">Mover ítems completados al final de la lista</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Lista</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">فعال کردن پیچیدن خط</string>
<string name="use_incognito_mode">استفاده از حالت ناشناس کیبورد‌ها</string>
<string name="move_done_checklist_items">جابه‌جایی موارد انجام شده فهرست نشان‌دار به پایین</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">فهرست نشان‌دار</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Ota käyttöön automaattinen rivitys</string>
<string name="use_incognito_mode">Käytä näppäimistöjen Incognito-tilaa</string>
<string name="move_done_checklist_items">Siirrä tekemättömät kohdat muistilistasta ylimmäksi</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Muistilista</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Activer le retour à la ligne</string>
<string name="use_incognito_mode">Utiliser le mode incognito des claviers</string>
<string name="move_done_checklist_items">Déplacer les éléments de cheklist inachevés en haut</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Habilitar sangrado de liña</string>
<string name="use_incognito_mode">Usar o modo incógnito dos teclados</string>
<string name="move_done_checklist_items"> Mover os elementos dunha lista de verificación non rematada a arriba</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Lista de verificación</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Omogući omotavanje linije</string>
<string name="use_incognito_mode">Use Incognito mode of keyboards</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Spisak</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Enable line wrap</string>
<string name="use_incognito_mode">Use Incognito mode of keyboards</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Aktifkan baris berlibat</string>
<string name="use_incognito_mode">Gunakan mode papan ketik incognito</string>
<string name="move_done_checklist_items">Pindah checklist yang belum selesai ke urutan atas</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Aktifkan baris berlibat</string>
<string name="use_incognito_mode">Gunakan mode papan ketik incognito</string>
<string name="move_done_checklist_items">Pindah checklist yang belum selesai ke urutan atas</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Abilita a capo automatico</string>
<string name="use_incognito_mode">Usa la modalità incognito per le tastiere</string>
<string name="move_done_checklist_items">Sposta gli elementi non spuntati in cima</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Scaletta</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">行の折り返しを有効にする</string>
<string name="use_incognito_mode">キーボードのシークレットモードを使用する</string>
<string name="move_done_checklist_items">チェックリストの未完了リストを上に移動</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">チェックリスト</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">naudoti eilutės perkėlimą</string>
<string name="use_incognito_mode">Use Incognito mode of keyboards</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Kontrolinis sąrašas</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Automatische terugloop inschakelen</string>
<string name="use_incognito_mode">Incognito-modus van toetsenbord gebruiken</string>
<string name="move_done_checklist_items">Afgewerkte items naar onderen verplaatsen</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Lijst</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Włącz zawijanie linii</string>
<string name="use_incognito_mode">Używaj trybu incognito klawiatury</string>
<string name="move_done_checklist_items">Przesuwaj na dół wykonane elementy listy kontrolnej</string>
<string name="add_new_checklist_items_top">Dodawaj na górze nowe elementy listy kontrolnej</string>
<!-- Checklists -->
<string name="checklist">Lista kontrolna</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Ativar quebra de linha</string>
<string name="use_incognito_mode">Usar o teclado no modo de Navegação Anônima</string>
<string name="move_done_checklist_items">Mover itens completos da lista de verificação para o final</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Lista de verificação</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Ativar quebra de linha</string>
<string name="use_incognito_mode">Utilizar modo incógnito no teclado</string>
<string name="move_done_checklist_items">Mover itens não realizados para o topo</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Lista de verificação</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Переносить строки</string>
<string name="use_incognito_mode">Использовать режим инкогнито для клавиатур</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Список</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Povoliť zalamovanie riadkov</string>
<string name="use_incognito_mode">Použiť Inkognito mód klávesníc</string>
<string name="move_done_checklist_items">Presunúť splnené položky zo zoznamu položiek na spodok</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Zoznam položiek</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Aktivera radbrytning</string>
<string name="use_incognito_mode">Använd tangentbordets inkognitoläge</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklista</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Sözcük kaydırmayı etkinleştir</string>
<string name="use_incognito_mode">Klavyelerin Gizli modunu kullan</string>
<string name="move_done_checklist_items">Tamamlanmamış yapılacak listesi öğelerini en üste taşı</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Yapılacak listesi</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Продовжувати друк з нового рядка</string>
<string name="use_incognito_mode">Використовувати режим Приватності в клавіатурі</string>
<string name="move_done_checklist_items">Поміщати вкінець виконані позиції у списку</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Список</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">启用行折叠</string>
<string name="use_incognito_mode">对于键盘使用隐私模式</string>
<string name="move_done_checklist_items">移动未完成的清单至顶端</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">清单</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">自動換行</string>
<string name="use_incognito_mode">使用無痕模式的鍵盤</string>
<string name="move_done_checklist_items">將未完成的核對清單項目移動至頂端</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">核對清單</string>

View File

@ -54,6 +54,7 @@
<string name="enable_line_wrap">Enable line wrap</string>
<string name="use_incognito_mode">Use Incognito mode of keyboards</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>