-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit opt in to RTL support #575
Conversation
7dbf17b
to
927c289
Compare
@@ -86,7 +86,8 @@ class Paparazzi @JvmOverloads constructor( | |||
private val appCompatEnabled: Boolean = true, | |||
private val maxPercentDifference: Double = 0.1, | |||
private val snapshotHandler: SnapshotHandler = determineHandler(maxPercentDifference), | |||
private val renderExtensions: Set<RenderExtension> = setOf() | |||
private val renderExtensions: Set<RenderExtension> = setOf(), | |||
private val supportsRtl: Boolean = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private val supportsRtl: Boolean = false | |
private val supportsRtl: Boolean = false, |
@@ -158,7 +159,8 @@ class Paparazzi @JvmOverloads constructor( | |||
.copy( | |||
layoutPullParser = LayoutPullParser.createFromString(contentRoot), | |||
deviceConfig = deviceConfig, | |||
renderingMode = renderingMode | |||
renderingMode = renderingMode, | |||
supportsRtl = supportsRtl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supportsRtl = supportsRtl | |
supportsRtl = supportsRtl, |
@@ -48,7 +48,8 @@ internal data class SessionParamsBuilder( | |||
private val layoutPullParser: LayoutPullParser? = null, | |||
private val projectKey: Any? = null, | |||
private val minSdk: Int = 0, | |||
private val decor: Boolean = true | |||
private val decor: Boolean = true, | |||
private val supportsRtl: Boolean = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private val supportsRtl: Boolean = false | |
private val supportsRtl: Boolean = false, |
If you want you can force trailing commas with ktlint to keep diffs like this clean with only added lines instead of causing each new parameter to also change a line. |
i tried but spotless complained :( cc: @fcduarte who had looked into this |
It's not the default. You have to opt in so ktlint knows you want it. |
Yeah, this needs to be added:
to |
If you switch to Kotlinter then you can put those in your editorconfig and both the IDE and ktlint will honor them. |
In production apps, RTL support is enabled from the application manifest.
In LayoutLib, RTL support is enabled in RenderParams.setRtlSupport, which was set to
true
as part of this PR.However, while testing internally on CashApp, it looks like a few screens (primarily due to this Contour issue) break with this change, so let's enable explicit opt-in for those using Contour, until the upstream issue is fixed.
Note the horizontal margins on the X and Search icons in the toolbar in the following screenshots from a production app, when the aforementioned manifest attribute is enabled: