Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55ff9123 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Make clock constrained by lockId in preview, fix overlapping with UDFPS

Test: manual test full screen preview in picker in Pixel 6a, observing
that clock no long overlaps with UDFPS
Flag: NONE bugfix
Bug: 383764306

Change-Id: I6e54c80fbd476add3dc9b629036dac7c22c4bd9e
parent 7420e1ef
Loading
Loading
Loading
Loading
+19 −8
Original line number Diff line number Diff line
@@ -115,14 +115,25 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout {
                // and we're not planning to add this vide in clockHostView
                // so we only need position of device entry icon to constrain clock
                // Copied calculation codes from applyConstraints in DefaultDeviceEntrySection
                clockPreviewConfig.lockId?.let { lockId ->
                    connect(lockscreenClockViewLargeId, BOTTOM, lockId, TOP)
                }
                    ?: run {
                        val bottomPaddingPx = getDimen(context, "lock_icon_margin_bottom")
                        val defaultDensity =
                            DisplayMetrics.DENSITY_DEVICE_STABLE.toFloat() /
                                DisplayMetrics.DENSITY_DEFAULT.toFloat()
                        val lockIconRadiusPx = (defaultDensity * 36).toInt()
                        val clockBottomMargin = bottomPaddingPx + 2 * lockIconRadiusPx
                        connect(
                            lockscreenClockViewLargeId,
                            BOTTOM,
                            PARENT_ID,
                            BOTTOM,
                            clockBottomMargin,
                        )
                    }

                connect(lockscreenClockViewLargeId, BOTTOM, PARENT_ID, BOTTOM, clockBottomMargin)
                val smallClockViewId = getId(context, "lockscreen_clock_view")
                constrainWidth(smallClockViewId, WRAP_CONTENT)
                constrainHeight(smallClockViewId, getDimen(context, "small_clock_height"))
+1 −0
Original line number Diff line number Diff line
@@ -22,4 +22,5 @@ data class ClockPreviewConfig(
    val previewContext: Context,
    val isShadeLayoutWide: Boolean,
    val isSceneContainerFlagEnabled: Boolean = false,
    val lockId: Int? = null,
)
+10 −2
Original line number Diff line number Diff line
@@ -136,8 +136,16 @@ object KeyguardPreviewClockViewBinder {
        viewModel: KeyguardPreviewClockViewModel,
    ) {
        val cs = ConstraintSet().apply { clone(rootView) }
        previewClock.largeClock.layout.applyPreviewConstraints(clockPreviewConfig, cs)
        previewClock.smallClock.layout.applyPreviewConstraints(clockPreviewConfig, cs)

        val configWithUpdatedLockId =
            if (rootView.getViewById(lockId) != null) {
                clockPreviewConfig.copy(lockId = lockId)
            } else {
                clockPreviewConfig
            }

        previewClock.largeClock.layout.applyPreviewConstraints(configWithUpdatedLockId, cs)
        previewClock.smallClock.layout.applyPreviewConstraints(configWithUpdatedLockId, cs)

        // When selectedClockSize is the initial value, make both clocks invisible to avoid
        // flickering