|
@@ -1,15 +1,17 @@
|
|
|
package eu.kanade.presentation.library.components
|
|
|
|
|
|
import androidx.compose.foundation.isSystemInDarkTheme
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
import androidx.compose.foundation.text.KeyboardActions
|
|
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
import androidx.compose.material.icons.outlined.FilterList
|
|
|
import androidx.compose.material.icons.outlined.FlipToBack
|
|
|
-import androidx.compose.material.icons.outlined.Refresh
|
|
|
+import androidx.compose.material.icons.outlined.MoreVert
|
|
|
import androidx.compose.material.icons.outlined.Search
|
|
|
import androidx.compose.material.icons.outlined.SelectAll
|
|
|
+import androidx.compose.material3.DropdownMenuItem
|
|
|
import androidx.compose.material3.Icon
|
|
|
import androidx.compose.material3.IconButton
|
|
|
import androidx.compose.material3.LocalContentColor
|
|
@@ -17,6 +19,10 @@ import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.Text
|
|
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
|
|
import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.runtime.getValue
|
|
|
+import androidx.compose.runtime.mutableStateOf
|
|
|
+import androidx.compose.runtime.remember
|
|
|
+import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.platform.LocalFocusManager
|
|
@@ -26,6 +32,7 @@ import androidx.compose.ui.text.input.ImeAction
|
|
|
import androidx.compose.ui.text.style.TextOverflow
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
import eu.kanade.presentation.components.AppBar
|
|
|
+import eu.kanade.presentation.components.DropdownMenu
|
|
|
import eu.kanade.presentation.components.Pill
|
|
|
import eu.kanade.presentation.components.SearchToolbar
|
|
|
import eu.kanade.presentation.library.LibraryState
|
|
@@ -43,6 +50,7 @@ fun LibraryToolbar(
|
|
|
onClickInvertSelection: () -> Unit,
|
|
|
onClickFilter: () -> Unit,
|
|
|
onClickRefresh: () -> Unit,
|
|
|
+ onClickOpenRandomManga: () -> Unit,
|
|
|
scrollBehavior: TopAppBarScrollBehavior?,
|
|
|
) = when {
|
|
|
state.selectionMode -> LibrarySelectionToolbar(
|
|
@@ -85,6 +93,7 @@ fun LibraryToolbar(
|
|
|
onClickSearch = { state.searchQuery = "" },
|
|
|
onClickFilter = onClickFilter,
|
|
|
onClickRefresh = onClickRefresh,
|
|
|
+ onClickOpenRandomManga = onClickOpenRandomManga,
|
|
|
scrollBehavior = scrollBehavior,
|
|
|
)
|
|
|
}
|
|
@@ -98,6 +107,7 @@ fun LibraryRegularToolbar(
|
|
|
onClickSearch: () -> Unit,
|
|
|
onClickFilter: () -> Unit,
|
|
|
onClickRefresh: () -> Unit,
|
|
|
+ onClickOpenRandomManga: () -> Unit,
|
|
|
scrollBehavior: TopAppBarScrollBehavior?,
|
|
|
) {
|
|
|
val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f
|
|
@@ -127,8 +137,34 @@ fun LibraryRegularToolbar(
|
|
|
IconButton(onClick = onClickFilter) {
|
|
|
Icon(Icons.Outlined.FilterList, contentDescription = stringResource(R.string.action_filter), tint = filterTint)
|
|
|
}
|
|
|
- IconButton(onClick = onClickRefresh) {
|
|
|
- Icon(Icons.Outlined.Refresh, contentDescription = stringResource(R.string.pref_category_library_update))
|
|
|
+ var moreExpanded by remember { mutableStateOf(false) }
|
|
|
+ Box {
|
|
|
+ IconButton(onClick = { moreExpanded = !moreExpanded }) {
|
|
|
+ Icon(
|
|
|
+ imageVector = Icons.Outlined.MoreVert,
|
|
|
+ contentDescription = stringResource(R.string.abc_action_menu_overflow_description),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ val onDismissRequest = { moreExpanded = false }
|
|
|
+ DropdownMenu(
|
|
|
+ expanded = moreExpanded,
|
|
|
+ onDismissRequest = onDismissRequest,
|
|
|
+ ) {
|
|
|
+ DropdownMenuItem(
|
|
|
+ text = { Text(text = stringResource(R.string.pref_category_library_update)) },
|
|
|
+ onClick = {
|
|
|
+ onClickRefresh()
|
|
|
+ onDismissRequest()
|
|
|
+ },
|
|
|
+ )
|
|
|
+ DropdownMenuItem(
|
|
|
+ text = { Text(text = stringResource(R.string.action_open_random_manga)) },
|
|
|
+ onClick = {
|
|
|
+ onClickOpenRandomManga()
|
|
|
+ onDismissRequest()
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
incognitoMode = incognitoMode,
|