Navigation from accounts/folders to unified inbox

pull/190/head
M66B 4 years ago
parent e7a9266b2b
commit 7debdd47c3

@ -297,6 +297,7 @@ public class FragmentAccounts extends FragmentBase {
@Override
public void onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.menu_search).setVisible(!settings);
menu.findItem(R.id.menu_unified).setVisible(!settings);
super.onPrepareOptionsMenu(menu);
}
@ -307,6 +308,9 @@ public class FragmentAccounts extends FragmentBase {
case R.id.menu_search:
onMenuSearch();
return true;
case R.id.menu_unified:
onMenuUnified();
return true;
case R.id.menu_force_sync:
onMenuForceSync();
return true;
@ -323,6 +327,15 @@ public class FragmentAccounts extends FragmentBase {
fragment.show(getParentFragmentManager(), "search");
}
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();
}
private void onMenuForceSync() {
ServiceSynchronize.reload(getContext(), null, true, "force sync");
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();

@ -451,6 +451,7 @@ public class FragmentFolders extends FragmentBase {
boolean subscriptions = prefs.getBoolean("subscriptions", false);
boolean subscribed_only = prefs.getBoolean("subscribed_only", false);
menu.findItem(R.id.menu_unified).setVisible(account < 0 && !primary);
menu.findItem(R.id.menu_compact).setChecked(compact);
menu.findItem(R.id.menu_show_hidden).setChecked(show_hidden);
menu.findItem(R.id.menu_show_flagged).setChecked(show_flagged);
@ -467,6 +468,9 @@ public class FragmentFolders extends FragmentBase {
case R.id.menu_search:
onMenuSearch();
return true;
case R.id.menu_unified:
onMenuUnified();
return true;
case R.id.menu_compact:
onMenuCompact();
return true;
@ -499,6 +503,15 @@ public class FragmentFolders extends FragmentBase {
fragment.show(getParentFragmentManager(), "search");
}
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();
}
private void onMenuCompact() {
compact = !compact;

@ -8,6 +8,12 @@
android:title="@string/title_search"
app:showAsAction="always" />
<item
android:id="@+id/menu_unified"
android:icon="@drawable/twotone_all_inbox_24"
android:title="@string/title_folders_unified"
app:showAsAction="always" />
<item
android:id="@+id/menu_force_sync"
android:title="@string/title_force_sync"

@ -8,6 +8,12 @@
android:title="@string/title_search"
app:showAsAction="always" />
<item
android:id="@+id/menu_unified"
android:icon="@drawable/twotone_all_inbox_24"
android:title="@string/title_folders_unified"
app:showAsAction="always" />
<item
android:id="@+id/menu_compact"
android:checkable="true"

Loading…
Cancel
Save