Tweak source view type menu radio icon to match stable

This commit is contained in:
arkon 2022-10-15 12:05:52 -04:00
parent c2eaf1c86b
commit dbd93cf5d1
2 changed files with 17 additions and 12 deletions

View file

@ -24,7 +24,7 @@ import eu.kanade.presentation.browse.BrowseSourceState
import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.DropdownMenu import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.presentation.components.RadioButton import eu.kanade.presentation.components.RadioMenuItem
import eu.kanade.presentation.components.SearchToolbar import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.CatalogueSource
@ -119,21 +119,24 @@ fun BrowseSourceRegularToolbar(
expanded = selectingDisplayMode, expanded = selectingDisplayMode,
onDismissRequest = { selectingDisplayMode = false }, onDismissRequest = { selectingDisplayMode = false },
) { ) {
RadioButton( RadioMenuItem(
text = { Text(text = stringResource(R.string.action_display_comfortable_grid)) }, text = { Text(text = stringResource(R.string.action_display_comfortable_grid)) },
onClick = { onDisplayModeChange(LibraryDisplayMode.ComfortableGrid) },
isChecked = displayMode == LibraryDisplayMode.ComfortableGrid, isChecked = displayMode == LibraryDisplayMode.ComfortableGrid,
) ) {
RadioButton( onDisplayModeChange(LibraryDisplayMode.ComfortableGrid)
}
RadioMenuItem(
text = { Text(text = stringResource(R.string.action_display_grid)) }, text = { Text(text = stringResource(R.string.action_display_grid)) },
onClick = { onDisplayModeChange(LibraryDisplayMode.CompactGrid) },
isChecked = displayMode == LibraryDisplayMode.CompactGrid, isChecked = displayMode == LibraryDisplayMode.CompactGrid,
) ) {
RadioButton( onDisplayModeChange(LibraryDisplayMode.CompactGrid)
}
RadioMenuItem(
text = { Text(text = stringResource(R.string.action_display_list)) }, text = { Text(text = stringResource(R.string.action_display_list)) },
onClick = { onDisplayModeChange(LibraryDisplayMode.List) },
isChecked = displayMode == LibraryDisplayMode.List, isChecked = displayMode == LibraryDisplayMode.List,
) ) {
onDisplayModeChange(LibraryDisplayMode.List)
}
} }
}, },
scrollBehavior = scrollBehavior, scrollBehavior = scrollBehavior,

View file

@ -7,6 +7,7 @@ import androidx.compose.material.icons.outlined.RadioButtonChecked
import androidx.compose.material.icons.outlined.RadioButtonUnchecked import androidx.compose.material.icons.outlined.RadioButtonUnchecked
import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.DpOffset import androidx.compose.ui.unit.DpOffset
@ -33,10 +34,10 @@ fun DropdownMenu(
} }
@Composable @Composable
fun RadioButton( fun RadioMenuItem(
text: @Composable () -> Unit, text: @Composable () -> Unit,
onClick: () -> Unit,
isChecked: Boolean, isChecked: Boolean,
onClick: () -> Unit,
) { ) {
DropdownMenuItem( DropdownMenuItem(
text = text, text = text,
@ -46,6 +47,7 @@ fun RadioButton(
Icon( Icon(
imageVector = Icons.Outlined.RadioButtonChecked, imageVector = Icons.Outlined.RadioButtonChecked,
contentDescription = "", contentDescription = "",
tint = MaterialTheme.colorScheme.primary,
) )
} else { } else {
Icon( Icon(