kopia lustrzana https://github.com/ryukoposting/Signal-Android
Improve UI for context menu in chat.
rodzic
9f474fadf4
commit
959bbdae6c
|
@ -399,7 +399,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
|||
|
||||
GiphyMp4PlaybackController.attach(list, callback, maxPlayback);
|
||||
list.addItemDecoration(new GiphyMp4ItemDecoration(callback, translationY -> {
|
||||
reactionsShade.setTranslationY(translationY);
|
||||
reactionsShade.setTranslationY(translationY + list.getHeight());
|
||||
return Unit.INSTANCE;
|
||||
}), 0);
|
||||
|
||||
|
@ -899,7 +899,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
|||
}
|
||||
|
||||
inlineDateDecoration = new StickyHeaderDecoration(adapter, false, false, ConversationAdapter.HEADER_TYPE_INLINE_DATE);
|
||||
list.addItemDecoration(inlineDateDecoration);
|
||||
list.addItemDecoration(inlineDateDecoration, 0);
|
||||
}
|
||||
|
||||
public void setLastSeen(long lastSeen) {
|
||||
|
@ -1446,17 +1446,18 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
|||
Bitmap videoBitmap = null;
|
||||
int childAdapterPosition = list.getChildAdapterPosition(itemView);
|
||||
|
||||
final GiphyMp4ProjectionPlayerHolder mp4Holder;
|
||||
GiphyMp4ProjectionPlayerHolder mp4Holder = null;
|
||||
if (childAdapterPosition != RecyclerView.NO_POSITION) {
|
||||
mp4Holder = giphyMp4ProjectionRecycler.getCurrentHolder(childAdapterPosition);
|
||||
if (mp4Holder != null) {
|
||||
if (mp4Holder != null && mp4Holder.isVisible()) {
|
||||
mp4Holder.pause();
|
||||
videoBitmap = mp4Holder.getBitmap();
|
||||
mp4Holder.hide();
|
||||
} else {
|
||||
mp4Holder = null;
|
||||
}
|
||||
} else {
|
||||
mp4Holder = null;
|
||||
}
|
||||
final GiphyMp4ProjectionPlayerHolder finalMp4Holder = mp4Holder;
|
||||
|
||||
ConversationItem conversationItem = (ConversationItem) itemView;
|
||||
Bitmap bitmap = ConversationItemSelection.snapshotView(conversationItem, list, messageRecord, videoBitmap);
|
||||
|
@ -1478,16 +1479,21 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
|||
|
||||
ViewUtil.hideKeyboard(requireContext(), conversationItem);
|
||||
|
||||
boolean showScrollButtons = conversationViewModel.getShowScrollButtons();
|
||||
if (showScrollButtons) {
|
||||
conversationViewModel.setShowScrollButtons(false);
|
||||
}
|
||||
|
||||
listener.handleReaction(item.getConversationMessage(),
|
||||
new ReactionsToolbarListener(item.getConversationMessage()),
|
||||
selectedConversationModel,
|
||||
new ConversationReactionOverlay.OnHideListener() {
|
||||
@Override public void startHide() {
|
||||
multiselectItemDecoration.hideShade(list);
|
||||
ViewUtil.fadeOut(reactionsShade, getResources().getInteger(R.integer.reaction_scrubber_hide_duration), View.GONE);
|
||||
}
|
||||
|
||||
@Override public void onHide() {
|
||||
reactionsShade.setVisibility(View.GONE);
|
||||
list.setLayoutFrozen(false);
|
||||
|
||||
if (selectedConversationModel.getAudioUri() != null) {
|
||||
|
@ -1498,12 +1504,16 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
|||
WindowUtil.setLightNavigationBarFromTheme(requireActivity());
|
||||
clearFocusedItem();
|
||||
|
||||
if (mp4Holder != null) {
|
||||
mp4Holder.show();
|
||||
mp4Holder.resume();
|
||||
if (finalMp4Holder != null) {
|
||||
finalMp4Holder.show();
|
||||
finalMp4Holder.resume();
|
||||
}
|
||||
|
||||
bodyBubble.setVisibility(View.VISIBLE);
|
||||
|
||||
if (showScrollButtons) {
|
||||
conversationViewModel.setShowScrollButtons(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -212,21 +212,12 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
|||
});
|
||||
}
|
||||
|
||||
private int getInputPanelHeight(@NonNull Activity activity) {
|
||||
View bottomPanel = activity.findViewById(R.id.conversation_activity_panel_parent);
|
||||
View emojiDrawer = activity.findViewById(R.id.emoji_drawer);
|
||||
|
||||
return bottomPanel.getHeight() + (emojiDrawer != null && emojiDrawer.getVisibility() == VISIBLE ? emojiDrawer.getHeight() : 0);
|
||||
}
|
||||
|
||||
private void showAfterLayout(@NonNull Activity activity,
|
||||
@NonNull ConversationMessage conversationMessage,
|
||||
@NonNull PointF lastSeenDownPoint,
|
||||
boolean isMessageOnLeft) {
|
||||
LayoutParams layoutParams = (LayoutParams) inputShade.getLayoutParams();
|
||||
layoutParams.bottomMargin = bottomNavigationBarHeight;
|
||||
layoutParams.height = getInputPanelHeight(activity);
|
||||
inputShade.setLayoutParams(layoutParams);
|
||||
updateToolbarShade(activity);
|
||||
updateInputShade(activity);
|
||||
|
||||
contextMenu = new ConversationContextMenu(dropdownAnchor, getMenuActionItems(conversationMessage));
|
||||
|
||||
|
@ -379,6 +370,29 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
|||
.setDuration(revealDuration);
|
||||
}
|
||||
|
||||
private void updateToolbarShade(@NonNull Activity activity) {
|
||||
View toolbar = activity.findViewById(R.id.toolbar);
|
||||
View bannerContainer = activity.findViewById(R.id.conversation_banner_container);
|
||||
|
||||
LayoutParams layoutParams = (LayoutParams) toolbarShade.getLayoutParams();
|
||||
layoutParams.height = toolbar.getHeight() + bannerContainer.getHeight();
|
||||
toolbarShade.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
private void updateInputShade(@NonNull Activity activity) {
|
||||
LayoutParams layoutParams = (LayoutParams) inputShade.getLayoutParams();
|
||||
layoutParams.bottomMargin = bottomNavigationBarHeight;
|
||||
layoutParams.height = getInputPanelHeight(activity);
|
||||
inputShade.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
private int getInputPanelHeight(@NonNull Activity activity) {
|
||||
View bottomPanel = activity.findViewById(R.id.conversation_activity_panel_parent);
|
||||
View emojiDrawer = activity.findViewById(R.id.emoji_drawer);
|
||||
|
||||
return bottomPanel.getHeight() + (emojiDrawer != null && emojiDrawer.getVisibility() == VISIBLE ? emojiDrawer.getHeight() : 0);
|
||||
}
|
||||
|
||||
@RequiresApi(api = 21)
|
||||
private void updateSystemUiOnShow(@NonNull Activity activity) {
|
||||
Window window = activity.getWindow();
|
||||
|
@ -489,10 +503,6 @@ public final class ConversationReactionOverlay extends FrameLayout {
|
|||
toolbarShade.setVisibility(INVISIBLE);
|
||||
inputShade.setVisibility(INVISIBLE);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21 && activity != null) {
|
||||
activity = null;
|
||||
}
|
||||
|
||||
if (onHideListener != null) {
|
||||
onHideListener.onHide();
|
||||
}
|
||||
|
|
|
@ -286,6 +286,10 @@ public class ConversationViewModel extends ViewModel {
|
|||
this.hasUnreadMentions.setValue(hasUnreadMentions);
|
||||
}
|
||||
|
||||
boolean getShowScrollButtons() {
|
||||
return this.showScrollButtons.getValue();
|
||||
}
|
||||
|
||||
void setShowScrollButtons(boolean showScrollButtons) {
|
||||
this.showScrollButtons.setValue(showScrollButtons);
|
||||
}
|
||||
|
|
|
@ -99,6 +99,10 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener, De
|
|||
container.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return container.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
player.pause();
|
||||
}
|
||||
|
|
|
@ -33,9 +33,7 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="@color/reactions_screen_light_shade_color"
|
||||
android:foreground="@color/reactions_screen_dark_shade_color"
|
||||
android:visibility="gone"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintTop_toBottomOf="@android:id/list" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/scroll_date_header"
|
||||
|
|
Ładowanie…
Reference in New Issue