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

Commit 2e67cf72 authored by Juan Sebastian Martinez's avatar Juan Sebastian Martinez Committed by Android (Google) Code Review
Browse files

Merge "Updating long-press effect dimensions after re-layouts." into main

parents b2ca6049 31267a62
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -332,6 +332,21 @@ open class QSTileViewImpl @JvmOverloads constructor(
    override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
        super.onLayout(changed, l, t, r, b)
        updateHeight()
        maybeUpdateLongPressEffectDimensions()
    }

    private fun maybeUpdateLongPressEffectDimensions() {
        if (!isLongClickable || longPressEffect == null) return

        val actualHeight = if (heightOverride != HeightOverrideable.NO_OVERRIDE) {
            heightOverride
        } else {
            measuredHeight
        }
        initialLongPressProperties?.height = actualHeight.toFloat()
        initialLongPressProperties?.width = measuredWidth.toFloat()
        finalLongPressProperties?.height = LONG_PRESS_EFFECT_HEIGHT_SCALE * actualHeight
        finalLongPressProperties?.width = LONG_PRESS_EFFECT_WIDTH_SCALE * measuredWidth
    }

    override fun onFocusChanged(gainFocus: Boolean, direction: Int, previouslyFocusedRect: Rect?) {