Merge "Fix setState with the current state" into mnc-ub-dev

am: c5f5f85

* commit 'c5f5f85c1323787b2dc692af2dbd3efc804d5034':
  Fix setState with the current state

Change-Id: Ifbbadcb2f888adcfe29b776a3ab363e88fbe6885

GitOrigin-RevId=4f0c8201b8c02def322843f180b86e0ea466e650

PiperOrigin-RevId: 140560466
This commit is contained in:
Yuichi Araki 2016-11-30 04:01:21 +00:00 committed by Travis Collins
parent d26cc78b39
commit dce18cd5dc
2 changed files with 9 additions and 0 deletions

View File

@ -441,6 +441,9 @@ public class BottomSheetBehavior<V extends View> extends CoordinatorLayout.Behav
* {@link #STATE_HIDDEN}.
*/
public final void setState(@State int state) {
if (state == mState) {
return;
}
if (mViewRef == null) {
// The view is not laid out yet; modify mState and let onLayoutChild handle it later
if (state == STATE_COLLAPSED || state == STATE_EXPANDED ||

View File

@ -126,6 +126,12 @@ public class BottomSheetBehaviorTest extends
checkSetState(BottomSheetBehavior.STATE_COLLAPSED, ViewMatchers.isDisplayed());
}
@Test
@MediumTest
public void testSetStateCollapsedToCollapsed() {
checkSetState(BottomSheetBehavior.STATE_COLLAPSED, ViewMatchers.isDisplayed());
}
@Test
@MediumTest
public void testSwipeDownToCollapse() {