diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java index 8f7ff787..786e98eb 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java @@ -546,6 +546,7 @@ public class MainActivity extends ThemedActivity AppLog.v(this, "Register BroadcastReceivers"); LocalBroadcastManager.getInstance(this).registerReceiver(brSetTitle, new IntentFilter(ACTION_UPDATE_TITLE_FROM_URL)); LocalBroadcastManager.getInstance(this).registerReceiver(brOpenExternalLink, new IntentFilter(ACTION_OPEN_EXTERNAL_URL)); + invalidateOptionsMenu(); this.appSettings = getAppSettings(); if (appSettings.isIntellihideToolbars()) { this.enableToolbarHiding(); @@ -572,17 +573,16 @@ public class MainActivity extends ThemedActivity CustomFragment top = getTopFragment(); if (top != null) { - //Are we displaying a Fragment other than PodSelectionFragment? - if (!top.getFragmentTag().equals(PodSelectionFragment.TAG)) { - getMenuInflater().inflate(R.menu.main__menu_top, menu); + //PodSelectionFragment? + if (top.getFragmentTag().equals(PodSelectionFragment.TAG)) { + ///Hide bottom toolbar + toolbarBottom.setVisibility(View.GONE); + } else { + getMenuInflater().inflate(appSettings.isExtendedNotificationsActivated() ? + R.menu.main__menu_top__notifications_dropdown : R.menu.main__menu_top, menu); getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu()); top.onCreateBottomOptionsMenu(toolbarBottom.getMenu(), getMenuInflater()); } - //PodSelectionFragment - else { - //Hide bottom toolbar - toolbarBottom.setVisibility(View.GONE); - } } return true; } @@ -620,6 +620,12 @@ public class MainActivity extends ThemedActivity public boolean onOptionsItemSelected(MenuItem item) { AppLog.i(this, "onOptionsItemSelected()"); switch (item.getItemId()) { + case R.id.action_notifications: { + if(appSettings.isExtendedNotificationsActivated()) { + return true; + } + //Otherwise we execute the action of action_notifications_all + } case R.id.action_notifications_all: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getNotificationsUrl()); diff --git a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java index d105a8f0..0307765a 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/data/AppSettings.java @@ -374,4 +374,8 @@ public class AppSettings { public int getAccentColor() { return getInt(prefApp, R.string.pref_key__accent_color_shade, context.getResources().getColor(R.color.accent)); } + + public boolean isExtendedNotificationsActivated() { + return getBoolean(prefApp, R.string.pref_key__extended_notifications, false); + } } \ No newline at end of file diff --git a/app/src/main/res/menu/main__menu_top.xml b/app/src/main/res/menu/main__menu_top.xml index d6ce2f61..71750e4f 100644 --- a/app/src/main/res/menu/main__menu_top.xml +++ b/app/src/main/res/menu/main__menu_top.xml @@ -8,36 +8,7 @@ android:icon="@drawable/ic_notifications_white_48px__layer" android:orderInCategory="100" android:title="@string/notifications" - app:showAsAction="always"> -
- + app:showAsAction="always"/>