@@ -39,7 +39,8 @@ public interface Callback {
3939 View getChildAtRawPosition (float x , float y );
4040 View getChildAtPosition (float x , float y );
4141 boolean canChildBeExpanded (View v );
42- boolean setUserExpandedChild (View v , boolean userxpanded );
42+ boolean setUserExpandedChild (View v , boolean userExpanded );
43+ boolean setUserLockedChild (View v , boolean userLocked );
4344 }
4445
4546 private static final String TAG = "ExpandHelper" ;
@@ -433,7 +434,7 @@ public boolean onTouchEvent(MotionEvent ev) {
433434 final int y = (int ) ev .getY ();
434435 View underPointer = findView (x , y );
435436 if (isFinished && underPointer != null && underPointer != mCurrView ) {
436- setGlow ( 0f );
437+ finishScale ( false );
437438 initScale (underPointer );
438439 mInitialTouchY = ev .getY ();
439440 mHasPopped = false ;
@@ -458,6 +459,7 @@ public boolean onTouchEvent(MotionEvent ev) {
458459 private boolean initScale (View v ) {
459460 if (v != null ) {
460461 if (DEBUG ) Slog .d (TAG , "scale begins on view: " + v );
462+ mCallback .setUserLockedChild (v , true );
461463 setView (v );
462464 setGlow (GLOW_BASE );
463465 mScaler .setView (v );
@@ -479,21 +481,26 @@ private boolean initScale(View v) {
479481 }
480482
481483 private void finishScale (boolean force ) {
484+ float currentHeight = mScaler .getHeight ();
485+ float targetHeight = mSmallSize ;
482486 float h = mScaler .getHeight ();
483487 final boolean wasClosed = (mOldHeight == mSmallSize );
484488 if (wasClosed ) {
485- h = (force || h > mSmallSize ) ? mNaturalHeight : mSmallSize ;
489+ targetHeight = (force || currentHeight > mSmallSize ) ? mNaturalHeight : mSmallSize ;
486490 } else {
487- h = (force || h < mNaturalHeight ) ? mSmallSize : mNaturalHeight ;
491+ targetHeight = (force || currentHeight < mNaturalHeight ) ? mSmallSize : mNaturalHeight ;
488492 }
489493 if (mScaleAnimation .isRunning ()) {
490494 mScaleAnimation .cancel ();
491495 }
492- mScaleAnimation .setFloatValues (h );
493- mScaleAnimation .setupStartValues ();
494- mScaleAnimation .start ();
495496 setGlow (0f );
496497 mCallback .setUserExpandedChild (mCurrView , h == mNaturalHeight );
498+ if (targetHeight != currentHeight ) {
499+ mScaleAnimation .setFloatValues (targetHeight );
500+ mScaleAnimation .setupStartValues ();
501+ mScaleAnimation .start ();
502+ }
503+ mCallback .setUserLockedChild (mCurrView , false );
497504 if (DEBUG ) Slog .d (TAG , "scale was finished on view: " + mCurrView );
498505 }
499506
0 commit comments