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.aidy.bottomdrawerlayout.AllDrawerLayout.java
/** * Enable or disable interaction with the given drawer. * /*from w w w. j av a2 s . c o m*/ * <p> * This allows the application to restrict the user's ability to open or * close the given drawer. DrawerLayout will still respond to calls to * {@link #openDrawer(int)}, {@link #closeDrawer(int)} and friends if a * drawer is locked. * </p> * * <p> * Locking a drawer open or closed will implicitly open or close that drawer * as appropriate. * </p> * * @param lockMode * The new lock mode for the given drawer. One of * {@link #LOCK_MODE_UNLOCKED}, {@link #LOCK_MODE_LOCKED_CLOSED} * or {@link #LOCK_MODE_LOCKED_OPEN}. * @param edgeGravity * Gravity.LEFT, RIGHT, START or END. Expresses which drawer to * change the mode for. * * @see #LOCK_MODE_UNLOCKED * @see #LOCK_MODE_LOCKED_CLOSED * @see #LOCK_MODE_LOCKED_OPEN */ public void setDrawerLockMode(int lockMode, int edgeGravity) { final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); final ViewDragHelper helper; switch (absGravity) { case Gravity.LEFT: mLockModeLeft = lockMode; helper = mLeftDragger; break; case Gravity.RIGHT: mLockModeRight = lockMode; helper = mRightDragger; break; case Gravity.TOP: mLockModeTop = lockMode; helper = mTopDragger; break; case Gravity.BOTTOM: mLockModeBottom = lockMode; helper = mBottomDragger; break; default: helper = mBottomDragger; break; } if (lockMode != LOCK_MODE_UNLOCKED) { // Cancel interaction in progress helper.cancel(); } switch (lockMode) { case LOCK_MODE_LOCKED_OPEN: final View toOpen = findDrawerWithGravity(absGravity); if (toOpen != null) { openDrawer(toOpen); } break; case LOCK_MODE_LOCKED_CLOSED: final View toClose = findDrawerWithGravity(absGravity); if (toClose != null) { closeDrawer(toClose); } break; // default: do nothing } }
From source file:com.hippo.ehviewer.ui.scene.DownloadsScene.java
private void guideDownloadLabels() { MainActivity activity = getActivity2(); if (null == activity || !Settings.getGuideDownloadLabels()) { return;/*from ww w .ja v a 2 s . c o m*/ } Display display = activity.getWindowManager().getDefaultDisplay(); Point point = new Point(); display.getSize(point); mShowcaseView = new ShowcaseView.Builder(activity).withMaterialShowcase().setStyle(R.style.Guide) .setTarget(new PointTarget(point.x, point.y / 3)).blockAllTouches() .setContentTitle(R.string.guide_download_labels_title) .setContentText(R.string.guide_download_labels_text).replaceEndButton(R.layout.button_guide) .setShowcaseEventListener(new SimpleShowcaseEventListener() { @Override public void onShowcaseViewDidHide(ShowcaseView showcaseView) { mShowcaseView = null; ViewUtils.removeFromParent(showcaseView); Settings.puttGuideDownloadLabels(false); openDrawer(Gravity.RIGHT); } }).build(); }
From source file:com.abewy.android.apps.klyph.widget.KlyphDrawerLayout.java
/** * Check the lock mode of the drawer with the given gravity. * * @param edgeGravity Gravity of the drawer to check * @return one of {@link #LOCK_MODE_UNLOCKED}, {@link #LOCK_MODE_LOCKED_CLOSED} or * {@link #LOCK_MODE_LOCKED_OPEN}. *//* ww w.j ava 2s .co m*/ public int getDrawerLockMode(int edgeGravity) { final int absGrav = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); if (absGrav == Gravity.LEFT) { return mLockModeLeft; } else if (absGrav == Gravity.RIGHT) { return mLockModeRight; } return LOCK_MODE_UNLOCKED; }
From source file:com.osc.tweet.app.activities.MainActivity.java
/** * Initialize the navigation drawer.//from www . ja v a2 s.c o m */ private void initDrawer() { ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.application_name, R.string.app_name) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { EventBus.getDefault().post(new OpenedDrawerEvent(Gravity.LEFT)); ViewPropertyAnimator animator = ViewPropertyAnimator.animate(mDrawerMenus[0]); animator.x(0).setDuration(getResources().getInteger(R.integer.anim_super_fast_duration)) .start(); animator = ViewPropertyAnimator.animate(mDrawerMenus[1]); animator.x(0).setDuration(getResources().getInteger(R.integer.anim_fast_duration)).start(); animator = ViewPropertyAnimator.animate(mDrawerMenus[2]); animator.x(0).setDuration(getResources().getInteger(R.integer.anim_duration)).start(); animator = ViewPropertyAnimator.animate(mDrawerMenus[3]); animator.x(0).setDuration(getResources().getInteger(R.integer.anim_slow_duration)).start(); } else if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) { EventBus.getDefault().post(new OpenedDrawerEvent(Gravity.RIGHT)); } } }; mDrawerLayout.setDrawerListener(mDrawerToggle); ScreenSize sz = DeviceUtils.getScreenSize(App.Instance); mDrawerMenus[0] = findViewById(R.id.open_website_ll); ViewHelper.setX(mDrawerMenus[0], sz.Width); mDrawerMenus[0].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { WebViewActivity.showInstance(MainActivity.this, Prefs.getInstance().websiteUrl(), getString(R.string.lbl_main_page)); EventBus.getDefault().post(new CloseDrawerEvent()); } }); mDrawerMenus[1] = findViewById(R.id.open_all_notices_ll); ViewHelper.setX(mDrawerMenus[1], sz.Width); mDrawerMenus[2] = findViewById(R.id.open_all_known_ll); ViewHelper.setX(mDrawerMenus[2], sz.Width); mDrawerMenus[3] = findViewById(R.id.open_might_know_ll); ViewHelper.setX(mDrawerMenus[3], sz.Width); mDrawerMenus[3].setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { PeopleActivity.showInstance(MainActivity.this); EventBus.getDefault().post(new CloseDrawerEvent()); } }); } }
From source file:com.hippo.ehviewer.ui.MainActivity.java
@Override public void onBackPressed() { if (mDrawerLayout != null && (mDrawerLayout.isDrawerOpen(Gravity.LEFT) || mDrawerLayout.isDrawerOpen(Gravity.RIGHT))) { mDrawerLayout.closeDrawers();// w w w. j a va 2s.co m } else { super.onBackPressed(); } }
From source file:android.car.ui.provider.CarDrawerLayout.java
/** * Enable or disable interaction with the given drawer. * * <p>This allows the application to restrict the user's ability to open or close * the given drawer. DrawerLayout will still respond to calls to {@link #openDrawer()}, * {@link #closeDrawer()} and friends if a drawer is locked.</p> * * <p>Locking a drawer open or closed will implicitly open or close * that drawer as appropriate.</p> * * @param lockMode The new lock mode for the given drawer. One of {@link #LOCK_MODE_UNLOCKED}, * {@link #LOCK_MODE_LOCKED_CLOSED} or {@link #LOCK_MODE_LOCKED_OPEN}. * @param edgeGravity Gravity.LEFT, RIGHT, START or END. * Expresses which drawer to change the mode for. * * @see #LOCK_MODE_UNLOCKED/*from w w w .ja v a 2s .co m*/ * @see #LOCK_MODE_LOCKED_CLOSED * @see #LOCK_MODE_LOCKED_OPEN */ public void setDrawerLockMode(int lockMode, int edgeGravity) { final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); if (absGravity == Gravity.LEFT) { mLockModeLeft = lockMode; } else if (absGravity == Gravity.RIGHT) { mLockModeRight = lockMode; } if (lockMode != LOCK_MODE_UNLOCKED) { // Cancel interaction in progress mDragger.cancel(); } switch (lockMode) { case LOCK_MODE_LOCKED_OPEN: openDrawer(); break; case LOCK_MODE_LOCKED_CLOSED: closeDrawer(); break; // default: do nothing } }
From source file:com.money.manager.ex.home.DashboardFragment.java
private View showTableLayoutTopPayees(Cursor cursor) { LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dashboard_summary_layout, null); CurrencyService currencyService = new CurrencyService(getActivity().getApplicationContext()); // Textview Title TextView title = (TextView) layout.findViewById(R.id.textViewTitle); title.setText(R.string.top_payees_last_30_days); // Table//from www . ja v a2s .c om TableLayout tableLayout = (TableLayout) layout.findViewById(R.id.tableLayoutSummary); // Create Title tableLayout.addView(createTableRow( new String[] { "<small><b>" + getString(R.string.payee) + "</b></small>", "<small><b>" + getString(R.string.quantity) + "</b></small>", "<small><b>" + getString(R.string.summary) + "</b></small>" }, new Float[] { 1f, null, null }, new Integer[] { null, Gravity.RIGHT, Gravity.RIGHT }, new Integer[][] { null, { 0, 0, padding_in_px, 0 }, null })); // add rows while (cursor.moveToNext()) { // load values String payee = cursor.getString(cursor.getColumnIndex(ViewMobileData.PAYEE)); double total = cursor.getDouble(cursor.getColumnIndex("TOTAL")); int num = cursor.getInt(cursor.getColumnIndex("NUM")); // Add Row tableLayout.addView(createTableRow( new String[] { "<small>" + payee + "</small>", "<small><i>" + Integer.toString(num) + "</i></small>", "<small>" + currencyService.getCurrencyFormatted(currencyService.getBaseCurrencyId(), MoneyFactory.fromDouble(total)) + "</small>" }, new Float[] { 1f, null, null }, new Integer[] { null, Gravity.RIGHT, Gravity.RIGHT }, new Integer[][] { null, { 0, 0, padding_in_px, 0 }, null })); } // return Layout return layout; }
From source file:com.zyk.drawerlayout.widget.DrawerLayout.java
public DrawerLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); density = getResources().getDisplayMetrics().density; mMinDrawerMarginWidth = (int) (MIN_DRAWER_MARGIN * density + 0.5f); //FIXME ????// w ww .j a va 2 s . c om mMinDrawerMarginHeight = mMinDrawerMarginWidth; final float minVel = MIN_FLING_VELOCITY * density; mLeftCallback = new ViewDragCallback(Gravity.LEFT); mRightCallback = new ViewDragCallback(Gravity.RIGHT); mTopCallback = new ViewDragCallback(Gravity.TOP); mBottomCallback = new ViewDragCallback(Gravity.BOTTOM); mLeftDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mLeftCallback); mLeftDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_LEFT); mLeftDragger.setMinVelocity(minVel); mLeftCallback.setDragger(mLeftDragger); mRightDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mRightCallback); mRightDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_RIGHT); mRightDragger.setMinVelocity(minVel); mRightCallback.setDragger(mRightDragger); mTopDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mTopCallback); mTopDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_TOP); mTopDragger.setMinVelocity(minVel); mTopCallback.setDragger(mTopDragger); mBottomDragger = ViewDragHelper.create(this, TOUCH_SLOP_SENSITIVITY, mBottomCallback); mBottomDragger.setEdgeTrackingEnabled(ViewDragHelper.EDGE_BOTTOM); mBottomDragger.setMinVelocity(minVel); mBottomCallback.setDragger(mBottomDragger); // So that we can catch the back button setFocusableInTouchMode(true); ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate()); ViewGroupCompat.setMotionEventSplittingEnabled(this, false); if (ViewCompat.getFitsSystemWindows(this)) { IMPL.configureApplyInsets(this); mStatusBarBackground = IMPL.getDefaultStatusBarBackground(context); } mDrawerElevation = DRAWER_ELEVATION * density; mNonDrawerViews = new ArrayList<View>(); }
From source file:com.abewy.android.apps.klyph.widget.KlyphDrawerLayout.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 om public int getDrawerLockMode(View drawerView) { final int gravity = getDrawerViewGravity(drawerView); if (gravity == Gravity.LEFT) { return mLockModeLeft; } else if (gravity == Gravity.RIGHT) { return mLockModeRight; } return LOCK_MODE_UNLOCKED; }
From source file:com.aidy.bottomdrawerlayout.DrawerLayout.java
/** * Check the lock mode of the drawer with the given gravity. * /*from ww w . j a va 2 s .c o m*/ * @param edgeGravity * Gravity of the drawer to check * @return one of {@link #LOCK_MODE_UNLOCKED}, * {@link #LOCK_MODE_LOCKED_CLOSED} or * {@link #LOCK_MODE_LOCKED_OPEN}. */ public int getDrawerLockMode(int edgeGravity) { final int absGravity = GravityCompat.getAbsoluteGravity(edgeGravity, ViewCompat.getLayoutDirection(this)); if (absGravity == Gravity.LEFT) { return mLockModeLeft; } else if (absGravity == Gravity.RIGHT) { return mLockModeRight; } return LOCK_MODE_UNLOCKED; }