Fixed a padding issue if there is no right icon but a reply icon
The text wasn't actually flowing around the picture in that case.
Test: add bigtext notification without image, observe normal padding
Change-Id: I0c3513dac6ffecec50023ba6cc1a0ef54f581bd4
Fixes: 120423951
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 0281e6a..dba62f2 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -4770,14 +4770,16 @@
TemplateBindResult result) {
boolean largeIconShown = bindLargeIcon(contentView, p);
boolean replyIconShown = bindReplyIcon(contentView, p);
+ boolean iconContainerVisible = largeIconShown || replyIconShown;
contentView.setViewVisibility(R.id.right_icon_container,
- largeIconShown || replyIconShown ? View.VISIBLE : View.GONE);
+ iconContainerVisible ? View.VISIBLE : View.GONE);
int marginEnd = calculateMarginEnd(largeIconShown, replyIconShown);
contentView.setViewLayoutMarginEnd(R.id.line1, marginEnd);
contentView.setViewLayoutMarginEnd(R.id.text, marginEnd);
contentView.setViewLayoutMarginEnd(R.id.progress, marginEnd);
if (result != null) {
result.setIconMarginEnd(marginEnd);
+ result.setRightIconContainerVisible(iconContainerVisible);
}
}
@@ -6777,7 +6779,8 @@
mBuilder.setTextViewColorSecondary(contentView, R.id.big_text, p);
contentView.setViewVisibility(R.id.big_text,
TextUtils.isEmpty(bigTextText) ? View.GONE : View.VISIBLE);
- contentView.setBoolean(R.id.big_text, "setHasImage", mBuilder.mN.hasLargeIcon());
+ contentView.setBoolean(R.id.big_text, "setHasImage",
+ result.isRightIconContainerVisible());
return contentView;
}
@@ -9914,6 +9917,7 @@
*/
private static class TemplateBindResult {
int mIconMarginEnd;
+ boolean mRightIconContainerVisible;
/**
* Get the margin end that needs to be added to any fields that may overlap
@@ -9923,9 +9927,21 @@
return mIconMarginEnd;
}
+ /**
+ * Is the icon container visible on the right size because of the reply button or the
+ * right icon.
+ */
+ public boolean isRightIconContainerVisible() {
+ return mRightIconContainerVisible;
+ }
+
public void setIconMarginEnd(int iconMarginEnd) {
this.mIconMarginEnd = iconMarginEnd;
}
+
+ public void setRightIconContainerVisible(boolean iconContainerVisible) {
+ mRightIconContainerVisible = iconContainerVisible;
+ }
}
private static class StandardTemplateParams {