AOD: Adjust header to spec

- factor out attributes to themes
- use themeing to change ambient header to larger text and icon size

Bug: 30876804
Test: receive notification on ambient screen, observe that header text is slightly larger
Change-Id: I70f79400e2ce47b862b3b501421aa71187866e61
This commit is contained in:
Adrian Roos
2017-04-04 15:12:52 -07:00
parent 7d062c4549
commit 7322c05097
6 changed files with 45 additions and 12 deletions

View File

@@ -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"

View File

@@ -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"

View File

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

View File

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

View File

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

View File

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