Fix wrong getIconBounds method inside BubbleTextView
Bug: 205065809
Test: screenshot on the bug
TL;DR;; created two variants depending on the layout direction
Change-Id: I9c5e74409c701b1f219ca450de0dca2291507045
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 7a38fe7..d2fe483 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -527,6 +527,18 @@
}
/**
+ * Using the view's bounds and icon size, calculate where the icon bounds will
+ * be if it was positioned at the center of the view.
+ */
+ public static void setRectToViewCenter(View iconView, int iconSize, Rect outBounds) {
+ int top = (iconView.getHeight() - iconSize) / 2;
+ int left = (iconView.getWidth() - iconSize) / 2;
+ int right = left + iconSize;
+ int bottom = top + iconSize;
+ outBounds.set(left, top, right, bottom);
+ }
+
+ /**
* Ensures that a value is within given bounds. Specifically:
* If value is less than lowerBound, return lowerBound; else if value is greater than upperBound,
* return upperBound; else return value unchanged.