public void update(int x, int y, int width, int height) { if (width != -1) setWidth(width); if (height != -1) setHeight(height); if (!isShowing() || mContentView == null) return; android.view.WindowManager.LayoutParams p = (android.view.WindowManager.LayoutParams) mContentView.getLayoutParams(); boolean update = false; if (width != -1 && p.width != width) { p.width = width; update = true; } if (height != -1 && p.height != height) { p.height = height; update = true; } if (p.x != x) { p.x = x; update = true; } if (p.y != y) { p.y = y; update = true; } if (update) { WindowManagerImpl wm = WindowManagerImpl.getDefault(); wm.updateViewLayout(mContentView, p); } }
public void dismiss() { if (isShowing() && mPopupView != null) { WindowManagerImpl wm = WindowManagerImpl.getDefault(); wm.removeView(mPopupView); if (mPopupView != mContentView && (mPopupView instanceof ViewGroup)) ((ViewGroup) mPopupView).removeView(mContentView); mIsShowing = false; } }
private void invokePopup(android.view.WindowManager.LayoutParams p) { WindowManagerImpl wm = WindowManagerImpl.getDefault(); wm.addView(mPopupView, p); }