Messaging: allow selecting text inside the selected message am: 78ecab8743

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Messaging/+/1754232

Change-Id: Ibaefc53a73ce8d28633fce26715c01616c3297a2
This commit is contained in:
Timi Rautamäki
2021-09-24 16:17:53 +00:00
committed by Automerger Merge Worker
@@ -708,6 +708,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
textBottomPadding = textBottomPaddingDefault; textBottomPadding = textBottomPaddingDefault;
textLeftPadding = messageTextLeftRightPadding; textLeftPadding = messageTextLeftRightPadding;
textRightPadding = messageTextLeftRightPadding; textRightPadding = messageTextLeftRightPadding;
mMessageTextView.setTextIsSelectable(isSelected());
} else { } else {
// Attachment(s) only // Attachment(s) only
contentLeftPadding = incoming ? arrowWidth : 0; contentLeftPadding = incoming ? arrowWidth : 0;
@@ -733,6 +734,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
textTopMargin = 0; textTopMargin = 0;
textTopPadding = textTopPaddingDefault; textTopPadding = textTopPaddingDefault;
textBottomPadding = textBottomPaddingDefault; textBottomPadding = textBottomPaddingDefault;
mMessageTextView.setTextIsSelectable(isSelected());
if (showArrow && incoming) { if (showArrow && incoming) {
textLeftPadding = messageTextLeftRightPadding + arrowWidth; textLeftPadding = messageTextLeftRightPadding + arrowWidth;
} else { } else {
@@ -1030,6 +1032,11 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
@Override @Override
public boolean onLongClick(final View view) { public boolean onLongClick(final View view) {
if (view == mMessageTextView) { if (view == mMessageTextView) {
// Avoid trying to reselect the message
if (isSelected()) {
return false;
}
// Preemptively handle the long click event on message text so it's not handled by // Preemptively handle the long click event on message text so it's not handled by
// the link spans. // the link spans.
return performLongClick(); return performLongClick();
@@ -1195,7 +1202,7 @@ public class ConversationMessageView extends FrameLayout implements View.OnClick
// This touch event is a long click, preemptively handle this touch event so that // This touch event is a long click, preemptively handle this touch event so that
// the link span won't get a onClicked() callback. // the link span won't get a onClicked() callback.
mIsLongClick = false; mIsLongClick = false;
return true; return false;
} }
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {