diff options
| -rw-r--r-- | core/res/res/layout/notification_template_header.xml | 19 | ||||
| -rw-r--r-- | core/res/res/layout/notification_template_material_ambient.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 7 | ||||
| -rw-r--r-- | core/res/res/values/dimens.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/styles_material.xml | 12 | ||||
| -rw-r--r-- | core/res/res/values/themes_material.xml | 13 |
6 files changed, 45 insertions, 12 deletions
diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml index a165621b9696..5a2bf4eb3f62 100644 --- a/core/res/res/layout/notification_template_header.xml +++ b/core/res/res/layout/notification_template_header.xml @@ -17,27 +17,24 @@ <NotificationHeaderView xmlns:android="http://schemas.android.com/apk/res/android" + android:theme="@style/Theme.Material.Notification" android:id="@+id/notification_header" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="@dimen/notification_header_height" android:clipChildren="false" - android:paddingTop="@dimen/notification_header_padding_top" - android:paddingBottom="@dimen/notification_header_padding_bottom" - android:layout_marginBottom="5dp" - android:paddingStart="@dimen/notification_content_margin_start" - android:paddingEnd="16dp"> + style="?attr/notificationHeaderStyle"> <com.android.internal.widget.CachingIconView android:id="@+id/icon" - android:layout_width="@dimen/notification_header_icon_size" - android:layout_height="@dimen/notification_header_icon_size" + android:layout_width="?attr/notificationHeaderIconSize" + android:layout_height="?attr/notificationHeaderIconSize" android:layout_marginEnd="3dp" /> <TextView android:id="@+id/app_name_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Material.Notification.Info" + android:textAppearance="?attr/notificationHeaderTextAppearance" android:layout_marginStart="3dp" android:layout_marginEnd="2dp" android:singleLine="true" @@ -46,7 +43,7 @@ android:id="@+id/header_text_divider" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Material.Notification.Info" + android:textAppearance="?attr/notificationHeaderTextAppearance" android:layout_marginStart="2dp" android:layout_marginEnd="2dp" android:text="@string/notification_header_divider_symbol" @@ -55,7 +52,7 @@ android:id="@+id/header_text" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Material.Notification.Info" + android:textAppearance="?attr/notificationHeaderTextAppearance" android:layout_marginStart="2dp" android:layout_marginEnd="2dp" android:visibility="gone" @@ -64,7 +61,7 @@ android:id="@+id/time_divider" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.Material.Notification.Info" + android:textAppearance="?attr/notificationHeaderTextAppearance" android:layout_marginStart="2dp" android:layout_marginEnd="2dp" android:text="@string/notification_header_divider_symbol" diff --git a/core/res/res/layout/notification_template_material_ambient.xml b/core/res/res/layout/notification_template_material_ambient.xml index f3aa0485bbd2..026bc6e5cb43 100644 --- a/core/res/res/layout/notification_template_material_ambient.xml +++ b/core/res/res/layout/notification_template_material_ambient.xml @@ -23,7 +23,8 @@ android:paddingStart="@dimen/notification_extra_margin_ambient" android:paddingEnd="@dimen/notification_extra_margin_ambient" > - <include layout="@layout/notification_template_header" /> + <include layout="@layout/notification_template_header" + android:theme="@style/Theme.Material.Notification.Ambient" /> <LinearLayout android:id="@+id/notification_action_list_margin_target" diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index a3b27052bf67..589f3970f45c 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -8630,5 +8630,12 @@ <attr name="stackFromEnd" format="boolean" /> </declare-styleable> + <!-- @hide --> + <declare-styleable name="NotificationTheme"> + <attr name="notificationHeaderStyle" format="reference" /> + <attr name="notificationHeaderTextAppearance" format="reference" /> + <attr name="notificationHeaderIconSize" format="dimension" /> + </declare-styleable> + <attr name="lockPatternStyle" format="reference" /> </resources> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index b82542af521f..c5316c6133cc 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -191,6 +191,9 @@ <!-- size (width and height) of the icon in the notification header --> <dimen name="notification_header_icon_size">18dp</dimen> + <!-- size (width and height) of the icon in the notification header --> + <dimen name="notification_header_icon_size_ambient">20dp</dimen> + <!-- Height of a small notification in the status bar --> <dimen name="notification_min_height">92dp</dimen> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 8f061a3862a3..ec1661176ba6 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -488,6 +488,10 @@ please see styles_device_defaults.xml. <style name="TextAppearance.Material.Notification.Time" parent="TextAppearance.Material.Notification.Info" /> + <style name="TextAppearance.Material.Notification.Info.Ambient"> + <item name="textSize">@dimen/notification_text_size</item> + </style> + <style name="TextAppearance.Material.Notification.Emphasis"> <item name="textColor">#66000000</item> </style> @@ -1283,4 +1287,12 @@ please see styles_device_defaults.xml. <style name="DialogWindowTitle.Material.Light" /> + <style name="Notification.Header" parent=""> + <item name="paddingTop">@dimen/notification_header_padding_top</item> + <item name="paddingBottom">@dimen/notification_header_padding_bottom</item> + <item name="layout_marginBottom">5dp</item> + <item name="paddingStart">@dimen/notification_content_margin_start</item> + <item name="paddingEnd">16dp</item> + </style> + </resources> diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 008c817dd73c..9dafa7a02849 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -1321,6 +1321,19 @@ please see themes_device_defaults.xml. <item name="windowNoTitle">true</item> </style> + <!-- Theme for inflating notifications --> + <style name="Theme.Material.Notification" parent=""> + <item name="notificationHeaderStyle">@style/Notification.Header</item> + <item name="notificationHeaderTextAppearance">@style/TextAppearance.Material.Notification.Info</item> + <item name="notificationHeaderIconSize">@dimen/notification_header_icon_size</item> + </style> + + <!-- Theme for inflating ambient notification --> + <style name="Theme.Material.Notification.Ambient"> + <item name="notificationHeaderTextAppearance">@style/TextAppearance.Material.Notification.Info.Ambient</item> + <item name="notificationHeaderIconSize">@dimen/notification_header_icon_size_ambient</item> + </style> + <!-- Default theme for Settings and activities launched from Settings. --> <style name="Theme.Material.Settings" parent="Theme.Material.Light.LightStatusBar"> <item name="colorPrimary">@color/primary_material_settings_light</item> |