Use color for icon shape selection (#1285)
This commit is contained in:
parent
cae772bd1d
commit
ff695cb767
@ -1,6 +1,5 @@
|
|||||||
package de.mm20.launcher2.ui.settings.icons
|
package de.mm20.launcher2.ui.settings.icons
|
||||||
|
|
||||||
import android.graphics.drawable.ColorDrawable
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.foundation.BorderStroke
|
import androidx.compose.foundation.BorderStroke
|
||||||
@ -17,9 +16,7 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.lazy.grid.GridCells
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.FormatPaint
|
|
||||||
import androidx.compose.material.icons.rounded.Palette
|
import androidx.compose.material.icons.rounded.Palette
|
||||||
import androidx.compose.material3.HorizontalDivider
|
import androidx.compose.material3.HorizontalDivider
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@ -42,13 +39,10 @@ import androidx.compose.ui.res.stringResource
|
|||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import de.mm20.launcher2.icons.IconPack
|
import de.mm20.launcher2.icons.IconPack
|
||||||
import de.mm20.launcher2.icons.LauncherIcon
|
import de.mm20.launcher2.icons.LauncherIcon
|
||||||
import de.mm20.launcher2.icons.StaticIconLayer
|
|
||||||
import de.mm20.launcher2.icons.StaticLauncherIcon
|
|
||||||
import de.mm20.launcher2.preferences.IconShape
|
import de.mm20.launcher2.preferences.IconShape
|
||||||
import de.mm20.launcher2.preferences.ui.GridSettings
|
import de.mm20.launcher2.preferences.ui.GridSettings
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
@ -430,30 +424,10 @@ fun IconShapePreference(
|
|||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
Box(
|
||||||
ShapedLauncherIcon(
|
modifier = Modifier.clip(getShape(it))
|
||||||
size = 48.dp,
|
.size(48.dp)
|
||||||
icon = {
|
.background(MaterialTheme.colorScheme.primary)
|
||||||
StaticLauncherIcon(
|
|
||||||
foregroundLayer = StaticIconLayer(
|
|
||||||
icon = ContextCompat.getDrawable(
|
|
||||||
context,
|
|
||||||
R.mipmap.ic_launcher_foreground
|
|
||||||
)!!,
|
|
||||||
scale = 1.5f,
|
|
||||||
),
|
|
||||||
backgroundLayer = StaticIconLayer(
|
|
||||||
icon = ColorDrawable(
|
|
||||||
context.getColor(R.color.ic_launcher_background)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
},
|
|
||||||
modifier = Modifier.clickable {
|
|
||||||
onValueChanged(it)
|
|
||||||
showDialog = false
|
|
||||||
},
|
|
||||||
shape = getShape(it)
|
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
getShapeName(it) ?: "",
|
getShapeName(it) ?: "",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user