List of usage examples for android.view Gravity isVertical
public static boolean isVertical(int gravity)
Indicate whether the supplied gravity has a vertical pull.
From source file:android.support.wear.widget.drawer.WearableDrawerView.java
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); // The peek view has a layout gravity of bottom for the top drawer, and a layout gravity // of top for the bottom drawer. This is required so that the peek view shows. On the top // drawer, the bottom peeks from the top, and on the bottom drawer, the top peeks. // LayoutParams are not guaranteed to return a non-null value until a child is attached to // the window. LayoutParams peekParams = (LayoutParams) mPeekContainer.getLayoutParams(); if (!Gravity.isVertical(peekParams.gravity)) { final boolean isTopDrawer = (((LayoutParams) getLayoutParams()).gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.TOP; if (isTopDrawer) { peekParams.gravity = Gravity.BOTTOM; mPeekIcon.setImageResource(R.drawable.ws_ic_more_horiz_24dp_wht); } else {/*from www .jav a2 s . co m*/ peekParams.gravity = Gravity.TOP; mPeekIcon.setImageResource(R.drawable.ws_ic_more_vert_24dp_wht); } mPeekContainer.setLayoutParams(peekParams); } }