Skip to content

Commit

Permalink
Fix styles
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler committed Dec 9, 2023
1 parent 3db1fb0 commit 457b280
Show file tree
Hide file tree
Showing 23 changed files with 110 additions and 97 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package app.lawnchair.lawnicons.model

import kotlinx.collections.immutable.ImmutableList

data class IconInfoModel(
val iconInfo: List<IconInfo>,
val iconInfo: ImmutableList<IconInfo>,
val iconCount: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import app.lawnchair.lawnicons.model.IconInfoModel
import app.lawnchair.lawnicons.model.SearchInfo
import app.lawnchair.lawnicons.util.getIconInfo
import javax.inject.Inject
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -26,11 +27,11 @@ class IconRepository @Inject constructor(application: Application) {
.sortedBy { it.name.lowercase() }
.also {
iconInfoModel.value = IconInfoModel(
iconInfo = it,
iconInfo = it.toPersistentList(),
iconCount = it.size,
)
searchedIconInfoModel.value = IconInfoModel(
iconInfo = it,
iconInfo = it.toPersistentList(),
iconCount = it.size,
)
}
Expand All @@ -57,7 +58,7 @@ class IconRepository @Inject constructor(application: Application) {
),
).map { searchInfo ->
searchInfo.iconInfo
}
}.toPersistentList()
IconInfoModel(
iconCount = it.size,
iconInfo = filtered,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.ui.components.core.SimpleListRow
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import coil.compose.AsyncImage
import coil.request.ImageRequest

Expand Down Expand Up @@ -70,9 +70,9 @@ fun ContributorRow(
)
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun ContributorRowPreview() {
private fun ContributorRowPreview() {
LawniconsTheme {
ContributorRow(
name = "User",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import app.lawnchair.lawnicons.ui.components.core.placeholder.material.fade
import app.lawnchair.lawnicons.ui.components.core.placeholder.material.placeholder
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.Elevation
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import app.lawnchair.lawnicons.ui.util.surfaceColorAtElevation

@Composable
Expand Down Expand Up @@ -63,9 +63,9 @@ fun ContributorRowPlaceholder(
}
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun ContributorRowPlaceholderPreview() {
private fun ContributorRowPlaceholderPreview() {
LawniconsTheme {
ContributorRowPlaceholder()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
import app.lawnchair.lawnicons.ui.components.core.SimpleListRow
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons

@Composable
fun ExternalLinkRow(
Expand Down Expand Up @@ -35,9 +35,9 @@ fun ExternalLinkRow(
)
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun ExternalLinkRowPreview() {
private fun ExternalLinkRowPreview() {
LawniconsTheme {
ExternalLinkRow(
name = "User",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.Elevation
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons

@Composable
fun Card(
Expand All @@ -26,7 +26,7 @@ fun Card(
text = label,
style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary,
modifier = modifier.padding(start = 32.dp, bottom = 12.dp),
modifier = Modifier.padding(start = 32.dp, bottom = 12.dp),
)
}
Surface(
Expand All @@ -44,9 +44,9 @@ fun Card(
}
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun CardPreview() {
private fun CardPreview() {
LawniconsTheme {
Card(
label = "Example",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.ui.components.home.ClickableIcon
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import app.lawnchair.lawnicons.ui.util.toPaddingValues

@OptIn(ExperimentalMaterial3Api::class)
Expand Down Expand Up @@ -68,9 +68,9 @@ fun LawniconsScaffold(
}
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun LawniconsScaffoldPreview() {
private fun LawniconsScaffoldPreview() {
LawniconsTheme {
LawniconsScaffold(
title = "Example small bar",
Expand All @@ -87,9 +87,9 @@ fun LawniconsScaffoldPreview() {
}
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun LawniconsScaffoldExpandedPreview() {
private fun LawniconsScaffoldExpandedPreview() {
LawniconsTheme {
LawniconsScaffold(
title = "Example small bar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextOverflow
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons

@Composable
fun SimpleListRow(
Expand Down Expand Up @@ -52,9 +52,9 @@ fun SimpleListRow(
)
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun SimpleListRowPreview() {
private fun SimpleListRowPreview() {
LawniconsTheme {
SimpleListRow(
label = "Example",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fun SystemUi() {
showSystemUi = true,
)
@Composable
fun SystemUIPreview() {
private fun SystemUIPreview() {
LawniconsTheme {
SystemUi()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.ui.components.home.ClickableIcon
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons

@OptIn(ExperimentalMaterial3Api::class)
@Composable
Expand Down Expand Up @@ -44,9 +44,9 @@ fun TopAppBar(
}

@OptIn(ExperimentalMaterial3Api::class)
@LawniconsPreview
@PreviewLawnicons
@Composable
fun SmallTopAppBarPreview() {
private fun SmallTopAppBarPreview() {
LawniconsTheme {
TopAppBar(
navigationIcon = {
Expand All @@ -65,9 +65,9 @@ fun SmallTopAppBarPreview() {
}

@OptIn(ExperimentalMaterial3Api::class)
@LawniconsPreview
@PreviewLawnicons
@Composable
fun LargeTopAppBarPreview() {
private fun LargeTopAppBarPreview() {
LawniconsTheme {
TopAppBar(
navigationIcon = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons

@Composable
fun ClickableIcon(
modifier: Modifier = Modifier,
size: Dp = 48.dp,
onClick: () -> Unit,
imageVector: ImageVector,
modifier: Modifier = Modifier,
size: Dp = 48.dp,
tint: Color = MaterialTheme.colorScheme.onSurface,
) {
Box(
Expand All @@ -42,9 +42,9 @@ fun ClickableIcon(
}
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun ClickableIconPreview() {
private fun ClickableIconPreview() {
LawniconsTheme {
ClickableIcon(
imageVector = Icons.Rounded.Clear,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
Expand All @@ -28,16 +27,16 @@ import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.R
import app.lawnchair.lawnicons.model.IconInfo
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import app.lawnchair.lawnicons.ui.util.SampleData

@Composable
fun IconInfoPopup(
iconInfo: IconInfo,
isPopupShown: MutableState<Boolean>,
isPopupShown: (Boolean) -> Unit,
) {
AlertDialog(
onDismissRequest = { isPopupShown.value = false },
onDismissRequest = { isPopupShown(false) },
title = { Text(text = iconInfo.name) },
icon = {
if (LocalInspectionMode.current) {
Expand All @@ -63,7 +62,7 @@ fun IconInfoPopup(
}
},
confirmButton = {
TextButton(onClick = { isPopupShown.value = false }) {
TextButton(onClick = { isPopupShown(false) }) {
Text(text = stringResource(id = R.string.ok_button))
}
},
Expand Down Expand Up @@ -95,14 +94,15 @@ fun IconInfoPopup(
)
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun IconInfoPopupPreview() {
private fun IconInfoPopupPreview() {
val showPopup = remember { mutableStateOf(true) }
LawniconsTheme {
IconInfoPopup(
iconInfo = SampleData.iconInfoSample,
isPopupShown = showPopup,
)
) {
showPopup.value = it
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.model.IconInfo
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.Elevation
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import app.lawnchair.lawnicons.ui.util.SampleData
import app.lawnchair.lawnicons.ui.util.surfaceColorAtElevation

Expand Down Expand Up @@ -90,14 +90,15 @@ fun IconPreview(
if (isIconInfoShown.value) {
IconInfoPopup(
iconInfo = iconInfo,
isPopupShown = isIconInfoShown,
)
) {
isIconInfoShown.value = it
}
}
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun IconPreviewComposablePreview() {
private fun IconPreviewComposablePreview() {
LawniconsTheme {
IconPreview(
iconInfo = SampleData.iconInfoSample,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.model.IconInfo
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import app.lawnchair.lawnicons.ui.util.SampleData
import app.lawnchair.lawnicons.ui.util.toPaddingValues
import kotlinx.collections.immutable.ImmutableList

@Composable
@ExperimentalFoundationApi
fun IconPreviewGrid(
iconInfo: List<IconInfo>,
iconInfo: ImmutableList<IconInfo>,
isExpandedScreen: Boolean,
) {
LazyVerticalGrid(
Expand Down Expand Up @@ -52,9 +53,9 @@ fun IconPreviewGrid(
}

@OptIn(ExperimentalFoundationApi::class)
@LawniconsPreview
@PreviewLawnicons
@Composable
fun IconGridPreview() {
private fun IconGridPreview() {
LawniconsTheme {
IconPreviewGrid(
SampleData.iconInfoList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.Elevation
import app.lawnchair.lawnicons.ui.util.LawniconsPreview
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons
import app.lawnchair.lawnicons.ui.util.surfaceColorAtElevation

@Composable
Expand All @@ -37,9 +37,9 @@ fun PlaceholderSearchBar() {
)
}

@LawniconsPreview
@PreviewLawnicons
@Composable
fun PlaceholderSearchBarPreview() {
private fun PlaceholderSearchBarPreview() {
LawniconsTheme {
PlaceholderSearchBar()
}
Expand Down
Loading

0 comments on commit 457b280

Please sign in to comment.