nowinandroid
nowinandroid copied to clipboard
[FR]: Introduce Multipreview annotation to simplify the @Preview configurations
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the problem
Duplicate preview annotations are defined in multiple places for example:
@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")
These configurations are repeatedly used in InterestsScreen, AuthorScreen, TopicScreen. Using Multipreview annotation can simplify the repeated definitions.
Describe the solution
Define an annotation class for DevicePreviews like:
@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
and replace the existing preview definitions.
Additional context
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct