From 1899dbc49b3112245600ce49ceee0fbbff7b3162 Mon Sep 17 00:00:00 2001 From: Leonidius20 <25536411+Leonidius20@users.noreply.github.com> Date: Tue, 16 Jul 2024 23:39:27 +0300 Subject: [PATCH] added share button to actionmode in recordings list (not operational yet) --- .../recorder/ui/recordings_list/RecordingsListAdapter.kt | 8 +------- .../recorder/ui/recordings_list/RecordingsListFragment.kt | 6 +++--- app/src/main/res/drawable/ic_share.xml | 5 +++++ .../recordings_list_multiple_recordings_context_menu.xml | 5 +++++ .../recordings_list_one_recording_context_menu.xml | 5 +++++ .../recordings_list_multiple_recordings_context_menu.xml | 5 +++++ .../menu/recordings_list_one_recording_context_menu.xml | 5 +++++ app/src/main/res/values/strings.xml | 1 + 8 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 app/src/main/res/drawable/ic_share.xml diff --git a/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListAdapter.kt b/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListAdapter.kt index 609cf61..72da59d 100644 --- a/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListAdapter.kt +++ b/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListAdapter.kt @@ -60,12 +60,6 @@ class RecordingsListAdapter( this.binding.recording = recordings[position] this.binding.root.isSelected = isSelected(position) - /*binding.root.backgroundTint (ContextCompat.getColor(context, - if (isSelected(position)) { - R.color.md_theme_secondaryContainer - } else android.R.color.black, - )) // todo: proper highlighting*/ - if (isSelected(position)) { binding.leadingIcon.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_selected)) // binding.leadingIcon.setBackgroundColor(ContextCompat.getColor(context, R.color.md_theme_errorContainer_highContrast)) @@ -75,7 +69,7 @@ class RecordingsListAdapter( } } - fun isSelected(position: Int) = selectedItems.contains(position) + private fun isSelected(position: Int) = selectedItems.contains(position) fun toggleSelection(position: Int) { if (selectedItems.get(position, false)) { diff --git a/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListFragment.kt b/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListFragment.kt index 60200f4..3218223 100644 --- a/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListFragment.kt +++ b/app/src/main/java/io/github/leonidius20/recorder/ui/recordings_list/RecordingsListFragment.kt @@ -165,9 +165,9 @@ class RecordingsListFragment : Fragment() { R.id.recordings_list_action_delete_forever -> { delete() } - /*R.id.recordings_list_action_share -> { + R.id.recordings_list_action_share -> { // todo - }*/ + } R.id.recordings_list_action_trash -> { trash() } @@ -203,7 +203,7 @@ class RecordingsListFragment : Fragment() { fun rename() { val position = adapter.getSelectedItemsPositions().first() // if success - // todo + // todo: first stop actionmode, then show rename dialog, so that the need for payloads is evident actionMode!!.finish() val newData = viewModel.recordings.value!![position].copy( name = "new name" diff --git a/app/src/main/res/drawable/ic_share.xml b/app/src/main/res/drawable/ic_share.xml new file mode 100644 index 0000000..74753b7 --- /dev/null +++ b/app/src/main/res/drawable/ic_share.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/menu-v30/recordings_list_multiple_recordings_context_menu.xml b/app/src/main/res/menu-v30/recordings_list_multiple_recordings_context_menu.xml index 7607c5b..dddeeac 100644 --- a/app/src/main/res/menu-v30/recordings_list_multiple_recordings_context_menu.xml +++ b/app/src/main/res/menu-v30/recordings_list_multiple_recordings_context_menu.xml @@ -11,4 +11,9 @@ android:icon="@drawable/ic_delete_forever" android:title="@string/recordings_list_action_delete_forever" /> + + \ No newline at end of file diff --git a/app/src/main/res/menu-v30/recordings_list_one_recording_context_menu.xml b/app/src/main/res/menu-v30/recordings_list_one_recording_context_menu.xml index cf064c2..14c4ed1 100644 --- a/app/src/main/res/menu-v30/recordings_list_one_recording_context_menu.xml +++ b/app/src/main/res/menu-v30/recordings_list_one_recording_context_menu.xml @@ -15,4 +15,9 @@ android:icon="@drawable/ic_delete_forever" android:title="@string/recordings_list_action_delete_forever" /> + + \ No newline at end of file diff --git a/app/src/main/res/menu/recordings_list_multiple_recordings_context_menu.xml b/app/src/main/res/menu/recordings_list_multiple_recordings_context_menu.xml index 7dbdaec..e0927ba 100644 --- a/app/src/main/res/menu/recordings_list_multiple_recordings_context_menu.xml +++ b/app/src/main/res/menu/recordings_list_multiple_recordings_context_menu.xml @@ -6,4 +6,9 @@ android:icon="@drawable/ic_delete_forever" android:title="@string/recordings_list_action_delete_forever" /> + + \ No newline at end of file diff --git a/app/src/main/res/menu/recordings_list_one_recording_context_menu.xml b/app/src/main/res/menu/recordings_list_one_recording_context_menu.xml index 2ac2a0f..d789e92 100644 --- a/app/src/main/res/menu/recordings_list_one_recording_context_menu.xml +++ b/app/src/main/res/menu/recordings_list_one_recording_context_menu.xml @@ -10,4 +10,9 @@ android:icon="@drawable/ic_delete_forever" android:title="@string/recordings_list_action_delete_forever" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0644aa2..99b9460 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -10,4 +10,5 @@ Delete forever Move to trash Recordings + Share \ No newline at end of file