PopupWindow update - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PopupWindow update method.

This code example shows how to use the following methods:dismiss, isShowing, showAtLocation, update
 
        mWindowAbovePos.y = mAnchorRect.top - getMeasuredHeight();
        mWindowBelowPos.y = mAnchorRect.bottom + mVerticalSpaceShownBelow;
        mWindowMiddlePos.y = (parentRect.bottom - parentRect.top) / 2;
 
        if (mWindow.isShowing()) {
            switchAboveBelow(true); 
            mWindow.update(mWindowAbovePos.x, mWindowAbovePos.y, -1, -1);
 
            if (!isPositionVisible(mWindowAbovePos, parentRect)) {
                hide(); 
 
                switchAboveBelow(false); 
                if (isPositionVisible(mWindowBelowPos, parentRect)) {
                    mWindow.showAtLocation(mParent, 0, mWindowBelowPos.x, mWindowBelowPos.y);
                    mIsShowing = true;
                } else { 
                    switchAboveBelow(true); 
                    if (isPositionVisible(mWindowMiddlePos, parentRect)) {
	                    mWindow.showAtLocation(mParent, 0, mWindowMiddlePos.x, mWindowMiddlePos.y);

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAsDropDown, update
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAsDropDown, update
		int height = view.getMeasuredHeight();
		int[] location = new int[2];
 
		parent.getLocationInWindow(location);
		if (isLeft) {
			popupWindow.showAsDropDown(parent, -location[0],
					-parent.getHeight() - height);
		} else { 
			popupWindow.showAsDropDown(parent, 0, -parent.getHeight() - height);
		} 
		popupWindow.setFocusable(true);
		// 设置允许在外点击消失 
		popupWindow.setOutsideTouchable(true);
		// 刷新状态 
		popupWindow.update();
	} 
 
	// 隐藏菜单 
	public void dismiss() { 
		popupWindow.dismiss();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAtLocation, update
	} 
	 
	public void showPopWindow(View view,int x,int y){
		if (!isShow) {
			isShow=true;
			mPopupWindow.setFocusable(true);
			mPopupWindow.setOutsideTouchable(true);
			//mPopupWindow.setAnimationStyle(R.style.PopupAnimation); 
			mPopupWindow.update();
			mPopupWindow.showAtLocation(SKSceneManage.getInstance().getCurrentScene(), Gravity.CENTER_HORIZONTAL, x, y);
		} 
	} 
	 
	public interface ICallGroupId{ 
		void onResult(int gId,String name);
	} 
	 
	public void setiCallGroupId(ICallGroupId iCallGroupId) {
		this.iCallGroupId = iCallGroupId;
	} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth, update
            int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
        RectF anchor = makePixRectInScreen(
                contentViewCore, anchorX, anchorY, anchorWidth, anchorHeight);
        Point origin = adjustWindowPosition(
                contentViewCore, (int) (anchor.centerX() - getAnchorOffset()), (int) anchor.bottom);
        mPopup.update(origin.x, origin.y, mPopup.getWidth(), mPopup.getHeight());
    } 
 
    private static RectF makePixRectInScreen(ContentViewCore contentViewCore,
            int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
        final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
        final float yOffset = getWebViewOffsetYPixInScreen(contentViewCore);
        return new RectF(
                coordinates.fromLocalCssToPix(anchorX),
                coordinates.fromLocalCssToPix(anchorY) + yOffset,
                coordinates.fromLocalCssToPix(anchorX + anchorWidth),
                coordinates.fromLocalCssToPix(anchorY + anchorHeight) + yOffset);
    } 
 
    private static float getWebViewOffsetYPixInScreen(ContentViewCore contentViewCore) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAsDropDown, update
		int height = contentView.getMeasuredHeight();
		int[] location = new int[2];
 
		parent.getLocationInWindow(location);
		if (isLeft) {
			popupWindow.showAsDropDown(parent, -location[0],
					-parent.getHeight() - height);
		} else { 
			popupWindow.showAsDropDown(parent, 0, -parent.getHeight() - height);
		} 
		popupWindow.setFocusable(true);
		// 设置允许在外点击消失 
		popupWindow.setOutsideTouchable(true);
		// 刷新状态 
		popupWindow.update();
	} 
 
	// 隐藏菜单 
	public void dismiss() { 
		 if (popupWindow != null && popupWindow.isShowing()) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setFocusable, setOutsideTouchable, showAtLocation, update
	} 
	 
	public void showPopWindow(View view,int x,int y){
		if (!LoginUserListSpinnerisShow) {
			LoginUserListSpinnerisShow=true;
			mPopupWindow.setFocusable(true);
			mPopupWindow.setOutsideTouchable(true);
			//mPopupWindow.setAnimationStyle(R.style.PopupAnimation); 
			mPopupWindow.update();
			mPopupWindow.showAtLocation(SKSceneManage.getInstance().getCurrentScene(), Gravity.CENTER_HORIZONTAL, x, y);
		} 
	} 
	 
	public interface ICallUserName{ 
		void onResult(String userName);
	} 
	 
	public void setiCallGroupId(ICallUserName UserName) {
		this.userNameCall = UserName;
	} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBackgroundDrawable, setContentView, setFocusable, setHeight, setOutsideTouchable
This code example shows how to use the following methods:setBackgroundDrawable, setContentView, setFocusable, setHeight, setOutsideTouchable
	 * @param bgDrawableId背景ID 
	 * @param width菜单宽度 
	 * @param height菜单高度 
	 */ 
	private static PopupWindow createPopupList(Context context, String[] items, int bgDrawableId, int width, int height, OnItemClickListener listener) {
		PopupWindow popup = new PopupWindow(context);
		ListView lv = new ListView(context);
		lv.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_single_choice, items));
		lv.setOnItemClickListener(listener);
		popup.setContentView(lv);
		popup.setFocusable(true);
		popup.setOutsideTouchable(true);
		popup.setBackgroundDrawable(context.getResources().getDrawable(bgDrawableId));
		popup.setWidth(width);
		popup.setHeight(height);
		popup.update();
		return popup;
	} 
 
	/****************** Toast *************/ 
	public static void showError(Context context, int stringId) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth, update
            int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
        RectF anchor = makePixRectInScreen(
                contentViewCore, anchorX, anchorY, anchorWidth, anchorHeight);
        Point origin = adjustWindowPosition(
                contentViewCore, (int) (anchor.centerX() - getAnchorOffset()), (int) anchor.bottom);
        mPopup.update(origin.x, origin.y, mPopup.getWidth(), mPopup.getHeight());
    } 
 
    private static RectF makePixRectInScreen(ContentViewCore contentViewCore,
            int anchorX, int anchorY, int anchorWidth, int anchorHeight) {
        final RenderCoordinates coordinates = contentViewCore.getRenderCoordinates();
        final float yOffset = getWebViewOffsetYPixInScreen(contentViewCore);
        return new RectF(
                coordinates.fromLocalCssToPix(anchorX),
                coordinates.fromLocalCssToPix(anchorY) + yOffset,
                coordinates.fromLocalCssToPix(anchorX + anchorWidth),
                coordinates.fromLocalCssToPix(anchorY + anchorHeight) + yOffset);
    } 
 
    private static float getWebViewOffsetYPixInScreen(ContentViewCore contentViewCore) {
5
CodeRank
Experience pair programming with AI  Get Codota for Java

Related PopupWindow update Questions & Answers:

update Method Overview
Updates the position and the dimension of the popup window.
See Code Examples for other Android PopupWindow Methods: