List of usage examples for android.view Gravity RIGHT
int RIGHT
To view the source code for android.view Gravity RIGHT.
Click Source Link
From source file:com.dk.view.FolderDrawerLayout.java
/** * Returns the title of the drawer with the given gravity. * /*w w w . j a v a 2 s. c om*/ * @param edgeGravity * Gravity.LEFT, RIGHT, START or END. Expresses which drawer to * return the title for. * @return The title of the drawer, or null if none set. * @see #setDrawerTitle(int, CharSequence) */ public CharSequence getDrawerTitle(int edgeGravity) { final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); if (absGravity == Gravity.LEFT) { return mTitleLeft; } else if (absGravity == Gravity.RIGHT) { return mTitleRight; } return null; }
From source file:com.aidy.bottomdrawerlayout.AllDrawerLayout.java
/** * Check the lock mode of the given drawer view. * //from w w w . ja v a 2 s . co m * @param drawerView * Drawer view to check lock mode * @return one of {@link #LOCK_MODE_UNLOCKED}, * {@link #LOCK_MODE_LOCKED_CLOSED} or * {@link #LOCK_MODE_LOCKED_OPEN}. */ public int getDrawerLockMode(View drawerView) { final int absGravity = getDrawerViewAbsoluteGravity(drawerView); switch (absGravity) { case Gravity.LEFT: return mLockModeLeft; case Gravity.RIGHT: return mLockModeRight; case Gravity.TOP: return mLockModeTop; case Gravity.BOTTOM: return mLockModeBottom; default: return LOCK_MODE_UNLOCKED; } }
From source file:com.amazon.appstream.sampleclient.SampleClientActivity.java
@Override public void onErrorMessage(final boolean fatal, final String message) { runOnUiThread(new Runnable() { @Override//from w w w.j a v a 2 s.c om public void run() { if (mStopped) { Log.i(TAG, "Ignoring error during stopped state :" + (fatal ? "fatal" : "non fatal") + ":" + message); return; // ignore errors if we're stopped. } if (fatal) { // Tell the app it needs to pause. AppStreamInterface.pause(true); ErrorDialogFragment dialog = new ErrorDialogFragment(); dialog.setMessage(message); dialog.show(getSupportFragmentManager(), "ErrorDialogFragment"); // And finally stop AppStream; kill the interfaces to give us a clean slate. stopAppStream(); } else { if (mConnectDialog != null) { openConnectDialog(message); } else { Toast toast = Toast.makeText(SampleClientActivity.this, message, Toast.LENGTH_LONG); toast.setGravity(Gravity.RIGHT | Gravity.BOTTOM, 10, 10); toast.show(); } } } }); }
From source file:com.android.mail.ui.TwoPaneController.java
/** * Set the toast bar's layout params to position it in the right place * depending the current view mode./*from www .jav a 2s . c om*/ * * @param convModeShowInList if we're in conversation mode, should the toast * bar appear over the list? no effect when not in conversation mode. */ private void repositionToastBar(boolean convModeShowInList) { final int mode = mViewMode.getMode(); final FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mToastBar.getLayoutParams(); switch (mode) { case ViewMode.SEARCH_RESULTS_LIST: case ViewMode.CONVERSATION_LIST: params.width = mLayout.computeConversationListWidth() - params.leftMargin - params.rightMargin; params.gravity = Gravity.BOTTOM | Gravity.RIGHT; mToastBar.setLayoutParams(params); break; case ViewMode.SEARCH_RESULTS_CONVERSATION: case ViewMode.CONVERSATION: if (convModeShowInList && !mLayout.isConversationListCollapsed()) { // Show undo bar in the conversation list. params.gravity = Gravity.BOTTOM | Gravity.LEFT; params.width = mLayout.computeConversationListWidth() - params.leftMargin - params.rightMargin; mToastBar.setLayoutParams(params); } else { // Show undo bar in the conversation. params.gravity = Gravity.BOTTOM | Gravity.RIGHT; params.width = mLayout.computeConversationWidth() - params.leftMargin - params.rightMargin; mToastBar.setLayoutParams(params); } break; } }
From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java
/** * Check the lock mode of the given drawer view. * * @param drawerView Drawer view to check lock mode * @return one of {@link #LOCK_MODE_UNLOCKED}, {@link #LOCK_MODE_LOCKED_CLOSED} or * {@link #LOCK_MODE_LOCKED_OPEN}. *///from w w w .j a v a 2s.c o m @LockMode public int getDrawerLockMode(View drawerView) { final int absGravity = getDrawerViewAbsoluteGravity(drawerView); if (absGravity == Gravity.LEFT) { return mLockModeLeft; } else if (absGravity == Gravity.RIGHT) { return mLockModeRight; } return LOCK_MODE_UNLOCKED; }
From source file:com.sonvp.tooltip.Tooltip.java
/** * change gravity tooltip if anchorView intersect display screen *///from w w w .j a va 2 s. c o m private void changeGravityToolTip() { Context context = container.getContext(); if (!(context instanceof Activity)) { return; } DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int displayHeight = displayMetrics.heightPixels; int displayWidth = displayMetrics.widthPixels; int displayTop = getStatusBarHeight(); int anchorTop = rectAnchorView.top; int anchorLeft = rectAnchorView.left; int anchorHeight = anchorView.getHeight(); int anchorWidth = anchorView.getWidth(); int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(displayWidth, View.MeasureSpec.AT_MOST); int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); viewTooltip.measure(widthMeasureSpec, heightMeasureSpec); int textHeight = viewTooltip.getMeasuredHeight(); // height multi line int heightToolTip = textHeight + // with Gravity is Top and Bottom (int) builder.arrowHeight + (int) builder.topPadding + (int) builder.bottomPadding + (int) builder.toolTipMargin; int textWidth = viewTooltip.getMeasuredHeight(); int widthToolTip = textWidth + // with Gravity is Left and Right (int) builder.arrowWidth + (int) builder.leftPadding + (int) builder.rightPadding + (int) builder.toolTipMargin; switch (gravity) { case Gravity.LEFT: if (!(viewTooltip instanceof TextView)) { if (anchorLeft < widthToolTip) { if (anchorTop > heightToolTip) { gravity = Gravity.TOP; } else { gravity = Gravity.BOTTOM; } } } case Gravity.RIGHT: if (!(viewTooltip instanceof TextView)) { int anchorRight = anchorLeft + anchorWidth; if (anchorRight + widthToolTip > displayWidth) { if (anchorTop > heightToolTip) { gravity = Gravity.TOP; } else { gravity = Gravity.BOTTOM; } } } default: // with Gravity is Left and Right int anchorVerticalCenter = anchorTop + anchorHeight / 2; int bottomArrow = anchorVerticalCenter + (int) builder.arrowHeight / 2; int topArrow = anchorVerticalCenter - (int) builder.arrowHeight / 2; if (bottomArrow + builder.radius + builder.toolTipMargin > displayHeight) { gravity = Gravity.TOP; } else if (topArrow < getStatusBarHeight() + builder.radius + builder.toolTipMargin) { gravity = Gravity.BOTTOM; } break; case Gravity.TOP: if (anchorTop - displayTop < heightToolTip) { gravity = Gravity.BOTTOM; } break; case Gravity.BOTTOM: int anchorBottom = displayHeight - (anchorTop + anchorHeight); if (anchorBottom < heightToolTip) { gravity = Gravity.TOP; } break; } }
From source file:com.mods.grx.settings.GrxSettingsActivity.java
private void ini_toolbar() { if (mDrawerRight) posicion = new android.support.v4.widget.DrawerLayout.LayoutParams( (int) getResources().getDimension(R.dimen.ancho_panel), ViewGroup.LayoutParams.MATCH_PARENT, Gravity.RIGHT); else/*from w w w. java2 s . c o m*/ posicion = new android.support.v4.widget.DrawerLayout.LayoutParams( (int) getResources().getDimension(R.dimen.ancho_panel), ViewGroup.LayoutParams.MATCH_PARENT, Gravity.LEFT); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); mDrawer = (DrawerLayout) findViewById(R.id.nav_drawer_layout); final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawer, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); mDrawer.setDrawerListener(toggle); toggle.syncState(); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mDrawer.isDrawerVisible(mSVN)) { if (mDrawerRight) mDrawer.closeDrawer(Gravity.RIGHT); else mDrawer.closeDrawer(Gravity.LEFT); } else { if (mDrawerRight) mDrawer.openDrawer(Gravity.RIGHT); else mDrawer.openDrawer(Gravity.LEFT); } } }); TypedArray a = this.getTheme().obtainStyledAttributes(new int[] { R.attr.snackbar_bg }); mSnackBarBgColor = a.getColor(0, 0); a.recycle(); }
From source file:com.abewy.android.apps.klyph.widget.KlyphDrawerLayout.java
/** * Simple gravity to string - only supports LEFT and RIGHT for debugging output. * * @param gravity Absolute gravity value * @return LEFT or RIGHT as appropriate, or a hex string *//*from ww w . j a v a 2 s .c o m*/ static String gravityToString(int gravity) { if ((gravity & Gravity.LEFT) == Gravity.LEFT) { return "LEFT"; } if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) { return "RIGHT"; } return Integer.toHexString(gravity); }
From source file:ca.co.rufus.androidboilerplate.ui.DebugDrawerLayout.java
/** * Sets the title of the drawer with the given gravity. * <p>//w ww .j a v a 2 s . c o m * When accessibility is turned on, this is the title that will be used to * identify the drawer to the active accessibility service. * * @param edgeGravity Gravity.LEFT, RIGHT, START or END. Expresses which * drawer to set the title for. * @param title The title for the drawer. */ public void setDrawerTitle(@EdgeGravity int edgeGravity, CharSequence title) { final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); if (absGravity == Gravity.LEFT) { mTitleLeft = title; } else if (absGravity == Gravity.RIGHT) { mTitleRight = title; } }
From source file:com.hippo.ehviewer.ui.scene.FavoritesScene.java
@Override @Implemented(FastScroller.OnDragHandlerListener.class) public void onStartDragHandler() { // Lock right drawer setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT); }