Example usage for android.view Gravity isVertical

List of usage examples for android.view Gravity isVertical

Introduction

In this page you can find the example usage for android.view Gravity isVertical.

Prototype

public static boolean isVertical(int gravity) 

Source Link

Document

Indicate whether the supplied gravity has a vertical pull.

Usage

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);
    }
}