diff --git a/app/src/main/java/com/geode/launcher/MainActivity.kt b/app/src/main/java/com/geode/launcher/MainActivity.kt index fa3dd282..2c92fc55 100644 --- a/app/src/main/java/com/geode/launcher/MainActivity.kt +++ b/app/src/main/java/com/geode/launcher/MainActivity.kt @@ -464,54 +464,59 @@ data class ColorPalette( val innerColors: List>, ) -data class BrandPalette( +data class AnimatedIconSpec( val lightPalette: ColorPalette, val darkPalette: ColorPalette, @param:DrawableRes val innerId: Int, @param:DrawableRes val outerId: Int, +) +data class BrandPalette( @param:DrawableRes val darkLogo: Int, @param:DrawableRes val lightLogo: Int, @param:StringRes val title: Int, val titleFont: TextStyle, + val animatedIcon: AnimatedIconSpec? = null, ) val geodeColorPalette = BrandPalette( - lightPalette = ColorPalette( - outerColors = listOf( - 0.0f to Color(0xfff5b11d), - 0.10f to Color(0xfff0834d), - 0.24f to Color(0xffe85f6b), - 0.49f to Color(0xffc9659e), - 1.0f to Color(0xffb9588f) + animatedIcon = AnimatedIconSpec( + lightPalette = ColorPalette( + outerColors = listOf( + 0.0f to Color(0xfff5b11d), + 0.10f to Color(0xfff0834d), + 0.24f to Color(0xffe85f6b), + 0.49f to Color(0xffc9659e), + 1.0f to Color(0xffb9588f) + ), + innerColors = listOf( + 0.48f to Color(0xfff2ce00), + 0.63f to Color(0xfff4b97e), + 0.73f to Color(0xfff7b66a), + 1.0f to Color(0xffeb8fac) + ) ), - innerColors = listOf( - 0.48f to Color(0xfff2ce00), - 0.63f to Color(0xfff4b97e), - 0.73f to Color(0xfff7b66a), - 1.0f to Color(0xffeb8fac) - ) - ), - darkPalette = ColorPalette( - outerColors = listOf( - 0.0f to Color(0xfffffdff), - 0.08f to Color(0xffF2EAF5), - 0.12f to Color(0xffEDE5EF), - 0.31f to Color(0xffCDB5CD), - 0.49f to Color(0xffBA9BBC), - 1.0f to Color(0xff8D7ACF), + darkPalette = ColorPalette( + outerColors = listOf( + 0.0f to Color(0xfffffdff), + 0.08f to Color(0xffF2EAF5), + 0.12f to Color(0xffEDE5EF), + 0.31f to Color(0xffCDB5CD), + 0.49f to Color(0xffBA9BBC), + 1.0f to Color(0xff8D7ACF), + ), + innerColors = listOf( + 0.48f to Color(0xffffffff), + 0.63f to Color(0xfff5e4c2), + 0.73f to Color(0xffe5c7ad), + 1.0f to Color(0xffb790a9), + ) ), - innerColors = listOf( - 0.48f to Color(0xffffffff), - 0.63f to Color(0xfff5e4c2), - 0.73f to Color(0xffe5c7ad), - 1.0f to Color(0xffb790a9), - ) + innerId = R.drawable.geode_monochrome_inner, + outerId = R.drawable.geode_monochrome_outer, ), - innerId = R.drawable.geode_monochrome_inner, - outerId = R.drawable.geode_monochrome_outer, darkLogo = R.drawable.geode_base, lightLogo = R.drawable.geode_base_light, title = R.string.launcher_title, @@ -519,42 +524,8 @@ val geodeColorPalette = BrandPalette( ) val sapphireColorPalette = BrandPalette( - lightPalette = ColorPalette( - outerColors = listOf( - 0.0f to Color(0xff906FFF), - 0.08f to Color(0xff9E81FF), - 0.12f to Color(0xffAB8DFF), - 0.31f to Color(0xffBE89FF), - 0.49f to Color(0xff979BD7), - 1.0f to Color(0xff558DDA), - ), - innerColors = listOf( - 0.48f to Color(0xffFFB65C), - 0.63f to Color(0xffFFADA4), - 0.73f to Color(0xffF0A3A4), - 1.0f to Color(0xffD066A6), - ) - ), - darkPalette = ColorPalette( - outerColors = listOf( - 0.0f to Color(0xfffffdff), - 0.08f to Color(0xffF2EAF5), - 0.12f to Color(0xffEDE5EF), - 0.31f to Color(0xffC0B5CD), - 0.49f to Color(0xff9B9DBC), - 1.0f to Color(0xff558DDA), - ), - innerColors = listOf( - 0.48f to Color(0xffFFF9F5), - 0.63f to Color(0xffF2DCD3), - 0.73f to Color(0xffDBA7A8), - 1.0f to Color(0xffD066A6), - ) - ), - innerId = R.drawable.sapphire_monochrome_inner, - outerId = R.drawable.sapphire_monochrome_outer, - darkLogo = R.drawable.sapphire_base, - lightLogo = R.drawable.sapphire_base_light, + darkLogo = R.drawable.sapphire_full, + lightLogo = R.drawable.sapphire_full, title = R.string.application_icon_sapphire, titleFont = sapphireTitleStyle ) @@ -616,11 +587,11 @@ fun SapphireLogoAnimatedPreview() { } @Composable -fun AnimatedLogo(modifier: Modifier = Modifier, basePalette: BrandPalette) { +fun AnimatedLogo(modifier: Modifier = Modifier, spec: AnimatedIconSpec) { val theme = LocalTheme.current - val colorPalette = if (theme == LIGHT) basePalette.lightPalette - else basePalette.darkPalette + val colorPalette = if (theme == LIGHT) spec.lightPalette + else spec.darkPalette val innerColorPalette = colorPalette.innerColors val outerColorPalette = colorPalette.outerColors @@ -652,7 +623,7 @@ fun AnimatedLogo(modifier: Modifier = Modifier, basePalette: BrandPalette) { Box(modifier = modifier) { Icon( - painter = painterResource(basePalette.innerId), + painter = painterResource(spec.innerId), contentDescription = null, modifier = Modifier .graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen) @@ -665,7 +636,7 @@ fun AnimatedLogo(modifier: Modifier = Modifier, basePalette: BrandPalette) { } ) Icon( - painter = painterResource(basePalette.outerId), + painter = painterResource(spec.outerId), contentDescription = null, modifier = Modifier .graphicsLayer(compositingStrategy = CompositingStrategy.Offscreen) @@ -689,21 +660,31 @@ fun GeodeLogo(modifier: Modifier = Modifier, shouldAnimate: Boolean = false, bas ) { val theme = LocalTheme.current - Crossfade( - targetState = shouldAnimate, - animationSpec = tween(durationMillis = 1000, easing = FastOutSlowInEasing), - label="logo fade" - ) { screen -> - when (screen) { - true -> AnimatedLogo(modifier = Modifier.size(64.dp, 64.dp), basePalette = basePalette) - false -> Image( - painterResource(if (theme == LIGHT) - basePalette.lightLogo else basePalette.darkLogo - ), - contentDescription = null, - modifier = Modifier.size(64.dp, 64.dp) - ) + if (basePalette.animatedIcon != null) { + Crossfade( + targetState = shouldAnimate, + animationSpec = tween(durationMillis = 1000, easing = FastOutSlowInEasing), + label="logo fade" + ) { screen -> + when (screen) { + true -> AnimatedLogo(modifier = Modifier.size(64.dp, 64.dp), spec = basePalette.animatedIcon) + false -> Image( + painterResource(if (theme == LIGHT) + basePalette.lightLogo else basePalette.darkLogo + ), + contentDescription = null, + modifier = Modifier.size(64.dp, 64.dp) + ) + } } + } else { + Image( + painterResource(if (theme == LIGHT) + basePalette.lightLogo else basePalette.darkLogo + ), + contentDescription = null, + modifier = Modifier.size(84.dp, 84.dp) + ) } Text( diff --git a/app/src/main/res/drawable/sapphire_base.xml b/app/src/main/res/drawable/sapphire_base.xml deleted file mode 100644 index 43e4d683..00000000 --- a/app/src/main/res/drawable/sapphire_base.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/sapphire_base_light.xml b/app/src/main/res/drawable/sapphire_base_light.xml deleted file mode 100644 index 53eee38a..00000000 --- a/app/src/main/res/drawable/sapphire_base_light.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/sapphire_full.png b/app/src/main/res/drawable/sapphire_full.png new file mode 100644 index 00000000..1d0fdd8b Binary files /dev/null and b/app/src/main/res/drawable/sapphire_full.png differ diff --git a/app/src/main/res/drawable/sapphire_monochrome.xml b/app/src/main/res/drawable/sapphire_monochrome.xml deleted file mode 100644 index ff37bbe5..00000000 --- a/app/src/main/res/drawable/sapphire_monochrome.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/sapphire_monochrome_inner.xml b/app/src/main/res/drawable/sapphire_monochrome_inner.xml deleted file mode 100644 index 4d67a6e4..00000000 --- a/app/src/main/res/drawable/sapphire_monochrome_inner.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/sapphire_monochrome_outer.xml b/app/src/main/res/drawable/sapphire_monochrome_outer.xml deleted file mode 100644 index 11e425c6..00000000 --- a/app/src/main/res/drawable/sapphire_monochrome_outer.xml +++ /dev/null @@ -1,9 +0,0 @@ - - -