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

Commit d3f19bcb authored by Mady Mellor's avatar Mady Mellor
Browse files

Fix position of bubble education views on large screen in RTL

In large screen or landscape, the width of the education view is not
full width, so we need to position it on the edge of the screen
when in RTL. It naturally does this in LTR.

Bug: 233408508
Test: force user education to show for bubbles, check how it appears
     in RTL & LTR on: large screen portrait & landscape, and portait
     and landscape on phone.
Change-Id: I4e9ca9ed3d59ecaab3d6522961acf190f6a54850
parent 53af3ea3
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -108,6 +108,7 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
        alpha = 0f
        visibility = View.VISIBLE
        expandedView.getManageButtonBoundsOnScreen(realManageButtonRect)
        val isRTL = mContext.resources.configuration.layoutDirection == LAYOUT_DIRECTION_RTL
        manageView.setPadding(realManageButtonRect.left - expandedView.manageButtonMargin,
                manageView.paddingTop, manageView.paddingRight, manageView.paddingBottom)
        post {
@@ -122,7 +123,11 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
            val offsetViewBounds = Rect()
            manageButton.getDrawingRect(offsetViewBounds)
            manageView.offsetDescendantRectToMyCoords(manageButton, offsetViewBounds)
            if (isRTL && (positioner.isLargeScreen || positioner.isLandscape)) {
                translationX = (positioner.screenRect.right - width).toFloat()
            } else {
                translationX = 0f
            }
            translationY = (realManageButtonRect.top - offsetViewBounds.top).toFloat()
            bringToFront()
            animate()
+6 −0
Original line number Diff line number Diff line
@@ -146,6 +146,12 @@ class StackEducationView constructor(
                } else {
                    setPadding(paddingLeft, paddingTop, positioner.bubbleSize + stackPadding,
                            paddingBottom)
                    if (positioner.isLargeScreen || positioner.isLandscape) {
                        translationX = (positioner.screenRect.right - width - stackPadding)
                                .toFloat()
                    } else {
                        translationX = 0f
                    }
                }
                translationY = stackPosition.y + positioner.bubbleSize / 2 - getHeight() / 2
            }