Skip to content

Commit

Permalink
added share button to actionmode in recordings list (not operational …
Browse files Browse the repository at this point in the history
…yet)
  • Loading branch information
Leonidius20 committed Jul 16, 2024
1 parent e7c57f2 commit 1899dbc
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/ic_share.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/>

</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@
android:icon="@drawable/ic_delete_forever"
android:title="@string/recordings_list_action_delete_forever" />

<item
android:id="@+id/recordings_list_action_share"
android:icon="@drawable/ic_share"
android:title="@string/recordings_list_action_share"/>

</menu>
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@
android:icon="@drawable/ic_delete_forever"
android:title="@string/recordings_list_action_delete_forever" />

<item
android:id="@+id/recordings_list_action_share"
android:icon="@drawable/ic_share"
android:title="@string/recordings_list_action_share"/>

</menu>
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@
android:icon="@drawable/ic_delete_forever"
android:title="@string/recordings_list_action_delete_forever" />

<item
android:id="@+id/recordings_list_action_share"
android:icon="@drawable/ic_share"
android:title="@string/recordings_list_action_share"/>

</menu>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@
android:icon="@drawable/ic_delete_forever"
android:title="@string/recordings_list_action_delete_forever" />

<item
android:id="@+id/recordings_list_action_share"
android:icon="@drawable/ic_share"
android:title="@string/recordings_list_action_share"/>

</menu>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
<string name="recordings_list_action_delete_forever">Delete forever</string>
<string name="recordings_list_action_trash">Move to trash</string>
<string name="recordings_list_title">Recordings</string>
<string name="recordings_list_action_share">Share</string>
</resources>

0 comments on commit 1899dbc

Please sign in to comment.