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

Commit 56392d2f authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Move updating layoutParams outside of dispatchDraw()" into main

parents 502f7b94 3a8d4f51
Loading
Loading
Loading
Loading
+8 −9
Original line number Original line Diff line number Diff line
@@ -87,6 +87,14 @@ class AppPairIconGraphic @JvmOverloads constructor(context: Context, attrs: Attr
        appPairBackground = AppPairIconBackground(context, this)
        appPairBackground = AppPairIconBackground(context, this)
        appPairBackground.setBounds(0, 0, backgroundSize.toInt(), backgroundSize.toInt())
        appPairBackground.setBounds(0, 0, backgroundSize.toInt(), backgroundSize.toInt())
        applyIcons(parentIcon.info.contents)
        applyIcons(parentIcon.info.contents)

        // Center the drawable area in the larger icon canvas
        val lp: LayoutParams = layoutParams as LayoutParams
        lp.gravity = Gravity.CENTER_HORIZONTAL
        lp.topMargin = outerPadding.toInt()
        lp.height = backgroundSize.toInt()
        lp.width = backgroundSize.toInt()
        layoutParams = lp
    }
    }


    /** Sets up app pair member icons for drawing. */
    /** Sets up app pair member icons for drawing. */
@@ -125,15 +133,6 @@ class AppPairIconGraphic @JvmOverloads constructor(context: Context, attrs: Attr


    override fun dispatchDraw(canvas: Canvas) {
    override fun dispatchDraw(canvas: Canvas) {
        super.dispatchDraw(canvas)
        super.dispatchDraw(canvas)

        // Center the drawable area in the larger icon canvas
        val lp: LayoutParams = layoutParams as LayoutParams
        lp.gravity = Gravity.CENTER_HORIZONTAL
        lp.topMargin = outerPadding.toInt()
        lp.height = backgroundSize.toInt()
        lp.width = backgroundSize.toInt()
        layoutParams = lp

        // Draw background
        // Draw background
        appPairBackground.draw(canvas)
        appPairBackground.draw(canvas)