summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-02-10 23:38:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-10 23:38:27 +0000
commitd212706aaeaf0cfb9bcc2d6866fb08fac78e667c (patch)
tree6272bbed59d78246550eb6a8bd25813ad4c47641
parent7cf2c9de2e89cd6fc3b958a5013938742b0eaf58 (diff)
parentb0bd3e7a04cf77f5df8bdfabd1421007cb1b17e1 (diff)
Merge "Epicenter API for ListPopupWindow"
-rw-r--r--api/current.txt2
-rw-r--r--core/java/android/widget/ListPopupWindow.java21
-rw-r--r--core/java/android/widget/PopupWindow.java4
3 files changed, 21 insertions, 6 deletions
diff --git a/api/current.txt b/api/current.txt
index 91f5cef85e56..c0d10a6bc20a 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -56015,6 +56015,7 @@ package android.widget {
method @Nullable public android.view.View getAnchorView();
method @StyleRes public int getAnimationStyle();
method @Nullable public android.graphics.drawable.Drawable getBackground();
+ method @Nullable public android.graphics.Rect getEpicenterBounds();
method public int getHeight();
method public int getHorizontalOffset();
method public int getInputMethodMode();
@@ -56041,6 +56042,7 @@ package android.widget {
method public void setBackgroundDrawable(@Nullable android.graphics.drawable.Drawable);
method public void setContentWidth(int);
method public void setDropDownGravity(int);
+ method public void setEpicenterBounds(@Nullable android.graphics.Rect);
method public void setHeight(int);
method public void setHorizontalOffset(int);
method public void setInputMethodMode(int);
diff --git a/core/java/android/widget/ListPopupWindow.java b/core/java/android/widget/ListPopupWindow.java
index f9564b44e825..25e5dd32c6b2 100644
--- a/core/java/android/widget/ListPopupWindow.java
+++ b/core/java/android/widget/ListPopupWindow.java
@@ -471,11 +471,24 @@ public class ListPopupWindow implements ShowableListMenu {
* Specifies the anchor-relative bounds of the popup's transition
* epicenter.
*
- * @param bounds anchor-relative bounds
- * @hide
+ * @param bounds anchor-relative bounds, or {@code null} to use default epicenter
+ *
+ * @see #getEpicenterBounds()
+ */
+ public void setEpicenterBounds(@Nullable Rect bounds) {
+ mEpicenterBounds = bounds != null ? new Rect(bounds) : null;
+ }
+
+ /**
+ * Returns bounds which are used as a popup's epicenter
+ * of the enter and exit transitions.
+ *
+ * @return bounds relative to anchor view, or {@code null} if not set
+ * @see #setEpicenterBounds(Rect)
*/
- public void setEpicenterBounds(Rect bounds) {
- mEpicenterBounds = bounds;
+ @Nullable
+ public Rect getEpicenterBounds() {
+ return mEpicenterBounds != null ? new Rect(mEpicenterBounds) : null;
}
/**
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 88d938082b05..279829672c57 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -490,7 +490,7 @@ public class PopupWindow {
*/
@Nullable
public Rect getEpicenterBounds() {
- return mEpicenterBounds;
+ return mEpicenterBounds != null ? new Rect(mEpicenterBounds) : null;
}
/**
@@ -509,7 +509,7 @@ public class PopupWindow {
* @see #getEpicenterBounds()
*/
public void setEpicenterBounds(@Nullable Rect bounds) {
- mEpicenterBounds = bounds;
+ mEpicenterBounds = bounds != null ? new Rect(bounds) : null;
}
private Transition getTransition(int resId) {