1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-25 13:52:08 +01:00

notification_toolbar_item_rework part 1

This commit is contained in:
Gregor Santner 2016-10-14 01:44:43 +02:00
parent 72189af353
commit eee1f3a84a
3 changed files with 124 additions and 5 deletions

View file

@ -620,7 +620,7 @@ public class MainActivity extends ThemedActivity
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
AppLog.i(this, "onOptionsItemSelected()"); AppLog.i(this, "onOptionsItemSelected()");
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.action_notifications: { case R.id.action_notifications_all: {
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getNotificationsUrl()); openDiasporaUrl(urls.getNotificationsUrl());
return true; 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: { case R.id.action_conversations: {
if (WebHelper.isOnline(MainActivity.this)) { if (WebHelper.isOnline(MainActivity.this)) {
openDiasporaUrl(urls.getConversationsUrl()); openDiasporaUrl(urls.getConversationsUrl());

View file

@ -54,6 +54,12 @@ public class DiasporaUrlHelper {
public static final String SUBURL_SIGN_IN = "/users/sign_in"; public static final String SUBURL_SIGN_IN = "/users/sign_in";
public static final String SUBURL_MANAGE_CONTACTS = "/contacts"; public static final String SUBURL_MANAGE_CONTACTS = "/contacts";
public static final String URL_BLANK = "about:blank"; 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) { public DiasporaUrlHelper(AppSettings settings) {
this.settings = settings; this.settings = settings;
@ -257,6 +263,31 @@ public class DiasporaUrlHelper {
return getPodUrl() + SUBURL_MANAGE_CONTACTS; 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 * Returns the url of the blank WebView
* *

View file

@ -6,16 +6,43 @@
<item <item
android:id="@+id/action_notifications" android:id="@+id/action_notifications"
android:icon="@drawable/ic_notifications_white_48px__layer" android:icon="@drawable/ic_notifications_white_48px__layer"
app:showAsAction="always"
android:orderInCategory="100" android:orderInCategory="100"
android:title="@string/notifications" 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>
<item <item
android:id="@+id/action_conversations" android:id="@+id/action_conversations"
android:icon="@drawable/ic_mail_white_48px__layer" android:icon="@drawable/ic_mail_white_48px__layer"
app:showAsAction="always"
android:orderInCategory="200" android:orderInCategory="200"
android:title="@string/conversations" /> android:title="@string/conversations"
app:showAsAction="always" />
</menu> </menu>