commit df1bd9de36101f9e9fb4da49c9a5bd1d8d9f2c54
parent 3c16aeaf4c367ad1bbdb5543eab23f68c0d5938e
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date: Thu, 20 Nov 2025 06:47:53 +0000
Bug 1993856 - Part 13: Migrate WallpaperState to M3 Acorn color tokens r=android-reviewers,007
- Follows the same changes made in CollectionsState around the button container and content color https://phabricator.services.mozilla.com/D272766.
- textActionSecondary is equivalent to textPrimary.
- Filled Button: https://www.figma.com/design/MjufE1X5fvkxZ0YneX4kRd/Android-Library--2025-?node-id=53923-27634&m=dev
Differential Revision: https://phabricator.services.mozilla.com/D273049
Diffstat:
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/wallpapers/WallpaperState.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/wallpapers/WallpaperState.kt
@@ -5,10 +5,11 @@
package org.mozilla.fenix.wallpapers
import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material3.ButtonDefaults
+import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.graphics.Color
-import org.mozilla.fenix.theme.FirefoxTheme
/**
* Represents all state related to the Wallpapers feature.
@@ -43,7 +44,7 @@ data class WallpaperState(
Color(currentWallpaper.cardColorLight)
}
}
- else -> FirefoxTheme.colors.layer2
+ else -> MaterialTheme.colorScheme.surfaceContainerLowest
}
/**
@@ -51,11 +52,10 @@ data class WallpaperState(
*/
val buttonBackgroundColor: Color
@Composable
- @ReadOnlyComposable
get() = if (isCurrentWallpaperDefault()) {
- FirefoxTheme.colors.actionSecondary
+ ButtonDefaults.buttonColors().containerColor
} else {
- FirefoxTheme.colors.layer1
+ MaterialTheme.colorScheme.surface
}
/**
@@ -63,11 +63,10 @@ data class WallpaperState(
*/
val buttonTextColor: Color
@Composable
- @ReadOnlyComposable
- get() = when {
- currentWallpaper.cardColorDark != null &&
- isSystemInDarkTheme() -> FirefoxTheme.colors.textPrimary
- else -> FirefoxTheme.colors.textActionSecondary
+ get() = if (isCurrentWallpaperDefault()) {
+ ButtonDefaults.buttonColors().contentColor
+ } else {
+ MaterialTheme.colorScheme.onSurface
}
private fun isCurrentWallpaperDefault(): Boolean = Wallpaper.nameIsDefault(currentWallpaper.name)
@@ -83,15 +82,4 @@ data class WallpaperState(
run(Color(currentWallpaper.cardColorLight), Color(currentWallpaper.cardColorDark))
}
}
-
- /**
- * Run the [run] block only if the current wallpaper's card colors are available.
- */
- fun runIfWallpaperCardColorsAreAvailable(
- run: (cardColorLight: Int, cardColorDark: Int) -> Unit,
- ) {
- if (currentWallpaper.cardColorLight != null && currentWallpaper.cardColorDark != null) {
- run(currentWallpaper.cardColorLight.toInt(), currentWallpaper.cardColorDark.toInt())
- }
- }
}