Skip to content

Commit

Permalink
Minor UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperDragonXD committed Sep 10, 2024
1 parent 15ef5c3 commit 975f463
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyGridItemScope
import androidx.compose.foundation.lazy.grid.LazyGridScope
import androidx.compose.foundation.lazy.grid.LazyGridState
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
Expand Down Expand Up @@ -96,7 +95,7 @@ fun IconPreviewGrid(
contentPadding: IconPreviewGridPadding = IconPreviewGridPadding.Defaults,
isIconPicker: Boolean = false,
gridState: LazyGridState = rememberLazyGridState(),
otherContent: @Composable (LazyGridItemScope.() -> Unit) = {},
otherContent: (LazyGridScope.() -> Unit) = {},
) {
val indexOfFirstItem by remember { derivedStateOf { gridState.firstVisibleItemIndex } }
val letter = iconInfo[indexOfFirstItem].label[0].uppercase()
Expand All @@ -120,11 +119,7 @@ fun IconPreviewGrid(
),
state = gridState,
) {
item(
span = { GridItemSpan(maxLineSpan) },
) {
otherContent()
}
otherContent()
items(
items = iconInfo,
contentType = { "icon_preview" },
Expand Down Expand Up @@ -241,6 +236,7 @@ fun AppBarListItem(modifier: Modifier = Modifier) {
contentDescription = stringResource(id = R.string.app_name),
modifier = Modifier
.size(36.dp)
.clip(CircleShape)
.combinedClickable(
onClick = {},
onLongClick = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
Expand All @@ -38,7 +39,6 @@ import androidx.compose.ui.unit.dp
import app.lawnchair.lawnicons.BuildConfig
import app.lawnchair.lawnicons.R
import app.lawnchair.lawnicons.repository.preferenceManager
import app.lawnchair.lawnicons.ui.components.core.Card
import app.lawnchair.lawnicons.ui.theme.LawniconsTheme
import app.lawnchair.lawnicons.ui.util.PreviewLawnicons

Expand Down Expand Up @@ -67,8 +67,13 @@ fun NewIconsCard(
modifier: Modifier = Modifier,
) {
AnimatedVisibility(visible) {
Card(
modifier = modifier,
Surface(
color = MaterialTheme.colorScheme.surfaceContainer,
shape = MaterialTheme.shapes.extraLarge,
modifier = modifier
.padding(horizontal = 8.dp)
.padding(bottom = 12.dp)
.fillMaxWidth(),
) {
Row(
verticalAlignment = Alignment.CenterVertically,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Star
import androidx.compose.material3.Icon
Expand All @@ -19,6 +20,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalInspectionMode
Expand Down Expand Up @@ -103,7 +105,9 @@ private fun About(
Image(
bitmap = context.appIcon().asImageBitmap(),
contentDescription = stringResource(id = R.string.app_name),
modifier = Modifier.size(72.dp),
modifier = Modifier
.size(72.dp)
.clip(CircleShape),
)
}
Text(
Expand Down
13 changes: 10 additions & 3 deletions app/src/main/kotlin/app/lawnchair/lawnicons/ui/destination/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Scaffold
Expand Down Expand Up @@ -145,11 +146,17 @@ private fun Home(
isIconPicker = isIconPicker,
gridState = lazyGridState,
) {
Column {
if (!isExpandedScreen) {
if (!isExpandedScreen) {
item(
span = { GridItemSpan(maxLineSpan) },
) {
AppBarListItem()
}
if (newIconsInfoModel.iconCount != 0) {
}
if (newIconsInfoModel.iconCount != 0) {
item(
span = { GridItemSpan(maxLineSpan) },
) {
NewIconsCard(onNavigateToNewIcons)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ import android.content.Context
import android.graphics.Bitmap
import androidx.core.graphics.drawable.toBitmap

fun Context.appIcon(): Bitmap = packageManager.getApplicationIcon(packageName).toBitmap()
fun Context.appIcon(): Bitmap = packageManager
.getApplicationIcon(packageName)
.toBitmap()
37 changes: 17 additions & 20 deletions app/src/main/res/drawable/new_releases.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
<!--
~ Copyright 2024 Lawnchair Launcher
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="960" android:viewportWidth="960" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M438,508L380,451Q369,440 352.5,440Q336,440 324,452Q313,463 313,480Q313,497 324,508L410,594Q422,606 438,606Q454,606 466,594L636,424Q648,412 647.5,396Q647,380 636,368Q624,356 607.5,355.5Q591,355 579,367L438,508ZM326,870L268,772L158,748Q143,745 134,732.5Q125,720 127,705L138,592L63,506Q53,495 53,480Q53,465 63,454L138,368L127,255Q125,240 134,227.5Q143,215 158,212L268,188L326,90Q334,77 348,72.5Q362,68 376,74L480,118L584,74Q598,68 612,72.5Q626,77 634,90L692,188L802,212Q817,215 826,227.5Q835,240 833,255L822,368L897,454Q907,465 907,480Q907,495 897,506L822,592L833,705Q835,720 826,732.5Q817,745 802,748L692,772L634,870Q626,883 612,887.5Q598,892 584,886L480,842L376,886Q362,892 348,887.5Q334,883 326,870ZM378,798L480,754L584,798L640,702L750,676L740,564L814,480L740,394L750,282L640,258L582,162L480,206L376,162L320,258L210,282L220,394L146,480L220,564L210,678L320,702L378,798ZM480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480L480,480Z"/>

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,7.5a1,1 0,0 1,1 1v4a1,1 0,1 1,-2 0v-4a1,1 0,0 1,1 -1Z"
android:fillColor="#000"
android:fillType="evenOdd"/>
<path
android:pathData="M14.67,2.092a1,1 0,0 1,1.292 0.419l1.378,2.456 2.914,0.484a1,1 0,0 1,0.825 1.134l-0.406,2.718 2.026,1.982a1,1 0,0 1,0 1.43l-2.026,1.982 0.406,2.717a1,1 0,0 1,-0.825 1.135l-2.914,0.483 -1.378,2.457a1,1 0,0 1,-1.292 0.418L12,20.672l-2.67,1.235a1,1 0,0 1,-1.292 -0.418L6.66,19.032l-2.914,-0.483a1,1 0,0 1,-0.825 -1.135l0.406,-2.717 -2.026,-1.982a1,1 0,0 1,0 -1.43l2.026,-1.982 -0.406,-2.718a1,1 0,0 1,0.825 -1.134l2.914,-0.484 1.378,-2.456a1,1 0,0 1,1.292 -0.419L12,3.328l2.67,-1.236ZM14.67,4.296 L12.42,5.337a1,1 0,0 1,-0.84 0L9.33,4.296 8.17,6.364a1,1 0,0 1,-0.709 0.498l-2.417,0.401 0.337,2.25a1,1 0,0 1,-0.29 0.862L3.43,12l1.66,1.624a1,1 0,0 1,0.29 0.863l-0.337,2.25 2.417,0.401a1,1 0,0 1,0.709 0.498l1.16,2.068 2.25,-1.041a1,1 0,0 1,0.84 0l2.25,1.04 1.16,-2.067a1,1 0,0 1,0.708 -0.498l2.418,-0.401 -0.337,-2.25a1,1 0,0 1,0.29 -0.863L20.57,12l-1.66,-1.625a1,1 0,0 1,-0.29 -0.862l0.337,-2.25 -2.418,-0.401a1,1 0,0 1,-0.708 -0.498l-1.16,-2.068Z"
android:fillColor="#000"
android:fillType="evenOdd"/>
<path
android:pathData="M11,16a1,1 0,1 1,2 0,1 1,0 0,1 -2,0Z"
android:fillColor="#000"
android:fillType="evenOdd"/>
</vector>

0 comments on commit 975f463

Please sign in to comment.