-
-
Save KatieBarnett/a708ad418930f630ce6733a2ed33d8f8 to your computer and use it in GitHub Desktop.
Initial fetch of current wallpaper color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun MotivateMeGlanceTheme( | |
context: Context, | |
content: @Composable (Boolean) -> Unit, | |
) { | |
val wallpaperManager = WallpaperManager.getInstance(context) | |
val colors = wallpaperManager.getWallpaperColors(FLAG_SYSTEM) | |
var useDarkColorOnWallpaper by remember { | |
mutableStateOf( | |
getUseDarkColorOnWallPaper(colors, FLAG_SYSTEM) ?: false | |
) | |
} | |
GlanceTheme( | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | |
GlanceTheme.colors | |
} else { | |
MotivateMeGlanceColorScheme.colors | |
} | |
) { | |
content.invoke(useDarkColorOnWallpaper) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment