Move text to new line in big base style
This was only used when progress was shown, did not exist for headerless, and was then hidden for all styles; this just left the big base template, where it needed more room. Now we just only set the text with progress when using that template. Note: The line1 container is used for margin adjustments, so removing it is non-trivial; I'll do that in a followup CL. Bug: 181048615 Test: visual inspection Change-Id: I465f7be95249b90ae8906b2bc951c9ff6066550a
This commit is contained in:
@@ -92,7 +92,6 @@ import android.util.proto.ProtoOutputStream;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.contentcapture.ContentCaptureContext;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RemoteViews;
|
||||
@@ -4970,8 +4969,6 @@ public class Notification implements Parcelable
|
||||
contentView.setTextViewText(R.id.title, null);
|
||||
contentView.setViewVisibility(R.id.text, View.GONE);
|
||||
contentView.setTextViewText(R.id.text, null);
|
||||
contentView.setViewVisibility(R.id.text_line_1, View.GONE);
|
||||
contentView.setTextViewText(R.id.text_line_1, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5001,6 +4998,7 @@ public class Notification implements Parcelable
|
||||
TemplateBindResult result) {
|
||||
p.headerless(resId == getBaseLayoutResource()
|
||||
|| resId == getHeadsUpBaseLayoutResource());
|
||||
p.allowTextWithProgress(resId == getBigBaseLayoutResource());
|
||||
RemoteViews contentView = new BuilderRemoteViews(mContext.getApplicationInfo(), resId);
|
||||
|
||||
resetStandardTemplate(contentView);
|
||||
@@ -5015,14 +5013,10 @@ public class Notification implements Parcelable
|
||||
contentView.setViewVisibility(R.id.title, View.VISIBLE);
|
||||
contentView.setTextViewText(R.id.title, processTextSpans(p.title));
|
||||
setTextViewColorPrimary(contentView, R.id.title, p);
|
||||
contentView.setViewLayoutWidth(R.id.title, showProgress
|
||||
? ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
: ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
TypedValue.COMPLEX_UNIT_PX);
|
||||
}
|
||||
if (p.text != null && p.text.length() != 0) {
|
||||
int textId = showProgress ? com.android.internal.R.id.text_line_1
|
||||
: com.android.internal.R.id.text;
|
||||
if (p.text != null && p.text.length() != 0
|
||||
&& (!showProgress || p.mAllowTextWithProgress)) {
|
||||
int textId = com.android.internal.R.id.text;
|
||||
contentView.setTextViewText(textId, processTextSpans(p.text));
|
||||
setTextViewColorSecondary(contentView, textId, p);
|
||||
contentView.setViewVisibility(textId, View.VISIBLE);
|
||||
@@ -5746,7 +5740,6 @@ public class Notification implements Parcelable
|
||||
}
|
||||
if (mStyle != null) {
|
||||
result = mStyle.makeBigContentView();
|
||||
hideLine1Text(result);
|
||||
if (fullyCustomViewRequiresDecoration(true /* fromStyle */)) {
|
||||
result = minimallyDecoratedBigContentView(result);
|
||||
}
|
||||
@@ -5829,12 +5822,6 @@ public class Notification implements Parcelable
|
||||
return createContentView();
|
||||
}
|
||||
|
||||
private void hideLine1Text(RemoteViews result) {
|
||||
if (result != null) {
|
||||
result.setViewVisibility(R.id.text_line_1, View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adapt the Notification header if this view is used as an expanded view.
|
||||
*
|
||||
@@ -12070,6 +12057,7 @@ public class Notification implements Parcelable
|
||||
boolean mHideSnoozeButton;
|
||||
boolean mPromotePicture;
|
||||
boolean mAllowActionIcons;
|
||||
boolean mAllowTextWithProgress;
|
||||
CharSequence title;
|
||||
CharSequence text;
|
||||
CharSequence headerTextSecondary;
|
||||
@@ -12088,6 +12076,7 @@ public class Notification implements Parcelable
|
||||
mHideSnoozeButton = false;
|
||||
mPromotePicture = false;
|
||||
mAllowActionIcons = false;
|
||||
mAllowTextWithProgress = false;
|
||||
title = null;
|
||||
text = null;
|
||||
summaryText = null;
|
||||
@@ -12132,6 +12121,11 @@ public class Notification implements Parcelable
|
||||
return this;
|
||||
}
|
||||
|
||||
final StandardTemplateParams allowTextWithProgress(boolean allowTextWithProgress) {
|
||||
this.mAllowTextWithProgress = allowTextWithProgress;
|
||||
return this;
|
||||
}
|
||||
|
||||
final StandardTemplateParams hideSnoozeButton(boolean hideSnoozeButton) {
|
||||
this.mHideSnoozeButton = hideSnoozeButton;
|
||||
return this;
|
||||
|
||||
@@ -59,32 +59,21 @@
|
||||
<!--<include layout="@layout/notification_template_part_line1"/>-->
|
||||
<!--<include layout="@layout/notification_template_text"/>-->
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView android:id="@+id/title"
|
||||
android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:textAlignment="viewStart"
|
||||
/>
|
||||
<TextView android:id="@+id/text_line_1"
|
||||
style="@style/Widget.DeviceDefault.Notification.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end|bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<com.android.internal.widget.ImageFloatingTextView
|
||||
style="@style/Widget.DeviceDefault.Notification.Text"
|
||||
|
||||
@@ -63,32 +63,21 @@
|
||||
<!--<include layout="@layout/notification_template_part_line1"/>-->
|
||||
<!--<include layout="@layout/notification_template_text"/>-->
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView android:id="@+id/title"
|
||||
android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.Title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:textAlignment="viewStart"
|
||||
/>
|
||||
<TextView android:id="@+id/text_line_1"
|
||||
style="@style/Widget.DeviceDefault.Notification.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end|bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<com.android.internal.widget.ImageFloatingTextView
|
||||
style="@style/Widget.DeviceDefault.Notification.Text"
|
||||
|
||||
@@ -15,29 +15,18 @@
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<TextView android:id="@+id/title"
|
||||
android:textAppearance="@style/TextAppearance.DeviceDefault.Notification.BigTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
android:textAlignment="viewStart"
|
||||
/>
|
||||
<TextView android:id="@+id/text_line_1"
|
||||
style="@style/Widget.DeviceDefault.Notification.Text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end|bottom"
|
||||
android:layout_marginStart="16dp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:fadingEdge="horizontal"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -2902,7 +2902,6 @@
|
||||
<java-symbol type="id" name="time_divider" />
|
||||
<java-symbol type="id" name="header_text_divider" />
|
||||
<java-symbol type="id" name="header_text_secondary_divider" />
|
||||
<java-symbol type="id" name="text_line_1" />
|
||||
<java-symbol type="drawable" name="ic_expand_notification" />
|
||||
<java-symbol type="drawable" name="ic_collapse_notification" />
|
||||
<java-symbol type="drawable" name="ic_expand_bundle" />
|
||||
|
||||
Reference in New Issue
Block a user