Merge "Changes in PopupWindow API"

This commit is contained in:
Matvei Malkov
2019-02-08 11:27:06 +00:00
committed by Android (Google) Code Review
2 changed files with 87 additions and 24 deletions

View File

@@ -56297,6 +56297,7 @@ package android.widget {
method public android.view.View getContentView();
method public float getElevation();
method @Nullable public android.transition.Transition getEnterTransition();
method @Nullable public android.graphics.Rect getEpicenterBounds();
method @Nullable public android.transition.Transition getExitTransition();
method public int getHeight();
method public int getInputMethodMode();
@@ -56309,30 +56310,37 @@ package android.widget {
method public int getWindowLayoutType();
method public boolean isAboveAnchor();
method public boolean isAttachedInDecor();
method public boolean isClipToScreenEnabled();
method public boolean isClippingEnabled();
method public boolean isFocusable();
method public boolean isLayoutInScreenEnabled();
method public boolean isOutsideTouchable();
method public boolean isShowing();
method public boolean isSplitTouchEnabled();
method public boolean isTouchModal();
method public boolean isTouchable();
method public void setAnimationStyle(int);
method public void setAttachedInDecor(boolean);
method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
method public void setClipToScreenEnabled(boolean);
method public void setClippingEnabled(boolean);
method public void setContentView(android.view.View);
method public void setElevation(float);
method public void setEnterTransition(@Nullable android.transition.Transition);
method public void setEpicenterBounds(@Nullable android.graphics.Rect);
method public void setExitTransition(@Nullable android.transition.Transition);
method public void setFocusable(boolean);
method public void setHeight(int);
method public void setIgnoreCheekPress();
method public void setInputMethodMode(int);
method public void setLayoutInScreenEnabled(boolean);
method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
method public void setOutsideTouchable(boolean);
method public void setOverlapAnchor(boolean);
method public void setSoftInputMode(int);
method public void setSplitTouchEnabled(boolean);
method public void setTouchInterceptor(android.view.View.OnTouchListener);
method public void setTouchModal(boolean);
method public void setTouchable(boolean);
method public void setWidth(int);
method @Deprecated public void setWindowLayoutMode(int, int);

View File

@@ -264,7 +264,7 @@ public class PopupWindow {
private WeakReference<View> mAnchorRoot;
private boolean mIsAnchorRootAttached;
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private final OnScrollChangedListener mOnScrollChangedListener = this::alignToAnchor;
private final View.OnLayoutChangeListener mOnLayoutChangeListener =
@@ -476,22 +476,39 @@ public class PopupWindow {
}
/**
* Sets the bounds used as the epicenter of the enter and exit transitions.
* <p>
* Transitions use a point or Rect, referred to as the epicenter, to orient
* <p>Returns bounds which are used as a center of the enter and exit transitions.<p/>
*
* <p>Transitions use Rect, referred to as the epicenter, to orient
* the direction of travel. For popup windows, the anchor view bounds are
* used as the default epicenter.
* <p>
* See {@link Transition#setEpicenterCallback(EpicenterCallback)} for more
* information about how transition epicenters.
* used as the default epicenter.</p>
*
* <p>See {@link Transition#setEpicenterCallback(EpicenterCallback)} for more
* information about how transition epicenters work.</p>
*
* @return bounds relative to anchor view, or {@code null} if not set
* @see #setEpicenterBounds(Rect)
*/
@Nullable
public Rect getEpicenterBounds() {
return mEpicenterBounds;
}
/**
* <p>Sets the bounds used as the epicenter of the enter and exit transitions.</p>
*
* <p>Transitions use Rect, referred to as the epicenter, to orient
* the direction of travel. For popup windows, the anchor view bounds are
* used as the default epicenter.</p>
*
* <p>See {@link Transition#setEpicenterCallback(EpicenterCallback)} for more
* information about how transition epicenters work.</p>
*
* @param bounds the epicenter bounds relative to the anchor view, or
* {@code null} to use the default epicenter
* @see #getTransitionEpicenter()
* @hide
*
* @see #getEpicenterBounds()
*/
@UnsupportedAppUsage
public void setEpicenterBounds(Rect bounds) {
public void setEpicenterBounds(@Nullable Rect bounds) {
mEpicenterBounds = bounds;
}
@@ -865,12 +882,28 @@ public class PopupWindow {
}
/**
* Clip this popup window to the screen, but not to the containing window.
* <p>Indicates whether this popup will be clipped to the screen and not to the
* containing window<p/>
*
* @param enabled True to clip to the screen.
* @hide
* @return true if popup will be clipped to the screen instead of the window, false otherwise
*
* @see #setClipToScreenEnabled(boolean)
*/
public boolean isClipToScreenEnabled() {
return mClipToScreen;
}
/**
* <p>Clip this popup window to the screen, but not to the containing window.</p>
*
* <p>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.</p>
*
* @param enabled true to clip to the screen.
*
* @see #isClipToScreenEnabled()
*/
@UnsupportedAppUsage
public void setClipToScreenEnabled(boolean enabled) {
mClipToScreen = enabled;
}
@@ -927,7 +960,8 @@ public class PopupWindow {
* for positioning.</p>
*
* @return true if the window will always be positioned in screen coordinates.
* @hide
*
* @see #setLayoutInScreenEnabled(boolean)
*/
public boolean isLayoutInScreenEnabled() {
return mLayoutInScreen;
@@ -939,9 +973,9 @@ public class PopupWindow {
* This will cause the popup to be positioned in absolute screen coordinates.</p>
*
* @param enabled true if the popup should always be positioned in screen coordinates
* @hide
*
* @see #isLayoutInScreenEnabled()
*/
@UnsupportedAppUsage
public void setLayoutInScreenEnabled(boolean enabled) {
mLayoutInScreen = enabled;
}
@@ -1021,11 +1055,30 @@ public class PopupWindow {
}
/**
* Set whether this window is touch modal or if outside touches will be sent to
* other windows behind it.
* @hide
* <p>Indicates whether outside touches will be sent to this window
* or other windows behind it<p/>
*
* @return true if touches will be sent to this window, false otherwise
*
* @see #setTouchModal(boolean)
*/
public boolean isTouchModal() {
return !mNotTouchModal;
}
/**
* <p>Set whether this window is touch modal or if outside touches will be sent to
* other windows behind it.<p/>
*
* <p>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.</p>
*
* @param touchModal true to sent all outside touches to this window,
* false to other windows behind it
*
* @see #isTouchModal()
*/
@UnsupportedAppUsage
public void setTouchModal(boolean touchModal) {
mNotTouchModal = !touchModal;
}
@@ -1454,7 +1507,7 @@ public class PopupWindow {
*
* @param p the layout parameters of the popup's content view
*/
@UnsupportedAppUsage
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private void invokePopup(WindowManager.LayoutParams p) {
if (mContext != null) {
p.packageName = mContext.getPackageName();
@@ -2060,6 +2113,8 @@ public class PopupWindow {
* <li>{@link #setInputMethodMode(int)}</li>
* <li>{@link #setTouchable(boolean)}</li>
* <li>{@link #setAnimationStyle(int)}</li>
* <li>{@link #setTouchModal(boolean)} (boolean)}</li>
* <li>{@link #setClipToScreenEnabled(boolean)}</li>
* </ul>
*/
public void update() {