@r10s' review

This commit is contained in:
Hocuri
2020-10-22 15:30:12 +02:00
parent 1c1300cdff
commit e40bbf69f6
2 changed files with 8 additions and 15 deletions
@@ -101,7 +101,7 @@ public class ConversationItem extends LinearLayout
private GlideRequests glideRequests;
protected ViewGroup bodyBubble;
protected View reply;
protected View replyView;
@Nullable private QuoteView quoteView;
private TextView bodyText;
private ConversationItemFooter footer;
@@ -162,7 +162,7 @@ public class ConversationItem extends LinearLayout
this.groupSenderHolder = findViewById(R.id.group_sender_holder);
this.quoteView = findViewById(R.id.quote_view);
this.container = findViewById(R.id.container);
this.reply = findViewById(R.id.reply_icon);
this.replyView = findViewById(R.id.reply_icon);
setOnClickListener(new ClickListener(null));
@@ -215,17 +215,10 @@ public class ConversationItem extends LinearLayout
}
public boolean disallowSwipe(float downX, float downY) {
if (BuildConfig.DEBUG) {
// If it is possible to reply to a message, it should also be possible to swipe it.
// For this to be possible we need a non-null reply icon.
boolean replyNull = (reply == null);
boolean canReply = ConversationFragment.canReplyToMsg(messageRecord);
if (replyNull == canReply) {
String msg = "(reply == null) was " + replyNull + " but canReplyToMsg() was " + canReply;
throw new AssertionError(msg);
}
}
if (reply == null) return true;
// If it is possible to reply to a message, it should also be possible to swipe it.
// For this to be possible we need a non-null reply icon.
// This means that `replyView != null` must always be the same as ConversationFragment.canReplyToMsg(messageRecord).
if (replyView == null) return true;
if (!dcChat.canSend()) return true;
if (!hasAudio(messageRecord)) return false;
@@ -33,12 +33,12 @@ final class ConversationSwipeAnimationHelper {
float progress = dx / TRIGGER_DX;
updateBodyBubbleTransition(conversationItem.bodyBubble, dx, sign);
updateReplyIconTransition(conversationItem.reply, dx, progress, sign);
updateReplyIconTransition(conversationItem.replyView, dx, progress, sign);
updateContactPhotoHolderTransition(conversationItem.contactPhotoHolder, progress, sign);
}
public static void trigger(@NonNull ConversationItem conversationItem) {
triggerReplyIcon(conversationItem.reply);
triggerReplyIcon(conversationItem.replyView);
}
private static void updateBodyBubbleTransition(@NonNull View bodyBubble, float dx, float sign) {