tweaking the way checklist items are moved to the top or bottom

This commit is contained in:
tibbi 2021-01-21 19:00:31 +01:00
parent 39e48b8977
commit 7740a3cfb8
16 changed files with 37 additions and 42 deletions

View File

@ -57,7 +57,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.32.24'
implementation 'com.simplemobiletools:commons:5.33.7'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.documentfile:documentfile:1.0.1'

View File

@ -148,26 +148,25 @@ 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)
}
selectedKeys.reversed().forEach { checklistId ->
val position = items.indexOfFirst { it.id == checklistId }
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)
}
selectedKeys.forEach { checklistId ->
val position = items.indexOfFirst { it.id == checklistId }
val tempItem = items[position]
items.removeAt(position)
items.add(items.size, tempItem)
}
notifyDataSetChanged()
listener?.saveChecklist()
}

View File

@ -1,11 +0,0 @@
<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>

View File

@ -1,11 +0,0 @@
<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 not shown.

Before

Width:  |  Height:  |  Size: 188 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 207 B

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M16,13h-3V3h-2v10H8l4,4 4,-4zM4,19v2h16v-2H4z" />
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FFFFFF"
android:pathData="M8,11h3v10h2V11h3l-4,-4 -4,4zM4,3v2h16V3H4z" />
</vector>

View File

@ -3,12 +3,12 @@
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:icon="@drawable/ic_move_to_top_vector"
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:icon="@drawable/ic_move_to_bottom_vector"
android:title="@string/move_to_bottom"
app:showAsAction="ifRoom"/>
<item

View File

@ -56,8 +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>
<string name="move_to_top">Presunúť na vrch</string>
<string name="move_to_bottom">Presunúť na spodok</string>
<!-- Import / Export -->
<string name="export_all_notes">Exportovať všetky poznámky ako súbory</string>