Merge "Fixed the transformation for MessagingStyle" into qt-dev am: 6ce6892440

am: b9a5b1ceef

Change-Id: I67a488f2854738399b1cfd64a981028eaa1d1079
This commit is contained in:
Selim Cinek
2019-05-06 19:28:54 -07:00
committed by android-build-merger

View File

@@ -97,7 +97,6 @@ public class MessagingLayoutTransformState extends TransformState {
HashMap<MessagingGroup, MessagingGroup> pairs = findPairs(ownGroups, otherGroups);
MessagingGroup lastPairedGroup = null;
float currentTranslation = 0;
float transformationDistanceRemaining = 0;
for (int i = ownGroups.size() - 1; i >= 0; i--) {
MessagingGroup ownGroup = ownGroups.get(i);
MessagingGroup matchingGroup = pairs.get(ownGroup);
@@ -108,13 +107,10 @@ public class MessagingLayoutTransformState extends TransformState {
lastPairedGroup = ownGroup;
if (to){
float totalTranslation = ownGroup.getTop() - matchingGroup.getTop();
transformationDistanceRemaining
= matchingGroup.getAvatar().getTranslationY();
currentTranslation = transformationDistanceRemaining - totalTranslation;
currentTranslation = matchingGroup.getAvatar().getTranslationY()
- totalTranslation;
} else {
float totalTranslation = matchingGroup.getTop() - ownGroup.getTop();
currentTranslation = ownGroup.getAvatar().getTranslationY();
transformationDistanceRemaining = currentTranslation - totalTranslation;
}
}
} else {
@@ -122,14 +118,20 @@ public class MessagingLayoutTransformState extends TransformState {
if (lastPairedGroup != null) {
adaptGroupAppear(ownGroup, transformationAmount, currentTranslation,
to);
int distance = lastPairedGroup.getTop() - ownGroup.getTop();
float transformationDistance = mTransformInfo.isAnimating()
? distance
: ownGroup.getHeight() * 0.75f;
float translationProgress = transformationDistanceRemaining
- (distance - transformationDistance);
groupTransformationAmount =
translationProgress / transformationDistance;
float newPosition = ownGroup.getTop() + currentTranslation;
if (!mTransformInfo.isAnimating()) {
// We fade the group away as soon as 1/2 of it is translated away on top
float fadeStart = -ownGroup.getHeight() * 0.5f;
groupTransformationAmount = (newPosition - fadeStart)
/ Math.abs(fadeStart);
} else {
float fadeStart = -ownGroup.getHeight() * 0.75f;
// We want to fade out as soon as the animation starts, let's add the
// complete top in addition
groupTransformationAmount = (newPosition - fadeStart)
/ (Math.abs(fadeStart) + ownGroup.getTop());
}
groupTransformationAmount = Math.max(0.0f, Math.min(1.0f,
groupTransformationAmount));
if (to) {
@@ -175,7 +177,8 @@ public class MessagingLayoutTransformState extends TransformState {
relativeOffset *= 0.5f;
}
ownGroup.getMessageContainer().setTranslationY(relativeOffset);
ownGroup.setTranslationY(overallTranslation * 0.85f);
ownGroup.getSenderView().setTranslationY(relativeOffset);
ownGroup.setTranslationY(overallTranslation * 0.9f);
}
private void disappear(MessagingGroup ownGroup, float transformationAmount) {
@@ -256,6 +259,9 @@ public class MessagingLayoutTransformState extends TransformState {
float distanceToTop = child.getTop() + child.getHeight() + previousTranslation;
transformationAmount = distanceToTop / child.getHeight();
transformationAmount = Math.max(0.0f, Math.min(1.0f, transformationAmount));
if (to) {
transformationAmount = 1.0f - transformationAmount;
}
}
transformView(transformationAmount, to, child, otherChild, false, /* sameAsAny */
useLinearTransformation);
@@ -400,6 +406,7 @@ public class MessagingLayoutTransformState extends TransformState {
setClippingDeactivated(ownGroup.getSenderView(), false);
ownGroup.setTranslationY(0);
ownGroup.getMessageContainer().setTranslationY(0);
ownGroup.getSenderView().setTranslationY(0);
}
ownGroup.setTransformingImages(false);
ownGroup.updateClipRect();