Last active
August 26, 2022 09:13
-
-
Save marcelpinto/96708acff5f392d7a5405a70ae37a66c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Copyright 2022 Google LLC. | |
* SPDX-License-Identifier: Apache-2.0 | |
*/ | |
@OptIn(ExperimentalGlanceRemoteViewsApi::class) | |
@Preview | |
@Composable | |
fun SampleGlanceWidgetPreview() { | |
// The size of the widget | |
val displaySize = DpSize(200.dp, 200.dp) | |
// Provide a state depending on the GlanceAppWidget state definition | |
val state = preferencesOf(SampleGlanceWidget.countKey to 2) | |
GlanceAppWidgetHostPreview( | |
modifier = Modifier.fillMaxSize(), | |
glanceAppWidget = SampleGlanceWidget, // The actual instance | |
state = state, | |
displaySize = displaySize, | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment