@@ -464,97 +464,68 @@ data class ColorPalette(
464464 val innerColors : List <Pair <Float , Color >>,
465465)
466466
467- data class BrandPalette (
467+ data class AnimatedIconSpec (
468468 val lightPalette : ColorPalette ,
469469 val darkPalette : ColorPalette ,
470470
471471 @param:DrawableRes val innerId : Int ,
472472 @param:DrawableRes val outerId : Int ,
473+ )
473474
475+ data class BrandPalette (
474476 @param:DrawableRes val darkLogo : Int ,
475477 @param:DrawableRes val lightLogo : Int ,
476478
477479 @param:StringRes val title : Int ,
478480 val titleFont : TextStyle ,
481+ val animatedIcon : AnimatedIconSpec ? = null ,
479482)
480483
481484val geodeColorPalette = BrandPalette (
482- lightPalette = ColorPalette (
483- outerColors = listOf (
484- 0.0f to Color (0xfff5b11d ),
485- 0.10f to Color (0xfff0834d ),
486- 0.24f to Color (0xffe85f6b ),
487- 0.49f to Color (0xffc9659e ),
488- 1.0f to Color (0xffb9588f )
485+ animatedIcon = AnimatedIconSpec (
486+ lightPalette = ColorPalette (
487+ outerColors = listOf (
488+ 0.0f to Color (0xfff5b11d ),
489+ 0.10f to Color (0xfff0834d ),
490+ 0.24f to Color (0xffe85f6b ),
491+ 0.49f to Color (0xffc9659e ),
492+ 1.0f to Color (0xffb9588f )
493+ ),
494+ innerColors = listOf (
495+ 0.48f to Color (0xfff2ce00 ),
496+ 0.63f to Color (0xfff4b97e ),
497+ 0.73f to Color (0xfff7b66a ),
498+ 1.0f to Color (0xffeb8fac )
499+ )
489500 ),
490- innerColors = listOf (
491- 0.48f to Color ( 0xfff2ce00 ),
492- 0.63f to Color (0xfff4b97e ),
493- 0.73f to Color (0xfff7b66a ),
494- 1.0f to Color (0xffeb8fac )
495- )
496- ),
497- darkPalette = ColorPalette (
498- outerColors = listOf (
499- 0.0f to Color ( 0xfffffdff ),
500- 0.08f to Color (0xffF2EAF5 ),
501- 0.12f to Color (0xffEDE5EF ),
502- 0.31f to Color (0xffCDB5CD ),
503- 0.49f to Color (0xffBA9BBC ),
504- 1.0f to Color ( 0xff8D7ACF ),
501+ darkPalette = ColorPalette (
502+ outerColors = listOf (
503+ 0.0f to Color (0xfffffdff ),
504+ 0.08f to Color (0xffF2EAF5 ),
505+ 0.12f to Color (0xffEDE5EF ),
506+ 0.31f to Color ( 0xffCDB5CD ),
507+ 0.49f to Color ( 0xffBA9BBC ),
508+ 1.0f to Color ( 0xff8D7ACF ),
509+ ),
510+ innerColors = listOf (
511+ 0.48f to Color (0xffffffff ),
512+ 0.63f to Color (0xfff5e4c2 ),
513+ 0.73f to Color (0xffe5c7ad ),
514+ 1.0f to Color (0xffb790a9 ),
515+ )
505516 ),
506- innerColors = listOf (
507- 0.48f to Color (0xffffffff ),
508- 0.63f to Color (0xfff5e4c2 ),
509- 0.73f to Color (0xffe5c7ad ),
510- 1.0f to Color (0xffb790a9 ),
511- )
517+ innerId = R .drawable.geode_monochrome_inner,
518+ outerId = R .drawable.geode_monochrome_outer,
512519 ),
513- innerId = R .drawable.geode_monochrome_inner,
514- outerId = R .drawable.geode_monochrome_outer,
515520 darkLogo = R .drawable.geode_base,
516521 lightLogo = R .drawable.geode_base_light,
517522 title = R .string.launcher_title,
518523 titleFont = launcherTitleStyle
519524)
520525
521526val sapphireColorPalette = BrandPalette (
522- lightPalette = ColorPalette (
523- outerColors = listOf (
524- 0.0f to Color (0xff906FFF ),
525- 0.08f to Color (0xff9E81FF ),
526- 0.12f to Color (0xffAB8DFF ),
527- 0.31f to Color (0xffBE89FF ),
528- 0.49f to Color (0xff979BD7 ),
529- 1.0f to Color (0xff558DDA ),
530- ),
531- innerColors = listOf (
532- 0.48f to Color (0xffFFB65C ),
533- 0.63f to Color (0xffFFADA4 ),
534- 0.73f to Color (0xffF0A3A4 ),
535- 1.0f to Color (0xffD066A6 ),
536- )
537- ),
538- darkPalette = ColorPalette (
539- outerColors = listOf (
540- 0.0f to Color (0xfffffdff ),
541- 0.08f to Color (0xffF2EAF5 ),
542- 0.12f to Color (0xffEDE5EF ),
543- 0.31f to Color (0xffC0B5CD ),
544- 0.49f to Color (0xff9B9DBC ),
545- 1.0f to Color (0xff558DDA ),
546- ),
547- innerColors = listOf (
548- 0.48f to Color (0xffFFF9F5 ),
549- 0.63f to Color (0xffF2DCD3 ),
550- 0.73f to Color (0xffDBA7A8 ),
551- 1.0f to Color (0xffD066A6 ),
552- )
553- ),
554- innerId = R .drawable.sapphire_monochrome_inner,
555- outerId = R .drawable.sapphire_monochrome_outer,
556- darkLogo = R .drawable.sapphire_base,
557- lightLogo = R .drawable.sapphire_base_light,
527+ darkLogo = R .drawable.sapphire_full,
528+ lightLogo = R .drawable.sapphire_full,
558529 title = R .string.application_icon_sapphire,
559530 titleFont = sapphireTitleStyle
560531)
@@ -616,11 +587,11 @@ fun SapphireLogoAnimatedPreview() {
616587}
617588
618589@Composable
619- fun AnimatedLogo (modifier : Modifier = Modifier , basePalette : BrandPalette ) {
590+ fun AnimatedLogo (modifier : Modifier = Modifier , spec : AnimatedIconSpec ) {
620591 val theme = LocalTheme .current
621592
622- val colorPalette = if (theme == LIGHT ) basePalette .lightPalette
623- else basePalette .darkPalette
593+ val colorPalette = if (theme == LIGHT ) spec .lightPalette
594+ else spec .darkPalette
624595
625596 val innerColorPalette = colorPalette.innerColors
626597 val outerColorPalette = colorPalette.outerColors
@@ -652,7 +623,7 @@ fun AnimatedLogo(modifier: Modifier = Modifier, basePalette: BrandPalette) {
652623
653624 Box (modifier = modifier) {
654625 Icon (
655- painter = painterResource(basePalette .innerId),
626+ painter = painterResource(spec .innerId),
656627 contentDescription = null ,
657628 modifier = Modifier
658629 .graphicsLayer(compositingStrategy = CompositingStrategy .Offscreen )
@@ -665,7 +636,7 @@ fun AnimatedLogo(modifier: Modifier = Modifier, basePalette: BrandPalette) {
665636 }
666637 )
667638 Icon (
668- painter = painterResource(basePalette .outerId),
639+ painter = painterResource(spec .outerId),
669640 contentDescription = null ,
670641 modifier = Modifier
671642 .graphicsLayer(compositingStrategy = CompositingStrategy .Offscreen )
@@ -689,21 +660,31 @@ fun GeodeLogo(modifier: Modifier = Modifier, shouldAnimate: Boolean = false, bas
689660 ) {
690661 val theme = LocalTheme .current
691662
692- Crossfade (
693- targetState = shouldAnimate,
694- animationSpec = tween(durationMillis = 1000 , easing = FastOutSlowInEasing ),
695- label= " logo fade"
696- ) { screen ->
697- when (screen) {
698- true -> AnimatedLogo (modifier = Modifier .size(64 .dp, 64 .dp), basePalette = basePalette)
699- false -> Image (
700- painterResource(if (theme == LIGHT )
701- basePalette.lightLogo else basePalette.darkLogo
702- ),
703- contentDescription = null ,
704- modifier = Modifier .size(64 .dp, 64 .dp)
705- )
663+ if (basePalette.animatedIcon != null ) {
664+ Crossfade (
665+ targetState = shouldAnimate,
666+ animationSpec = tween(durationMillis = 1000 , easing = FastOutSlowInEasing ),
667+ label= " logo fade"
668+ ) { screen ->
669+ when (screen) {
670+ true -> AnimatedLogo (modifier = Modifier .size(64 .dp, 64 .dp), spec = basePalette.animatedIcon)
671+ false -> Image (
672+ painterResource(if (theme == LIGHT )
673+ basePalette.lightLogo else basePalette.darkLogo
674+ ),
675+ contentDescription = null ,
676+ modifier = Modifier .size(64 .dp, 64 .dp)
677+ )
678+ }
706679 }
680+ } else {
681+ Image (
682+ painterResource(if (theme == LIGHT )
683+ basePalette.lightLogo else basePalette.darkLogo
684+ ),
685+ contentDescription = null ,
686+ modifier = Modifier .size(84 .dp, 84 .dp)
687+ )
707688 }
708689
709690 Text (
0 commit comments