@@ -61,7 +61,7 @@ public class MaterialMainContainerBackHelper extends MaterialBackAnimationHelper
6161 private float initialTouchY ;
6262 @ Nullable private Rect initialHideToClipBounds ;
6363 @ Nullable private Rect initialHideFromClipBounds ;
64- @ Nullable private Integer deviceCornerRadius ;
64+ @ Nullable private Integer expandedCornerSize ;
6565
6666 public MaterialMainContainerBackHelper (@ NonNull View view ) {
6767 super (view );
@@ -132,7 +132,7 @@ public void updateBackProgress(
132132 view .setTranslationY (translationY );
133133 if (view instanceof ClippableRoundedCornerLayout ) {
134134 ((ClippableRoundedCornerLayout ) view )
135- .updateCornerRadius (lerp (getDeviceCornerRadius (), collapsedCornerSize , progress ));
135+ .updateCornerRadius (lerp (getExpandedCornerSize (), collapsedCornerSize , progress ));
136136 }
137137 }
138138
@@ -187,18 +187,24 @@ private ValueAnimator createCornerAnimator(
187187 ClippableRoundedCornerLayout clippableRoundedCornerLayout ) {
188188 ValueAnimator cornerAnimator =
189189 ValueAnimator .ofFloat (
190- clippableRoundedCornerLayout .getCornerRadius (), getDeviceCornerRadius ());
190+ clippableRoundedCornerLayout .getCornerRadius (), getExpandedCornerSize ());
191191 cornerAnimator .addUpdateListener (
192192 animation ->
193193 clippableRoundedCornerLayout .updateCornerRadius ((Float ) animation .getAnimatedValue ()));
194194 return cornerAnimator ;
195195 }
196196
197- public int getDeviceCornerRadius () {
198- if (deviceCornerRadius == null ) {
199- deviceCornerRadius = getMaxDeviceCornerRadius ();
197+ public int getExpandedCornerSize () {
198+ if (expandedCornerSize == null ) {
199+ expandedCornerSize = isAtTopOfScreen () ? getMaxDeviceCornerRadius () : 0 ;
200200 }
201- return deviceCornerRadius ;
201+ return expandedCornerSize ;
202+ }
203+
204+ private boolean isAtTopOfScreen () {
205+ int [] location = new int [2 ];
206+ view .getLocationOnScreen (location );
207+ return location [1 ] == 0 ;
202208 }
203209
204210 private int getMaxDeviceCornerRadius () {
0 commit comments