parent
bc9edf1f69
commit
0fcbf02a2c
|
@ -144,28 +144,26 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
|||
builder.setContentTitle(pn.title)
|
||||
.setContentText(pn.body)
|
||||
.setContentTitle(pn.title)
|
||||
.setStyle(new Notification.InboxStyle()
|
||||
.addLine(pn.body))
|
||||
.setStyle(new Notification.BigTextStyle().bigText(pn.body))
|
||||
.setSmallIcon(R.drawable.ic_ntf_logo)
|
||||
.setContentIntent(PendingIntent.getActivity(context, notificationId, contentIntent, PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT))
|
||||
.setWhen(notification==null ? System.currentTimeMillis() : notification.createdAt.toEpochMilli())
|
||||
.setShowWhen(true)
|
||||
.setCategory(Notification.CATEGORY_SOCIAL)
|
||||
.setAutoCancel(true)
|
||||
.setGroup(accountID)
|
||||
.setColor(context.getColor(R.color.shortcut_icon_background));
|
||||
if(!GlobalUserPreferences.uniformNotificationIcon){
|
||||
switch (pn.notificationType) {
|
||||
case FAVORITE -> builder.setSmallIcon(R.drawable.ic_fluent_star_24_filled);
|
||||
case REBLOG -> builder.setSmallIcon(R.drawable.ic_fluent_arrow_repeat_all_24_filled);
|
||||
case FOLLOW -> builder.setSmallIcon(R.drawable.ic_fluent_person_add_24_filled);
|
||||
case MENTION -> builder.setSmallIcon(R.drawable.ic_fluent_mention_24_filled);
|
||||
case POLL -> builder.setSmallIcon(R.drawable.ic_fluent_poll_24_filled);
|
||||
case STATUS -> builder.setSmallIcon(R.drawable.ic_fluent_chat_24_filled);
|
||||
.setColor(context.getColor(R.color.primary_700))
|
||||
.setGroup(accountID);
|
||||
|
||||
default -> builder.setSmallIcon(R.drawable.ic_ntf_logo);
|
||||
}
|
||||
}else{
|
||||
builder.setSmallIcon(R.drawable.ic_ntf_logo);
|
||||
if (!GlobalUserPreferences.uniformNotificationIcon) {
|
||||
builder.setSmallIcon(switch (pn.notificationType) {
|
||||
case FAVORITE -> R.drawable.ic_fluent_star_24_filled;
|
||||
case REBLOG -> R.drawable.ic_fluent_arrow_repeat_all_24_filled;
|
||||
case FOLLOW -> R.drawable.ic_fluent_person_add_24_filled;
|
||||
case MENTION -> R.drawable.ic_fluent_mention_24_filled;
|
||||
case POLL -> R.drawable.ic_fluent_poll_24_filled;
|
||||
case STATUS -> R.drawable.ic_fluent_chat_24_filled;
|
||||
case UPDATE -> R.drawable.ic_fluent_history_24_filled;
|
||||
});
|
||||
}
|
||||
|
||||
if(avatar!=null){
|
||||
|
|
|
@ -2,8 +2,6 @@ package org.joinmastodon.android.fragments;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
@ -78,6 +76,7 @@ public class NotificationsListFragment extends BaseStatusListFragment<Notificati
|
|||
case REBLOG -> getString(R.string.notification_boosted);
|
||||
case FAVORITE -> getString(R.string.user_favorited);
|
||||
case POLL -> getString(R.string.poll_ended);
|
||||
case UPDATE -> getString(R.string.sk_post_edited);
|
||||
};
|
||||
HeaderStatusDisplayItem titleItem=extraText!=null ? new HeaderStatusDisplayItem(n.id, n.account, n.createdAt, this, accountID, null, extraText, n, null) : null;
|
||||
if(n.status!=null){
|
||||
|
|
|
@ -210,15 +210,14 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||
GlobalUserPreferences.save();
|
||||
needAppRestart=true;
|
||||
}));
|
||||
// items.add(new SwitchItem(R.string.sk_enable_delete_notifications, R.drawable.ic_fluent_delete_24_regular, GlobalUserPreferences.enableDeleteNotifications, i->{
|
||||
// GlobalUserPreferences.enableDeleteNotifications=i.checked;
|
||||
// GlobalUserPreferences.save();
|
||||
// needAppRestart=true;
|
||||
// }));
|
||||
items.add(new SwitchItem(R.string.mo_relocate_publish_button, R.drawable.ic_fluent_arrow_autofit_down_24_regular, GlobalUserPreferences.relocatePublishButton, i->{
|
||||
GlobalUserPreferences.relocatePublishButton=i.checked;
|
||||
items.add(new SwitchItem(R.string.sk_settings_single_notification, R.drawable.ic_fluent_convert_range_24_regular, GlobalUserPreferences.keepOnlyLatestNotification, i->{
|
||||
GlobalUserPreferences.keepOnlyLatestNotification=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
}));
|
||||
// items.add(new SwitchItem(R.string.sk_settings_translate_only_opened, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{
|
||||
// GlobalUserPreferences.translateButtonOpenedOnly=i.checked;
|
||||
// GlobalUserPreferences.save();
|
||||
// }));
|
||||
// items.add(new SwitchItem(R.string.sk_settings_hide_translate_in_timeline, R.drawable.ic_fluent_translate_24_regular, GlobalUserPreferences.translateButtonOpenedOnly, i->{
|
||||
// GlobalUserPreferences.translateButtonOpenedOnly=i.checked;
|
||||
// GlobalUserPreferences.save();
|
||||
|
@ -246,11 +245,8 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||
items.add(new SwitchItem(R.string.notify_follow, R.drawable.ic_fluent_person_add_24_regular, pushSubscription.alerts.follow, i->onNotificationsChanged(PushNotification.Type.FOLLOW, i.checked)));
|
||||
items.add(new SwitchItem(R.string.notify_reblog, R.drawable.ic_fluent_arrow_repeat_all_24_regular, pushSubscription.alerts.reblog, i->onNotificationsChanged(PushNotification.Type.REBLOG, i.checked)));
|
||||
items.add(new SwitchItem(R.string.notify_mention, R.drawable.ic_fluent_mention_24_regular, pushSubscription.alerts.mention, i->onNotificationsChanged(PushNotification.Type.MENTION, i.checked)));
|
||||
items.add(new SwitchItem(R.string.sk_notify_update, R.drawable.ic_fluent_history_24_regular, pushSubscription.alerts.update, i->onNotificationsChanged(PushNotification.Type.UPDATE, i.checked)));
|
||||
items.add(new SwitchItem(R.string.sk_notify_posts, R.drawable.ic_fluent_alert_24_regular, pushSubscription.alerts.status, i->onNotificationsChanged(PushNotification.Type.STATUS, i.checked)));
|
||||
items.add(new SwitchItem(R.string.sk_settings_single_notification, R.drawable.ic_fluent_convert_range_24_regular, GlobalUserPreferences.keepOnlyLatestNotification, i->{
|
||||
GlobalUserPreferences.keepOnlyLatestNotification=i.checked;
|
||||
GlobalUserPreferences.save();
|
||||
}));
|
||||
|
||||
items.add(new HeaderItem(R.string.settings_account));
|
||||
items.add(new TextItem(R.string.sk_settings_profile, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/settings/profile"), R.drawable.ic_fluent_open_24_regular));
|
||||
|
@ -455,6 +451,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
|||
case REBLOG -> subscription.alerts.reblog=enabled;
|
||||
case MENTION -> subscription.alerts.mention=subscription.alerts.poll=enabled;
|
||||
case STATUS -> subscription.alerts.status=enabled;
|
||||
case UPDATE -> subscription.alerts.update=enabled;
|
||||
}
|
||||
needUpdateNotificationSettings=true;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,8 @@ public class Notification extends BaseModel implements DisplayItemsParent{
|
|||
@SerializedName("poll")
|
||||
POLL,
|
||||
@SerializedName("status")
|
||||
STATUS
|
||||
STATUS,
|
||||
@SerializedName("update")
|
||||
UPDATE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,9 @@ public class PushNotification extends BaseModel{
|
|||
@SerializedName("poll")
|
||||
POLL(R.string.notification_type_poll),
|
||||
@SerializedName("status")
|
||||
STATUS(R.string.sk_notification_type_status);
|
||||
STATUS(R.string.sk_notification_type_status),
|
||||
@SerializedName("update")
|
||||
UPDATE(R.string.sk_notification_type_update);
|
||||
|
||||
@StringRes
|
||||
public final int localizedName;
|
||||
|
|
|
@ -45,10 +45,11 @@ public class PushSubscription extends BaseModel implements Cloneable{
|
|||
public boolean mention;
|
||||
public boolean poll;
|
||||
public boolean status;
|
||||
public boolean update;
|
||||
|
||||
public static Alerts ofAll(){
|
||||
Alerts alerts=new Alerts();
|
||||
alerts.follow=alerts.favourite=alerts.reblog=alerts.mention=alerts.poll=alerts.status=true;
|
||||
alerts.follow=alerts.favourite=alerts.reblog=alerts.mention=alerts.poll=alerts.status=alerts.update=true;
|
||||
return alerts;
|
||||
}
|
||||
|
||||
|
@ -61,6 +62,7 @@ public class PushSubscription extends BaseModel implements Cloneable{
|
|||
", mention="+mention+
|
||||
", poll="+poll+
|
||||
", status="+status+
|
||||
", update="+update+
|
||||
'}';
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M19.25 12c0-4.004-3.246-7.25-7.25-7.25-1.662 0-3.194 0.56-4.417 1.5H8.25c0.552 0 1 0.448 1 1s-0.448 1-1 1h-3c-0.552 0-1-0.448-1-1V7H4.216L4.25 6.948V4.25c0-0.552 0.448-1 1-1s1 0.448 1 1v0.504C7.829 3.499 9.827 2.75 12 2.75c5.109 0 9.25 4.141 9.25 9.25s-4.141 9.25-9.25 9.25S2.75 17.109 2.75 12c0-0.383 0.023-0.76 0.068-1.13C2.881 10.358 3.334 10 3.85 10c0.59 0 1.017 0.569 0.949 1.156C4.766 11.433 4.75 11.714 4.75 12c0 4.004 3.246 7.25 7.25 7.25s7.25-3.246 7.25-7.25zM13 8c0-0.552-0.448-1-1-1s-1 0.448-1 1v5c0 0.552 0.448 1 1 1h3c0.552 0 1-0.448 1-1s-0.448-1-1-1h-2V8z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
|
@ -0,0 +1,3 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
|
||||
<path android:pathData="M19.5 12c0-4.142-3.358-7.5-7.5-7.5-1.97 0-3.76 0.759-5.1 2h1.35C8.664 6.5 9 6.836 9 7.25S8.664 8 8.25 8h-3C4.836 8 4.5 7.664 4.5 7.25v-3c0-0.414 0.336-0.75 0.75-0.75S6 3.836 6 4.25v1.042C7.592 3.867 9.695 3 12 3c4.97 0 9 4.03 9 9s-4.03 9-9 9-9-4.03-9-9c0-0.468 0.036-0.928 0.105-1.377C3.16 10.256 3.486 10 3.857 10c0.46 0 0.791 0.438 0.724 0.892C4.528 11.254 4.5 11.624 4.5 12c0 4.142 3.358 7.5 7.5 7.5 4.142 0 7.5-3.358 7.5-7.5zm-7-4.25C12.5 7.336 12.164 7 11.75 7S11 7.336 11 7.75v4.5c0 0.414 0.336 0.75 0.75 0.75h2.5c0.414 0 0.75-0.336 0.75-0.75s-0.336-0.75-0.75-0.75H12.5V7.75z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||
</vector>
|
|
@ -171,4 +171,7 @@
|
|||
<string name="sk_edit_timeline">Edit timeline</string>
|
||||
<string name="sk_edit_timelines">Edit timelines</string>
|
||||
<string name="sk_alt_button">ALT</string>
|
||||
<string name="sk_post_edited">edited</string>
|
||||
<string name="sk_notification_type_update">Edited posts</string>
|
||||
<string name="sk_notify_update">Edits a reblogged posts</string>
|
||||
</resources>
|
Loading…
Reference in New Issue