From 431e5ba8f5db60d7eb0497a8de1536da1ccf8500 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 3 Jul 2024 11:41:03 -0300 Subject: [PATCH] toggle files checkbox when clicking them and add more space before checkbox --- .../org/calyxos/backup/storage/ui/restore/FilesAdapter.kt | 8 ++++---- storage/lib/src/main/res/layout/item_file.xml | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/storage/lib/src/main/java/org/calyxos/backup/storage/ui/restore/FilesAdapter.kt b/storage/lib/src/main/java/org/calyxos/backup/storage/ui/restore/FilesAdapter.kt index ba63fbcd..7fab5683 100644 --- a/storage/lib/src/main/java/org/calyxos/backup/storage/ui/restore/FilesAdapter.kt +++ b/storage/lib/src/main/java/org/calyxos/backup/storage/ui/restore/FilesAdapter.kt @@ -80,12 +80,12 @@ internal class FilesAdapter( R.drawable.ic_chevron_right } expandView.setImageResource(res) - itemView.setOnClickListener { - onExpandClicked(item) - } } else if (item is FileItem) { expandView.setImageResource(getDrawableResource(item)) - itemView.setOnClickListener(null) + } + itemView.setOnClickListener { + if (item is FolderItem) onExpandClicked(item) + else checkBox.toggle() } itemView.updatePadding(left = indentPadding * item.level) nameView.text = item.name diff --git a/storage/lib/src/main/res/layout/item_file.xml b/storage/lib/src/main/res/layout/item_file.xml index b9262f72..86508bbb 100644 --- a/storage/lib/src/main/res/layout/item_file.xml +++ b/storage/lib/src/main/res/layout/item_file.xml @@ -25,6 +25,7 @@ android:id="@+id/nameView" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_marginEnd="8dp" android:textAppearance="?android:attr/textAppearanceListItem" app:layout_constraintEnd_toStartOf="@+id/checkBox" app:layout_constraintStart_toEndOf="@+id/expandView"