Skip to content

Commit 6a858c3

Browse files
dsandlercwren
authored andcommitted
Gestures for expanding notifications.
Change-Id: I104c157ffcc2d60b3f0a95c59d4322b07103b69f
1 parent 3d100d9 commit 6a858c3

17 files changed

+712
-280
lines changed

core/java/android/app/Notification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ public BigTextStyle bigText(CharSequence cs) {
16811681
}
16821682

16831683
private RemoteViews makeBigContentView() {
1684-
RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(R.layout.notification_template_base);
1684+
RemoteViews contentView = mBuilder.applyStandardTemplateWithActions(R.layout.notification_template_big_text);
16851685

16861686
contentView.setTextViewText(R.id.big_text, mBigText);
16871687
contentView.setViewVisibility(R.id.big_text, View.VISIBLE);
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/*
4+
**
5+
** Copyright 2008, The Android Open Source Project
6+
**
7+
** Licensed under the Apache License, Version 2.0 (the "License");
8+
** you may not use this file except in compliance with the License.
9+
** You may obtain a copy of the License at
10+
**
11+
** http://www.apache.org/licenses/LICENSE-2.0
12+
**
13+
** Unless required by applicable law or agreed to in writing, software
14+
** distributed under the License is distributed on an "AS IS" BASIS,
15+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
** See the License for the specific language governing permissions and
17+
** limitations under the License.
18+
*/
19+
-->
20+
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
21+
android:id="@android:id/text1"
22+
android:textAppearance="?android:attr/dropDownHintAppearance"
23+
android:singleLine="true"
24+
android:layout_marginLeft="3dip"
25+
android:layout_marginTop="3dip"
26+
android:layout_marginRight="3dip"
27+
android:layout_marginBottom="3dip"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content" />

core/res/res/layout/notification_template_base.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
-->
1616

1717
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
19+
android:background="@android:color/background_dark"
1820
android:id="@+id/status_bar_latest_event_content"
1921
android:layout_width="match_parent"
2022
android:layout_height="wrap_content"
23+
internal:layout_minHeight="64dp"
24+
internal:layout_maxHeight="64dp"
2125
>
2226
<ImageView android:id="@+id/icon"
2327
android:layout_width="@dimen/notification_large_icon_width"

core/res/res/layout/notification_template_big_picture.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
-->
1616

1717
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
19+
android:background="@android:color/background_dark"
1820
android:id="@+id/status_bar_latest_event_content"
1921
android:layout_width="match_parent"
2022
android:layout_height="match_parent"
23+
internal:layout_minHeight="65dp"
24+
internal:layout_maxHeight="unbounded"
2125
>
2226
<ImageView
2327
android:id="@+id/big_picture"
@@ -30,4 +34,4 @@
3034
android:layout_height="wrap_content"
3135
android:layout_marginTop="192dp"
3236
/>
33-
</FrameLayout>
37+
</FrameLayout>
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2012 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
17+
xmlns:internal="http://schemas.android.com/apk/prv/res/android"
18+
android:background="@android:color/background_dark"
19+
android:id="@+id/status_bar_latest_event_content"
20+
android:layout_width="match_parent"
21+
android:layout_height="wrap_content"
22+
internal:layout_minHeight="65dp"
23+
internal:layout_maxHeight="unbounded"
24+
>
25+
<ImageView android:id="@+id/icon"
26+
android:layout_width="@dimen/notification_large_icon_width"
27+
android:layout_height="@dimen/notification_large_icon_height"
28+
android:background="@android:drawable/notify_panel_notification_icon_bg_tile"
29+
android:scaleType="center"
30+
/>
31+
<LinearLayout
32+
android:layout_width="match_parent"
33+
android:layout_height="wrap_content"
34+
android:layout_gravity="fill_vertical"
35+
android:layout_marginLeft="@dimen/notification_large_icon_width"
36+
android:minHeight="@dimen/notification_large_icon_height"
37+
android:orientation="vertical"
38+
android:paddingLeft="12dp"
39+
android:paddingRight="12dp"
40+
android:paddingTop="4dp"
41+
android:paddingBottom="4dp"
42+
android:gravity="center_vertical"
43+
>
44+
<LinearLayout
45+
android:id="@+id/line1"
46+
android:layout_width="match_parent"
47+
android:layout_height="wrap_content"
48+
android:orientation="horizontal"
49+
>
50+
<TextView android:id="@+id/title"
51+
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
52+
android:layout_width="match_parent"
53+
android:layout_height="wrap_content"
54+
android:singleLine="true"
55+
android:ellipsize="marquee"
56+
android:fadingEdge="horizontal"
57+
android:layout_weight="1"
58+
/>
59+
<ViewStub android:id="@+id/time"
60+
android:layout_width="wrap_content"
61+
android:layout_height="wrap_content"
62+
android:layout_gravity="center"
63+
android:layout_weight="0"
64+
android:visibility="gone"
65+
android:layout="@layout/notification_template_part_time"
66+
/>
67+
<ViewStub android:id="@+id/chronometer"
68+
android:layout_width="wrap_content"
69+
android:layout_height="wrap_content"
70+
android:layout_gravity="center"
71+
android:layout_weight="0"
72+
android:visibility="gone"
73+
android:layout="@layout/notification_template_part_chronometer"
74+
/>
75+
</LinearLayout>
76+
<TextView android:id="@+id/text2"
77+
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Line2"
78+
android:layout_width="match_parent"
79+
android:layout_height="wrap_content"
80+
android:layout_marginTop="-2dp"
81+
android:layout_mgarginBottom="-2dp"
82+
android:singleLine="true"
83+
android:fadingEdge="horizontal"
84+
android:ellipsize="marquee"
85+
android:visibility="gone"
86+
/>
87+
<TextView android:id="@+id/big_text"
88+
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
89+
android:layout_width="match_parent"
90+
android:layout_height="wrap_content"
91+
android:singleLine="false"
92+
android:visibility="gone"
93+
/>
94+
<LinearLayout
95+
android:id="@+id/line3"
96+
android:layout_width="match_parent"
97+
android:layout_height="wrap_content"
98+
android:orientation="horizontal"
99+
>
100+
<TextView android:id="@+id/text"
101+
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
102+
android:layout_width="0dp"
103+
android:layout_height="wrap_content"
104+
android:layout_weight="1"
105+
android:layout_gravity="center"
106+
android:singleLine="true"
107+
android:ellipsize="marquee"
108+
android:fadingEdge="horizontal"
109+
/>
110+
<TextView android:id="@+id/info"
111+
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info"
112+
android:layout_width="wrap_content"
113+
android:layout_height="wrap_content"
114+
android:layout_gravity="center"
115+
android:layout_weight="0"
116+
android:singleLine="true"
117+
android:gravity="center"
118+
android:paddingLeft="8dp"
119+
/>
120+
<ImageView android:id="@+id/right_icon"
121+
android:layout_width="wrap_content"
122+
android:layout_height="wrap_content"
123+
android:layout_gravity="center"
124+
android:layout_weight="0"
125+
android:scaleType="center"
126+
android:paddingLeft="8dp"
127+
android:visibility="gone"
128+
android:drawableAlpha="180"
129+
/>
130+
</LinearLayout>
131+
<ProgressBar
132+
android:id="@android:id/progress"
133+
android:layout_width="match_parent"
134+
android:layout_height="wrap_content"
135+
android:visibility="gone"
136+
style="?android:attr/progressBarStyleHorizontal"
137+
/>
138+
<LinearLayout
139+
android:id="@+id/actions"
140+
android:layout_width="match_parent"
141+
android:layout_height="wrap_content"
142+
android:visibility="gone"
143+
>
144+
<!-- actions will be added here -->
145+
</LinearLayout>
146+
</LinearLayout>
147+
</FrameLayout>

core/res/res/values/public.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,7 @@
10881088
<java-symbol type="layout" name="notification_intruder_content" />
10891089
<java-symbol type="layout" name="notification_template_base" />
10901090
<java-symbol type="layout" name="notification_template_big_picture" />
1091+
<java-symbol type="layout" name="notification_template_big_text" />
10911092
<java-symbol type="layout" name="notification_template_part_time" />
10921093
<java-symbol type="layout" name="notification_template_part_chronometer" />
10931094
<java-symbol type="layout" name="notification_template_inbox" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2012 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<SizeAdaptiveLayout xmlns:android="http://schemas.android.com/apk/res/android"
17+
android:background="@android:color/background_dark"
18+
android:id="@+id/notification_adaptive_wrapper"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content" />

packages/SystemUI/res/layout/status_bar_notification_row.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
22
android:layout_width="match_parent"
3-
android:layout_height="@dimen/notification_height"
3+
android:layout_height="wrap_content"
44
>
55

66
<Button
@@ -21,7 +21,14 @@
2121
android:focusable="true"
2222
android:clickable="true"
2323
android:background="@drawable/notification_row_bg"
24-
/>
24+
>
25+
26+
<com.android.internal.widget.SizeAdaptiveLayout android:id="@+id/adaptive"
27+
android:background="@android:color/background_dark"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content" />
30+
31+
</com.android.systemui.statusbar.LatestItemView>
2532

2633
<View
2734
android:layout_width="match_parent"

packages/SystemUI/res/values/dimens.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@
5555
<!-- Height of notification icons in the status bar -->
5656
<dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
5757

58+
<!-- Height of a small notification in the status bar -->
59+
<dimen name="notification_min_height">@android:dimen/notification_large_icon_height</dimen>
60+
61+
<!-- Height of a small notification in the status bar -->
62+
<!-- TODO: change this back to 256dp once we deal with actions. -->
63+
<dimen name="notification_max_height">320dp</dimen>
64+
5865
<!-- size at which Notification icons will be drawn in the status bar -->
5966
<dimen name="status_bar_icon_drawing_size">18dip</dimen>
6067

0 commit comments

Comments
 (0)