Skip to content
Snippets Groups Projects
Commit 4fdcbca3 authored by akwizgran's avatar akwizgran
Browse files

Add a back stack to activities launched from notifications.

See
https://developer.android.com/guide/topics/ui/notifiers/notifications.html#NotificationResponse
parent a1ca8e0e
No related branches found
No related tags found
No related merge requests found
......@@ -58,7 +58,12 @@
<activity
android:name=".android.contact.ContactListActivity"
android:logo="@drawable/logo"
android:label="@string/contact_list_title" >
android:label="@string/contact_list_title"
android:parentActivityName=".android.HomeScreenActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.HomeScreenActivity"
/>
</activity>
<activity
android:name=".android.contact.ConversationActivity"
......@@ -93,7 +98,12 @@
<activity
android:name=".android.groups.GroupListActivity"
android:logo="@drawable/logo"
android:label="@string/forums_title" >
android:label="@string/forums_title"
android:parentActivityName=".android.HomeScreenActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".android.HomeScreenActivity"
/>
</activity>
<activity
android:name=".android.groups.ManageGroupsActivity"
......
......@@ -38,6 +38,7 @@ import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
public class BriarService extends RoboService implements EventListener {
......@@ -192,7 +193,10 @@ public class BriarService extends RoboService implements EventListener {
b.setDefaults(DEFAULT_ALL);
Intent i = new Intent(this, ContactListActivity.class);
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_SINGLE_TOP);
b.setContentIntent(PendingIntent.getActivity(this, 0, i, 0));
TaskStackBuilder tsb = TaskStackBuilder.create(this);
tsb.addParentStack(ContactListActivity.class);
tsb.addNextIntent(i);
b.setContentIntent(tsb.getPendingIntent(0, 0));
Object o = getSystemService(NOTIFICATION_SERVICE);
NotificationManager nm = (NotificationManager) o;
nm.notify(PRIVATE_MESSAGE_NOTIFICATION_ID, b.build());
......@@ -207,7 +211,10 @@ public class BriarService extends RoboService implements EventListener {
b.setDefaults(DEFAULT_ALL);
Intent i = new Intent(this, GroupListActivity.class);
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_SINGLE_TOP);
b.setContentIntent(PendingIntent.getActivity(this, 0, i, 0));
TaskStackBuilder tsb = TaskStackBuilder.create(this);
tsb.addParentStack(GroupListActivity.class);
tsb.addNextIntent(i);
b.setContentIntent(tsb.getPendingIntent(0, 0));
Object o = getSystemService(NOTIFICATION_SERVICE);
NotificationManager nm = (NotificationManager) o;
nm.notify(GROUP_POST_NOTIFICATION_ID, b.build());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment