Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class ChecklistAdapter(activity: BaseSimpleActivity, var items: ArrayList<Checkl
}

when (id) {
R.id.cab_move_to_top -> moveSelectedItemsToTop()
R.id.cab_move_to_bottom -> moveSelectedItemsToBottom()
R.id.cab_rename -> renameChecklistItem()
R.id.cab_delete -> deleteSelection()
}
Expand Down Expand Up @@ -145,6 +147,31 @@ class ChecklistAdapter(activity: BaseSimpleActivity, var items: ArrayList<Checkl
}
}

private fun moveSelectedItemsToTop() {
selectedKeys.withIndex()
.reversed()
.forEach { keys ->
val position = items.indexOfFirst { it.id == keys.value }
val tempItem = items[position]
items.removeAt(position)
items.add(0, tempItem)
}
notifyDataSetChanged()
listener?.saveChecklist()
}

private fun moveSelectedItemsToBottom() {
selectedKeys.withIndex()
.forEach { keys ->
val position = items.indexOfFirst { it.id == keys.value }
val tempItem = items[position]
items.removeAt(position)
items.add(items.size, tempItem)
}
notifyDataSetChanged()
listener?.saveChecklist()
}

private fun getItemWithKey(key: Int): ChecklistItem? = items.firstOrNull { it.id == key }

private fun getSelectedItems() = items.filter { selectedKeys.contains(it.id) } as ArrayList<ChecklistItem>
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/res/drawable-anydpi/ic_move_to_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF"
android:alpha="0.8">
<path
android:fillColor="@android:color/white"
android:pathData="M16,13h-3V3h-2v10H8l4,4 4,-4zM4,19v2h16v-2H4z"/>
</vector>
11 changes: 11 additions & 0 deletions app/src/main/res/drawable-anydpi/ic_move_to_top.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#FFFFFF"
android:alpha="0.8">
<path
android:fillColor="@android:color/white"
android:pathData="M8,11h3v10h2V11h3l-4,-4 -4,4zM4,3v2h16V3H4z"/>
</vector>
Binary file added app/src/main/res/drawable-hdpi/ic_move_to_bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/ic_move_to_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/ic_move_to_bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/ic_move_to_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/ic_move_to_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxhdpi/ic_move_to_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/src/main/res/menu/cab_checklist.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/cab_move_to_top"
android:icon="@drawable/ic_move_to_top"
android:title="@string/move_to_top"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/cab_move_to_bottom"
android:icon="@drawable/ic_move_to_bottom"
android:title="@string/move_to_bottom"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/cab_rename"
android:icon="@drawable/ic_rename_new"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">إضافة عناصر قائمة تدقيق جديدة</string>
<string name="checklist_is_empty">قائمة التدقيق فارغة</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">تصدير جميع الملاحظات كملفات</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-az/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Add new checklist items</string>
<string name="checklist_is_empty">The checklist is empty</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Bütün qeydləri fayl şəklində çıxar</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Přidat do seznamu nové položky</string>
<string name="checklist_is_empty">Seznam položek je prázdný</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportovat všechny poznámky jako soubory</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-cy/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Ychwanegu eitemau newydd at restr wirio</string>
<string name="checklist_is_empty">Mae\'r rhestr wirio yn wag</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Allforio pob nodyn fel ffeil</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-da/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Føj nye punkter til tjeklisten</string>
<string name="checklist_is_empty">Tjeklisten er tom</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Eksporter alle noter som filer</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Neue Checklisteneinträge hinzufügen</string>
<string name="checklist_is_empty">Die Checkliste ist leer</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Alle Notizen als Dateien exportieren</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Προσθήκη νέων στοιχείων λίστας ελέγχου</string>
<string name="checklist_is_empty">Η λίστα ελέγχου είναι κενή</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Εξαγωγή όλων των σημειώσεων ως αρχεία</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Añadir nuevos items a la lista</string>
<string name="checklist_is_empty">La lista está vacía</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportar todas las notas como archivos</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Ajouter de nouveaux éléments</string>
<string name="checklist_is_empty">La checklist est vide</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exporter toutes les notes en tant que fichiers</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-gl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Engadir elementos a unha nova lista de verificación</string>
<string name="checklist_is_empty">A lista de verificación está baleira</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportar todas as notas como ficheiros</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Dodajte nove stavke na spisak</string>
<string name="checklist_is_empty">Spisak je prazan</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Izvezi sve bilješke kao datoteke</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Add new checklist items</string>
<string name="checklist_is_empty">The checklist is empty</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Export all notes as files</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-id/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Tambah item checklist baru</string>
<string name="checklist_is_empty">Checklist kosong</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Ekspor semua catatan ke berkas</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Tambah item checklist baru</string>
<string name="checklist_is_empty">Checklist kosong</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Ekspor semua catatan ke berkas</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Aggiungi nuovi elementi</string>
<string name="checklist_is_empty">La scaletta è vuota</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Esporta le note come file</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">新しいチェックリスト項目を追加</string>
<string name="checklist_is_empty">チェックリストが空です</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">すべてのメモをファイルとしてエクスポート</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-lt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Pridėti naujus kontrolinio sąrašo objektus</string>
<string name="checklist_is_empty">Kontrolinis sąršas tuščias</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Eksportuoti visus užrašus kaip bylas</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Items toevoegen</string>
<string name="checklist_is_empty">De lijst is leeg</string>
<string name="remove_done_items">Afgeronde items wissen</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Alle notities naar bestanden exporteren</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Add new checklist items</string>
<string name="checklist_is_empty">The checklist is empty</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Eksportuj wszystkie notatki jako pliki</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Adicionar novos itens de lista de verificação</string>
<string name="checklist_is_empty">A lista de verificação está vazia</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportar todas as notas como arquivo</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Adicionar itens à lista de verificação</string>
<string name="checklist_is_empty">A lista está vazia</string>
<string name="remove_done_items">Remover itens realizados</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportar todas as notas como ficheiros</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Добавить позиции в список</string>
<string name="checklist_is_empty">Список пуст</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Экспортировать все заметки в файлы</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-sk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Pridať do zoznamu nové položky</string>
<string name="checklist_is_empty">Zoznam položiek je prázdny</string>
<string name="remove_done_items">Odstrániť splnené položky</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportovať všetky poznámky ako súbory</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-sv/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Lägg till nya checklisteobjekt</string>
<string name="checklist_is_empty">Checklistan är tom</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Exportera alla anteckningar som filer</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Yeni yapılacak listesi öğeleri ekle</string>
<string name="checklist_is_empty">Yapılacak listesi boş</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Tüm notları dosya olarak dışa aktar</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-uk/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Додати нові позиції у списку</string>
<string name="checklist_is_empty">Список порожній</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Експортувати всі нотатки як файли</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">添加新的清单项目</string>
<string name="checklist_is_empty">清单为空</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">以文件导出所有笔记</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">新增新的核對清單項目</string>
<string name="checklist_is_empty">核對清單為空白</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">將全部筆記匯出成檔案</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
<string name="add_new_checklist_items">Add new checklist items</string>
<string name="checklist_is_empty">The checklist is empty</string>
<string name="remove_done_items">Remove done items</string>
<string name="move_to_top">Move to top</string>
<string name="move_to_bottom">Move to bottom</string>

<!-- Import / Export -->
<string name="export_all_notes">Export all notes as files</string>
Expand Down