Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05dbd903 authored by Scott Main's avatar Scott Main Committed by Android Git Automerger
Browse files

am 4975af77: am 6b77a76d: am 5dc7ac74: am a7b56a20: am e249763d: small update...

am 4975af77: am 6b77a76d: am 5dc7ac74: am a7b56a20: am e249763d: small update to Toast guide, flatten sidenav for notifications/toasts, new screenshots for notifications

* commit '4975af77':
  small update to Toast guide, flatten sidenav for notifications/toasts, new screenshots for notifications
parents 935db6c5 4975af77
Loading
Loading
Loading
Loading
+9 −16
Original line number Diff line number Diff line
@@ -191,28 +191,21 @@
      <li><a href="<?cs var:toroot ?>guide/topics/ui/menus.html">
          <span class="en">Menus</span></span>
          </a></li>
      <li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html">
           <span class="en">Dialogs</span>
          </a></li>
      <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html">
           <span class="en">Action Bar</span>
          </a></li>
      <li><a href="<?cs var:toroot ?>guide/topics/ui/settings.html">
            <span class="en">Settings</span>
          </a></li>
      <li class="nav-section">
          <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html">
              <span class="en">Notifications</span>
            </a></div>
          <ul>
          <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/toasts.html">
              <span class="en">Toast Notifications</span>
      <li><a href="<?cs var:toroot ?>guide/topics/ui/dialogs.html">
           <span class="en">Dialogs</span>
          </a></li>
      <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/notifications.html">
              <span class="en">Status Notifications</span>
          <span class="en">Notifications</span>
        </a></li>
      <li><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/toasts.html">
          <span class="en">Toasts</span>
        </a></li>
          </ul>
      </li>
      <li class="nav-section">
        <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/search/index.html">
            <span class="en">Search</span>
+38 −22
Original line number Diff line number Diff line
@@ -5,25 +5,42 @@ page.title=Notifications
<div id="qv">
<h2>In this document</h2>
<ol>
        <li>
            <a href="#NotificationUI">Notification Display Elements</a>
        </li>
        <li>
        <a href="#CreateNotification">Creating a Notification</a>
  <li><a href="#NotificationUI">Notification Display Elements</a>
    <ol>
      <li><a href="#NormalNotify">Normal view</a></li>
      <li><a href="#BigNotify">Big view</a></li>
    </ol>
  </li>
        <li>
            <a href="#Managing">Managing Notifications</a>
  <li><a href="#CreateNotification">Creating a Notification</a>
    <ol>
      <li><a href="#Required">Required notification contents</a></li>
      <li><a href="#Optional">Optional notification contents and settings</a></li>
      <li><a href="#Actions">Notification actions</a></li>
      <li><a href="#SimpleNotification">Creating a simple notification</a></li>
      <li><a href="#ApplyStyle">Applying a big view style to a notification</a></li>
    </ol>
  </li>
        <li>
            <a href="#NotificationResponse">Preserving Navigation when Starting an Activity</a>
  <li><a href="#Managing">Managing Notifications</a>
    <ol>
      <li><a href="#Updating">Updating notifications</a></li>
      <li><a href="#Removing">Removing notifications</a></li>
    </ol>
  </li>
        <li>
            <a href="#Progress">Displaying Progress in a Notification</a>
  <li><a href="#NotificationResponse">Preserving Navigation when Starting an Activity</a>
    <ol>
      <li><a href="#DirectEntry">Setting up a regular activity PendingIntent</a></li>
      <li><a href="#ExtendedNotification">Setting up a special activity PendingIntent</a></li>
    </ol>
  </li>
        <li>
            <a href="#CustomNotification">Custom Notification Layouts</a>
  <li><a href="#Progress">Displaying Progress in a Notification</a>
    <ol>
      <li><a href="#FixedProgress">Displaying a fixed-duration progress indicator</a></li>
      <li><a href="#ActivityIndicator">Displaying a continuing activity indicator</a></li>
    </ol>
  </li>
  <li><a href="#CustomNotification">Custom Notification Layouts</a></li>
</ol>

    <h2>Key classes</h2>
    <ol>
        <li>{@link android.app.NotificationManager}</li>
@@ -54,13 +71,12 @@ page.title=Notifications
<img
    id="figure1"
    src="{@docRoot}images/ui/notifications/iconic_notification.png"
    height="32"
    alt="" />
    height="120" alt="" />
<p class="img-caption">
    <strong>Figure 1.</strong> Notifications in the notification area.
</p>
<img id="figure2" src="{@docRoot}images/ui/notifications/normal_notification.png"
    height="240" alt="" />
     height="293" alt="" />
<p class="img-caption">
    <strong>Figure 2.</strong> Notifications in the notification drawer.
</p>
@@ -98,7 +114,7 @@ page.title=Notifications
<img
    src="{@docRoot}images/ui/notifications/normal_notification_callouts.png"
    alt=""
    height="204"
    height="153"
    id="figure3" />
<p class="img-caption">
  <strong>Figure 3.</strong> Notification in normal view.
+17 −35
Original line number Diff line number Diff line
page.title=Toast Notifications
parent.title=Notifications
parent.link=index.html
page.title=Toasts
@jd:body

<div id="qv-wrapper">
  <div id="qv">    
    <h2>Quickview</h2>
    <ol>
      <li>A toast is a message that appears on the surface of the screen for a moment, but it
does not take focus (or pause the current activity), so it cannot accept user input</li>
      <li>You can customize the toast layout to include images</li>
    </ol>
    
    <h2>In this document</h2>
    <ol>
      <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
  </div>
</div>

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

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

<p>A toast can be created and displayed from an {@link android.app.Activity} or 
{@link android.app.Service}. If you create a toast notification from a Service, it
appears in front of the Activity currently in focus.</p>

<p>If user response to the notification is required, consider using a 
<a href="notifications.html">Status Bar Notification</a>.</p>
<p>If user response to a status message is required, consider instead using a 
<a href="{@docRoot}guide/topics/ui/notifiers/notifications.html">Notification</a>.</p>


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

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

<img src="{@docRoot}images/custom_toast.png" alt="" style="float:right" />

<p>If a simple text message isn't enough, you can create a customized layout for your
toast notification. To create a custom layout, define a View layout,
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>
              android:orientation="horizontal"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:padding="10dp"
              android:padding="8dp"
              android:background="#DAAA"
              >
    &lt;ImageView android:id="@+id/image"
    &lt;ImageView android:src="@drawable/droid"
               android:layout_width="wrap_content"
               android:layout_height="fill_parent"
               android:layout_marginRight="10dp"
               android:layout_height="wrap_content"
               android:layout_marginRight="8dp"
               />
    &lt;TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:layout_height="wrap_content"
              android:textColor="#FFF"
              />
&lt;/LinearLayout>
@@ -126,13 +110,11 @@ ID to inflate the layout from the XML, as shown here:</p>

<pre>
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.toast_layout,
View layout = inflater.inflate(R.layout.custom_toast,
                               (ViewGroup) findViewById(R.id.toast_layout_root));

ImageView image = (ImageView) layout.findViewById(R.id.image);
image.setImageResource(R.drawable.android);
TextView text = (TextView) layout.findViewById(R.id.text);
text.setText("Hello! This is a custom toast!");
text.setText("This is a custom toast");

Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
+39.9 KiB (46.3 KiB)
Loading image diff...
+14.7 KiB (21.3 KiB)
Loading image diff...
Loading