Merge "Set correct bounds when offset and expanded" into rvc-dev
This commit is contained in:
@@ -170,9 +170,9 @@ public class PipAnimationController {
|
|||||||
private final @AnimationType int mAnimationType;
|
private final @AnimationType int mAnimationType;
|
||||||
private final Rect mDestinationBounds = new Rect();
|
private final Rect mDestinationBounds = new Rect();
|
||||||
|
|
||||||
private T mStartValue;
|
protected T mCurrentValue;
|
||||||
|
protected T mStartValue;
|
||||||
private T mEndValue;
|
private T mEndValue;
|
||||||
private T mCurrentValue;
|
|
||||||
private PipAnimationCallback mPipAnimationCallback;
|
private PipAnimationCallback mPipAnimationCallback;
|
||||||
private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory
|
private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory
|
||||||
mSurfaceControlTransactionFactory;
|
mSurfaceControlTransactionFactory;
|
||||||
@@ -288,7 +288,6 @@ public class PipAnimationController {
|
|||||||
*/
|
*/
|
||||||
void updateEndValue(T endValue) {
|
void updateEndValue(T endValue) {
|
||||||
mEndValue = endValue;
|
mEndValue = endValue;
|
||||||
mStartValue = mCurrentValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceControl.Transaction newSurfaceControlTransaction() {
|
SurfaceControl.Transaction newSurfaceControlTransaction() {
|
||||||
@@ -337,6 +336,12 @@ public class PipAnimationController {
|
|||||||
tx.show(leash);
|
tx.show(leash);
|
||||||
tx.apply();
|
tx.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void updateEndValue(Float endValue) {
|
||||||
|
super.updateEndValue(endValue);
|
||||||
|
mStartValue = mCurrentValue;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,6 +397,14 @@ public class PipAnimationController {
|
|||||||
getSurfaceTransactionHelper().resetScale(tx, leash, getDestinationBounds())
|
getSurfaceTransactionHelper().resetScale(tx, leash, getDestinationBounds())
|
||||||
.crop(tx, leash, getDestinationBounds());
|
.crop(tx, leash, getDestinationBounds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void updateEndValue(Rect endValue) {
|
||||||
|
super.updateEndValue(endValue);
|
||||||
|
if (mStartValue != null && mCurrentValue != null) {
|
||||||
|
mStartValue.set(mCurrentValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -431,13 +431,21 @@ public class PipTouchHandler {
|
|||||||
} else {
|
} else {
|
||||||
final float offsetBufferPx = BOTTOM_OFFSET_BUFFER_DP
|
final float offsetBufferPx = BOTTOM_OFFSET_BUFFER_DP
|
||||||
* mContext.getResources().getDisplayMetrics().density;
|
* mContext.getResources().getDisplayMetrics().density;
|
||||||
final Rect toMovementBounds = mMenuState == MENU_STATE_FULL && willResizeMenu()
|
final boolean isExpanded = mMenuState == MENU_STATE_FULL && willResizeMenu();
|
||||||
|
final Rect toMovementBounds = isExpanded
|
||||||
? new Rect(expandedMovementBounds)
|
? new Rect(expandedMovementBounds)
|
||||||
: new Rect(normalMovementBounds);
|
: new Rect(normalMovementBounds);
|
||||||
final int prevBottom = mMovementBounds.bottom - mMovementBoundsExtraOffsets;
|
final int prevBottom = mMovementBounds.bottom - mMovementBoundsExtraOffsets;
|
||||||
final int toBottom = toMovementBounds.bottom < toMovementBounds.top
|
final int toBottom = toMovementBounds.bottom < toMovementBounds.top
|
||||||
? toMovementBounds.bottom
|
? toMovementBounds.bottom
|
||||||
: toMovementBounds.bottom - extraOffset;
|
: toMovementBounds.bottom - extraOffset;
|
||||||
|
|
||||||
|
if (isExpanded) {
|
||||||
|
curBounds.set(mExpandedBounds);
|
||||||
|
mSnapAlgorithm.applySnapFraction(curBounds, toMovementBounds,
|
||||||
|
mSavedSnapFraction);
|
||||||
|
}
|
||||||
|
|
||||||
if ((Math.min(prevBottom, toBottom) - offsetBufferPx) <= curBounds.top
|
if ((Math.min(prevBottom, toBottom) - offsetBufferPx) <= curBounds.top
|
||||||
&& curBounds.top <= (Math.max(prevBottom, toBottom) + offsetBufferPx)) {
|
&& curBounds.top <= (Math.max(prevBottom, toBottom) + offsetBufferPx)) {
|
||||||
mMotionHelper.animateToOffset(curBounds, toBottom - curBounds.top);
|
mMotionHelper.animateToOffset(curBounds, toBottom - curBounds.top);
|
||||||
|
|||||||
Reference in New Issue
Block a user