diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationReactionOverlay.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationReactionOverlay.java
index e41a5913d..e637ecd74 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationReactionOverlay.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationReactionOverlay.java
@@ -260,33 +260,42 @@ public final class ConversationReactionOverlay extends FrameLayout {
reactionBarBackgroundY = reactionBarTopPadding;
}
} else {
- boolean everythingFitsVertically = contextMenu.getMaxHeight() + conversationItemSnapshot.getHeight() + menuPadding + reactionBarHeight + reactionBarTopPadding < overlayHeight;
+ float reactionBarOffset = DimensionUnit.DP.toPixels(48);
+ float spaceForReactionBar = Math.max(reactionBarHeight + reactionBarOffset - conversationItemSnapshot.getHeight(), 0);
+ boolean everythingFitsVertically = contextMenu.getMaxHeight() + conversationItemSnapshot.getHeight() + menuPadding + spaceForReactionBar < overlayHeight;
if (everythingFitsVertically) {
float bubbleBottom = selectedConversationModel.getItemY() + selectedConversationModel.getBubbleY() + conversationItemSnapshot.getHeight();
boolean menuFitsBelowItem = bubbleBottom + menuPadding + contextMenu.getMaxHeight() <= overlayHeight + statusBarHeight;
if (menuFitsBelowItem) {
- reactionBarBackgroundY = conversationItem.getY() - menuPadding - reactionBarHeight;
+ if (conversationItem.getY() < 0) {
+ endY = 0;
+ }
+ float contextMenuTop = endY + conversationItemSnapshot.getHeight();
+ reactionBarBackgroundY = getReactionBarOffsetForTouch(lastSeenDownPoint, contextMenuTop, reactionBarOffset, reactionBarHeight, reactionBarTopPadding);
if (reactionBarBackgroundY < reactionBarTopPadding) {
- endY = backgroundView.getHeight() + menuPadding + reactionBarTopPadding;
- reactionBarBackgroundY = reactionBarTopPadding;
+ endY = backgroundView.getHeight() + menuPadding + reactionBarTopPadding;
}
} else {
- endY = overlayHeight - contextMenu.getMaxHeight() - menuPadding - conversationItemSnapshot.getHeight();
- reactionBarBackgroundY = endY - menuPadding - reactionBarHeight;
+ endY = overlayHeight - contextMenu.getMaxHeight() - menuPadding - conversationItemSnapshot.getHeight();
+
+ float contextMenuTop = endY + conversationItemSnapshot.getHeight();
+ reactionBarBackgroundY = getReactionBarOffsetForTouch(lastSeenDownPoint, contextMenuTop, reactionBarOffset, reactionBarHeight, reactionBarTopPadding);
}
endApparentTop = endY;
- } else if (reactionBarHeight + contextMenu.getMaxHeight() + menuPadding * 2 < overlayHeight) {
- float spaceAvailableForItem = (float) overlayHeight - contextMenu.getMaxHeight() - menuPadding * 2 - reactionBarHeight - reactionBarTopPadding;
+ } else if (reactionBarOffset + reactionBarHeight + contextMenu.getMaxHeight() + menuPadding < overlayHeight) {
+ float spaceAvailableForItem = (float) overlayHeight - contextMenu.getMaxHeight() - menuPadding - spaceForReactionBar;
- endScale = spaceAvailableForItem / conversationItemSnapshot.getHeight();
- endX += Util.halfOffsetFromScale(conversationItemSnapshot.getWidth(), endScale) * (isMessageOnLeft ? -1 : 1);
- endY = reactionBarHeight - Util.halfOffsetFromScale(conversationItemSnapshot.getHeight(), endScale) + menuPadding + reactionBarTopPadding;
- reactionBarBackgroundY = reactionBarTopPadding;
- endApparentTop = reactionBarHeight + menuPadding + reactionBarTopPadding;
+ endScale = spaceAvailableForItem / conversationItemSnapshot.getHeight();
+ endX += Util.halfOffsetFromScale(conversationItemSnapshot.getWidth(), endScale) * (isMessageOnLeft ? -1 : 1);
+ endY = spaceForReactionBar - Util.halfOffsetFromScale(conversationItemSnapshot.getHeight(), endScale);
+
+ float contextMenuTop = endY + (conversationItemSnapshot.getHeight() * endScale);
+ reactionBarBackgroundY = getReactionBarOffsetForTouch(lastSeenDownPoint, contextMenuTop, reactionBarOffset, reactionBarHeight, reactionBarTopPadding);
+ endApparentTop = endY + Util.halfOffsetFromScale(conversationItemSnapshot.getHeight(), endScale);
} else {
contextMenu.setHeight(contextMenu.getMaxHeight() / 2);
@@ -368,6 +377,10 @@ public final class ConversationReactionOverlay extends FrameLayout {
.setDuration(revealDuration);
}
+ private float getReactionBarOffsetForTouch(@NonNull PointF lastSeenDownPoint, float contextMenuTop, float reactionBarOffset, int reactionBarHeight, float reactionBarTopPadding) {
+ return Math.max(Math.min(lastSeenDownPoint.y - statusBarHeight, contextMenuTop) - reactionBarOffset - reactionBarHeight, reactionBarTopPadding);
+ }
+
private void updateToolbarShade(@NonNull Activity activity) {
View toolbar = activity.findViewById(R.id.toolbar);
View bannerContainer = activity.findViewById(R.id.conversation_banner_container);
diff --git a/app/src/main/res/anim/delay_fade_in.xml b/app/src/main/res/anim/delay_fade_in.xml
new file mode 100644
index 000000000..b8e737fa4
--- /dev/null
+++ b/app/src/main/res/anim/delay_fade_in.xml
@@ -0,0 +1,7 @@
+
diff --git a/app/src/main/res/values/animations.xml b/app/src/main/res/values/animations.xml
index d756fcdcf..ddc54783a 100644
--- a/app/src/main/res/values/animations.xml
+++ b/app/src/main/res/values/animations.xml
@@ -21,7 +21,7 @@
\ No newline at end of file