Merge changes I282ed7eb,I4e9ca9ed into tm-dev

* changes:
  Fix a padding issue for bubble user education in RTL
  Fix position of bubble education views on large screen in RTL
This commit is contained in:
Mady Mellor
2022-05-24 15:14:43 +00:00
committed by Android (Google) Code Review
2 changed files with 21 additions and 3 deletions

View File

@@ -108,8 +108,16 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
alpha = 0f alpha = 0f
visibility = View.VISIBLE visibility = View.VISIBLE
expandedView.getManageButtonBoundsOnScreen(realManageButtonRect) expandedView.getManageButtonBoundsOnScreen(realManageButtonRect)
manageView.setPadding(realManageButtonRect.left - expandedView.manageButtonMargin, val isRTL = mContext.resources.configuration.layoutDirection == LAYOUT_DIRECTION_RTL
manageView.paddingTop, manageView.paddingRight, manageView.paddingBottom) if (isRTL) {
val rightPadding = positioner.screenRect.right - realManageButtonRect.right -
expandedView.manageButtonMargin
manageView.setPadding(manageView.paddingLeft, manageView.paddingTop,
rightPadding, manageView.paddingBottom)
} else {
manageView.setPadding(realManageButtonRect.left - expandedView.manageButtonMargin,
manageView.paddingTop, manageView.paddingRight, manageView.paddingBottom)
}
post { post {
manageButton manageButton
.setOnClickListener { .setOnClickListener {
@@ -122,7 +130,11 @@ class ManageEducationView constructor(context: Context, positioner: BubblePositi
val offsetViewBounds = Rect() val offsetViewBounds = Rect()
manageButton.getDrawingRect(offsetViewBounds) manageButton.getDrawingRect(offsetViewBounds)
manageView.offsetDescendantRectToMyCoords(manageButton, offsetViewBounds) manageView.offsetDescendantRectToMyCoords(manageButton, offsetViewBounds)
translationX = 0f if (isRTL && (positioner.isLargeScreen || positioner.isLandscape)) {
translationX = (positioner.screenRect.right - width).toFloat()
} else {
translationX = 0f
}
translationY = (realManageButtonRect.top - offsetViewBounds.top).toFloat() translationY = (realManageButtonRect.top - offsetViewBounds.top).toFloat()
bringToFront() bringToFront()
animate() animate()

View File

@@ -146,6 +146,12 @@ class StackEducationView constructor(
} else { } else {
setPadding(paddingLeft, paddingTop, positioner.bubbleSize + stackPadding, setPadding(paddingLeft, paddingTop, positioner.bubbleSize + stackPadding,
paddingBottom) paddingBottom)
if (positioner.isLargeScreen || positioner.isLandscape) {
translationX = (positioner.screenRect.right - width - stackPadding)
.toFloat()
} else {
translationX = 0f
}
} }
translationY = stackPosition.y + positioner.bubbleSize / 2 - getHeight() / 2 translationY = stackPosition.y + positioner.bubbleSize / 2 - getHeight() / 2
} }