title: Bottom sheet + Android MotionLayout implementation
body: <p>I am trying to implement Bottom sheet using MotionLayout. It works in a trivial case - when bottom sheet should be visible only in a half of screen (for example). But I can't make it work in a scenario when bottom sheet expands and fills whole screen.</p>
  
  <p><a href="https://i.stack.imgur.com/fJTCx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fJTCx.png" alt="enter image description here"></a></p>
  
  <p>So here can be 3 states:</p>
  
  <ol>
  <li>Bottom sheet hidden</li>
  <li>Bottom sheet fills half screen</li>
  <li>Bottom sheet fills whole screen</li>
  </ol>
  
  <p>Here is layout:</p>
  
  <pre><code>&lt;androidx.constraintlayout.motion.widget.MotionLayout
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         app:layoutDescription="@xml/scene_description"&gt;
  
           &lt;FrameLayout
              android:id="@+id/fragmentPlaceholder"
              android:layout_width="match_parent"
              android:layout_height="570dp"
              android:elevation="8dp"&gt; some content here &lt;/FrameLayout&gt;
  
  
  &lt;/androidx.constraintlayout.motion.widget.MotionLayout&gt;
  </code></pre>
  
  <p>Here <code>570dp</code> is equal to half screen (for example)</p>
  
  <p>And the content of <code>scene_description.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"&gt;
  
      &lt;Transition
          android:id="@+id/transition1"
          app:constraintSetStart="@id/bottomSheetHidden"
          app:constraintSetEnd="@id/bottomSheetHalfOpen"
          app:duration="300"&gt;
  
          &lt;OnSwipe
              app:dragDirection="dragDown"
              app:onTouchUp="autoCompleteToStart"
              app:touchAnchorId="@+id/fragmentPlaceholder"
              app:touchAnchorSide="bottom"/&gt;
  
      &lt;/Transition&gt;
  
  
      &lt;Transition
          android:id="@+id/transition2"
          app:constraintSetStart="@id/bottomSheetHalfOpen"
          app:constraintSetEnd="@id/bottomSheetOpenFullScreen"
          app:duration="300"&gt;
  
      &lt;/Transition&gt;
  
  
      &lt;Transition
          android:id="@+id/transition3"
          app:constraintSetStart="@id/bottomSheetHidden"
          app:constraintSetEnd="@id/bottomSheetOpenFullScreen"
          app:duration="300"&gt;
  
          &lt;OnSwipe
              app:dragDirection="dragDown"
              app:touchAnchorId="@+id/fragmentPlaceholder"
              app:touchAnchorSide="bottom" /&gt;
  
      &lt;/Transition&gt;
  
  
      &lt;ConstraintSet android:id="@+id/bottomSheetHidden"&gt;
  
          &lt;Constraint android:id="@id/fragmentPlaceholder"&gt;
              &lt;Layout
                  android:layout_width="match_parent"
                  android:layout_height="570dp"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintTop_toBottomOf="parent"/&gt; &lt;!-- below screen, not visible--&gt;
          &lt;/Constraint&gt;
  
      &lt;/ConstraintSet&gt;
  
  
      &lt;ConstraintSet android:id="@+id/bottomSheetHalfOpen"
          app:deriveConstraintsFrom="@id/bottomSheetHidden"&gt;
  
          &lt;Constraint android:id="@id/fragmentPlaceholder"&gt;
              &lt;Layout
                  android:layout_width="match_parent"
                  android:layout_height="570dp"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintBottom_toBottomOf="parent" /&gt;
          &lt;/Constraint&gt;
      &lt;/ConstraintSet&gt;
  
  
      &lt;ConstraintSet android:id="@+id/bottomSheetOpenFullScreen"
          app:deriveConstraintsFrom="@id/bottomSheetHidden"&gt;
  
          &lt;Constraint android:id="@id/fragmentPlaceholder"&gt;
              &lt;Layout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_marginTop="30dp"
                  app:layout_constraintTop_toTopOf="parent"
                  app:layout_constraintStart_toStartOf="parent"
                  app:layout_constraintEnd_toEndOf="parent"
                  app:layout_constraintBottom_toBottomOf="parent" /&gt;
          &lt;/Constraint&gt;
  
      &lt;/ConstraintSet&gt;
  
  &lt;/MotionScene&gt;
  </code></pre>
  
  <p><br/>
  <strong>The problems is OnSwipe doesn't work when bottom sheet is in Full screen state, but works when bottom sheet is in half screen state.</strong> I want to have an opportunity to hide bottom sheet using swipe movement.</p>
  
  <p>How this problem could be solved? Should transitions be added or modified? </p>