add BackHandler add actionModeCounter

This commit is contained in:
semenvav 2023-07-24 23:58:39 +03:00
parent c14fcfdec3
commit a0625e5de2
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package eu.kanade.presentation.more.download package eu.kanade.presentation.more.download
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
@ -160,6 +161,9 @@ private fun DownloadStatsAppBar(
navigateUp = navigateUp, navigateUp = navigateUp,
onMultiDeleteClicked = onMultiDeleteClicked, onMultiDeleteClicked = onMultiDeleteClicked,
) )
BackHandler(
onBack = onCancelActionMode,
)
} else { } else {
SearchToolbar( SearchToolbar(
navigateUp = navigateUp, navigateUp = navigateUp,
@ -212,6 +216,9 @@ private fun DownloadStatsAppBar(
}, },
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
) )
BackHandler(
onBack = { onChangeSearchQuery(null) },
)
} }
} }
@ -230,7 +237,7 @@ private fun DownloadStatsActionAppBar(
modifier = modifier, modifier = modifier,
title = stringResource(R.string.label_download_stats), title = stringResource(R.string.label_download_stats),
onCancelActionMode = onCancelActionMode, onCancelActionMode = onCancelActionMode,
actions = { actionModeActions = {
AppBarActions( AppBarActions(
listOf( listOf(
AppBar.Action( AppBar.Action(
@ -251,6 +258,7 @@ private fun DownloadStatsActionAppBar(
), ),
) )
}, },
actionModeCounter = selected.size,
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,
navigateUp = navigateUp, navigateUp = navigateUp,
) )
@ -296,7 +304,7 @@ fun SortDropdownMenu(
onDismissRequest = onDismissRequest, onDismissRequest = onDismissRequest,
) { ) {
listOfNotNull( listOfNotNull(
SortingMode.BY_ALPHABET to stringResource(R.string.action_sort_alpha), SortingMode.BY_ALPHABET to stringResource(R.string.action_sort_A_Z),
SortingMode.BY_SIZE to stringResource(R.string.action_sort_size), SortingMode.BY_SIZE to stringResource(R.string.action_sort_size),
).map { (mode, string) -> ).map { (mode, string) ->
SortItem( SortItem(

View File

@ -58,6 +58,7 @@
<!-- reserved for #4048 --> <!-- reserved for #4048 -->
<string name="action_filter_empty">Remove filter</string> <string name="action_filter_empty">Remove filter</string>
<string name="action_sort_alpha">Alphabetically</string> <string name="action_sort_alpha">Alphabetically</string>
<string name="action_sort_A_Z">A-Z</string>
<string name="action_sort_count">Total entries</string> <string name="action_sort_count">Total entries</string>
<string name="action_sort_total">Total chapters</string> <string name="action_sort_total">Total chapters</string>
<string name="action_sort_last_read">Last read</string> <string name="action_sort_last_read">Last read</string>