Update notification layouts to match redlines
Also fixes a lot of paddings and other small issues with the notification layouts. Bug: 15437369 Change-Id: I40b6c69afc160c498b7e2e709814b5b847f615de
This commit is contained in:
@@ -40,6 +40,7 @@ import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.MathUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
@@ -1755,6 +1756,7 @@ public class Notification implements Parcelable
|
||||
*/
|
||||
public static class Builder {
|
||||
private static final int MAX_ACTION_BUTTONS = 3;
|
||||
private static final float LARGE_TEXT_SCALE = 1.3f;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -2577,28 +2579,14 @@ public class Notification implements Parcelable
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private RemoteViews applyStandardTemplate(int resId, boolean fitIn1U) {
|
||||
final boolean largeFontScale
|
||||
= mContext.getResources().getConfiguration().fontScale >= 1.25f;
|
||||
|
||||
private RemoteViews applyStandardTemplate(int resId) {
|
||||
Bitmap profileIcon = getProfileBadge();
|
||||
RemoteViews contentView = new BuilderRemoteViews(mContext.getPackageName(),
|
||||
mOriginatingUserId, resId);
|
||||
|
||||
if (largeFontScale) {
|
||||
// Make a little extra room for the bigger text.
|
||||
final int margin = (int) mContext.getResources()
|
||||
.getDimensionPixelSize(R.dimen.notification_large_font_vert_pad);
|
||||
contentView.setViewPadding(R.id.line1, 0, margin, 0, 0);
|
||||
contentView.setViewPadding(R.id.line3, 0, 0, 0, margin);
|
||||
}
|
||||
|
||||
boolean showLine3 = false;
|
||||
boolean showLine2 = false;
|
||||
|
||||
if (mPriority < PRIORITY_LOW) {
|
||||
// TODO: Low priority presentation
|
||||
}
|
||||
if (profileIcon != null) {
|
||||
contentView.setImageViewBitmap(R.id.profile_icon, profileIcon);
|
||||
contentView.setViewVisibility(R.id.profile_icon, View.VISIBLE);
|
||||
@@ -2666,15 +2654,12 @@ public class Notification implements Parcelable
|
||||
}
|
||||
}
|
||||
if (showLine2) {
|
||||
if (fitIn1U) {
|
||||
// need to shrink all the type to make sure everything fits
|
||||
final Resources res = mContext.getResources();
|
||||
final float subTextSize = res.getDimensionPixelSize(
|
||||
R.dimen.notification_subtext_size);
|
||||
contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize);
|
||||
}
|
||||
// vertical centering
|
||||
contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
|
||||
|
||||
// need to shrink all the type to make sure everything fits
|
||||
final Resources res = mContext.getResources();
|
||||
final float subTextSize = res.getDimensionPixelSize(
|
||||
R.dimen.notification_subtext_size);
|
||||
contentView.setTextViewTextSize(R.id.text, TypedValue.COMPLEX_UNIT_PX, subTextSize);
|
||||
}
|
||||
|
||||
if (mWhen != 0 && mShowWhen) {
|
||||
@@ -2691,13 +2676,51 @@ public class Notification implements Parcelable
|
||||
contentView.setViewVisibility(R.id.time, View.GONE);
|
||||
}
|
||||
|
||||
// Adjust padding depending on line count and font size.
|
||||
contentView.setViewPadding(R.id.line1, 0, calculateTopPadding(mContext,
|
||||
hasThreeLines(), mContext.getResources().getConfiguration().fontScale),
|
||||
0, 0);
|
||||
|
||||
contentView.setViewVisibility(R.id.line3, showLine3 ? View.VISIBLE : View.GONE);
|
||||
contentView.setViewVisibility(R.id.overflow_divider, showLine3 ? View.VISIBLE : View.GONE);
|
||||
return contentView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logic to find out whether the notification is going to have three lines in the contracted
|
||||
* layout. This is used to adjust the top padding.
|
||||
*
|
||||
* @return true if the notification is going to have three lines; false if the notification
|
||||
* is going to have one or two lines
|
||||
*/
|
||||
private boolean hasThreeLines() {
|
||||
boolean hasLine3 = mContentText != null || mContentInfo != null || mNumber > 0;
|
||||
boolean hasLine2 = (mSubText != null && mContentText != null) ||
|
||||
(mSubText == null && (mProgressMax != 0 || mProgressIndeterminate));
|
||||
return hasLine2 && hasLine3;
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static int calculateTopPadding(Context ctx, boolean hasThreeLines,
|
||||
float fontScale) {
|
||||
int padding = ctx.getResources().getDimensionPixelSize(hasThreeLines
|
||||
? R.dimen.notification_top_pad_narrow
|
||||
: R.dimen.notification_top_pad);
|
||||
int largePadding = ctx.getResources().getDimensionPixelSize(hasThreeLines
|
||||
? R.dimen.notification_top_pad_large_text_narrow
|
||||
: R.dimen.notification_top_pad_large_text);
|
||||
float largeFactor = (MathUtils.constrain(fontScale, 1.0f, LARGE_TEXT_SCALE) - 1f)
|
||||
/ (LARGE_TEXT_SCALE - 1f);
|
||||
|
||||
// Linearly interpolate the padding between large and normal with the font scale ranging
|
||||
// from 1f to LARGE_TEXT_SCALE
|
||||
return Math.round((1 - largeFactor) * padding + largeFactor * largePadding);
|
||||
}
|
||||
|
||||
private RemoteViews applyStandardTemplateWithActions(int layoutId) {
|
||||
RemoteViews big = applyStandardTemplate(layoutId, false);
|
||||
RemoteViews big = applyStandardTemplate(layoutId);
|
||||
|
||||
int N = mActions.size();
|
||||
if (N > 0) {
|
||||
@@ -2717,7 +2740,7 @@ public class Notification implements Parcelable
|
||||
if (mContentView != null) {
|
||||
return mContentView;
|
||||
} else {
|
||||
return applyStandardTemplate(getBaseLayoutResource(), true); // no more special large_icon flavor
|
||||
return applyStandardTemplate(getBaseLayoutResource());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2810,7 +2833,7 @@ public class Notification implements Parcelable
|
||||
*/
|
||||
private void applyLargeIconBackground(RemoteViews contentView) {
|
||||
contentView.setInt(R.id.icon, "setBackgroundResource",
|
||||
R.drawable.notification_icon_legacy_bg_inset);
|
||||
R.drawable.notification_icon_legacy_bg);
|
||||
|
||||
contentView.setDrawableParameters(
|
||||
R.id.icon,
|
||||
@@ -2819,6 +2842,10 @@ public class Notification implements Parcelable
|
||||
resolveColor(),
|
||||
PorterDuff.Mode.SRC_ATOP,
|
||||
-1);
|
||||
|
||||
int padding = mContext.getResources().getDimensionPixelSize(
|
||||
R.dimen.notification_large_icon_circle_padding);
|
||||
contentView.setViewPadding(R.id.icon, padding, padding, padding, padding);
|
||||
}
|
||||
|
||||
private void removeLargeIconBackground(RemoteViews contentView) {
|
||||
@@ -3234,7 +3261,7 @@ public class Notification implements Parcelable
|
||||
}
|
||||
|
||||
private int getBigTextLayoutResource() {
|
||||
return getBigBaseLayoutResource();
|
||||
return R.layout.notification_template_material_big_text;
|
||||
}
|
||||
|
||||
private int getInboxLayoutResource() {
|
||||
@@ -3327,6 +3354,19 @@ public class Notification implements Parcelable
|
||||
return contentView;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the padding of the first line such that the big and small content view have the
|
||||
* same top padding.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
protected void applyTopPadding(RemoteViews contentView) {
|
||||
int topPadding = Builder.calculateTopPadding(mBuilder.mContext,
|
||||
mBuilder.hasThreeLines(),
|
||||
mBuilder.mContext.getResources().getConfiguration().fontScale);
|
||||
contentView.setViewPadding(R.id.line1, 0, topPadding, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
@@ -3465,6 +3505,8 @@ public class Notification implements Parcelable
|
||||
|
||||
contentView.setImageViewBitmap(R.id.big_picture, mPicture);
|
||||
|
||||
applyTopPadding(contentView);
|
||||
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@@ -3575,8 +3617,6 @@ public class Notification implements Parcelable
|
||||
}
|
||||
|
||||
private RemoteViews makeBigContentView() {
|
||||
// Remove the content text so line3 only shows if you have a summary
|
||||
final boolean hadThreeLines = (mBuilder.mContentText != null && mBuilder.mSubText != null);
|
||||
|
||||
// Nasty
|
||||
CharSequence oldBuilderContentText = mBuilder.mContentText;
|
||||
@@ -3586,15 +3626,12 @@ public class Notification implements Parcelable
|
||||
|
||||
mBuilder.mContentText = oldBuilderContentText;
|
||||
|
||||
if (hadThreeLines) {
|
||||
// vertical centering
|
||||
contentView.setViewPadding(R.id.line1, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
contentView.setTextViewText(R.id.big_text, mBuilder.processLegacyText(mBigText));
|
||||
contentView.setViewVisibility(R.id.big_text, View.VISIBLE);
|
||||
contentView.setViewVisibility(R.id.text2, View.GONE);
|
||||
|
||||
applyTopPadding(contentView);
|
||||
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@@ -3706,13 +3743,20 @@ 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;
|
||||
while (i < mTexts.size() && i < rowIds.length) {
|
||||
CharSequence str = mTexts.get(i);
|
||||
if (str != null && !str.equals("")) {
|
||||
contentView.setViewVisibility(rowIds[i], View.VISIBLE);
|
||||
contentView.setTextViewText(rowIds[i], mBuilder.processLegacyText(str));
|
||||
if (largeText) {
|
||||
contentView.setTextViewTextSize(rowIds[i], TypedValue.COMPLEX_UNIT_PX,
|
||||
subTextSize);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -3723,6 +3767,8 @@ public class Notification implements Parcelable
|
||||
contentView.setViewVisibility(R.id.inbox_more,
|
||||
mTexts.size() > rowIds.length ? View.VISIBLE : View.GONE);
|
||||
|
||||
applyTopPadding(contentView);
|
||||
|
||||
return contentView;
|
||||
}
|
||||
|
||||
@@ -3876,7 +3922,7 @@ public class Notification implements Parcelable
|
||||
|
||||
private RemoteViews makeMediaContentView() {
|
||||
RemoteViews view = mBuilder.applyStandardTemplate(
|
||||
R.layout.notification_template_material_media, true /* 1U */);
|
||||
R.layout.notification_template_material_media);
|
||||
|
||||
final int numActions = mBuilder.mActions.size();
|
||||
final int N = mActionsToShowInCompact == null
|
||||
@@ -3901,7 +3947,7 @@ public class Notification implements Parcelable
|
||||
|
||||
private RemoteViews makeMediaBigContentView() {
|
||||
RemoteViews big = mBuilder.applyStandardTemplate(
|
||||
R.layout.notification_template_material_big_media, false);
|
||||
R.layout.notification_template_material_big_media);
|
||||
|
||||
final int N = Math.min(mBuilder.mActions.size(), MAX_MEDIA_BUTTONS);
|
||||
if (N > 0) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 198 B |
Binary file not shown.
|
Before Width: | Height: | Size: 173 B |
Binary file not shown.
|
Before Width: | Height: | Size: 188 B |
@@ -14,8 +14,12 @@
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/notification_icon_legacy_bg" android:insetBottom="8dp"
|
||||
android:insetLeft="8dp" android:insetRight="8dp" android:insetTop="8dp"
|
||||
android:visible="true"/>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:startColor="#44000000"
|
||||
android:centerColor="#1C000000"
|
||||
android:endColor="#00000000"
|
||||
android:centerY="0.3"
|
||||
android:centerX="0.5"
|
||||
android:angle="270"/>
|
||||
</shape>
|
||||
@@ -25,8 +25,8 @@
|
||||
android:gravity="start|center_vertical"
|
||||
android:drawablePadding="8dp"
|
||||
android:paddingStart="8dp"
|
||||
android:textColor="#555555"
|
||||
android:textSize="@dimen/notification_text_size"
|
||||
android:textColor="@color/secondary_text_material_light"
|
||||
android:textSize="13sp"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
/>
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:showDividers="middle"
|
||||
android:divider="@drawable/list_divider_holo_light"
|
||||
android:dividerPadding="12dp"
|
||||
>
|
||||
<!-- actions will be added here -->
|
||||
</LinearLayout>
|
||||
|
||||
@@ -23,20 +23,23 @@
|
||||
android:id="@+id/icon_group"
|
||||
>
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:layout_width="@dimen/notification_large_icon_width"
|
||||
android:layout_height="@dimen/notification_large_icon_height"
|
||||
android:padding="8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:scaleType="centerInside"
|
||||
/>
|
||||
<ImageView android:id="@+id/right_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:padding="4dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:padding="3dp"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
/>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
@@ -31,25 +31,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="@dimen/notification_large_icon_width"
|
||||
android:minHeight="@dimen/notification_large_icon_height"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<include layout="@layout/notification_template_part_line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<include layout="@layout/notification_template_part_line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<include layout="@layout/notification_template_part_line3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
<include layout="@layout/notification_template_part_line1" />
|
||||
<include layout="@layout/notification_template_part_line2" />
|
||||
<include layout="@layout/notification_template_part_line3" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="@dimen/notification_large_icon_width"
|
||||
android:minHeight="@dimen/notification_large_icon_height"
|
||||
android:orientation="vertical"
|
||||
@@ -42,22 +41,26 @@
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/notification_large_icon_height"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:singleLine="false"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<include layout="@layout/notification_template_part_line3" />
|
||||
<include
|
||||
layout="@layout/notification_template_part_line3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
/>
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/action_divider"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/list_divider_holo_light" />
|
||||
android:background="@drawable/notification_template_divider" />
|
||||
<include
|
||||
layout="@layout/notification_material_action_list"
|
||||
android:layout_marginLeft="-8dp"
|
||||
android:layout_marginRight="-8dp"
|
||||
android:layout_marginStart="-8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2014 The Android Open Source Project
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
|
||||
android:id="@+id/status_bar_latest_event_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
internal:layout_minHeight="65dp"
|
||||
internal:layout_maxHeight="unbounded"
|
||||
>
|
||||
<include layout="@layout/notification_template_icon_group"
|
||||
android:layout_width="@dimen/notification_large_icon_width"
|
||||
android:layout_height="@dimen/notification_large_icon_height"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:layout_marginStart="@dimen/notification_large_icon_width"
|
||||
android:minHeight="@dimen/notification_large_icon_height"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<include layout="@layout/notification_template_part_line1" />
|
||||
<include layout="@layout/notification_template_part_line2" />
|
||||
<TextView android:id="@+id/big_text"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:id="@+id/action_divider"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/notification_template_divider" />
|
||||
<include
|
||||
layout="@layout/notification_material_action_list"
|
||||
android:layout_marginStart="-8dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:id="@+id/overflow_divider"
|
||||
android:visibility="visible"
|
||||
android:background="@drawable/notification_template_divider" />
|
||||
<include
|
||||
layout="@layout/notification_template_part_line3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="10dp" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -113,7 +113,7 @@
|
||||
<FrameLayout
|
||||
android:id="@+id/inbox_end_pad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dip"
|
||||
android:layout_height="10dp"
|
||||
android:visibility="gone"
|
||||
android:layout_weight="0"
|
||||
/>
|
||||
@@ -122,7 +122,7 @@
|
||||
android:layout_height="1dip"
|
||||
android:id="@+id/action_divider"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/list_divider_holo_light" />
|
||||
android:background="@drawable/notification_template_divider" />
|
||||
<include
|
||||
layout="@layout/notification_material_action_list"
|
||||
android:layout_width="match_parent"
|
||||
@@ -136,7 +136,13 @@
|
||||
android:layout_height="1dip"
|
||||
android:id="@+id/overflow_divider"
|
||||
android:visibility="visible"
|
||||
android:background="@drawable/list_divider_holo_light" />
|
||||
<include layout="@layout/notification_template_part_line3" />
|
||||
android:background="@drawable/notification_template_divider" />
|
||||
<include
|
||||
layout="@layout/notification_template_part_line3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="10dp" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
android:id="@+id/line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/notification_vert_pad"
|
||||
android:layout_weight="0"
|
||||
>
|
||||
<TextView android:id="@+id/title"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Title"
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent.Line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-2dp"
|
||||
android:layout_marginBottom="-2dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:layout_marginBottom="-1dp"
|
||||
android:singleLine="true"
|
||||
android:fadingEdge="horizontal"
|
||||
android:ellipsize="marquee"
|
||||
@@ -32,7 +33,8 @@
|
||||
<ProgressBar
|
||||
android:id="@android:id/progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="8dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:visibility="gone"
|
||||
android:layout_weight="0"
|
||||
style="@style/Widget.Material.Light.ProgressBar.Horizontal"
|
||||
|
||||
@@ -19,10 +19,9 @@
|
||||
android:id="@+id/line3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="0"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingBottom="@dimen/notification_vert_pad"
|
||||
>
|
||||
<TextView android:id="@+id/text"
|
||||
android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
|
||||
<drawable name="notification_template_icon_bg">#3333B5E5</drawable>
|
||||
<drawable name="notification_template_icon_low_bg">#0cffffff</drawable>
|
||||
<drawable name="notification_template_divider">#29000000</drawable>
|
||||
|
||||
<color name="notification_icon_bg_color">#ff9e9e9e</color>
|
||||
<color name="notification_action_legacy_color_filter">#ff555555</color>
|
||||
|
||||
@@ -215,17 +215,26 @@
|
||||
<dimen name="action_bar_stacked_tab_max_width">180dp</dimen>
|
||||
|
||||
<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
|
||||
<dimen name="notification_text_size">13sp</dimen>
|
||||
<dimen name="notification_text_size">14sp</dimen>
|
||||
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
|
||||
<dimen name="notification_title_text_size">16sp</dimen>
|
||||
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
|
||||
<dimen name="notification_subtext_size">12sp</dimen>
|
||||
|
||||
<!-- 8dp at the top/bottom of the notification view -->
|
||||
<dimen name="notification_vert_pad">10dp</dimen>
|
||||
<!-- Top padding for notifications in the standard layout. -->
|
||||
<dimen name="notification_top_pad">10dp</dimen>
|
||||
|
||||
<!-- Replacement for @dimen/notification_vert_pad when the text is large -->
|
||||
<dimen name="notification_large_font_vert_pad">3dp</dimen>
|
||||
<!-- Top padding for notifications when narrow (i.e. it has 3 lines) -->
|
||||
<dimen name="notification_top_pad_narrow">4dp</dimen>
|
||||
|
||||
<!-- Top padding for notification when text is large -->
|
||||
<dimen name="notification_top_pad_large_text">5dp</dimen>
|
||||
|
||||
<!-- Top padding for notification when text is large and narrow (i.e. it has 3 lines -->
|
||||
<dimen name="notification_top_pad_large_text_narrow">-4dp</dimen>
|
||||
|
||||
<!-- Padding for notification icon when drawn with circle around it -->
|
||||
<dimen name="notification_large_icon_circle_padding">11dp</dimen>
|
||||
|
||||
<!-- Keyguard dimensions -->
|
||||
<!-- TEMP -->
|
||||
|
||||
@@ -413,12 +413,12 @@ please see styles_device_defaults.xml.
|
||||
<style name="TextAppearance.StatusBar.Material" />
|
||||
|
||||
<style name="TextAppearance.StatusBar.Material.EventContent">
|
||||
<item name="textColor">#90000000</item>
|
||||
<item name="textColor">@color/secondary_text_material_light</item>
|
||||
<item name="textSize">@dimen/notification_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.StatusBar.Material.EventContent.Title">
|
||||
<item name="textColor">#DD000000</item>
|
||||
<item name="textColor">@color/primary_text_default_material_light</item>
|
||||
<item name="textSize">@dimen/notification_title_text_size</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -349,7 +349,11 @@
|
||||
<java-symbol type="dimen" name="notification_text_size" />
|
||||
<java-symbol type="dimen" name="notification_title_text_size" />
|
||||
<java-symbol type="dimen" name="notification_subtext_size" />
|
||||
<java-symbol type="dimen" name="notification_large_font_vert_pad" />
|
||||
<java-symbol type="dimen" name="notification_top_pad" />
|
||||
<java-symbol type="dimen" name="notification_top_pad_narrow" />
|
||||
<java-symbol type="dimen" name="notification_top_pad_large_text" />
|
||||
<java-symbol type="dimen" name="notification_top_pad_large_text_narrow" />
|
||||
<java-symbol type="dimen" name="notification_large_icon_circle_padding" />
|
||||
<java-symbol type="dimen" name="immersive_mode_cling_width" />
|
||||
<java-symbol type="dimen" name="circular_display_mask_offset" />
|
||||
|
||||
@@ -1705,12 +1709,12 @@
|
||||
<java-symbol type="layout" name="notification_template_material_inbox" />
|
||||
<java-symbol type="layout" name="notification_template_material_media" />
|
||||
<java-symbol type="layout" name="notification_template_material_big_media" />
|
||||
<java-symbol type="layout" name="notification_template_material_big_text" />
|
||||
<java-symbol type="layout" name="notification_template_icon_group" />
|
||||
<java-symbol type="layout" name="notification_material_media_action" />
|
||||
<java-symbol type="color" name="notification_action_legacy_color_filter" />
|
||||
<java-symbol type="color" name="notification_icon_bg_color" />
|
||||
<java-symbol type="drawable" name="notification_icon_legacy_bg" />
|
||||
<java-symbol type="drawable" name="notification_icon_legacy_bg_inset" />
|
||||
<java-symbol type="drawable" name="notification_material_media_progress" />
|
||||
<java-symbol type="color" name="notification_media_action_bg" />
|
||||
<java-symbol type="color" name="notification_media_progress" />
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -1183,7 +1183,10 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
icon.setImageDrawable(iconDrawable);
|
||||
if (mNotificationColorUtil.isGrayscale(iconDrawable)) {
|
||||
icon.setBackgroundResource(
|
||||
com.android.internal.R.drawable.notification_icon_legacy_bg_inset);
|
||||
com.android.internal.R.drawable.notification_icon_legacy_bg);
|
||||
int padding = mContext.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.notification_large_icon_circle_padding);
|
||||
icon.setPadding(padding, padding, padding, padding);
|
||||
}
|
||||
|
||||
if (profileIcon != null) {
|
||||
@@ -1214,6 +1217,11 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
R.style.TextAppearance_StatusBar_Material_EventContent_Parenthetical);
|
||||
}
|
||||
|
||||
int topPadding = Notification.Builder.calculateTopPadding(mContext,
|
||||
false /* hasThreeLines */,
|
||||
mContext.getResources().getConfiguration().fontScale);
|
||||
title.setPadding(0, topPadding, 0, 0);
|
||||
|
||||
entry.autoRedacted = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user