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

Commit 56ed8e4f authored by Sherry Zhou's avatar Sherry Zhou Committed by Android (Google) Code Review
Browse files

Merge "Make clock constrained by lockId in preview, fix overlapping with UDFPS" into main

parents 24fd1b3f 55ff9123
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