Merge "Fix the pointer position when displayed in RTL" into tm-dev
This commit is contained in:
@@ -706,6 +706,8 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
* @param animate whether the pointer should animate to this position.
|
* @param animate whether the pointer should animate to this position.
|
||||||
*/
|
*/
|
||||||
public void setPointerPosition(float bubblePosition, boolean onLeft, boolean animate) {
|
public void setPointerPosition(float bubblePosition, boolean onLeft, boolean animate) {
|
||||||
|
final boolean isRtl = mContext.getResources().getConfiguration().getLayoutDirection()
|
||||||
|
== LAYOUT_DIRECTION_RTL;
|
||||||
// Pointer gets drawn in the padding
|
// Pointer gets drawn in the padding
|
||||||
final boolean showVertically = mPositioner.showBubblesVertically();
|
final boolean showVertically = mPositioner.showBubblesVertically();
|
||||||
final float paddingLeft = (showVertically && onLeft)
|
final float paddingLeft = (showVertically && onLeft)
|
||||||
@@ -732,12 +734,22 @@ public class BubbleExpandedView extends LinearLayout {
|
|||||||
float pointerX;
|
float pointerX;
|
||||||
if (showVertically) {
|
if (showVertically) {
|
||||||
pointerY = bubbleCenter - (mPointerWidth / 2f);
|
pointerY = bubbleCenter - (mPointerWidth / 2f);
|
||||||
pointerX = onLeft
|
if (!isRtl) {
|
||||||
? -mPointerHeight + mPointerOverlap
|
pointerX = onLeft
|
||||||
: getWidth() - mPaddingRight - mPointerOverlap;
|
? -mPointerHeight + mPointerOverlap
|
||||||
|
: getWidth() - mPaddingRight - mPointerOverlap;
|
||||||
|
} else {
|
||||||
|
pointerX = onLeft
|
||||||
|
? -(getWidth() - mPaddingLeft - mPointerOverlap)
|
||||||
|
: mPointerHeight - mPointerOverlap;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
pointerY = mPointerOverlap;
|
pointerY = mPointerOverlap;
|
||||||
pointerX = bubbleCenter - (mPointerWidth / 2f);
|
if (!isRtl) {
|
||||||
|
pointerX = bubbleCenter - (mPointerWidth / 2f);
|
||||||
|
} else {
|
||||||
|
pointerX = -(getWidth() - mPaddingLeft - bubbleCenter) + (mPointerWidth / 2f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (animate) {
|
if (animate) {
|
||||||
mPointerView.animate().translationX(pointerX).translationY(pointerY).start();
|
mPointerView.animate().translationX(pointerX).translationY(pointerY).start();
|
||||||
|
|||||||
Reference in New Issue
Block a user