Merge "Fixed the paddings in inbox style to match the rest of the templates" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-04-24 14:44:26 +00:00
committed by Android (Google) Code Review
6 changed files with 33 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -47,7 +47,7 @@
<com.android.internal.widget.ImageFloatingTextView android:id="@+id/big_text"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="0.5dp"
android:layout_marginTop="@dimen/notification_text_margin_top"
android:paddingBottom="@dimen/notification_content_margin_bottom"
android:textAppearance="@style/TextAppearance.Material.Notification"
android:singleLine="false"

View File

@@ -37,6 +37,7 @@
android:layout_gravity="top"
android:paddingStart="@dimen/notification_content_margin_start"
android:paddingEnd="@dimen/notification_content_margin_end"
android:paddingBottom="@dimen/notification_content_margin_bottom"
android:minHeight="@dimen/notification_min_content_height"
android:clipToPadding="false"
android:orientation="vertical"

View File

@@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="0.5dp"
android:layout_marginTop="@dimen/notification_text_margin_top"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:gravity="top"

View File

@@ -290,6 +290,12 @@
<!-- Padding for notification icon when drawn with circle around it -->
<dimen name="notification_large_icon_circle_padding">11dp</dimen>
<!-- The margin on top of the text of the notification -->
<dimen name="notification_text_margin_top">0.5dp</dimen>
<!-- The padding on top of inbox style elements -->
<dimen name="notification_inbox_item_top_padding">5dp</dimen>
<!-- Size of the profile badge for notifications -->
<dimen name="notification_badge_size">12dp</dimen>

View File

@@ -2548,6 +2548,9 @@
<java-symbol type="dimen" name="notification_messaging_spacing" />
<java-symbol type="dimen" name="notification_text_margin_top" />
<java-symbol type="dimen" name="notification_inbox_item_top_padding" />
<!-- WallpaperManager config -->
<java-symbol type="string" name="config_wallpaperCropperPackage" />