android.support.design.widget.AppBarLayout.OnOffsetChangedListener Java Examples

The following examples show how to use android.support.design.widget.AppBarLayout.OnOffsetChangedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BottomSheetLayout.java    From ThreePhasesBottomSheet with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void init() {
    ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext());
    minFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
    touchSlop = viewConfiguration.getScaledTouchSlop();

    dimView = new View(getContext());
    dimView.setBackgroundColor(Color.BLACK);
    dimView.setAlpha(0);
    dimView.setVisibility(INVISIBLE);

    peek = 0;//getHeight() return 0 at start!

    setFocusableInTouchMode(true);

    Point point = new Point();
    ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(point);
    screenWidth = point.x;
    sheetEndX = screenWidth;
    mOnOffsetChangedListener = new OnOffsetChangedListener() {
        @Override
        public void onOffsetChanged(final AppBarLayout appBarLayout, final int verticalOffset) {
            mAppBarLayoutOffset = verticalOffset;
        }
    };
}