com.actionbarsherlock.internal.widget
Class PopupWindowCompat
java.lang.Object
android.widget.PopupWindow
com.actionbarsherlock.internal.widget.PopupWindowCompat
public class PopupWindowCompat
- extends android.widget.PopupWindow
Works around bugs in the handling of ViewTreeObserver by
PopupWindow.
PopupWindow registers an ViewTreeObserver.OnScrollChangedListener with
ViewTreeObserver, but does not keep a reference to the observer
instance that it has registers on. This is problematic when the anchor view
used by PopupWindow to access the observer is detached from the
window, as it will revert from the shared ViewTreeObserver owned
by the ViewRoot to a floating one, meaning
PopupWindow cannot unregister it's listener anymore and has
leaked it into the global observer.
This class works around this issue by
- replacing
PopupWindow.mOnScrollChangedListener with a no-op
listener so that any registration or unregistration performed by
PopupWindow itself has no effect and causes no leaks.
- registering the real listener only with the shared
ViewTreeObserver and keeping a reference to it to facilitate
correct unregistration. The reason for not registering on a floating observer
(before a view is attached) is that there is no safe way to get a reference
to the shared observer that the floating one will be merged into. This would
again cause the listener to leak.
| Nested classes/interfaces inherited from class android.widget.PopupWindow |
android.widget.PopupWindow.OnDismissListener |
| Fields inherited from class android.widget.PopupWindow |
INPUT_METHOD_FROM_FOCUSABLE, INPUT_METHOD_NEEDED, INPUT_METHOD_NOT_NEEDED |
|
Constructor Summary |
PopupWindowCompat()
|
PopupWindowCompat(android.content.Context context)
|
PopupWindowCompat(android.content.Context context,
android.util.AttributeSet attrs)
|
PopupWindowCompat(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
|
PopupWindowCompat(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
|
PopupWindowCompat(int width,
int height)
|
PopupWindowCompat(android.view.View contentView)
|
PopupWindowCompat(android.view.View contentView,
int width,
int height)
|
PopupWindowCompat(android.view.View contentView,
int width,
int height,
boolean focusable)
|
|
Method Summary |
void |
dismiss()
|
void |
showAsDropDown(android.view.View anchor,
int xoff,
int yoff)
|
void |
showAtLocation(android.view.View parent,
int gravity,
int x,
int y)
|
void |
update(android.view.View anchor,
int width,
int height)
|
void |
update(android.view.View anchor,
int xoff,
int yoff,
int width,
int height)
|
| Methods inherited from class android.widget.PopupWindow |
getAnimationStyle, getBackground, getContentView, getHeight, getInputMethodMode, getMaxAvailableHeight, getMaxAvailableHeight, getSoftInputMode, getWidth, isAboveAnchor, isClippingEnabled, isFocusable, isOutsideTouchable, isShowing, isSplitTouchEnabled, isTouchable, setAnimationStyle, setBackgroundDrawable, setClippingEnabled, setContentView, setFocusable, setHeight, setIgnoreCheekPress, setInputMethodMode, setOnDismissListener, setOutsideTouchable, setSoftInputMode, setSplitTouchEnabled, setTouchable, setTouchInterceptor, setWidth, setWindowLayoutMode, showAsDropDown, update, update, update, update |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PopupWindowCompat
public PopupWindowCompat()
PopupWindowCompat
public PopupWindowCompat(android.content.Context context)
PopupWindowCompat
public PopupWindowCompat(android.content.Context context,
android.util.AttributeSet attrs)
PopupWindowCompat
public PopupWindowCompat(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
PopupWindowCompat
public PopupWindowCompat(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr,
int defStyleRes)
PopupWindowCompat
public PopupWindowCompat(int width,
int height)
PopupWindowCompat
public PopupWindowCompat(android.view.View contentView)
PopupWindowCompat
public PopupWindowCompat(android.view.View contentView,
int width,
int height,
boolean focusable)
PopupWindowCompat
public PopupWindowCompat(android.view.View contentView,
int width,
int height)
showAsDropDown
public void showAsDropDown(android.view.View anchor,
int xoff,
int yoff)
- Overrides:
showAsDropDown in class android.widget.PopupWindow
update
public void update(android.view.View anchor,
int xoff,
int yoff,
int width,
int height)
- Overrides:
update in class android.widget.PopupWindow
update
public void update(android.view.View anchor,
int width,
int height)
- Overrides:
update in class android.widget.PopupWindow
showAtLocation
public void showAtLocation(android.view.View parent,
int gravity,
int x,
int y)
- Overrides:
showAtLocation in class android.widget.PopupWindow
dismiss
public void dismiss()
- Overrides:
dismiss in class android.widget.PopupWindow
Copyright © 2014 se.solovyev. All Rights Reserved.