summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
author 1 <mrcasey@google.com> 2023-04-27 18:47:01 +0000
committer 1 <mrcasey@google.com> 2023-04-27 18:47:01 +0000
commitece4f065d291928392c29a012fc5bb150559da09 (patch)
treee25b3794464e5d991e4344d722aac892e209a6f5 /java/src
parentb2494b73cfb4802e694fa45a088334b628b85837 (diff)
When showing a single text line in preview, strip out newlines
Bug: 279939310 Test: Manual test with a multiline input in portrait and landscape. Change-Id: If271934fdb9ba1bf4a531c5498c901dd839e625f
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/intentresolver/contentpreview/TextContentPreviewUi.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/java/src/com/android/intentresolver/contentpreview/TextContentPreviewUi.java b/java/src/com/android/intentresolver/contentpreview/TextContentPreviewUi.java
index 3f662ce3..ccf5061d 100644
--- a/java/src/com/android/intentresolver/contentpreview/TextContentPreviewUi.java
+++ b/java/src/com/android/intentresolver/contentpreview/TextContentPreviewUi.java
@@ -96,7 +96,13 @@ class TextContentPreviewUi extends ContentPreviewUi {
TextView textView = contentPreviewLayout.findViewById(
com.android.internal.R.id.content_preview_text);
- textView.setText(mSharingText);
+ String text = mSharingText.toString();
+
+ // If we're only previewing one line, then strip out newlines.
+ if (textView.getMaxLines() == 1) {
+ text = text.replace("\n", " ");
+ }
+ textView.setText(text);
TextView previewTitleView = contentPreviewLayout.findViewById(
com.android.internal.R.id.content_preview_title);