kopia lustrzana https://github.com/ryukoposting/Signal-Android
Remove unneeded code for redraw.
rodzic
1af15842cc
commit
cf9b91ebd4
|
@ -303,8 +303,7 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||||
conversationMessage.getMessageRecord(),
|
conversationMessage.getMessageRecord(),
|
||||||
messageRequestViewModel.shouldShowMessageRequest(),
|
messageRequestViewModel.shouldShowMessageRequest(),
|
||||||
groupViewModel.isNonAdminInAnnouncementGroup()),
|
groupViewModel.isNonAdminInAnnouncementGroup()),
|
||||||
this::handleReplyMessage,
|
this::handleReplyMessage
|
||||||
this::onViewHolderPositionTranslated
|
|
||||||
).attachToRecyclerView(list);
|
).attachToRecyclerView(list);
|
||||||
|
|
||||||
giphyMp4ProjectionRecycler = initializeGiphyMp4();
|
giphyMp4ProjectionRecycler = initializeGiphyMp4();
|
||||||
|
@ -499,12 +498,6 @@ public class ConversationFragment extends LoggingFragment implements Multiselect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onViewHolderPositionTranslated(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
|
||||||
if (viewHolder instanceof GiphyMp4Playable) {
|
|
||||||
giphyMp4ProjectionRecycler.updateVideoDisplayPositionAndSize(recyclerView, (GiphyMp4Playable) viewHolder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getStartPosition() {
|
private int getStartPosition() {
|
||||||
return conversationViewModel.getArgs().getStartingPosition();
|
return conversationViewModel.getArgs().getStartingPosition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,17 +30,14 @@ public class ConversationItemSwipeCallback extends ItemTouchHelper.SimpleCallbac
|
||||||
private final SwipeAvailabilityProvider swipeAvailabilityProvider;
|
private final SwipeAvailabilityProvider swipeAvailabilityProvider;
|
||||||
private final ConversationItemTouchListener itemTouchListener;
|
private final ConversationItemTouchListener itemTouchListener;
|
||||||
private final OnSwipeListener onSwipeListener;
|
private final OnSwipeListener onSwipeListener;
|
||||||
private final OnViewHolderTranslated onViewHolderTranslated;
|
|
||||||
|
|
||||||
ConversationItemSwipeCallback(@NonNull SwipeAvailabilityProvider swipeAvailabilityProvider,
|
ConversationItemSwipeCallback(@NonNull SwipeAvailabilityProvider swipeAvailabilityProvider,
|
||||||
@NonNull OnSwipeListener onSwipeListener,
|
@NonNull OnSwipeListener onSwipeListener)
|
||||||
@NonNull OnViewHolderTranslated onViewHolderTranslated)
|
|
||||||
{
|
{
|
||||||
super(0, ItemTouchHelper.END);
|
super(0, ItemTouchHelper.END);
|
||||||
this.itemTouchListener = new ConversationItemTouchListener(this::updateLatestDownCoordinate);
|
this.itemTouchListener = new ConversationItemTouchListener(this::updateLatestDownCoordinate);
|
||||||
this.swipeAvailabilityProvider = swipeAvailabilityProvider;
|
this.swipeAvailabilityProvider = swipeAvailabilityProvider;
|
||||||
this.onSwipeListener = onSwipeListener;
|
this.onSwipeListener = onSwipeListener;
|
||||||
this.onViewHolderTranslated = onViewHolderTranslated;
|
|
||||||
this.shouldTriggerSwipeFeedback = true;
|
this.shouldTriggerSwipeFeedback = true;
|
||||||
this.canTriggerSwipe = true;
|
this.canTriggerSwipe = true;
|
||||||
}
|
}
|
||||||
|
@ -93,14 +90,14 @@ public class ConversationItemSwipeCallback extends ItemTouchHelper.SimpleCallbac
|
||||||
|
|
||||||
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE && isCorrectSwipeDir) {
|
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE && isCorrectSwipeDir) {
|
||||||
ConversationSwipeAnimationHelper.update((ConversationItem) viewHolder.itemView, Math.abs(dx), sign);
|
ConversationSwipeAnimationHelper.update((ConversationItem) viewHolder.itemView, Math.abs(dx), sign);
|
||||||
dispatchTranslationUpdate(recyclerView, viewHolder);
|
recyclerView.invalidate();
|
||||||
handleSwipeFeedback((ConversationItem) viewHolder.itemView, Math.abs(dx));
|
handleSwipeFeedback((ConversationItem) viewHolder.itemView, Math.abs(dx));
|
||||||
if (canTriggerSwipe) {
|
if (canTriggerSwipe) {
|
||||||
setTouchListener(recyclerView, viewHolder, Math.abs(dx));
|
setTouchListener(recyclerView, viewHolder, Math.abs(dx));
|
||||||
}
|
}
|
||||||
} else if (actionState == ItemTouchHelper.ACTION_STATE_IDLE || dx == 0) {
|
} else if (actionState == ItemTouchHelper.ACTION_STATE_IDLE || dx == 0) {
|
||||||
ConversationSwipeAnimationHelper.update((ConversationItem) viewHolder.itemView, 0, 1);
|
ConversationSwipeAnimationHelper.update((ConversationItem) viewHolder.itemView, 0, 1);
|
||||||
dispatchTranslationUpdate(recyclerView, viewHolder);
|
recyclerView.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dx == 0) {
|
if (dx == 0) {
|
||||||
|
@ -109,10 +106,6 @@ public class ConversationItemSwipeCallback extends ItemTouchHelper.SimpleCallbac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispatchTranslationUpdate(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
|
||||||
onViewHolderTranslated.onViewHolderTranslated(recyclerView, viewHolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleSwipeFeedback(@NonNull ConversationItem item, float dx) {
|
private void handleSwipeFeedback(@NonNull ConversationItem item, float dx) {
|
||||||
if (dx > SWIPE_SUCCESS_DX && shouldTriggerSwipeFeedback) {
|
if (dx > SWIPE_SUCCESS_DX && shouldTriggerSwipeFeedback) {
|
||||||
vibrate(item.getContext());
|
vibrate(item.getContext());
|
||||||
|
@ -172,7 +165,7 @@ public class ConversationItemSwipeCallback extends ItemTouchHelper.SimpleCallbac
|
||||||
ConversationSwipeAnimationHelper.update((ConversationItem) viewHolder.itemView,
|
ConversationSwipeAnimationHelper.update((ConversationItem) viewHolder.itemView,
|
||||||
0f,
|
0f,
|
||||||
getSignFromDirection(viewHolder.itemView));
|
getSignFromDirection(viewHolder.itemView));
|
||||||
dispatchTranslationUpdate(recyclerView, viewHolder);
|
recyclerView.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue