Skip to content

Commit 6b77a76

Browse files
scottamainAndroid Git Automerger
authored andcommitted
am 5dc7ac7: am a7b56a2: am e249763: small update to Toast guide, flatten sidenav for notifications/toasts, new screenshots for notifications
* commit '5dc7ac745300fb043267a0c9235244a115507c51': small update to Toast guide, flatten sidenav for notifications/toasts, new screenshots for notifications
2 parents 4c38e24 + 5dc7ac7 commit 6b77a76

File tree

7 files changed

+64
-73
lines changed

7 files changed

+64
-73
lines changed

docs/html/guide/guide_toc.cs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,28 +191,21 @@ localized titles are added in the language order specified below.
191191
<li><a href="<?cs var:toroot ?>guide/topics/ui/menus.html">
192192
<span class="en">Menus</span></span>
193193
</a></li>
194-
<li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html">
195-
<span class="en">Dialogs</span>
196-
</a></li>
197194
<li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html">
198195
<span class="en">Action Bar</span>
199196
</a></li>
200197
<li><a href="<?cs var:toroot ?>guide/topics/ui/settings.html">
201198
<span class="en">Settings</span>
202199
</a></li>
203-
<li class="nav-section">
204-
<div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html">
205-
<span class="en">Notifications</span>
206-
</a></div>
207-
<ul>
208-
<li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/toasts.html">
209-
<span class="en">Toast Notifications</span>
210-
</a></li>
211-
<li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/notifications.html">
212-
<span class="en">Status Notifications</span>
213-
</a></li>
214-
</ul>
215-
</li>
200+
<li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html">
201+
<span class="en">Dialogs</span>
202+
</a></li>
203+
<li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/notifications.html">
204+
<span class="en">Notifications</span>
205+
</a></li>
206+
<li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/toasts.html">
207+
<span class="en">Toasts</span>
208+
</a></li>
216209
<li class="nav-section">
217210
<div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/search/index.html">
218211
<span class="en">Search</span>

docs/html/guide/topics/ui/notifiers/notifications.jd

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,43 @@ page.title=Notifications
44
<div id="qv-wrapper">
55
<div id="qv">
66
<h2>In this document</h2>
7+
<ol>
8+
<li><a href="#NotificationUI">Notification Display Elements</a>
79
<ol>
8-
<li>
9-
<a href="#NotificationUI">Notification Display Elements</a>
10-
</li>
11-
<li>
12-
<a href="#CreateNotification">Creating a Notification</a>
13-
</li>
14-
<li>
15-
<a href="#Managing">Managing Notifications</a>
16-
</li>
17-
<li>
18-
<a href="#NotificationResponse">Preserving Navigation when Starting an Activity</a>
19-
</li>
20-
<li>
21-
<a href="#Progress">Displaying Progress in a Notification</a>
22-
</li>
23-
<li>
24-
<a href="#CustomNotification">Custom Notification Layouts</a>
25-
</li>
10+
<li><a href="#NormalNotify">Normal view</a></li>
11+
<li><a href="#BigNotify">Big view</a></li>
12+
</ol>
13+
</li>
14+
<li><a href="#CreateNotification">Creating a Notification</a>
15+
<ol>
16+
<li><a href="#Required">Required notification contents</a></li>
17+
<li><a href="#Optional">Optional notification contents and settings</a></li>
18+
<li><a href="#Actions">Notification actions</a></li>
19+
<li><a href="#SimpleNotification">Creating a simple notification</a></li>
20+
<li><a href="#ApplyStyle">Applying a big view style to a notification</a></li>
21+
</ol>
22+
</li>
23+
<li><a href="#Managing">Managing Notifications</a>
24+
<ol>
25+
<li><a href="#Updating">Updating notifications</a></li>
26+
<li><a href="#Removing">Removing notifications</a></li>
27+
</ol>
28+
</li>
29+
<li><a href="#NotificationResponse">Preserving Navigation when Starting an Activity</a>
30+
<ol>
31+
<li><a href="#DirectEntry">Setting up a regular activity PendingIntent</a></li>
32+
<li><a href="#ExtendedNotification">Setting up a special activity PendingIntent</a></li>
33+
</ol>
34+
</li>
35+
<li><a href="#Progress">Displaying Progress in a Notification</a>
36+
<ol>
37+
<li><a href="#FixedProgress">Displaying a fixed-duration progress indicator</a></li>
38+
<li><a href="#ActivityIndicator">Displaying a continuing activity indicator</a></li>
2639
</ol>
40+
</li>
41+
<li><a href="#CustomNotification">Custom Notification Layouts</a></li>
42+
</ol>
43+
2744
<h2>Key classes</h2>
2845
<ol>
2946
<li>{@link android.app.NotificationManager}</li>
@@ -54,13 +71,12 @@ page.title=Notifications
5471
<img
5572
id="figure1"
5673
src="{@docRoot}images/ui/notifications/iconic_notification.png"
57-
height="32"
58-
alt="" />
74+
height="120" alt="" />
5975
<p class="img-caption">
6076
<strong>Figure 1.</strong> Notifications in the notification area.
6177
</p>
6278
<img id="figure2" src="{@docRoot}images/ui/notifications/normal_notification.png"
63-
height="240" alt="" />
79+
height="293" alt="" />
6480
<p class="img-caption">
6581
<strong>Figure 2.</strong> Notifications in the notification drawer.
6682
</p>
@@ -98,7 +114,7 @@ page.title=Notifications
98114
<img
99115
src="{@docRoot}images/ui/notifications/normal_notification_callouts.png"
100116
alt=""
101-
height="204"
117+
height="153"
102118
id="figure3" />
103119
<p class="img-caption">
104120
<strong>Figure 3.</strong> Notification in normal view.

docs/html/guide/topics/ui/notifiers/toasts.jd

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
page.title=Toast Notifications
2-
parent.title=Notifications
3-
parent.link=index.html
1+
page.title=Toasts
42
@jd:body
53

64
<div id="qv-wrapper">
7-
<div id="qv">
8-
<h2>Quickview</h2>
9-
<ol>
10-
<li>A toast is a message that appears on the surface of the screen for a moment, but it
11-
does not take focus (or pause the current activity), so it cannot accept user input</li>
12-
<li>You can customize the toast layout to include images</li>
13-
</ol>
14-
5+
<div id="qv">
156
<h2>In this document</h2>
167
<ol>
178
<li><a href="#Basics">The Basics</a></li>
@@ -26,22 +17,17 @@ does not take focus (or pause the current activity), so it cannot accept user in
2617
</div>
2718
</div>
2819

29-
<p>A toast notification is a message that pops up on the surface of the window.
30-
It only fills the amount of space required for the message and the user's current
31-
activity remains visible and interactive. The notification automatically fades in and
32-
out, and does not accept interaction events.</p>
20+
<p>A toast provides simple feedback about an operation in a small popup.
21+
It only fills the amount of space required for the message and the current
22+
activity remains visible and interactive.
23+
For example, navigating away from an email before you send it triggers a
24+
"Draft saved" toast to let you know that you can continue editing later.
25+
Toasts automatically disappear after a timeout.</p>
3326

34-
<p>The screenshot below shows an example toast notification from the Alarm application.
35-
Once an alarm is turned on, a toast is displayed to assure you that the
36-
alarm was set.</p>
3727
<img src="{@docRoot}images/toast.png" alt="" />
3828

39-
<p>A toast can be created and displayed from an {@link android.app.Activity} or
40-
{@link android.app.Service}. If you create a toast notification from a Service, it
41-
appears in front of the Activity currently in focus.</p>
42-
43-
<p>If user response to the notification is required, consider using a
44-
<a href="notifications.html">Status Bar Notification</a>.</p>
29+
<p>If user response to a status message is required, consider instead using a
30+
<a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notification</a>.</p>
4531

4632

4733
<h2 id="Basics">The Basics</h2>
@@ -90,8 +76,6 @@ To nudge it down, increase the value of the last parameter.
9076

9177
<h2 id="CustomToastView">Creating a Custom Toast View</h2>
9278

93-
<img src="{@docRoot}images/custom_toast.png" alt="" style="float:right" />
94-
9579
<p>If a simple text message isn't enough, you can create a customized layout for your
9680
toast notification. To create a custom layout, define a View layout,
9781
in XML or in your application code, and pass the root {@link android.view.View} object
@@ -105,17 +89,17 @@ with the following XML (saved as <em>toast_layout.xml</em>):</p>
10589
android:orientation="horizontal"
10690
android:layout_width="fill_parent"
10791
android:layout_height="fill_parent"
108-
android:padding="10dp"
92+
android:padding="8dp"
10993
android:background="#DAAA"
11094
>
111-
&lt;ImageView android:id="@+id/image"
95+
&lt;ImageView android:src="@drawable/droid"
11296
android:layout_width="wrap_content"
113-
android:layout_height="fill_parent"
114-
android:layout_marginRight="10dp"
97+
android:layout_height="wrap_content"
98+
android:layout_marginRight="8dp"
11599
/>
116100
&lt;TextView android:id="@+id/text"
117101
android:layout_width="wrap_content"
118-
android:layout_height="fill_parent"
102+
android:layout_height="wrap_content"
119103
android:textColor="#FFF"
120104
/>
121105
&lt;/LinearLayout>
@@ -126,13 +110,11 @@ ID to inflate the layout from the XML, as shown here:</p>
126110

127111
<pre>
128112
LayoutInflater inflater = getLayoutInflater();
129-
View layout = inflater.inflate(R.layout.toast_layout,
113+
View layout = inflater.inflate(R.layout.custom_toast,
130114
(ViewGroup) findViewById(R.id.toast_layout_root));
131115

132-
ImageView image = (ImageView) layout.findViewById(R.id.image);
133-
image.setImageResource(R.drawable.android);
134116
TextView text = (TextView) layout.findViewById(R.id.text);
135-
text.setText("Hello! This is a custom toast!");
117+
text.setText("This is a custom toast");
136118

137119
Toast toast = new Toast(getApplicationContext());
138120
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);

docs/html/images/toast.png

39.9 KB
Loading
14.7 KB
Loading
31.3 KB
Loading
6.41 KB
Loading

0 commit comments

Comments
 (0)