summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2016-04-24 14:44:26 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-04-24 14:44:28 +0000
commit14d8be728bbca1e7d721479fa1476e23e1b7accf (patch)
treedc92d8080a628925598d8f3105b3ccaeef883984 /core/java
parentb02d51b3d31b1a49ddc7c7e7db97b576d6e4f78f (diff)
parent07c8017bc27f1cbf34e29f27e08ba4e7f8f10d16 (diff)
Merge "Fixed the paddings in inbox style to match the rest of the templates" into nyc-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/Notification.java38
1 files changed, 21 insertions, 17 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index dd05392c9c98..5becd0777f00 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -4826,33 +4826,37 @@ public class Notification implements Parcelable
contentView.setViewVisibility(rowId, View.GONE);
}
- final boolean largeText =
- mBuilder.mContext.getResources().getConfiguration().fontScale > 1f;
- final float subTextSize = mBuilder.mContext.getResources().getDimensionPixelSize(
- R.dimen.notification_subtext_size);
int i=0;
- final float density = mBuilder.mContext.getResources().getDisplayMetrics().density;
- int topPadding = (int) (5 * density);
- int bottomPadding = mBuilder.mContext.getResources().getDimensionPixelSize(
- com.android.internal.R.dimen.notification_content_margin_bottom);
+ int topPadding = mBuilder.mContext.getResources().getDimensionPixelSize(
+ R.dimen.notification_inbox_item_top_padding);
boolean first = true;
- while (i < mTexts.size() && i < rowIds.length) {
+ int onlyViewId = 0;
+ int maxRows = rowIds.length;
+ if (mBuilder.mActions.size() > 0) {
+ maxRows--;
+ }
+ while (i < mTexts.size() && i < maxRows) {
CharSequence str = mTexts.get(i);
- if (str != null && !str.equals("")) {
+ if (!TextUtils.isEmpty(str)) {
contentView.setViewVisibility(rowIds[i], View.VISIBLE);
contentView.setTextViewText(rowIds[i], mBuilder.processLegacyText(str));
- if (largeText) {
- contentView.setTextViewTextSize(rowIds[i], TypedValue.COMPLEX_UNIT_PX,
- subTextSize);
- }
- contentView.setViewPadding(rowIds[i], 0, topPadding, 0,
- i == rowIds.length - 1 || i == mTexts.size() - 1 ? bottomPadding : 0);
+ contentView.setViewPadding(rowIds[i], 0, topPadding, 0, 0);
handleInboxImageMargin(contentView, rowIds[i], first);
+ if (first) {
+ onlyViewId = rowIds[i];
+ } else {
+ onlyViewId = 0;
+ }
first = false;
}
i++;
}
-
+ if (onlyViewId != 0) {
+ // We only have 1 entry, lets make it look like the normal Text of a Bigtext
+ topPadding = mBuilder.mContext.getResources().getDimensionPixelSize(
+ R.dimen.notification_text_margin_top);
+ contentView.setViewPadding(onlyViewId, 0, topPadding, 0, 0);
+ }
return contentView;
}