Cleanup Source home screen

This commit is contained in:
Syer10
2021-09-27 21:23:47 -04:00
parent 93a41b7626
commit fbf3e09416

View File

@@ -51,7 +51,7 @@ fun SourceHomeScreen(
} else { } else {
Box(Modifier.fillMaxSize(), Alignment.TopCenter) { Box(Modifier.fillMaxSize(), Alignment.TopCenter) {
val state = rememberLazyListState() val state = rememberLazyListState()
SourceCategory("all", sources, serverUrl, onSourceClicked, state) SourceCategory(sources, serverUrl, onSourceClicked, state)
/*val sourcesByLang = sources.groupBy { it.lang.toLowerCase() }.toList() /*val sourcesByLang = sources.groupBy { it.lang.toLowerCase() }.toList()
LazyColumn(state = state) { LazyColumn(state = state) {
items(sourcesByLang) { (lang, sources) -> items(sourcesByLang) { (lang, sources) ->
@@ -74,16 +74,11 @@ fun SourceHomeScreen(
@Composable @Composable
fun SourceCategory( fun SourceCategory(
lang: String,
sources: List<Source>, sources: List<Source>,
serverUrl: String, serverUrl: String,
onSourceClicked: (Source) -> Unit, onSourceClicked: (Source) -> Unit,
state: LazyListState state: LazyListState
) { ) {
Column {
/*Surface(elevation = 1.dp, modifier = Modifier.fillMaxWidth()) {
Text(lang.uppercase(Locale.getDefault()), modifier = Modifier.align(Alignment.CenterHorizontally), color = MaterialTheme.colors.onBackground)
}*/
LazyVerticalGrid(GridCells.Adaptive(120.dp), state = state) { LazyVerticalGrid(GridCells.Adaptive(120.dp), state = state) {
items(sources) { source -> items(sources) { source ->
SourceItem( SourceItem(
@@ -95,7 +90,6 @@ fun SourceCategory(
} }
} }
} }
}
@Composable @Composable
fun SourceItem( fun SourceItem(