Skip to content

Commit

Permalink
Explicit opt in to RTL support
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodbx committed Sep 14, 2022
1 parent 1ed082b commit 927c289
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
) : TestRule {
private val logger = PaparazziLogger()
private lateinit var renderSession: RenderSessionImpl
Expand Down Expand Up @@ -158,7 +159,8 @@ class Paparazzi @JvmOverloads constructor(
.copy(
layoutPullParser = LayoutPullParser.createFromString(contentRoot),
deviceConfig = deviceConfig,
renderingMode = renderingMode
renderingMode = renderingMode,
supportsRtl = supportsRtl
)
.withTheme(theme)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
) {
fun withTheme(
themeName: String,
Expand Down Expand Up @@ -105,7 +106,7 @@ internal data class SessionParamsBuilder(
} else {
result.locale = localeQualifier.tag
}
result.setRtlSupport(true)
result.setRtlSupport(supportsRtl)

for ((key, value) in flags) {
result.setFlag(key as Key<Any>, value)
Expand Down

0 comments on commit 927c289

Please sign in to comment.