mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-26 07:06:03 +03:00
Implement nicer UI for migrate list sorting
This commit is contained in:
parent
92e83f702c
commit
90c08303fa
3 changed files with 37 additions and 21 deletions
|
@ -8,7 +8,13 @@ import androidx.compose.foundation.layout.asPaddingValues
|
|||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.ArrowDownward
|
||||
import androidx.compose.material.icons.outlined.ArrowUpward
|
||||
import androidx.compose.material.icons.outlined.Numbers
|
||||
import androidx.compose.material.icons.outlined.SortByAlpha
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
|
@ -75,25 +81,35 @@ fun MigrateSourceList(
|
|||
ScrollbarLazyColumn(
|
||||
contentPadding = bottomNavPaddingValues + WindowInsets.navigationBars.asPaddingValues() + topPaddingValues,
|
||||
) {
|
||||
stickyHeader {
|
||||
Row {
|
||||
Button(onClick = onToggleSortingMode) {
|
||||
Text(sortingMode.toString())
|
||||
stickyHeader(key = "header") {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.animateItemPlacement()
|
||||
.padding(start = horizontalPadding),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.migration_selection_prompt),
|
||||
modifier = Modifier.weight(1f),
|
||||
style = MaterialTheme.typography.header,
|
||||
)
|
||||
|
||||
IconButton(onClick = onToggleSortingMode) {
|
||||
when (sortingMode) {
|
||||
SetMigrateSorting.Mode.ALPHABETICAL -> Icon(Icons.Outlined.SortByAlpha, contentDescription = stringResource(R.string.action_sort_alpha))
|
||||
SetMigrateSorting.Mode.TOTAL -> Icon(Icons.Outlined.Numbers, contentDescription = stringResource(R.string.action_sort_total))
|
||||
}
|
||||
}
|
||||
Button(onClick = onToggleSortingDirection) {
|
||||
Text(sortingDirection.toString())
|
||||
IconButton(onClick = onToggleSortingDirection) {
|
||||
when (sortingDirection) {
|
||||
SetMigrateSorting.Direction.ASCENDING -> Icon(Icons.Outlined.ArrowUpward, contentDescription = stringResource(R.string.action_asc))
|
||||
SetMigrateSorting.Direction.DESCENDING -> Icon(Icons.Outlined.ArrowDownward, contentDescription = stringResource(R.string.action_desc))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item(key = "title") {
|
||||
Text(
|
||||
text = stringResource(R.string.migration_selection_prompt),
|
||||
modifier = Modifier
|
||||
.animateItemPlacement()
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.header,
|
||||
)
|
||||
}
|
||||
|
||||
items(
|
||||
|
|
|
@ -10,7 +10,7 @@ import nucleus.presenter.Presenter
|
|||
|
||||
abstract class FullComposeController<P : Presenter<*>>(bundle: Bundle? = null) :
|
||||
NucleusController<ComposeControllerBinding, P>(bundle),
|
||||
FullComposeContentController {
|
||||
ComposeContentController {
|
||||
|
||||
override fun createBinding(inflater: LayoutInflater) =
|
||||
ComposeControllerBinding.inflate(inflater)
|
||||
|
@ -31,7 +31,7 @@ abstract class FullComposeController<P : Presenter<*>>(bundle: Bundle? = null) :
|
|||
*/
|
||||
abstract class BasicFullComposeController(bundle: Bundle? = null) :
|
||||
BaseController<ComposeControllerBinding>(bundle),
|
||||
FullComposeContentController {
|
||||
ComposeContentController {
|
||||
|
||||
override fun createBinding(inflater: LayoutInflater) =
|
||||
ComposeControllerBinding.inflate(inflater)
|
||||
|
@ -47,6 +47,6 @@ abstract class BasicFullComposeController(bundle: Bundle? = null) :
|
|||
}
|
||||
}
|
||||
|
||||
interface FullComposeContentController {
|
||||
interface ComposeContentController {
|
||||
@Composable fun ComposeContent()
|
||||
}
|
||||
|
|
|
@ -41,9 +41,9 @@ import eu.kanade.tachiyomi.data.updater.AppUpdateResult
|
|||
import eu.kanade.tachiyomi.databinding.MainActivityBinding
|
||||
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||
import eu.kanade.tachiyomi.ui.base.controller.ComposeContentController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.FabController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.FullComposeContentController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.setRoot
|
||||
|
@ -599,9 +599,9 @@ class MainActivity : BaseActivity() {
|
|||
binding.fabLayout.rootFab.hide()
|
||||
}
|
||||
|
||||
val isFullComposeController = internalTo is FullComposeContentController
|
||||
binding.appbar.isVisible = !isFullComposeController
|
||||
binding.controllerContainer.enableScrollingBehavior(!isFullComposeController)
|
||||
val isComposeController = internalTo is ComposeContentController
|
||||
binding.appbar.isVisible = !isComposeController
|
||||
binding.controllerContainer.enableScrollingBehavior(!isComposeController)
|
||||
|
||||
if (!isTablet()) {
|
||||
// Save lift state
|
||||
|
|
Loading…
Reference in a new issue