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

The following examples show how to use android.support.design.widget.BottomSheetBehavior#STATE_EXPANDED . 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 vote down vote up
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: ScrollingActivity.java    From Android-Multi-Theme-UI with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View view) {
    switch (view.getId()){
        case R.id.theme_selected :
        case R.id.fab:
            // change the state of the bottom sheet
            switch (mBottomSheetBehavior.getState()){
                case BottomSheetBehavior.STATE_HIDDEN :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                    break;

                case BottomSheetBehavior.STATE_COLLAPSED :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                    break;

                case BottomSheetBehavior.STATE_EXPANDED :
                    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
                    break;
            }
            break;
    }
}
 
Example 3
Source File: Luhn.java    From Luhn with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        return;
    }
    super.onBackPressed();
    sLuhnCallback.onFinished(false);
}
 
Example 4
Source File: MainFragment.java    From outlay with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    super.onResume();
    presenter.getCategories();
    if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        presenter.loadTimeline();
    }
    cleanAmountInput();
}
 
Example 5
Source File: BottomSheetActivity.java    From AndroidSamples with Apache License 2.0 5 votes vote down vote up
private void bottomSheet() {

        if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
            mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        } else {
            mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
        }
    }
 
Example 6
Source File: DetailsActivity.java    From AndroidDesignWidgetsSample with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.card_item_1)
void showBottomSheet() {
    int lastState = bottomSheetBehavior.getState();
    switch (lastState) {
        case BottomSheetBehavior.STATE_COLLAPSED:
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
            break;
        case BottomSheetBehavior.STATE_EXPANDED:
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
            break;
        case BottomSheetBehavior.STATE_HIDDEN:
            bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
            break;
    }
}
 
Example 7
Source File: FluentAppBar.java    From fluentAppBar with Apache License 2.0 5 votes vote down vote up
@Override
public void onStateChanged(@NonNull View bottomSheet, int newState) {
    if (fluentAppBarType == CLICK_FLUENT) {
        if (newState == BottomSheetBehavior.STATE_EXPANDED) {
            handleShowFluentBlur();
        } else if (newState == BottomSheetBehavior.STATE_COLLAPSED) {
            BlurView blurView = (BlurView) findViewById(R.id.blurview);
            blurView.setBlurEnabled(false);
            setBackgroundColor(backgroundColour);
        }
    }
}
 
Example 8
Source File: MainFragment.java    From outlay with Apache License 2.0 5 votes vote down vote up
public boolean onBackPressed() {
    if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        return false;
    }
    return true;
}
 
Example 9
Source File: Cuhn.java    From africastalking-android with MIT License 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
        return;
    }
    super.onBackPressed();
    Luhn.sLuhnCallback.onFinished(false);
}
 
Example 10
Source File: PicDialog.java    From PicKing with Apache License 2.0 5 votes vote down vote up
@Override
public void onBackPressed() {
    if (behavior.getState() == BottomSheetBehavior.STATE_EXPANDED)
        behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    else
        super.onBackPressed();
}
 
Example 11
Source File: LocationAlarmActivity.java    From LocationAware with Apache License 2.0 5 votes vote down vote up
@Override
public void showBottomSheet() {
  if (mBottomSheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
  } else {
    mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
  }
}
 
Example 12
Source File: NavigationView.java    From graphhopper-navigation-android with MIT License 5 votes vote down vote up
private void resetBottomSheetState(int bottomSheetState) {
  if (bottomSheetState > INVALID_STATE) {
    boolean isShowing = bottomSheetState == BottomSheetBehavior.STATE_EXPANDED;
    summaryBehavior.setHideable(!isShowing);
    summaryBehavior.setState(bottomSheetState);
  }
}
 
Example 13
Source File: MainActivity.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (mDrawer.isDrawerOpen(Gravity.START)) {
            mDrawer.closeDrawer(Gravity.START);
        } else if (mBehaviorPoi.getState() == BottomSheetBehavior.STATE_EXPANDED) {
            mBehaviorPoi.setState(BottomSheetBehavior.STATE_HIDDEN);

        } else {
            exitApp();
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
Example 14
Source File: AmapRouteFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapClick(LatLng latLng) {
    ((RouteActivity) getActivity()).showToolbar();
    if (mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    }
}
 
Example 15
Source File: BaiduMapRouteFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onMapClick(LatLng latLng) {
    ((RouteActivity) getActivity()).showToolbar();
    if (mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    }
}
 
Example 16
Source File: MainActivity.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (mDrawer.isDrawerOpen(Gravity.START)) {
            mDrawer.closeDrawer(Gravity.START);
        } else if (mBehaviorPoi.getState() == BottomSheetBehavior.STATE_EXPANDED) {
            mBehaviorPoi.setState(BottomSheetBehavior.STATE_HIDDEN);

        } else {
            exitApp();
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
Example 17
Source File: AmapRouteFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onMapClick(LatLng latLng) {
    ((RouteActivity) getActivity()).showToolbar();
    if (mBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
        mBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    }
}
 
Example 18
Source File: MapFragment.java    From settlers-remake with MIT License 4 votes vote down vote up
/**
 * Menu methods
 */
@Override
public boolean isMenuOpen() {
	return bottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED;
}
 
Example 19
Source File: ReplyAction.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBackPressed() {
	if (behavior.getState() == BottomSheetBehavior.STATE_EXPANDED) behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
	else super.onBackPressed();
}
 
Example 20
Source File: PostAction.java    From chaoli-forum-for-android-2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBackPressed() {
    if (behavior.getState() == BottomSheetBehavior.STATE_EXPANDED) behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    else super.onBackPressed();
}