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

Commit 891718ac authored by Luan Nguyen's avatar Luan Nguyen
Browse files

docs: Fix notification api guide issues (7461154, 12765600)

bug: 7461154
bug: 12765600
Change-Id: Ib4aff7f6481a514bf01894cad4984fed09f015e2
parent eba583e3
Loading
Loading
Loading
Loading
+10 −9
Original line number Original line Diff line number Diff line
@@ -663,20 +663,21 @@ mNotificationManager.notify(id, builder.build());
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
// Creates an Intent for the Activity
// Creates an Intent for the Activity
Intent notifyIntent =
Intent notifyIntent =
        new Intent(new ComponentName(this, ResultActivity.class));
        new Intent(this, ResultActivity.class);
// Sets the Activity to start in a new, empty task
// Sets the Activity to start in a new, empty task
notifyIntent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                        | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// Creates the PendingIntent
// Creates the PendingIntent
PendingIntent notifyIntent =
PendingIntent notifyPendingIntent =
        PendingIntent.getActivity(
        PendingIntent.getActivity(
        this,
        this,
        0,
        0,
        notifyIntent
        notifyIntent,
        PendingIntent.FLAG_UPDATE_CURRENT
        PendingIntent.FLAG_UPDATE_CURRENT
);
);


// Puts the PendingIntent into the notification builder
// Puts the PendingIntent into the notification builder
builder.setContentIntent(notifyIntent);
builder.setContentIntent(notifyPendingIntent);
// Notifications are issued by sending them to the
// Notifications are issued by sending them to the
// NotificationManager system service.
// NotificationManager system service.
NotificationManager mNotificationManager =
NotificationManager mNotificationManager =
@@ -715,7 +716,7 @@ mNotificationManager.notify(id, builder.build());
<h3 id="FixedProgress">Displaying a fixed-duration progress indicator</h3>
<h3 id="FixedProgress">Displaying a fixed-duration progress indicator</h3>
<p>
<p>
    To display a determinate progress bar, add the bar to your notification by calling
    To display a determinate progress bar, add the bar to your notification by calling
    {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress()
    {@link android.support.v4.app.NotificationCompat.Builder#setProgress
    setProgress(max, progress, false)} and then issue the notification. As your operation proceeds,
    setProgress(max, progress, false)} and then issue the notification. As your operation proceeds,
    increment <code>progress</code>, and update the notification. At the end of the operation,
    increment <code>progress</code>, and update the notification. At the end of the operation,
    <code>progress</code> should equal <code>max</code>. A common way to call
    <code>progress</code> should equal <code>max</code>. A common way to call
@@ -727,7 +728,7 @@ mNotificationManager.notify(id, builder.build());
    You can either leave the progress bar showing when the operation is done, or remove it. In
    You can either leave the progress bar showing when the operation is done, or remove it. In
    either case, remember to update the notification text to show that the operation is complete.
    either case, remember to update the notification text to show that the operation is complete.
    To remove the progress bar, call
    To remove the progress bar, call
    {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress()
    {@link android.support.v4.app.NotificationCompat.Builder#setProgress
    setProgress(0, 0, false)}. For example:
    setProgress(0, 0, false)}. For example:
</p>
</p>
<pre>
<pre>
@@ -783,8 +784,8 @@ new Thread(
<p>
<p>
    Issue the notification at the beginning of the operation. The animation will run until you
    Issue the notification at the beginning of the operation. The animation will run until you
    modify your notification. When the operation is done, call
    modify your notification. When the operation is done, call
    {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress()
    {@link android.support.v4.app.NotificationCompat.Builder#setProgress setProgress(0, 0, false)}
    setProgress(0, 0, false)} and then update the notification to remove the activity indicator.
    and then update the notification to remove the activity indicator.
    Always do this; otherwise, the animation will run even when the operation is complete. Also
    Always do this; otherwise, the animation will run even when the operation is complete. Also
    remember to change the notification text to indicate that the operation is complete.
    remember to change the notification text to indicate that the operation is complete.
</p>
</p>