Java 类android.support.design.widget.AppBarLayout.OnOffsetChangedListener 实例源码

项目:ThreePhasesBottomSheet    文件:BottomSheetLayout.java   
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;
        }
    };
}