Java Code Examples for com.google.android.material.bottomsheet.BottomSheetBehavior#STATE_COLLAPSED

The following examples show how to use com.google.android.material.bottomsheet.BottomSheetBehavior#STATE_COLLAPSED . 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: BaseModalBottomSheet.java    From CommonUtils with Apache License 2.0 6 votes vote down vote up
@Override
@CallSuper
public void onStateChanged(@NonNull View bottomSheet, @BottomSheetBehavior.State int newState) {
    BaseModalBottomSheet.this.bottomSheet = bottomSheet;

    if (newState == BottomSheetBehavior.STATE_HIDDEN) {
        dismissAllowingStateLoss();
        return;
    }

    heightChanged();

    if (newState == BottomSheetBehavior.STATE_COLLAPSED)
        prepareCollapsed();

    if (newState == BottomSheetBehavior.STATE_DRAGGING && hasNoScroll)
        restoreNotCollapsed();
}
 
Example 2
Source File: MapFragment.java    From nearby-android with Apache License 2.0 6 votes vote down vote up
/**
 * Set the menu options based on
 * the bottom sheet state
 *
 */
@Override
public final void onPrepareOptionsMenu(final Menu menu){
  final MenuItem listItem = menu.findItem(R.id.list_action);
  final MenuItem routeItem = menu.findItem(R.id.route_action);
  final MenuItem filterItem = menu.findItem(R.id.filter_in_map);


  if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
    listItem.setVisible(true);
    filterItem.setVisible(true);
    routeItem.setVisible(false);
  }else if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED){
    listItem.setVisible(false);
    filterItem.setVisible(true);
    routeItem.setVisible(true);
  }
}
 
Example 3
Source File: MainActivity.java    From call_manage with MIT License 5 votes vote down vote up
public void updateButtons(int bottomSheetState) {
    if (bottomSheetState == BottomSheetBehavior.STATE_HIDDEN || bottomSheetState == BottomSheetBehavior.STATE_COLLAPSED) {
        showButtons(true);
        if (mViewPager.getCurrentItem() == 1) showView(mAddContactButton, true);
    } else {
        showButtons(false);
        if (mViewPager.getCurrentItem() == 1) showView(mAddContactButton, false);
    }
}
 
Example 4
Source File: LoginSignUpPresenter.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@Override public void onStateChanged(@NonNull android.view.View bottomSheet, int newState) {
  switch (newState) {
    case BottomSheetBehavior.STATE_COLLAPSED:
      view.collapseBottomSheet();
      break;
    case BottomSheetBehavior.STATE_EXPANDED:
      view.expandBottomSheet();
      break;
  }
}
 
Example 5
Source File: MapFragment.java    From nearby-android with Apache License 2.0 5 votes vote down vote up
/**
 * Dismiss the bottom sheet
 * when map is scrolled and notify
 * presenter
 */
@Override public final void onMapViewChange() {
  mShowSnackbar = true;
  if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED){
    if (!mShowingRouteDetail){
      // show snackbar prompting for re-doing search
      showSearchSnackbar();
    }

  }else{
    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
  }
  mPresenter.setCurrentExtent(mMapView.getVisibleArea().getExtent());
}
 
Example 6
Source File: RoundedBottomSheetDialogFragment.java    From zephyr with MIT License 4 votes vote down vote up
protected int getInitialBottomSheetState() {
    return BottomSheetBehavior.STATE_COLLAPSED;
}
 
Example 7
Source File: BaseLibraryActivityViewModel.java    From Jockey with Apache License 2.0 4 votes vote down vote up
@Bindable
public boolean isToolbarExpanded() {
    return mBottomSheetState == BottomSheetBehavior.STATE_COLLAPSED;
}
 
Example 8
Source File: BaseLibraryActivityViewModel.java    From Jockey with Apache License 2.0 4 votes vote down vote up
@Bindable
public int getNowPlayingContentVisibility() {
    return (mBottomSheetState == BottomSheetBehavior.STATE_COLLAPSED)
            ? View.INVISIBLE
            : View.VISIBLE;
}