From 08322052625a5169a28820826f25b5854997c2fa Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 30 Sep 2022 11:07:08 +0530 Subject: [PATCH] feat(common): add Multipreview annotations --- .../common/ui/preview/PreviewAnnotations.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt diff --git a/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt b/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt new file mode 100644 index 00000000..6447dee6 --- /dev/null +++ b/common/src/main/kotlin/dev/msfjarvis/claw/common/ui/preview/PreviewAnnotations.kt @@ -0,0 +1,24 @@ +@file:Suppress("NON_SOURCE_REPEATED_ANNOTATION") // IDE false-positive + +package dev.msfjarvis.claw.common.ui.preview + +import android.content.res.Configuration +import androidx.compose.ui.tooling.preview.Preview + +/** + * Multipreview annotation that represents light and dark themes. Add this annotation to a + * composable to render the both themes. + */ +@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, name = "Light theme") +@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark theme") +annotation class ThemePreviews + +/** + * Multipreview annotation that represents various device sizes. Add this annotation to a composable + * to render various devices. + */ +@Preview(name = "phone", device = "spec:shape=Normal,width=360,height=640,unit=dp,dpi=480") +@Preview(name = "landscape", device = "spec:shape=Normal,width=640,height=360,unit=dp,dpi=480") +@Preview(name = "foldable", device = "spec:shape=Normal,width=673,height=841,unit=dp,dpi=480") +@Preview(name = "tablet", device = "spec:shape=Normal,width=1280,height=800,unit=dp,dpi=480") +annotation class DevicePreviews