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

Commit 7c973e49 authored by Sherry Zhou's avatar Sherry Zhou
Browse files

Fix large clock not changing font size when the screen rotates

Flag: NONE bugfix
Test: manual test, switch between landscape and portrait mode, observe
that large clock changes to correct font size; also observe that full
screen preview of large clock is same with large clock on actual
lockscreen
Bug: 378542029

Change-Id: I75646634172afeaf7c98614ab82ad9efd16b2f9e
parent 47afe07f
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.ConstraintSet
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.domain.interactor.KeyguardBlueprintInteractor
import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor
@@ -44,7 +45,6 @@ import kotlinx.coroutines.DisposableHandle
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map
import com.android.app.tracing.coroutines.launchTraced as launch

object KeyguardClockViewBinder {
    private val TAG = KeyguardClockViewBinder::class.simpleName!!
@@ -133,8 +133,10 @@ object KeyguardClockViewBinder {
                    launch {
                        if (!MigrateClocksToBlueprint.isEnabled) return@launch
                        aodBurnInViewModel.movement.collect { burnInModel ->
                            viewModel.currentClock.value?.let {
                                it.largeClock.layout.applyAodBurnIn(
                            viewModel.currentClock.value
                                ?.largeClock
                                ?.layout
                                ?.applyAodBurnIn(
                                    AodClockBurnInModel(
                                        translationX = burnInModel.translationX.toFloat(),
                                        translationY = burnInModel.translationY.toFloat(),
@@ -143,6 +145,15 @@ object KeyguardClockViewBinder {
                                )
                        }
                    }

                    launch {
                        if (!MigrateClocksToBlueprint.isEnabled) return@launch
                        viewModel.largeClockTextSize.collect { fontSizePx ->
                            viewModel.currentClock.value
                                ?.largeClock
                                ?.events
                                ?.onFontSettingChanged(fontSizePx = fontSizePx.toFloat())
                        }
                    }
                }
            }
+3 −0
Original line number Diff line number Diff line
@@ -187,6 +187,9 @@ constructor(
    val largeClockTopMargin: Flow<Int> =
        configurationInteractor.onAnyConfigurationChange.map { getLargeClockTopMargin() }

    val largeClockTextSize: Flow<Int> =
        configurationInteractor.dimensionPixelSize(customR.dimen.large_clock_text_size)

    enum class ClockLayout {
        LARGE_CLOCK,
        SMALL_CLOCK,