From 7177265e9cd82bc6379dc673c8cdd774d240c493 Mon Sep 17 00:00:00 2001 From: Matvei Malkov Date: Thu, 14 Mar 2019 15:41:52 +0000 Subject: [PATCH] Revert deletion and deprecate few PopupWindow methods After method rename procedure b/126354063 we discovered that androidx-platform-dev already depends on that methods added during fixit week, so revert deletion of these methods and deprecate them. Bug: b/126354063 Test: PopupWindowTests Change-Id: I17b985542ffd661358059740bdf620e1bfb5b550 --- api/current.txt | 4 ++ core/java/android/widget/PopupWindow.java | 52 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/api/current.txt b/api/current.txt index f2dc7a925f98a..39ebba5896943 100644 --- a/api/current.txt +++ b/api/current.txt @@ -56416,10 +56416,12 @@ package android.widget { method public int getWindowLayoutType(); method public boolean isAboveAnchor(); method public boolean isAttachedInDecor(); + method @Deprecated public boolean isClipToScreenEnabled(); method public boolean isClippedToScreen(); method public boolean isClippingEnabled(); method public boolean isFocusable(); method public boolean isLaidOutInScreen(); + method @Deprecated public boolean isLayoutInScreenEnabled(); method public boolean isOutsideTouchable(); method public boolean isShowing(); method public boolean isSplitTouchEnabled(); @@ -56428,6 +56430,7 @@ package android.widget { method public void setAnimationStyle(int); method public void setAttachedInDecor(boolean); method public void setBackgroundDrawable(android.graphics.drawable.Drawable); + method @Deprecated public void setClipToScreenEnabled(boolean); method public void setClippingEnabled(boolean); method public void setContentView(android.view.View); method public void setElevation(float); @@ -56440,6 +56443,7 @@ package android.widget { method public void setInputMethodMode(int); method public void setIsClippedToScreen(boolean); method public void setIsLaidOutInScreen(boolean); + method @Deprecated public void setLayoutInScreenEnabled(boolean); method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener); method public void setOutsideTouchable(boolean); method public void setOverlapAnchor(boolean); diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index 03e7e10aaf84a..20fc0b1a9f0be 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -881,6 +881,32 @@ public class PopupWindow { mClippingEnabled = enabled; } + /** + *

Indicates whether this popup will be clipped to the screen and not to the + * containing window

+ * + * @return true if popup will be clipped to the screen instead of the window, false otherwise + * @deprecated Use {@link #isClippedToScreen()} instead + */ + @Deprecated + public boolean isClipToScreenEnabled() { + return mClipToScreen; + } + + /** + *

Clip this popup window to the screen, but not to the containing window.

+ * + *

If the popup is showing, calling this method will take effect only + * the next time the popup is shown or through a manual call to one of + * the {@link #update()} methods.

+ * + * @deprecated Use {@link #setIsClippedToScreen(boolean)} instead + */ + @Deprecated + public void setClipToScreenEnabled(boolean enabled) { + mClipToScreen = enabled; + } + /** *

Indicates whether this popup will be clipped to the screen and not to the * containing window

@@ -955,6 +981,32 @@ public class PopupWindow { mSplitTouchEnabled = enabled ? 1 : 0; } + /** + *

Indicates whether the popup window will be forced into using absolute screen coordinates + * for positioning.

+ * + * @return true if the window will always be positioned in screen coordinates. + * + * @deprecated Use {@link #isLaidOutInScreen()} instead + */ + @Deprecated + public boolean isLayoutInScreenEnabled() { + return mLayoutInScreen; + } + + /** + *

Allows the popup window to force the flag + * {@link WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}, overriding default behavior. + * This will cause the popup to be positioned in absolute screen coordinates.

+ * + * @param enabled true if the popup should always be positioned in screen coordinates + * @deprecated Use {@link #setIsLaidOutInScreen(boolean)} instead + */ + @Deprecated + public void setLayoutInScreenEnabled(boolean enabled) { + mLayoutInScreen = enabled; + } + /** *

Indicates whether the popup window will be forced into using absolute screen coordinates * for positioning.