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

This code example shows how to use the following methods:getWidth, setWidth
            assertThat(popupWindow.getContentView()).isSameAs(contentView);
        } 
 
        @Test 
        public void testSetWidth() { 
            popupWindow.setWidth(1);
 
            assertThat(popupWindow.getWidth()).isEqualTo(1);
        } 
 
        @Test 
        public void testSetHeight() { 
            popupWindow.setHeight(2);
 
            assertThat(popupWindow.getHeight()).isEqualTo(2);
        } 
 
        @Test 
        public void testSetFocusable() { 
            popupWindow.setFocusable(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:getWidth, setBackgroundDrawable, setFocusable, setOutsideTouchable, showAtLocation
		webView.loadDataWithBaseURL(baseUrl, data, "text/html", "UTF-8",
				"file://" + dirName + "/");
 
		int height = (int) (llWrapper.getHeight() * 0.6);
		popupWindow = new PopupWindow(webView,
				ViewGroup.LayoutParams.MATCH_PARENT, height);
		popupWindow.setFocusable(true);
		popupWindow.setOutsideTouchable(true);
		popupWindow.setBackgroundDrawable(new BitmapDrawable());
		int x = -popupWindow.getWidth() / 2;
		popupWindow.showAtLocation(llWrapper, Gravity.CENTER, x, 0);
	} 
 
	private void setupWebView() { 
		webView = new WebView(this);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.setWebChromeClient(new WebChromeClient() {
			@Override 
			public boolean onJsAlert(WebView view, String url, String message,
					JsResult result) {
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:getWidth, setContentView, showAsDropDown
  } 
 
  public void showPopList() 
  { 
    this.mPopView.setBackgroundResource(this.mPopBgId);
    this.mPopWindow.setContentView(this.mPopView);
    this.mPopOffsetX = (this.mPopAnchorView.getWidth() - this.mPopWindow.getWidth() - (int)(0.5F + 9.0F * this.mContext.getResources().getDisplayMetrics().density));
    this.mPopWindow.showAsDropDown(this.mPopAnchorView, this.mPopOffsetX, this.mPopOffsetY);
  } 
 
  public void update() 
  { 
    if (this.mPopWindow != null)
      this.mPopWindow.update();
  } 
} 
 
/* Location:           C:\Users\sandrocheng.21KUNPENG\Desktop\classes_dex2jar.jar 
 * Qualified Name:     com.tencent.qqpimsecure.uilib.view.PopListView 
 * JD-Core Version:    0.6.2 
5
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
This code example shows how to use the following methods:getWidth, isShowing, showAsDropDown
    protected DirectoryItem viewToItem(View view) {
        return (DirectoryItem) view.getTag();
    } 
 
    public void toggle() { 
        if (mPopup.isShowing()) {
            hide(); 
        } else { 
            show(); 
        } 
    } 
 
    public void show() { 
        mPopup.showAsDropDown(mAnchor); 
 
        Log.d(TAG, "width: " + mPopup.getWidth());
    } 
 
    public void hide() { 
        mPopup.dismiss();
    } 
5
CodeRank
This code example shows how to use the following methods:getWidth
		mMyPopup.showAsDropDown(this, getMyErrorX(), getMyErrorY());
		 
	} 
	 
	private int getMyErrorX() { 
		return getWidth() - mMyPopup.getWidth() - getPaddingRight();
	} 
	 
	private int getMyErrorY() { 
		int vspace = getBottom() - getTop() -
				getCompoundPaddingBottom() - getCompoundPaddingTop();
		int icontop = getCompoundPaddingTop() + vspace / 2;
		 
		return icontop - getHeight() - 2;
	} 
	 
	private void resetMyError() { 
		if (mMyPopup != null) {
			if (mMyPopup.isShowing()) {
				mMyPopup.dismiss();
4
CodeRank

Related PopupWindow getWidth Questions & Answers:

getWidth Method Overview
Return this popup's width MeasureSpec
See Code Examples for other Android PopupWindow Methods: