Navigation from accounts/folders to unified inbox

This commit is contained in:
M66B 2020-12-01 22:03:19 +01:00
parent e7a9266b2b
commit 7debdd47c3
4 changed files with 38 additions and 0 deletions

View File

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

View File

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

View File

@ -8,6 +8,12 @@
android:title="@string/title_search" android:title="@string/title_search"
app:showAsAction="always" /> 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 <item
android:id="@+id/menu_force_sync" android:id="@+id/menu_force_sync"
android:title="@string/title_force_sync" android:title="@string/title_force_sync"

View File

@ -8,6 +8,12 @@
android:title="@string/title_search" android:title="@string/title_search"
app:showAsAction="always" /> 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 <item
android:id="@+id/menu_compact" android:id="@+id/menu_compact"
android:checkable="true" android:checkable="true"