kopia lustrzana https://github.com/ryukoposting/Signal-Android
Adjust position of reaction bar.
rodzic
dec1902dc7
commit
5080567ca9
|
@ -260,33 +260,42 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
||||||
reactionBarBackgroundY = reactionBarTopPadding;
|
reactionBarBackgroundY = reactionBarTopPadding;
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
if (everythingFitsVertically) {
|
||||||
float bubbleBottom = selectedConversationModel.getItemY() + selectedConversationModel.getBubbleY() + conversationItemSnapshot.getHeight();
|
float bubbleBottom = selectedConversationModel.getItemY() + selectedConversationModel.getBubbleY() + conversationItemSnapshot.getHeight();
|
||||||
boolean menuFitsBelowItem = bubbleBottom + menuPadding + contextMenu.getMaxHeight() <= overlayHeight + statusBarHeight;
|
boolean menuFitsBelowItem = bubbleBottom + menuPadding + contextMenu.getMaxHeight() <= overlayHeight + statusBarHeight;
|
||||||
|
|
||||||
if (menuFitsBelowItem) {
|
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) {
|
if (reactionBarBackgroundY < reactionBarTopPadding) {
|
||||||
endY = backgroundView.getHeight() + menuPadding + reactionBarTopPadding;
|
endY = backgroundView.getHeight() + menuPadding + reactionBarTopPadding;
|
||||||
reactionBarBackgroundY = reactionBarTopPadding;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
endY = overlayHeight - contextMenu.getMaxHeight() - menuPadding - conversationItemSnapshot.getHeight();
|
endY = overlayHeight - contextMenu.getMaxHeight() - menuPadding - conversationItemSnapshot.getHeight();
|
||||||
reactionBarBackgroundY = endY - menuPadding - reactionBarHeight;
|
|
||||||
|
float contextMenuTop = endY + conversationItemSnapshot.getHeight();
|
||||||
|
reactionBarBackgroundY = getReactionBarOffsetForTouch(lastSeenDownPoint, contextMenuTop, reactionBarOffset, reactionBarHeight, reactionBarTopPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
endApparentTop = endY;
|
endApparentTop = endY;
|
||||||
} else if (reactionBarHeight + contextMenu.getMaxHeight() + menuPadding * 2 < overlayHeight) {
|
} else if (reactionBarOffset + reactionBarHeight + contextMenu.getMaxHeight() + menuPadding < overlayHeight) {
|
||||||
float spaceAvailableForItem = (float) overlayHeight - contextMenu.getMaxHeight() - menuPadding * 2 - reactionBarHeight - reactionBarTopPadding;
|
float spaceAvailableForItem = (float) overlayHeight - contextMenu.getMaxHeight() - menuPadding - spaceForReactionBar;
|
||||||
|
|
||||||
endScale = spaceAvailableForItem / conversationItemSnapshot.getHeight();
|
endScale = spaceAvailableForItem / conversationItemSnapshot.getHeight();
|
||||||
endX += Util.halfOffsetFromScale(conversationItemSnapshot.getWidth(), endScale) * (isMessageOnLeft ? -1 : 1);
|
endX += Util.halfOffsetFromScale(conversationItemSnapshot.getWidth(), endScale) * (isMessageOnLeft ? -1 : 1);
|
||||||
endY = reactionBarHeight - Util.halfOffsetFromScale(conversationItemSnapshot.getHeight(), endScale) + menuPadding + reactionBarTopPadding;
|
endY = spaceForReactionBar - Util.halfOffsetFromScale(conversationItemSnapshot.getHeight(), endScale);
|
||||||
reactionBarBackgroundY = reactionBarTopPadding;
|
|
||||||
endApparentTop = reactionBarHeight + menuPadding + reactionBarTopPadding;
|
float contextMenuTop = endY + (conversationItemSnapshot.getHeight() * endScale);
|
||||||
|
reactionBarBackgroundY = getReactionBarOffsetForTouch(lastSeenDownPoint, contextMenuTop, reactionBarOffset, reactionBarHeight, reactionBarTopPadding);
|
||||||
|
endApparentTop = endY + Util.halfOffsetFromScale(conversationItemSnapshot.getHeight(), endScale);
|
||||||
} else {
|
} else {
|
||||||
contextMenu.setHeight(contextMenu.getMaxHeight() / 2);
|
contextMenu.setHeight(contextMenu.getMaxHeight() / 2);
|
||||||
|
|
||||||
|
@ -368,6 +377,10 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
||||||
.setDuration(revealDuration);
|
.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) {
|
private void updateToolbarShade(@NonNull Activity activity) {
|
||||||
View toolbar = activity.findViewById(R.id.toolbar);
|
View toolbar = activity.findViewById(R.id.toolbar);
|
||||||
View bannerContainer = activity.findViewById(R.id.conversation_banner_container);
|
View bannerContainer = activity.findViewById(R.id.conversation_banner_container);
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<alpha
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:interpolator="@android:interpolator/decelerate_quad"
|
||||||
|
android:fromAlpha="0.0"
|
||||||
|
android:toAlpha="1.0"
|
||||||
|
android:startOffset="150"
|
||||||
|
android:duration="@android:integer/config_shortAnimTime" />
|
|
@ -21,7 +21,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ConversationContextMenuAnimation" parent="@android:style/Animation">
|
<style name="ConversationContextMenuAnimation" parent="@android:style/Animation">
|
||||||
<item name="android:windowEnterAnimation">@anim/fade_in</item>
|
<item name="android:windowEnterAnimation">@anim/delay_fade_in</item>
|
||||||
<item name="android:windowExitAnimation">@anim/shrink_fade_out</item>
|
<item name="android:windowExitAnimation">@anim/shrink_fade_out</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
Ładowanie…
Reference in New Issue