Java Code Examples for android.support.design.widget.BottomSheetBehavior#State

The following examples show how to use android.support.design.widget.BottomSheetBehavior#State . 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: BottomSheetMenuDialog.java    From BottomSheetBuilder with Apache License 2.0 6 votes vote down vote up
@Override
public void onStateChanged(@NonNull View bottomSheet,
                           @BottomSheetBehavior.State int newState) {

    if (mCallback != null) {
        mCallback.onStateChanged(bottomSheet, newState);
    }

    //noinspection WrongConstant
    if (newState == BottomSheetBehavior.STATE_HIDDEN) {
        mBehavior.setBottomSheetCallback(null);
        try {
            BottomSheetMenuDialog.super.dismiss();
        } catch (IllegalArgumentException e) {
            // Ignore exception handling
        }

        // User dragged the sheet.
        if (!mClicked && !mRequestDismiss && !mRequestCancel && mOnCancelListener != null) {
            mOnCancelListener.onCancel(BottomSheetMenuDialog.this);
        }
    }
}
 
Example 2
Source File: BottomSheetDialogScene.java    From scene with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateChanged(@NonNull View bottomSheet,
                           @BottomSheetBehavior.State int newState) {
    if (newState == BottomSheetBehavior.STATE_HIDDEN) {
        cancel();
    }
}
 
Example 3
Source File: TopSheetDialog.java    From AndroidTopSheet with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateChanged(@NonNull View topSheet,
                           @BottomSheetBehavior.State int newState) {
    if (newState == TopSheetBehavior.STATE_HIDDEN) {
        dismiss();
    }
}