summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
author Matt Casey <mrcasey@google.com> 2023-04-28 00:59:38 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-04-28 00:59:38 +0000
commitf5c207adda4e8d018598278301b75499d0b45cc7 (patch)
tree03d6f88e4fd2373760fc4716341f60922cc98f9f /java/src
parentf680044e68571da056b823f2078836656a96ac78 (diff)
parentece4f065d291928392c29a012fc5bb150559da09 (diff)
Merge "When showing a single text line in preview, strip out newlines" into udc-dev
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);