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

Commit a4e305b1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Support position clock in preview using UDFPS location" into main

parents cdba3fea 27f5f57d
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)