Skip to content

Commit 156c792

Browse files
cwrenAndroid (Google) Code Review
authored andcommitted
Merge "Don't allow notificaitons to be larger than 4U, even with actions. Limit BigText template to a fixed number of lines. Optimize layout of BigText and Inbox for expansion." into jb-dev
2 parents b23341e + ca7b7d0 commit 156c792

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

core/res/res/layout/notification_template_big_text.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,16 @@
4343
<LinearLayout
4444
android:layout_width="match_parent"
4545
android:layout_height="wrap_content"
46-
android:minHeight="@dimen/notification_large_icon_height"
4746
android:orientation="vertical"
48-
>
47+
android:layout_weight="1"
48+
>
4949
<LinearLayout
5050
android:id="@+id/line1"
5151
android:layout_width="match_parent"
5252
android:layout_height="wrap_content"
5353
android:orientation="horizontal"
54+
android:layout_gravity="top"
55+
android:layout_weight="0"
5456
>
5557
<TextView android:id="@+id/title"
5658
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
@@ -87,24 +89,29 @@
8789
android:singleLine="true"
8890
android:fadingEdge="horizontal"
8991
android:ellipsize="marquee"
92+
android:layout_weight="0"
9093
android:visibility="gone"
9194
/>
9295
<TextView android:id="@+id/big_text"
9396
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
9497
android:layout_width="match_parent"
95-
android:layout_height="wrap_content"
98+
android:layout_height="0dp"
9699
android:layout_marginTop="2dp"
97100
android:layout_marginBottom="2dp"
98101
android:singleLine="false"
99102
android:visibility="gone"
103+
android:maxLines="8"
104+
android:ellipsize="end"
105+
android:layout_weight="1"
100106
/>
101107
</LinearLayout>
102108
<LinearLayout
103109
android:id="@+id/actions"
104110
android:layout_width="match_parent"
105-
android:layout_height="wrap_content"
111+
android:layout_height="0dp"
106112
android:orientation="vertical"
107113
android:visibility="gone"
114+
android:layout_weight="1"
108115
>
109116
<!-- actions will be added here -->
110117
</LinearLayout>
@@ -116,13 +123,14 @@
116123
android:ellipsize="marquee"
117124
android:fadingEdge="horizontal"
118125
android:visibility="gone"
119-
android:layout_weight="1"
126+
android:layout_weight="0"
120127
/>
121128
<LinearLayout
122129
android:id="@+id/line3"
123130
android:layout_width="match_parent"
124131
android:layout_height="wrap_content"
125132
android:orientation="horizontal"
133+
android:layout_weight="1"
126134
>
127135
<TextView android:id="@+id/text"
128136
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
@@ -160,6 +168,7 @@
160168
android:layout_width="match_parent"
161169
android:layout_height="wrap_content"
162170
android:visibility="gone"
171+
android:layout_weight="0"
163172
style="?android:attr/progressBarStyleHorizontal"
164173
/>
165174
</LinearLayout>

core/res/res/layout/notification_template_inbox.xml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
android:layout_width="match_parent"
4848
android:layout_height="wrap_content"
4949
android:orientation="horizontal"
50+
android:layout_weight="0"
5051
>
5152
<TextView android:id="@+id/title"
5253
android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title"
@@ -84,62 +85,69 @@
8485
android:fadingEdge="horizontal"
8586
android:ellipsize="marquee"
8687
android:visibility="gone"
88+
android:layout_weight="0"
8789
/>
8890
<TextView android:id="@+id/inbox_text0"
8991
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
9092
android:layout_width="match_parent"
91-
android:layout_height="wrap_content"
93+
android:layout_height="0dp"
9294
android:singleLine="true"
9395
android:ellipsize="end"
9496
android:paddingTop="4dp"
9597
android:paddingBottom="4dp"
9698
android:visibility="gone"
99+
android:layout_weight="1"
97100
/>
98101
<TextView android:id="@+id/inbox_text1"
99102
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
100103
android:layout_width="match_parent"
101-
android:layout_height="wrap_content"
104+
android:layout_height="0dp"
102105
android:singleLine="true"
103106
android:ellipsize="end"
104107
android:paddingTop="4dp"
105108
android:paddingBottom="4dp"
106109
android:visibility="gone"
110+
android:layout_weight="1"
107111
/>
108112
<TextView android:id="@+id/inbox_text2"
109113
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
110114
android:layout_width="match_parent"
111-
android:layout_height="wrap_content"
115+
android:layout_height="0dp"
112116
android:singleLine="true"
113117
android:ellipsize="end"
114118
android:paddingTop="4dp"
115119
android:paddingBottom="4dp"
116120
android:visibility="gone"
121+
android:layout_weight="1"
117122
/>
118123
<TextView android:id="@+id/inbox_text3"
119124
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
120125
android:layout_width="match_parent"
121-
android:layout_height="wrap_content"
126+
android:layout_height="0dp"
122127
android:singleLine="true"
123128
android:ellipsize="end"
124129
android:paddingTop="4dp"
125130
android:paddingBottom="4dp"
126131
android:visibility="gone"
132+
android:layout_weight="1"
127133
/>
128134
<TextView android:id="@+id/inbox_text4"
129135
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
130136
android:layout_width="match_parent"
131-
android:layout_height="wrap_content"
137+
android:layout_height="0dp"
132138
android:singleLine="true"
133139
android:ellipsize="end"
134140
android:paddingTop="4dp"
135141
android:paddingBottom="4dp"
136142
android:visibility="gone"
143+
android:layout_weight="1"
137144
/>
138145
<LinearLayout
139146
android:id="@+id/actions"
140147
android:layout_width="match_parent"
141148
android:layout_height="wrap_content"
142149
android:orientation="vertical"
150+
android:layout_weight="0"
143151
android:visibility="gone"
144152
>
145153
<!-- actions will be added here -->
@@ -152,13 +160,14 @@
152160
android:ellipsize="marquee"
153161
android:fadingEdge="horizontal"
154162
android:visibility="gone"
155-
android:layout_weight="1"
163+
android:layout_weight="0"
156164
/>
157165
<LinearLayout
158166
android:id="@+id/line3"
159167
android:layout_width="match_parent"
160168
android:layout_height="wrap_content"
161169
android:orientation="horizontal"
170+
android:layout_weight="0"
162171
>
163172
<TextView android:id="@+id/text"
164173
android:textAppearance="@style/TextAppearance.StatusBar.EventContent"
@@ -196,6 +205,7 @@
196205
android:layout_width="match_parent"
197206
android:layout_height="wrap_content"
198207
android:visibility="gone"
208+
android:layout_weight="0"
199209
style="?android:attr/progressBarStyleHorizontal"
200210
/>
201211
</LinearLayout>

packages/SystemUI/res/values/dimens.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@
5858
<!-- Height of a small notification in the status bar plus glow, padding, etc -->
5959
<dimen name="notification_min_height">72dp</dimen>
6060

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>
61+
<!-- Height of a large notification in the status bar -->
62+
<dimen name="notification_max_height">256dp</dimen>
6463

6564
<!-- size at which Notification icons will be drawn in the status bar -->
6665
<dimen name="status_bar_icon_drawing_size">18dip</dimen>

0 commit comments

Comments
 (0)