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
import io.gitlab.arturbosch.detekt.Detekt | |
plugins { | |
// this is necessary to avoid the plugins to be loaded multiple times | |
// in each subproject's classloader | |
// ===== Other main pluging of project ==== | |
id("org.jlleitschuh.gradle.ktlint").apply(false) // https://github.com/jlleitschuh/ktlint-gradle | |
id("io.gitlab.arturbosch.detekt").apply(false) // https://github.com/detekt/detekt | |
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
@Preview(locale = "fr-rFR") | |
@Composable | |
fun DifferentLocaleComposablePreview() { | |
Text(text = stringResource(R.string.greetings)) | |
} |
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
// Step 1: Create | |
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) | |
@OtherMultipreview1 | |
@OtherMultipreview2 | |
@DevicePreviews | |
annotation class AllPreviews | |
// Step 2: User AllPreviews |
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
@DevicePreviews | |
@Composable | |
fun WelcomeScreenPreview() { | |
MyAppTheme() { | |
Surface() { | |
WelcomeScreen() | |
} | |
} | |
} |
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
/** | |
* Multipreview annotation that represents various device sizes. Add this annotation to a composable | |
* to render various devices. | |
*/ | |
@Preview(showSystemUi = true, device = "spec:width=411dp,height=891dp", name = "Phone") | |
@Preview(showSystemUi = true, device = "spec:width=673.5dp,height=841dp,dpi=480", name = "Foldable") | |
@Preview(showSystemUi = true, device = "spec:width=1280dp,height=800dp,dpi=480", name = "Tablet") | |
@Preview(showSystemUi = true, device = "spec:width=1920dp,height=1080dp,dpi=480", name = "Desktop") | |
annotation class DevicePreviews |
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
@Preview(showSystemUi = true, showBackground = true, backgroundColor = 0xFFE1E2EC) | |
@Composable | |
fun WelcomeScreenPreview() { | |
MyAppTheme { | |
Surface { | |
WelcomeScreen() | |
} | |
} | |
} |
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
@Preview(showSystemUi = true, device = "spec:width=411dp,height=891dp") | |
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES) | |
// @Preview(showSystemUi = true, device = "spec:width=673.5dp,height=841dp,dpi=480") | |
// @Preview(showSystemUi = true, device = "spec:width=1280dp,height=800dp,dpi=480") | |
// @Preview(showSystemUi = true, device = "spec:width=1920dp,height=1080dp,dpi=480") | |
@Composable | |
fun WelcomeScreenPreview() { | |
MyAppTheme() { | |
Surface() { | |
WelcomeScreen() |
NewerOlder