Java Code Examples for android.support.design.widget.BottomSheetBehavior#getState()
The following examples show how to use
android.support.design.widget.BottomSheetBehavior#getState() .
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: BottomSheetMediaActions.java From Gallery-example with GNU General Public License v3.0 | 6 votes |
private static void toggleBottomSheet(View bottomSheet) { BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); int state = bottomSheetBehavior.getState(); switch (state) { case BottomSheetBehavior.STATE_COLLAPSED: bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); break; case BottomSheetBehavior.STATE_HIDDEN: bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); break; case BottomSheetBehavior.STATE_EXPANDED: bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); break; } }
Example 2
Source File: MainActivity.java From ViewPrinter with Apache License 2.0 | 5 votes |
@Override public void onBackPressed() { BottomSheetBehavior b = BottomSheetBehavior.from(mPanel); if (b.getState() != BottomSheetBehavior.STATE_HIDDEN) { b.setState(BottomSheetBehavior.STATE_HIDDEN); return; } super.onBackPressed(); }
Example 3
Source File: SecondActivity.java From boxing with Apache License 2.0 | 5 votes |
private void showFragment() { if (mInsideBottomSheet != null) { BottomSheetBehavior behavior = BottomSheetBehavior.from(mInsideBottomSheet); if (behavior.getState() != BottomSheetBehavior.STATE_EXPANDED) { behavior.setState(BottomSheetBehavior.STATE_EXPANDED); } else { behavior.setState(BottomSheetBehavior.STATE_HIDDEN); } } }