Navigate to unified messages

This commit is contained in:
M66B 2022-11-06 21:32:40 +01:00
parent dc47faf66e
commit 7461994310
4 changed files with 19 additions and 20 deletions

View File

@ -2144,8 +2144,13 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
}
private void onViewMessages(Intent intent) {
boolean unified = intent.getBooleanExtra("unified", false);
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
getSupportFragmentManager().popBackStack("messages", FragmentManager.POP_BACK_STACK_INCLUSIVE);
if (unified && "unified".equals(startup)) {
getSupportFragmentManager().popBackStack("unified", 0);
return;
} else
getSupportFragmentManager().popBackStack("messages", FragmentManager.POP_BACK_STACK_INCLUSIVE);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean foldernav = prefs.getBoolean("foldernav", false);
@ -2167,7 +2172,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
fragment.setArguments(args);
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("messages");
fragmentTransaction.replace(R.id.content_frame, fragment)
.addToBackStack(unified ? "unified" : "messages");
fragmentTransaction.commit();
}

View File

@ -159,14 +159,11 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
if (EntityFolder.OUTBOX.equals(folder.type))
lbm.sendBroadcast(new Intent(ActivityView.ACTION_VIEW_OUTBOX));
if (folder.type == null) {
Intent view = new Intent(context, ActivityView.class);
view.setAction("unified");
context.startActivity(view);
} else if (folder.folders > 1)
else if (folder.folders > 1 || folder.type == null)
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
.putExtra("type", folder.type));
.putExtra("type", folder.type)
.putExtra("unified", folder.type == null));
else {
Bundle args = new Bundle();
args.putString("type", folder.type);

View File

@ -399,12 +399,10 @@ public class FragmentAccounts extends FragmentBase {
}
private void onMenuUnified() {
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(new Bundle());
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("messages");
fragmentTransaction.commit();
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
.putExtra("unified", true));
}
private void onMenuOutbox() {

View File

@ -760,12 +760,10 @@ public class FragmentFolders extends FragmentBase {
}
private void onMenuUnified() {
FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(new Bundle());
FragmentTransaction fragmentTransaction = getParentFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("messages");
fragmentTransaction.commit();
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGES)
.putExtra("unified", true));
}
private void onMenuOutbox() {