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 689c45ee..8f7ff787 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 @@ -620,7 +620,7 @@ public class MainActivity extends ThemedActivity public boolean onOptionsItemSelected(MenuItem item) { AppLog.i(this, "onOptionsItemSelected()"); switch (item.getItemId()) { - case R.id.action_notifications: { + case R.id.action_notifications_all: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getNotificationsUrl()); return true; @@ -630,6 +630,67 @@ public class MainActivity extends ThemedActivity } } + + case R.id.action_notifications_also_commented: { + if (WebHelper.isOnline(MainActivity.this)) { + openDiasporaUrl(urls.getSuburlNotificationsAlsoCommentedUrl()); + return true; + } else { + snackbarNoInternet.show(); + return false; + } + } + + case R.id.action_notifications_comment_on_post: { + if (WebHelper.isOnline(MainActivity.this)) { + openDiasporaUrl(urls.getSuburlNotificationsCommentOnPostUrl()); + return true; + } else { + snackbarNoInternet.show(); + return false; + } + } + + case R.id.action_notifications_liked: { + if (WebHelper.isOnline(MainActivity.this)) { + openDiasporaUrl(urls.getSuburlNotificationsLikedUrl()); + return true; + } else { + snackbarNoInternet.show(); + return false; + } + } + + case R.id.action_notifications_mentioned: { + if (WebHelper.isOnline(MainActivity.this)) { + openDiasporaUrl(urls.getSuburlNotificationsMentionedUrl()); + return true; + } else { + snackbarNoInternet.show(); + return false; + } + } + + case R.id.action_notifications_reshared: { + if (WebHelper.isOnline(MainActivity.this)) { + openDiasporaUrl(urls.getSuburlNotificationsResharedUrl()); + return true; + } else { + snackbarNoInternet.show(); + return false; + } + } + + case R.id.action_notifications_started_sharing: { + if (WebHelper.isOnline(MainActivity.this)) { + openDiasporaUrl(urls.getSuburlNotificationsStartedSharingUrl()); + return true; + } else { + snackbarNoInternet.show(); + return false; + } + } + case R.id.action_conversations: { if (WebHelper.isOnline(MainActivity.this)) { openDiasporaUrl(urls.getConversationsUrl()); diff --git a/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java b/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java index e13eae48..6b6b3820 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/util/DiasporaUrlHelper.java @@ -54,6 +54,12 @@ public class DiasporaUrlHelper { public static final String SUBURL_SIGN_IN = "/users/sign_in"; public static final String SUBURL_MANAGE_CONTACTS = "/contacts"; public static final String URL_BLANK = "about:blank"; + public static final String SUBURL_NOTIFICATIONS_ALSO_COMMENTED = "/notifications?type=also_commented"; + public static final String SUBURL_NOTIFICATIONS_COMMENT_ON_POST = "/notifications?type=comment_on_post"; + public static final String SUBURL_NOTIFICATIONS_LIKED = "/notifications?type=liked"; + public static final String SUBURL_NOTIFICATIONS_MENTIONED = "/notifications?type=mentioned"; + public static final String SUBURL_NOTIFICATIONS_RESHARED = "/notifications?type=reshared"; + public static final String SUBURL_NOTIFICATIONS_STARTED_SHARING = "/notifications?type=started_sharing"; public DiasporaUrlHelper(AppSettings settings) { this.settings = settings; @@ -257,6 +263,31 @@ public class DiasporaUrlHelper { return getPodUrl() + SUBURL_MANAGE_CONTACTS; } + + public String getSuburlNotificationsAlsoCommentedUrl() { + return getPodUrl() + SUBURL_NOTIFICATIONS_ALSO_COMMENTED; + } + + public String getSuburlNotificationsCommentOnPostUrl() { + return getPodUrl() + SUBURL_NOTIFICATIONS_COMMENT_ON_POST; + } + + public String getSuburlNotificationsLikedUrl() { + return getPodUrl() + SUBURL_NOTIFICATIONS_LIKED; + } + + public String getSuburlNotificationsMentionedUrl() { + return getPodUrl() + SUBURL_NOTIFICATIONS_MENTIONED; + } + + public String getSuburlNotificationsResharedUrl() { + return getPodUrl() + SUBURL_NOTIFICATIONS_RESHARED; + } + + public String getSuburlNotificationsStartedSharingUrl() { + return getPodUrl() + SUBURL_NOTIFICATIONS_STARTED_SHARING; + } + /** * Returns the url of the blank WebView * diff --git a/app/src/main/res/menu/main__menu_top.xml b/app/src/main/res/menu/main__menu_top.xml index 73ea3bc7..d6ce2f61 100644 --- a/app/src/main/res/menu/main__menu_top.xml +++ b/app/src/main/res/menu/main__menu_top.xml @@ -6,16 +6,43 @@ + app:showAsAction="always"> + + + + + + + + + + + + + + + android:title="@string/conversations" + app:showAsAction="always" />