PopupWindow getHeight - 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 getHeight method.

This code example shows how to use the following methods:getHeight, setHeight
            assertThat(popupWindow.getWidth()).isEqualTo(1);
        } 
 
        @Test 
        public void testSetHeight() { 
            popupWindow.setHeight(2);
 
            assertThat(popupWindow.getHeight()).isEqualTo(2);
        } 
 
        @Test 
        public void testSetFocusable() { 
            popupWindow.setFocusable(true);
 
            assertTrue(popupWindow.isFocusable());
        } 
 
        @Test 
        public void testSetTouchable() { 
            popupWindow.setTouchable(true);
7
CodeRank
This code example shows how to use the following methods:getHeight, getWidth, isShowing
            final int action = event.getAction();
            final int x = (int) event.getX();
            final int y = (int) event.getY();
 
            if (action == MotionEvent.ACTION_DOWN &&
                    mPopup != null && mPopup.isShowing() &&
                    (x >= 0 && x < mPopup.getWidth() && y >= 0 && y < mPopup.getHeight())) {
                mHandler.postDelayed(mResizePopupRunnable, EXPAND_LIST_TIMEOUT);
            } else if (action == MotionEvent.ACTION_UP) {
                mHandler.removeCallbacks(mResizePopupRunnable);
            } 
            return false; 
        } 
    } 
 
    private class PopupScrollListener implements ListView.OnScrollListener {
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
                int totalItemCount) {
 
        } 
7
CodeRank
This code example shows how to use the following methods:dismiss, getHeight, getWidth
			public boolean onTouch(View v, MotionEvent event) {
	            final int x = (int) event.getX();
	            final int y = (int) event.getY();
	             
	            if ((event.getAction() == MotionEvent.ACTION_DOWN)
	                    && ((x < 0) || (x >= mWindow.getWidth()) || (y < 0) || (y >= mWindow.getHeight()))) {
					aboutToDismiss(); 
	            } else if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
					aboutToDismiss(); 
					mWindow.dismiss();
					return true; 
				} 
				 
				return false; 
			} 
		}); 
 
		mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
	} 
	 
6
CodeRank
This code example shows how to use the following methods:getHeight, getWidth, isShowing, showAtLocation
			mIncreasePopup.dismiss();
		} 
	} 
	 
	private void popup() { 
		if (mDecreasePopup.isShowing() && mIncreasePopup.isShowing()) {
			return; 
		} 
		getGlobalVisibleRect(mGlobal);
		if (mOrientation == LinearLayout.HORIZONTAL) {
			mDecreasePopup.showAtLocation(this,
					Gravity.NO_GRAVITY,
					mGlobal.left, 
					mGlobal.centerY() - mDecreasePopup.getHeight()/2);
			mIncreasePopup.showAtLocation(this,
					Gravity.NO_GRAVITY,
					mGlobal.right - mIncreasePopup.getWidth(), 
					mGlobal.centerY() - mIncreasePopup.getHeight()/2);
		} else { 
			// TODO: re-position when Switcher is at the very top/bottom of screen 

6
CodeRank
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
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
getHeight Method Overview
Return this popup's height MeasureSpec
See Code Examples for other Android PopupWindow Methods: