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.hippo.ehviewer.ui.scene.DownloadsScene.java
@Override public void onStartDragHandler() { // Lock right drawer setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED, Gravity.RIGHT); }
From source file:com.esri.android.mapsapp.MapFragment.java
/** * Adds the compass as per the height of the layout * //from www .j a va2 s . c o m * @param height */ private void addCompass(int height) { mMapContainer.removeView(mCompass); // Create the Compass custom view, and add it onto // the MapView. mCompass = new Compass(mMapView.getContext()); mCompass.setAlpha(1f); mCompass.setRotationAngle(45); int HEIGHT = 240; int WIDTH = 240; compassFrameParams = new FrameLayout.LayoutParams(WIDTH, HEIGHT, Gravity.RIGHT); int TOP_MARGIN_COMPASS = TOP_MARGIN_SEARCH + height + 45; int LEFT_MARGIN_COMPASS = 0; int BOTTOM_MARGIN_COMPASS = 0; int RIGHT_MARGIN_COMPASS = 0; ((MarginLayoutParams) compassFrameParams).setMargins(LEFT_MARGIN_COMPASS, TOP_MARGIN_COMPASS, RIGHT_MARGIN_COMPASS, BOTTOM_MARGIN_COMPASS); mCompass.setLayoutParams(compassFrameParams); mCompass.setVisibility(View.GONE); mCompass.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mCompass.setVisibility(View.GONE); mMapView.setRotationAngle(0); } }); // Add the compass on the map mMapContainer.addView(mCompass); }
From source file:com.hippo.ehviewer.ui.scene.DownloadsScene.java
@Override public void onEndDragHandler() { // Restore right drawer if (null != mRecyclerView && !mRecyclerView.isInCustomChoice()) { setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED, Gravity.RIGHT); }/* w ww .j a va2 s .co m*/ }
From source file:com.abewy.android.apps.klyph.app.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { /*//from w w w .j a v a 2s .co m * if (drawerToggle.onOptionsItemSelected(item)) * { * return true; * } */ if (item.getItemId() == android.R.id.home) { if (drawer.isDrawerOpen(Gravity.LEFT)) { drawer.closeDrawer(Gravity.LEFT); if (drawer.isDrawerOpen(Gravity.RIGHT)) drawer.closeDrawer(Gravity.RIGHT); } else { drawer.openDrawer(Gravity.LEFT); if (drawer.isDrawerOpen(Gravity.RIGHT)) drawer.closeDrawer(Gravity.RIGHT); } return true; } else if (item.getItemId() == R.id.menu_notifications) { if (drawer.isDrawerOpen(Gravity.RIGHT)) { drawer.closeDrawer(Gravity.RIGHT); if (drawer.isDrawerOpen(Gravity.LEFT)) drawer.closeDrawer(Gravity.LEFT); } else { drawer.openDrawer(Gravity.RIGHT); if (drawer.isDrawerOpen(Gravity.LEFT)) drawer.closeDrawer(Gravity.LEFT); } return true; } else if (item.getItemId() == R.id.menu_buy_pro) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(KLYPH_PRO_PLAY_STORE_URI)); intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); startActivity(intent); } else if (item.getItemId() == R.id.menu_logout) { AlertUtil.showAlert(this, R.string.menu_logout, R.string.logout_confirmation, R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { logout(); } }, R.string.cancel, null); return true; } else if (item.getItemId() == R.id.menu_faq) { startActivity(new Intent(this, FaqActivity.class)); } return super.onOptionsItemSelected(item); }
From source file:com.mobicage.rogerthat.plugins.friends.ServiceActionMenuActivity.java
private void populateScreen(final ServiceMenu menu) { menuBrandingHash = menu.branding;/*from ww w . j av a 2s .c o m*/ final FriendsPlugin friendsPlugin = mService.getPlugin(FriendsPlugin.class); final MessagingPlugin messagingPlugin = mService.getPlugin(MessagingPlugin.class); final FriendStore store = friendsPlugin.getStore(); List<Cell> usedCells = new ArrayList<Cell>(); if (page == 0) { addAboutHandler(usedCells, menu.aboutLabel); addHistoryHandler(usedCells, store, menu.messagesLabel); addCallHandler(menu, usedCells, menu.callLabel); if (CloudConstants.isYSAAA()) { addScanHandler(menu, usedCells, null); } else { addShareHandler(menu, usedCells, menu.shareLabel); } } boolean[] rows = new boolean[] { false, false, false }; if (page == 0) rows[0] = true; for (final ServiceMenuItem item : menu.itemList) { rows[(int) item.coords[1]] = true; final Cell cell = cells[(int) item.coords[0]][(int) item.coords[1]]; View.OnClickListener onClickListener = new SafeViewOnClickListener() { @Override public void safeOnClick(View v) { pressMenuItem(menu, messagingPlugin, store, item); } }; ((View) cell.icon.getParent()).setOnClickListener(onClickListener); cell.icon.setImageBitmap(BitmapFactory.decodeByteArray(item.icon, 0, item.icon.length)); cell.icon.setVisibility(View.VISIBLE); cell.label.setText(item.label); cell.label.setVisibility(View.VISIBLE); usedCells.add(cell); } for (int i = 2; i >= 0; i--) { if (rows[i]) break; tableRows[i].setVisibility(View.GONE); } boolean showBranded = false; boolean useDarkScheme = false; Integer menuItemColor = null; if (menu.branding != null) { try { BrandingMgr brandingMgr = messagingPlugin.getBrandingMgr(); Friend friend = store.getExistingFriend(email); if (brandingMgr.isBrandingAvailable(menu.branding)) { BrandingResult br = brandingMgr.prepareBranding(menu.branding, friend, false); WebSettings settings = branding.getSettings(); settings.setJavaScriptEnabled(false); settings.setBlockNetworkImage(false); branding.setVisibility(View.VISIBLE); branding.setVerticalScrollBarEnabled(false); final int displayWidth = UIUtils.getDisplayWidth(this); final int calculatedHeight = BrandingMgr.calculateHeight(br, displayWidth); final long start = System.currentTimeMillis(); branding.getViewTreeObserver().addOnPreDrawListener(new OnPreDrawListener() { @Override public boolean onPreDraw() { int height = branding.getMeasuredHeight(); if (height > calculatedHeight * 90 / 100 || System.currentTimeMillis() - start > 3000) { if (calculatedHeight > 0) { setBrandingHeight(height); } else { mService.postDelayedOnUIHandler(new SafeRunnable() { @Override protected void safeRun() throws Exception { setBrandingHeight(branding.getMeasuredHeight()); } }, 100); } branding.getViewTreeObserver().removeOnPreDrawListener(this); } return false; } }); branding.loadUrl("file://" + br.file.getAbsolutePath()); if (br.color != null) { branding.setBackgroundColor(br.color); activity.setBackgroundColor(br.color); } if (br.scheme == ColorScheme.dark) { for (Cell cell : usedCells) { cell.label.setTextColor(darkSchemeTextColor); cell.label.setShadowLayer(2, 1, 1, Color.BLACK); } useDarkScheme = true; } menuItemColor = br.menuItemColor; final ImageView watermarkView = (ImageView) findViewById(R.id.watermark); if (br.watermark != null) { BitmapDrawable watermark = new BitmapDrawable(getResources(), BitmapFactory.decodeFile(br.watermark.getAbsolutePath())); watermark.setGravity(Gravity.BOTTOM | Gravity.RIGHT); watermarkView.setImageDrawable(watermark); final LayoutParams layoutParams = watermarkView.getLayoutParams(); layoutParams.width = layoutParams.height = displayWidth; } else { watermarkView.setImageDrawable(null); } showBranded = true; } else { friend.actionMenu = menu; friend.actionMenu.items = menu.itemList.toArray(new ServiceMenuItemTO[] {}); brandingMgr.queue(friend); } } catch (BrandingFailureException e) { L.bug("Could not display service action menu with branding.", e); } } if (!showBranded) { setNavigationBarVisible(AppConstants.SHOW_NAV_HEADER); setNavigationBarTitle(menu.name); title.setVisibility(View.GONE); title.setText(menu.name); } for (final Cell cell : usedCells) { final View p = (View) cell.icon.getParent(); final Drawable d = getResources().getDrawable( useDarkScheme ? R.drawable.mc_smi_background_light : R.drawable.mc_smi_background_dark); p.setBackgroundDrawable(d); } if (menuItemColor == null) menuItemColor = Color.parseColor("#646464"); for (Cell cell : new Cell[] { cells[0][0], cells[1][0], cells[2][0], cells[3][0] }) cell.faIcon.setTextColor(menuItemColor); if (menu.maxPage > 0) { for (int i = 0; i <= menu.maxPage; i++) { ImageView bolleke = (ImageView) getLayoutInflater().inflate(R.layout.page, pages, false); if (page == i) { if (useDarkScheme) { bolleke.setImageResource(R.drawable.current_page_dark); } else { bolleke.setImageResource(R.drawable.current_page_light); } } else { if (useDarkScheme) { bolleke.setImageResource(R.drawable.other_page_dark); } else { bolleke.setImageResource(R.drawable.other_page_light); } } pages.addView(bolleke); } pages.setVisibility(View.VISIBLE); } final int leftPage = page - 1; final int rightPage = page + 1; final String service = email; Slider instance = new Slider(this, this, page == menu.maxPage ? null : new Slider.Swiper() { @Override public Intent onSwipe() { return new Intent(ServiceActionMenuActivity.this, ServiceActionMenuActivity.class) .putExtra(SERVICE_EMAIL, service).putExtra(MENU_PAGE, rightPage); } }, page == 0 ? null : new Slider.Swiper() { @Override public Intent onSwipe() { return new Intent(ServiceActionMenuActivity.this, ServiceActionMenuActivity.class) .putExtra(SERVICE_EMAIL, service).putExtra(MENU_PAGE, leftPage); } }); mGestureScanner = new GestureDetector(this, instance); }
From source file:com.hxqc.mall.usedcar.activity.SellCarActivity.java
@Override public void onBackPressed() { if (mPlateNumView != null && mPlateNumView.mKeyboardWindow != null && mPlateNumView.mKeyboardWindow.isShowing()) { mPlateNumView.hideKeyboard();// w w w . ja va 2 s . c o m } else if (mDrawerLayoutView.isDrawerOpen(Gravity.RIGHT)) { mDrawerLayoutView.closeDrawers(); } else { showExitDialog(); } }
From source file:com.hippo.nimingban.ui.ListActivity.java
@Override public void onBackPressed() { if (mSlidingDrawerLayout != null && (mSlidingDrawerLayout.isDrawerOpen(Gravity.LEFT) || mSlidingDrawerLayout.isDrawerOpen(Gravity.RIGHT))) { mSlidingDrawerLayout.closeDrawers(); } else {/* w ww . j a va 2 s . co m*/ long time = System.currentTimeMillis(); if (time - mPressBackTime > BACK_PRESSED_INTERVAL) { // It is the last scene mPressBackTime = time; Toast.makeText(this, R.string.press_twice_exit, Toast.LENGTH_SHORT).show(); } else { super.onBackPressed(); } } }
From source file:com.hxqc.mall.usedcar.activity.SellCarActivity.java
private void initRight(Fragment fragment) { mRightView.setLayoutParams(new DrawerLayout.LayoutParams(DisplayTools.getScreenWidth(this) * 4 / 5, DrawerLayout.LayoutParams.MATCH_PARENT, Gravity.RIGHT)); FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.right, fragment); fragmentTransaction.commit();/*from w w w .j a v a2 s .co m*/ }
From source file:com.waz.zclient.pages.main.participants.dialog.ParticipantsDialogFragment.java
@SuppressLint("RtlHardcoded") private void setVisible(final boolean show) { if (getView() == null || isInConfigurationChange) { removeFragment();/* www . jav a2s.co m*/ return; } Animation animation; if (show) { switch (selfGravity) { case Gravity.TOP: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_top); break; case Gravity.RIGHT: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_right); break; case Gravity.LEFT: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_left); break; case Gravity.BOTTOM: default: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_show_gravity_bottom); } } else { switch (selfGravity) { case Gravity.TOP: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_top); break; case Gravity.RIGHT: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_right); break; case Gravity.LEFT: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_left); break; case Gravity.BOTTOM: default: animation = AnimationUtils.loadAnimation(getActivity(), R.anim.popover_hide_gravity_bottom); } } animation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { if (show) { return; } removeFragment(); } @Override public void onAnimationRepeat(Animation animation) { } }); getView().startAnimation(animation); }
From source file:com.facebook.LikeView.java
private void updateLayout() { // Make sure the container is horizontally aligned according to specifications. LayoutParams containerViewLayoutParams = (LayoutParams) containerView.getLayoutParams(); LinearLayout.LayoutParams buttonLayoutParams = (LinearLayout.LayoutParams) likeButton.getLayoutParams(); int viewGravity = horizontalAlignment == HorizontalAlignment.LEFT ? Gravity.LEFT : horizontalAlignment == HorizontalAlignment.CENTER ? Gravity.CENTER_HORIZONTAL : Gravity.RIGHT; containerViewLayoutParams.gravity = viewGravity | Gravity.TOP; buttonLayoutParams.gravity = viewGravity; // Choose the right auxiliary view to make visible. socialSentenceView.setVisibility(GONE); likeBoxCountView.setVisibility(GONE); View auxView;//from w w w . ja v a 2 s . c om if (likeViewStyle == Style.STANDARD && likeActionController != null && !Utility.isNullOrEmpty(likeActionController.getSocialSentence())) { auxView = socialSentenceView; } else if (likeViewStyle == Style.BOX_COUNT && likeActionController != null && !Utility.isNullOrEmpty(likeActionController.getLikeCountString())) { updateBoxCountCaretPosition(); auxView = likeBoxCountView; } else { // No more work to be done. return; } auxView.setVisibility(VISIBLE); // Now position the auxiliary view properly LinearLayout.LayoutParams auxViewLayoutParams = (LinearLayout.LayoutParams) auxView.getLayoutParams(); auxViewLayoutParams.gravity = viewGravity; containerView.setOrientation(auxiliaryViewPosition == AuxiliaryViewPosition.INLINE ? LinearLayout.HORIZONTAL : LinearLayout.VERTICAL); if (auxiliaryViewPosition == AuxiliaryViewPosition.TOP || (auxiliaryViewPosition == AuxiliaryViewPosition.INLINE && horizontalAlignment == HorizontalAlignment.RIGHT)) { // Button comes after the auxiliary view. Make sure it is at the end containerView.removeView(likeButton); containerView.addView(likeButton); } else { // In all other cases, the button comes first containerView.removeView(auxView); containerView.addView(auxView); } switch (auxiliaryViewPosition) { case TOP: auxView.setPadding(edgePadding, edgePadding, edgePadding, internalPadding); break; case BOTTOM: auxView.setPadding(edgePadding, internalPadding, edgePadding, edgePadding); break; case INLINE: if (horizontalAlignment == HorizontalAlignment.RIGHT) { auxView.setPadding(edgePadding, edgePadding, internalPadding, edgePadding); } else { auxView.setPadding(internalPadding, edgePadding, edgePadding, edgePadding); } break; } }