Navigate to unified inbox from notification or widget

pull/146/head
M66B 6 years ago
parent b0eeff6846
commit 203fcc1eba

@ -359,16 +359,21 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Intent intent = getIntent(); Intent intent = getIntent();
String action = intent.getAction(); String action = intent.getAction();
Log.i(Helper.TAG, "View intent=" + intent + " action=" + action); Log.i(Helper.TAG, "View intent=" + intent + " action=" + action);
if (action != null && action.startsWith("thread")) { if (action != null) {
intent.setAction(null); intent.setAction(null);
setIntent(intent); setIntent(intent);
if ("unified".equals(action))
getSupportFragmentManager().popBackStack("unified", 0);
else if (action.startsWith("thread")) {
ViewModelMessages model = ViewModelProviders.of(this).get(ViewModelMessages.class); ViewModelMessages model = ViewModelProviders.of(this).get(ViewModelMessages.class);
model.setMessages(null); model.setMessages(null);
intent.putExtra("thread", action.split(":", 2)[1]); intent.putExtra("thread", action.split(":", 2)[1]);
onViewThread(intent); onViewThread(intent);
} }
}
if (getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT)) { if (getIntent().hasExtra(Intent.EXTRA_PROCESS_TEXT)) {
String search = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString(); String search = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT).toString();

@ -384,6 +384,7 @@ public class ServiceSynchronize extends LifecycleService {
// Build pending intent // Build pending intent
Intent view = new Intent(this, ActivityView.class); Intent view = new Intent(this, ActivityView.class);
view.setAction("unified");
view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); view.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent piView = PendingIntent.getActivity( PendingIntent piView = PendingIntent.getActivity(
this, ActivityView.REQUEST_UNIFIED, view, PendingIntent.FLAG_UPDATE_CURRENT); this, ActivityView.REQUEST_UNIFIED, view, PendingIntent.FLAG_UPDATE_CURRENT);

@ -47,6 +47,7 @@ public class Widget extends AppWidgetProvider {
private static void update(int[] appWidgetIds, AppWidgetManager appWidgetManager, Context context, int count) { private static void update(int[] appWidgetIds, AppWidgetManager appWidgetManager, Context context, int count) {
Intent intent = new Intent(context, ActivityView.class); Intent intent = new Intent(context, ActivityView.class);
intent.setAction("unified");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, intent, PendingIntent.FLAG_UPDATE_CURRENT); PendingIntent pi = PendingIntent.getActivity(context, ActivityView.REQUEST_UNIFIED, intent, PendingIntent.FLAG_UPDATE_CURRENT);
for (int id : appWidgetIds) { for (int id : appWidgetIds) {

Loading…
Cancel
Save