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

Commit 27f5f57d authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Support position clock in preview using UDFPS location

Bug: 387534445
Test: manual test clock position in new customization picker ui
Flag: NONE bugfix

Change-Id: Ia318fef20c2cfb693ce68f12ea380a704bab7759
parent 1427b5b5
Loading
Loading
Loading
Loading
+29 −20
Original line number Diff line number Diff line
@@ -111,11 +111,19 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout {
                connect(lockscreenClockViewLargeId, START, PARENT_ID, START)
                connect(lockscreenClockViewLargeId, END, PARENT_ID, END)

                // In preview, we'll show UDFPS icon for UDFPS devices
                // and nothing for non-UDFPS devices,
                // 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.udfpsTop?.let {
                    val screenHeight = context.resources.displayMetrics.heightPixels
                    connect(
                        lockscreenClockViewLargeId,
                        BOTTOM,
                        PARENT_ID,
                        BOTTOM,
                        (screenHeight - it).toInt(),
                    )
                }
                    ?: run {
                        // Copied calculation codes from applyConstraints in
                        // DefaultDeviceEntrySection
                        clockPreviewConfig.lockId?.let { lockId ->
                            connect(lockscreenClockViewLargeId, BOTTOM, lockId, TOP)
                        }
@@ -134,6 +142,7 @@ class DefaultClockFaceLayout(val view: View) : ClockFaceLayout {
                                    clockBottomMargin,
                                )
                            }
                    }

                val smallClockViewId = context.getId("lockscreen_clock_view")
                constrainWidth(smallClockViewId, WRAP_CONTENT)
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ data class ClockPreviewConfig(
    val isShadeLayoutWide: Boolean,
    val isSceneContainerFlagEnabled: Boolean = false,
    val lockId: Int? = null,
    val udfpsTop: Float? = null,
) {
    fun getSmallClockTopPadding(
        statusBarHeight: Int = SystemBarUtils.getStatusBarHeight(context)