Skip to content

Commit

Permalink
Temporarily remove showSystemUi (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbro112 authored Jul 31, 2024
1 parent 9158f25 commit 44f9f80
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,11 @@ fun snapshotComposable(
composeView.post {
// Measure the composable agnostic of the parent constraints to layout properly in activity
val composableSize = measureComposableSize(composeView, previewConfig)
val bitmap = if (previewConfig.showSystemUi == true && previewConfig.device == null) {
val rootView = activity.window.decorView.rootView
captureBitmap(
view = rootView,
width = rootView.width,
height = rootView.height,
)
} else {
captureBitmap(
view = composeView,
width = composableSize.width,
height = composableSize.height,
)
}
val bitmap = captureBitmap(
view = composeView,
width = composableSize.width,
height = composableSize.height,
)
bitmap?.let {
snapshotRule.take(bitmap, previewConfig)
} ?: run {
Expand Down Expand Up @@ -121,7 +112,8 @@ private fun measureComposableSize(
// Override the width and height if set in preview annotation
val deviceDpScale = deviceSpec.densityPpi / DEFAULT_DENSITY_PPI
val widthPixels = previewConfig.widthDp?.let { it * deviceDpScale } ?: deviceSpec.widthPixels
val heightPixels = previewConfig.heightDp?.let { it * deviceDpScale } ?: deviceSpec.heightPixels
val heightPixels =
previewConfig.heightDp?.let { it * deviceDpScale } ?: deviceSpec.heightPixels
Log.i(
EmergeComposeSnapshotReflectiveParameterizedInvoker.TAG,
"Measuring composable with device dimensions: $widthPixels x $heightPixels"
Expand Down

0 comments on commit 44f9f80

Please sign in to comment.