diff options
author | Dan Sandler <dsandler@android.com> | 2014-05-15 09:36:47 -0400 |
---|---|---|
committer | Dan Sandler <dsandler@android.com> | 2014-05-22 01:36:46 -0400 |
commit | 842dd77bb9c002af5364237f46b63c826f1c4082 (patch) | |
tree | f6834814e795cd439ac16ed163ae020b616d29f3 /core/res | |
parent | 7de53d693eb4b70431514481d9da30b80f007939 (diff) | |
download | frameworks_base-842dd77bb9c002af5364237f46b63c826f1c4082.zip frameworks_base-842dd77bb9c002af5364237f46b63c826f1c4082.tar.gz frameworks_base-842dd77bb9c002af5364237f46b63c826f1c4082.tar.bz2 |
Introducing Notification.MediaStyle.
Allows you to create a nice music player with all the
trimmings, including:
* up to 5 actions in the bigContentView, styled as
transport control buttons
* up to 2 of those actions in the 1U (!)
* a nice custom progress bar
* a tinted background (taken from your Notification.color)
* a special place to put your MediaSessionToken
Bug: 15147533
Change-Id: Ic20a2b369eb6c5fe4853987a44ffd9bace720c7f
Diffstat (limited to 'core/res')
-rw-r--r-- | core/res/res/drawable/notification_quantum_media_progress.xml | 28 | ||||
-rw-r--r-- | core/res/res/layout/notification_quantum_media_action.xml | 25 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_part_chronometer.xml | 2 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_part_time.xml | 2 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_quantum_big_media.xml | 158 | ||||
-rw-r--r-- | core/res/res/layout/notification_template_quantum_media.xml | 135 | ||||
-rw-r--r-- | core/res/res/values/colors.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 4 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 8 |
9 files changed, 364 insertions, 2 deletions
diff --git a/core/res/res/drawable/notification_quantum_media_progress.xml b/core/res/res/drawable/notification_quantum_media_progress.xml new file mode 100644 index 0000000..74d871b --- /dev/null +++ b/core/res/res/drawable/notification_quantum_media_progress.xml @@ -0,0 +1,28 @@ +<?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. +--> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:id="@id/background" android:drawable="@color/transparent"> + </item> + <item android:id="@id/secondaryProgress"> + <scale android:scaleWidth="100%" + android:drawable="@color/notification_media_progress" /> + </item> + <item android:id="@id/progress"> + <scale android:scaleWidth="100%" + android:drawable="@color/notification_media_progress" /> + </item> +</layer-list> diff --git a/core/res/res/layout/notification_quantum_media_action.xml b/core/res/res/layout/notification_quantum_media_action.xml new file mode 100644 index 0000000..17f0848 --- /dev/null +++ b/core/res/res/layout/notification_quantum_media_action.xml @@ -0,0 +1,25 @@ +<?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 + --> + +<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" + style="@android:style/Widget.Quantum.Light.Button.Borderless.Small" + android:id="@+id/action0" + android:layout_width="60dp" + android:layout_height="match_parent" + android:layout_weight="1" + android:gravity="center" + /> diff --git a/core/res/res/layout/notification_template_part_chronometer.xml b/core/res/res/layout/notification_template_part_chronometer.xml index aa9c4dc..9b6e6c5 100644 --- a/core/res/res/layout/notification_template_part_chronometer.xml +++ b/core/res/res/layout/notification_template_part_chronometer.xml @@ -15,7 +15,7 @@ --> <Chronometer android:id="@+id/chronometer" xmlns:android="http://schemas.android.com/apk/res/android" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Time" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/core/res/res/layout/notification_template_part_time.xml b/core/res/res/layout/notification_template_part_time.xml index 2bd6c3f..b559dce 100644 --- a/core/res/res/layout/notification_template_part_time.xml +++ b/core/res/res/layout/notification_template_part_time.xml @@ -15,7 +15,7 @@ --> <DateTimeView android:id="@+id/time" xmlns:android="http://schemas.android.com/apk/res/android" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Time" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/core/res/res/layout/notification_template_quantum_big_media.xml b/core/res/res/layout/notification_template_quantum_big_media.xml new file mode 100644 index 0000000..5c9334e --- /dev/null +++ b/core/res/res/layout/notification_template_quantum_big_media.xml @@ -0,0 +1,158 @@ +<?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" + > + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="fill_vertical" + android:minHeight="@dimen/notification_large_icon_height" + android:orientation="vertical" + android:gravity="top" + > + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingStart="@dimen/notification_large_icon_width" + android:minHeight="@dimen/notification_large_icon_height" + android:paddingTop="2dp" + android:orientation="vertical" + android:background="@color/notification_media_info_bg" + > + <LinearLayout + android:id="@+id/line1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="6dp" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" + android:orientation="horizontal" + > + <TextView android:id="@+id/title" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + android:layout_weight="1" + /> + <ViewStub android:id="@+id/time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="0" + android:visibility="gone" + android:layout="@layout/notification_template_part_time" + /> + <ViewStub android:id="@+id/chronometer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="0" + android:visibility="gone" + android:layout="@layout/notification_template_part_chronometer" + /> + </LinearLayout> + <TextView android:id="@+id/text2" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Line2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="-2dp" + android:layout_marginBottom="-2dp" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:singleLine="true" + android:fadingEdge="horizontal" + android:ellipsize="marquee" + android:visibility="gone" + /> + <TextView android:id="@+id/big_text" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:singleLine="false" + android:visibility="gone" + /> + <LinearLayout + android:id="@+id/line3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_marginEnd="8dp" + android:orientation="horizontal" + android:gravity="center_vertical" + > + <TextView android:id="@+id/text" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center" + android:singleLine="true" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + /> + <TextView android:id="@+id/info" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Info" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="0" + android:singleLine="true" + android:gravity="center" + android:paddingStart="8dp" + /> + </LinearLayout> + </LinearLayout> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="60dp" + android:id="@+id/media_action_area" + android:background="@color/notification_media_action_bg" + > + <LinearLayout + android:id="@+id/actions" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="6dp" + android:orientation="horizontal" + > + <!-- media buttons will be added here --> + </LinearLayout> + <ProgressBar + android:id="@android:id/progress" + android:layout_width="match_parent" + android:layout_height="6dp" + android:layout_gravity="top" + android:visibility="gone" + style="@style/Widget.StatusBar.Quantum.ProgressBar" + /> + </FrameLayout> + </LinearLayout> + <include layout="@layout/notification_template_icon_group" + android:layout_width="@dimen/notification_large_icon_width" + android:layout_height="@dimen/notification_large_icon_height" + /> +</FrameLayout> diff --git a/core/res/res/layout/notification_template_quantum_media.xml b/core/res/res/layout/notification_template_quantum_media.xml new file mode 100644 index 0000000..14fabce --- /dev/null +++ b/core/res/res/layout/notification_template_quantum_media.xml @@ -0,0 +1,135 @@ +<?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 + --> + +<LinearLayout 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="64dp" + android:orientation="horizontal" + internal:layout_minHeight="64dp" + internal:layout_maxHeight="64dp" + > + <include layout="@layout/notification_template_icon_group" + android:layout_width="@dimen/notification_large_icon_width" + android:layout_height="@dimen/notification_large_icon_height" + android:layout_weight="0" + /> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="fill_vertical" + android:minHeight="@dimen/notification_large_icon_height" + android:orientation="vertical" + android:paddingEnd="8dp" + android:paddingTop="2dp" + android:paddingBottom="2dp" + android:gravity="top" + > + <LinearLayout + android:id="@+id/line1" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="6dp" + android:layout_marginStart="8dp" + android:orientation="horizontal" + > + <TextView android:id="@+id/title" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Title" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:singleLine="true" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + android:layout_weight="1" + /> + <ViewStub android:id="@+id/time" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="0" + android:visibility="gone" + android:layout="@layout/notification_template_part_time" + /> + <ViewStub android:id="@+id/chronometer" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="0" + android:visibility="gone" + android:layout="@layout/notification_template_part_chronometer" + /> + </LinearLayout> + <TextView android:id="@+id/text2" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Line2" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="-2dp" + android:layout_marginBottom="-2dp" + android:layout_marginStart="8dp" + android:singleLine="true" + android:fadingEdge="horizontal" + android:ellipsize="marquee" + android:visibility="gone" + /> + <ProgressBar + android:id="@android:id/progress" + android:layout_width="match_parent" + android:layout_height="12dp" + android:layout_marginStart="8dp" + android:visibility="gone" + style="@style/Widget.StatusBar.Quantum.ProgressBar" + /> + <LinearLayout + android:id="@+id/line3" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:gravity="center_vertical" + android:layout_marginStart="8dp" + > + <TextView android:id="@+id/text" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:layout_gravity="center" + android:singleLine="true" + android:ellipsize="marquee" + android:fadingEdge="horizontal" + /> + <TextView android:id="@+id/info" + android:textAppearance="@style/TextAppearance.StatusBar.Quantum.EventContent.Info" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:layout_weight="0" + android:singleLine="true" + android:gravity="center" + android:paddingStart="8dp" + /> + </LinearLayout> + </LinearLayout> + <LinearLayout + android:id="@+id/actions" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="center_vertical|end" + android:orientation="horizontal" + > + <!-- media buttons will be added here --> + </LinearLayout> +</LinearLayout> diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml index ad29505..5a2609e 100644 --- a/core/res/res/values/colors.xml +++ b/core/res/res/values/colors.xml @@ -129,6 +129,10 @@ <color name="notification_icon_bg_color">#ffa3a3a3</color> <color name="notification_action_legacy_color_filter">#ff555555</color> + <color name="notification_media_action_bg">#00000000</color> + <color name="notification_media_info_bg">#40FFFFFF</color> + <color name="notification_media_progress">#FFFFFFFF</color> + <!-- Keyguard colors --> <color name="keyguard_avatar_frame_color">#ffffffff</color> <color name="keyguard_avatar_frame_shadow_color">#80000000</color> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index fd57c5e..4a27ebe 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -299,6 +299,10 @@ please see styles_device_defaults.xml. <style name="TextAppearance.StatusBar.Quantum.EventContent.Emphasis"> <item name="android:textColor">#66000000</item> </style> + <style name="Widget.StatusBar.Quantum.ProgressBar" + parent="Widget.Quantum.Light.ProgressBar.Horizontal"> + <item name="android:progressDrawable">@drawable/notification_quantum_media_progress</item> + </style> <style name="Widget.StatusBar.Quantum.ProgressBar" parent="Widget.Quantum.Light.ProgressBar.Horizontal"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index d7a5573..dcff978 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1662,13 +1662,21 @@ <java-symbol type="layout" name="notification_template_quantum_big_picture" /> <java-symbol type="layout" name="notification_template_quantum_big_text" /> <java-symbol type="layout" name="notification_template_quantum_inbox" /> + <java-symbol type="layout" name="notification_template_quantum_media" /> + <java-symbol type="layout" name="notification_template_quantum_big_media" /> <java-symbol type="layout" name="notification_template_icon_group" /> + <java-symbol type="layout" name="notification_quantum_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_quantum_bg_dim" /> <java-symbol type="drawable" name="notification_quantum_bg" /> + <java-symbol type="drawable" name="notification_quantum_media_progress" /> + <java-symbol type="color" name="notification_media_action_bg" /> + <java-symbol type="color" name="notification_media_info_bg" /> + <java-symbol type="color" name="notification_media_progress" /> + <java-symbol type="id" name="media_action_area" /> <!-- From SystemUI --> <java-symbol type="anim" name="push_down_in" /> |