mirror of
https://github.com/gsantner/dandelion
synced 2024-12-22 19:08:03 +01:00
Added notifications dropdown menu with settings
This commit is contained in:
parent
54ba7b389c
commit
8e852d7ff2
7 changed files with 87 additions and 38 deletions
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -8,36 +8,7 @@
|
|||
android:icon="@drawable/ic_notifications_white_48px__layer"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/notifications"
|
||||
app:showAsAction="always">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/action_notifications_all"
|
||||
android:title="All Notifications" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_also_commented"
|
||||
android:title="Also Commented" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_comment_on_post"
|
||||
android:title="Comment on Post" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_liked"
|
||||
android:title="Liked" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_mentioned"
|
||||
android:title="Mentioned" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_reshared"
|
||||
android:title="Reshared" />
|
||||
<item
|
||||
android:id="@+id/action_notifications_started_sharing"
|
||||
android:title="Started Sharing" />
|
||||
</menu>
|
||||
</item>
|
||||
app:showAsAction="always"/>
|
||||
<item
|
||||
android:id="@+id/action_conversations"
|
||||
android:icon="@drawable/ic_mail_white_48px__layer"
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.MainActivity">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications"
|
||||
android:icon="@drawable/ic_notifications_white_48px__layer"
|
||||
android:orderInCategory="100"
|
||||
android:title="@string/notifications"
|
||||
app:showAsAction="always">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/action_notifications_all"
|
||||
android:title="@string/notifications__all" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_also_commented"
|
||||
android:title="@string/notifications__also_commented" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_comment_on_post"
|
||||
android:title="@string/notifications__comment_on_post" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_liked"
|
||||
android:title="@string/notifications__liked" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_mentioned"
|
||||
android:title="@string/notifications__mentioned" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_notifications_reshared"
|
||||
android:title="@string/notifications__reshared" />
|
||||
<item
|
||||
android:id="@+id/action_notifications_started_sharing"
|
||||
android:title="@string/notifications__started_sharing" />
|
||||
</menu>
|
||||
</item>
|
||||
<item
|
||||
android:id="@+id/action_conversations"
|
||||
android:icon="@drawable/ic_mail_white_48px__layer"
|
||||
android:orderInCategory="200"
|
||||
android:title="@string/conversations"
|
||||
app:showAsAction="always" />
|
||||
|
||||
</menu>
|
|
@ -16,6 +16,7 @@
|
|||
<string name="pref_key__clear_cache" translatable="false">pref_key_clear_cache</string>
|
||||
<string name="pref_key__chrome_custom_tabs_enabled" translatable="false">pref_key__chrome_custom_tabs_enabled</string>
|
||||
<string name="pref_key__http_proxy_load_tor_preset" translatable="false">pref_key__http_proxy_load_tor_preset</string>
|
||||
<string name="pref_key__extended_notifications" translatable="false">pref_key__extended_notifications</string>
|
||||
|
||||
<!-- Themes -->
|
||||
<string name="pref_key__primary_color__preference_click" translatable="false">pref_key_primary_color</string>
|
||||
|
@ -78,6 +79,10 @@
|
|||
<string name="pref_title__accent_color">Accent Color</string>
|
||||
<string name="pref_desc__accent_color">Color of the progressbar</string>
|
||||
|
||||
<!-- Notifications dropdown -->
|
||||
<string name="pref_title__extended_notifications">Extended Notifications</string>
|
||||
<string name="pref_desc__extended_notifications">Extend the notifications bell with a dropdown menu that shows notification categories</string>
|
||||
|
||||
<!-- Font size -->
|
||||
<string name="pref_title__font_size">Font size</string>
|
||||
<array name="pref_entries__font_size">
|
||||
|
|
|
@ -29,6 +29,15 @@
|
|||
<string name="public_">Public</string>
|
||||
<string name="search">Search</string>
|
||||
|
||||
<!-- Notifications dropdown menu -->
|
||||
<string name="notifications__all">All Notifications</string>
|
||||
<string name="notifications__also_commented">Also Commented</string>
|
||||
<string name="notifications__comment_on_post">Comment on Post</string>
|
||||
<string name="notifications__liked">Liked</string>
|
||||
<string name="notifications__mentioned">Mentioned</string>
|
||||
<string name="notifications__reshared">Reshared</string>
|
||||
<string name="notifications__started_sharing">Started Sharing</string>
|
||||
|
||||
|
||||
<!-- Pod Activity -->
|
||||
<string name="title_activity_pods">Select Pod</string>
|
||||
|
|
|
@ -87,6 +87,12 @@
|
|||
android:summary="@string/pref_desc__intellihide_toolbars"
|
||||
android:title="@string/pref_title__intellihide_toolbars"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/pref_key__extended_notifications"
|
||||
android:summary="@string/pref_desc__extended_notifications"
|
||||
android:title="@string/pref_title__extended_notifications"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/pref_key__append_shared_via_app"
|
||||
|
|
Loading…
Reference in a new issue