Commit 92489a7f authored by Grigory Fedorov's avatar Grigory Fedorov

Message notification provides back stack - back or up buttons leads to contact list #456

http://developer.android.com/design/patterns/navigation.html#into-your-app
parent 8a8071e0
...@@ -15,6 +15,7 @@ import com.xabber.android.data.message.MessageItem; ...@@ -15,6 +15,7 @@ import com.xabber.android.data.message.MessageItem;
import com.xabber.android.data.message.chat.ChatManager; import com.xabber.android.data.message.chat.ChatManager;
import com.xabber.android.data.roster.RosterManager; import com.xabber.android.data.roster.RosterManager;
import com.xabber.android.ui.ChatViewer; import com.xabber.android.ui.ChatViewer;
import com.xabber.android.ui.ContactList;
import com.xabber.android.ui.helper.AccountPainter; import com.xabber.android.ui.helper.AccountPainter;
import com.xabber.android.utils.StringUtils; import com.xabber.android.utils.StringUtils;
...@@ -22,6 +23,7 @@ import java.util.List; ...@@ -22,6 +23,7 @@ import java.util.List;
public class MessageNotificationCreator { public class MessageNotificationCreator {
private static int UNIQUE_REQUEST_CODE = 0;
private final Application application; private final Application application;
private final AccountPainter accountPainter; private final AccountPainter accountPainter;
private List<MessageNotification> messageNotifications; private List<MessageNotification> messageNotifications;
...@@ -194,10 +196,12 @@ public class MessageNotificationCreator { ...@@ -194,10 +196,12 @@ public class MessageNotificationCreator {
} }
private PendingIntent getIntent(MessageNotification message) { private PendingIntent getIntent(MessageNotification message) {
Intent chatIntent Intent backIntent = ContactList.createIntent(application);
= ChatViewer.createClearTopIntent(application, message.getAccount(), message.getUser()); backIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(application, 0, chatIntent, PendingIntent.FLAG_UPDATE_CURRENT); Intent intent = ChatViewer.createClearTopIntent(application, message.getAccount(), message.getUser());
return PendingIntent.getActivities(application, UNIQUE_REQUEST_CODE++,
new Intent[]{backIntent, intent}, PendingIntent.FLAG_ONE_SHOT);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment