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

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

Merge "Fix large clock is wrongly scaled down in lockscreen and wrong pivot...

Merge "Fix large clock is wrongly scaled down in lockscreen and wrong pivot when applying scale in AOD" into main
parents 5ff76a1a 8b5e8a26
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -93,7 +93,7 @@ object KeyguardBlueprintViewBinder {
                                        blueprint.applyConstraints(this)
                                        blueprint.applyConstraints(this)
                                    }
                                    }


                                logAlphaVisibilityOfAppliedConstraintSet(cs, clockViewModel)
                                logAlphaVisibilityScaleOfAppliedConstraintSet(cs, clockViewModel)
                                cs.applyTo(constraintLayout)
                                cs.applyTo(constraintLayout)
                            }
                            }
                        }
                        }
@@ -115,7 +115,7 @@ object KeyguardBlueprintViewBinder {
                                    clone(constraintLayout)
                                    clone(constraintLayout)
                                    blueprint.applyConstraints(this)
                                    blueprint.applyConstraints(this)
                                }
                                }
                            logAlphaVisibilityOfAppliedConstraintSet(cs, clockViewModel)
                            logAlphaVisibilityScaleOfAppliedConstraintSet(cs, clockViewModel)
                            cs.applyTo(constraintLayout)
                            cs.applyTo(constraintLayout)
                        }
                        }
                    }
                    }
@@ -124,7 +124,7 @@ object KeyguardBlueprintViewBinder {
        }
        }
    }
    }


    private fun logAlphaVisibilityOfAppliedConstraintSet(
    private fun logAlphaVisibilityScaleOfAppliedConstraintSet(
        cs: ConstraintSet,
        cs: ConstraintSet,
        viewModel: KeyguardClockViewModel
        viewModel: KeyguardClockViewModel
    ) {
    ) {
@@ -136,12 +136,15 @@ object KeyguardBlueprintViewBinder {
        Log.i(
        Log.i(
            TAG,
            TAG,
            "applyCsToSmallClock: vis=${cs.getVisibility(smallClockViewId)} " +
            "applyCsToSmallClock: vis=${cs.getVisibility(smallClockViewId)} " +
                "alpha=${cs.getConstraint(smallClockViewId).propertySet.alpha}"
                "alpha=${cs.getConstraint(smallClockViewId).propertySet.alpha} " +
                "scale=${cs.getConstraint(smallClockViewId).transform.scaleX} "
        )
        )
        Log.i(
        Log.i(
            TAG,
            TAG,
            "applyCsToLargeClock: vis=${cs.getVisibility(largeClockViewId)} " +
            "applyCsToLargeClock: vis=${cs.getVisibility(largeClockViewId)} " +
                "alpha=${cs.getConstraint(largeClockViewId).propertySet.alpha}"
                "alpha=${cs.getConstraint(largeClockViewId).propertySet.alpha} " +
                "scale=${cs.getConstraint(largeClockViewId).transform.scaleX} " +
                "pivotX=${cs.getConstraint(largeClockViewId).transform.transformPivotX} "
        )
        )
        Log.i(
        Log.i(
            TAG,
            TAG,
+16 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,16 @@ internal fun ConstraintSet.setAlpha(
    alpha: Float,
    alpha: Float,
) = views.forEach { view -> this.setAlpha(view.id, alpha) }
) = views.forEach { view -> this.setAlpha(view.id, alpha) }


internal fun ConstraintSet.setScaleX(
    views: Iterable<View>,
    alpha: Float,
) = views.forEach { view -> this.setScaleX(view.id, alpha) }

internal fun ConstraintSet.setScaleY(
    views: Iterable<View>,
    alpha: Float,
) = views.forEach { view -> this.setScaleY(view.id, alpha) }

@SysUISingleton
@SysUISingleton
class ClockSection
class ClockSection
@Inject
@Inject
@@ -125,6 +135,9 @@ constructor(
            setAlpha(getNonTargetClockFace(clock).views, 0F)
            setAlpha(getNonTargetClockFace(clock).views, 0F)
            if (!keyguardClockViewModel.isLargeClockVisible.value) {
            if (!keyguardClockViewModel.isLargeClockVisible.value) {
                connect(sharedR.id.bc_smartspace_view, TOP, sharedR.id.date_smartspace_view, BOTTOM)
                connect(sharedR.id.bc_smartspace_view, TOP, sharedR.id.date_smartspace_view, BOTTOM)
            } else {
                setScaleX(getTargetClockFace(clock).views, rootViewModel.burnInModel.value.scale)
                setScaleY(getTargetClockFace(clock).views, rootViewModel.burnInModel.value.scale)
            }
            }
        }
        }
    }
    }
@@ -205,6 +218,9 @@ constructor(
            create(R.id.small_clock_guideline_top, ConstraintSet.HORIZONTAL_GUIDELINE)
            create(R.id.small_clock_guideline_top, ConstraintSet.HORIZONTAL_GUIDELINE)
            setGuidelineBegin(R.id.small_clock_guideline_top, smallClockTopMargin)
            setGuidelineBegin(R.id.small_clock_guideline_top, smallClockTopMargin)
            connect(R.id.lockscreen_clock_view, TOP, R.id.small_clock_guideline_top, BOTTOM)
            connect(R.id.lockscreen_clock_view, TOP, R.id.small_clock_guideline_top, BOTTOM)

            // Explicitly clear pivot to force recalculate pivot instead of using legacy value
            setTransformPivot(R.id.lockscreen_clock_view_large, Float.NaN, Float.NaN)
        }
        }


        constrainWeatherClockDateIconsBarrier(constraints)
        constrainWeatherClockDateIconsBarrier(constraints)