Add custom bottom sheet state representing manual opening

This commit is contained in:
alex 2018-01-04 18:19:57 +02:00
parent f25e8afc92
commit 3f437064c9

View file

@ -104,11 +104,16 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
*/
public static final int STATE_HIDDEN = 5;
/**
* The bottom sheet is manually opened to a certain height.
*/
public static final int STATE_MANUALLY_MOVED = 6;
/**
* @hide
*/
@RestrictTo(LIBRARY_GROUP)
@IntDef({STATE_EXPANDED, STATE_COLLAPSED, STATE_DRAGGING, STATE_SETTLING, STATE_HIDDEN})
@IntDef({STATE_EXPANDED, STATE_COLLAPSED, STATE_DRAGGING, STATE_SETTLING, STATE_HIDDEN, STATE_MANUALLY_MOVED})
@Retention(RetentionPolicy.SOURCE)
public @interface State {
}
@ -400,7 +405,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
targetState = STATE_EXPANDED;
} else {
top = child.getTop();
targetState = STATE_DRAGGING;
targetState = STATE_MANUALLY_MOVED;
}
} else if (mHideable && shouldHide(child, getYVelocity())) {
top = mParentHeight;
@ -420,7 +425,7 @@ public class ExtendedBottomSheetBehavior<V extends View> extends CoordinatorLayo
targetState = STATE_COLLAPSED;
} else {
top = child.getTop();
targetState = STATE_DRAGGING;
targetState = STATE_MANUALLY_MOVED;
}
}
if (mViewDragHelper.smoothSlideViewTo(child, child.getLeft(), top)) {