[conflict] Merge "Fix the pointer position when displayed in RTL" into tm-dev am: 91d28d1b21 am: ca9b8b4392
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18620988 Change-Id: I59b673c6930d32ddd3f32254dd85d820f025601a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> Merged-In: I71a6f64a43c1b7bb5e0a30773d4cc5ae55c63b6a
This commit is contained in:
@@ -908,6 +908,8 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
* @param animate whether the pointer should animate to this position.
|
||||
*/
|
||||
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
|
||||
final boolean showVertically = mPositioner.showBubblesVertically();
|
||||
final float paddingLeft = (showVertically && onLeft)
|
||||
@@ -932,12 +934,23 @@ public class BubbleExpandedView extends LinearLayout {
|
||||
updatePointerView();
|
||||
if (showVertically) {
|
||||
mPointerPos.y = bubbleCenter - (mPointerWidth / 2f);
|
||||
mPointerPos.x = onLeft
|
||||
? -mPointerHeight + mPointerOverlap
|
||||
: getWidth() - mPaddingRight - mPointerOverlap;
|
||||
if (!isRtl) {
|
||||
mPointerPos.x = onLeft
|
||||
? -mPointerHeight + mPointerOverlap
|
||||
: getWidth() - mPaddingRight - mPointerOverlap;
|
||||
} else {
|
||||
mPointerPos.x = onLeft
|
||||
? -(getWidth() - mPaddingLeft - mPointerOverlap)
|
||||
: mPointerHeight - mPointerOverlap;
|
||||
}
|
||||
} else {
|
||||
mPointerPos.y = mPointerOverlap;
|
||||
mPointerPos.x = bubbleCenter - (mPointerWidth / 2f);
|
||||
if (!isRtl) {
|
||||
mPointerPos.x = bubbleCenter - (mPointerWidth / 2f);
|
||||
} else {
|
||||
mPointerPos.x = -(getWidth() - mPaddingLeft - bubbleCenter)
|
||||
+ (mPointerWidth / 2f);
|
||||
}
|
||||
}
|
||||
if (animate) {
|
||||
mPointerView.animate().translationX(mPointerPos.x).translationY(
|
||||
|
||||
Reference in New Issue
Block a user