don't overwrite notifications
re: sk22#219
This commit is contained in:
parent
cbcbaaa9fa
commit
2614118d7d
5 changed files with 13 additions and 1 deletions
|
@ -30,6 +30,7 @@ public class GlobalUserPreferences{
|
||||||
public static boolean translateButtonOpenedOnly;
|
public static boolean translateButtonOpenedOnly;
|
||||||
public static boolean uniformNotificationIcon;
|
public static boolean uniformNotificationIcon;
|
||||||
public static boolean reduceMotion;
|
public static boolean reduceMotion;
|
||||||
|
public static boolean keepOnlyLatestNotification;
|
||||||
public static String publishButtonText;
|
public static String publishButtonText;
|
||||||
public static ThemePreference theme;
|
public static ThemePreference theme;
|
||||||
public static ColorPreference color;
|
public static ColorPreference color;
|
||||||
|
@ -64,6 +65,7 @@ public class GlobalUserPreferences{
|
||||||
translateButtonOpenedOnly=prefs.getBoolean("translateButtonOpenedOnly", false);
|
translateButtonOpenedOnly=prefs.getBoolean("translateButtonOpenedOnly", false);
|
||||||
uniformNotificationIcon=prefs.getBoolean("uniformNotificationIcon", false);
|
uniformNotificationIcon=prefs.getBoolean("uniformNotificationIcon", false);
|
||||||
reduceMotion=prefs.getBoolean("reduceMotion", false);
|
reduceMotion=prefs.getBoolean("reduceMotion", false);
|
||||||
|
keepOnlyLatestNotification=prefs.getBoolean("keepOnlyLatestNotification", false);
|
||||||
publishButtonText=prefs.getString("publishButtonText", "");
|
publishButtonText=prefs.getString("publishButtonText", "");
|
||||||
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
|
theme=ThemePreference.values()[prefs.getInt("theme", 0)];
|
||||||
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
|
recentLanguages=fromJson(prefs.getString("recentLanguages", "{}"), recentLanguagesType, new HashMap<>());
|
||||||
|
@ -93,6 +95,7 @@ public class GlobalUserPreferences{
|
||||||
.putBoolean("translateButtonOpenedOnly", translateButtonOpenedOnly)
|
.putBoolean("translateButtonOpenedOnly", translateButtonOpenedOnly)
|
||||||
.putBoolean("uniformNotificationIcon", uniformNotificationIcon)
|
.putBoolean("uniformNotificationIcon", uniformNotificationIcon)
|
||||||
.putBoolean("reduceMotion", reduceMotion)
|
.putBoolean("reduceMotion", reduceMotion)
|
||||||
|
.putBoolean("keepOnlyLatestNotification", keepOnlyLatestNotification)
|
||||||
.putString("publishButtonText", publishButtonText)
|
.putString("publishButtonText", publishButtonText)
|
||||||
.putInt("theme", theme.ordinal())
|
.putInt("theme", theme.ordinal())
|
||||||
.putString("color", color.name())
|
.putString("color", color.name())
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
||||||
private static final String TAG="PushNotificationReceive";
|
private static final String TAG="PushNotificationReceive";
|
||||||
|
|
||||||
public static final int NOTIFICATION_ID=178;
|
public static final int NOTIFICATION_ID=178;
|
||||||
|
private static int notificationId = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent){
|
public void onReceive(Context context, Intent intent){
|
||||||
|
@ -157,6 +158,6 @@ public class PushNotificationReceiver extends BroadcastReceiver{
|
||||||
if(AccountSessionManager.getInstance().getLoggedInAccounts().size()>1){
|
if(AccountSessionManager.getInstance().getLoggedInAccounts().size()>1){
|
||||||
builder.setSubText(accountName);
|
builder.setSubText(accountName);
|
||||||
}
|
}
|
||||||
nm.notify(accountID, NOTIFICATION_ID, builder.build());
|
nm.notify(accountID, GlobalUserPreferences.keepOnlyLatestNotification ? NOTIFICATION_ID : notificationId++, builder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,6 +230,10 @@ public class SettingsFragment extends MastodonToolbarFragment{
|
||||||
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_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.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_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_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 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));
|
items.add(new TextItem(R.string.sk_settings_profile, ()->UiUtils.launchWebBrowser(getActivity(), "https://"+session.domain+"/settings/profile"), R.drawable.ic_fluent_open_24_regular));
|
||||||
|
|
|
@ -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="M6.25 3C5.007 3 4 4.007 4 5.25v2.5C4 8.993 5.007 10 6.25 10h9.5C16.993 10 18 8.993 18 7.75v-2.5C18 4.007 16.993 3 15.75 3h-9.5zM5.5 5.25c0-0.414 0.336-0.75 0.75-0.75h9.5c0.414 0 0.75 0.336 0.75 0.75v2.5c0 0.414-0.336 0.75-0.75 0.75h-9.5C5.836 8.5 5.5 8.164 5.5 7.75v-2.5zM8.7 16C8.313 16 8 16.336 8 16.75s0.313 0.75 0.7 0.75h4.6c0.387 0 0.7-0.336 0.7-0.75S13.687 16 13.3 16H8.7zm8.653 0.445L17.28 16.53c-0.266 0.267-0.683 0.29-0.976 0.073L16.22 16.53l-2-2c-0.267-0.266-0.29-0.682-0.073-0.976l0.073-0.084 2-2c0.293-0.293 0.767-0.293 1.06 0 0.267 0.266 0.29 0.683 0.073 0.976L17.28 12.53l-0.719 0.721h1.5c0.647 0 1.18-0.492 1.243-1.122L19.311 12V9.75c0-0.415 0.335-0.75 0.75-0.75 0.38 0 0.693 0.282 0.743 0.648L20.81 9.75V12c0 1.462-1.142 2.658-2.583 2.745L18.06 14.75h-1.499l0.718 0.719c0.267 0.266 0.29 0.683 0.073 0.976zM18 19.25v-2.026l-0.013 0.012c-0.405 0.406-0.96 0.57-1.487 0.495v1.519c0 0.414-0.336 0.75-0.75 0.75h-9.5c-0.414 0-0.75-0.336-0.75-0.75v-5c0-0.414 0.336-0.75 0.75-0.75h6.822c0.058-0.192 0.148-0.376 0.272-0.543l0.022-0.03 0.12-0.14L14.275 12H6.25C5.007 12 4 13.007 4 14.25v5c0 1.243 1.007 2.25 2.25 2.25h9.5c1.243 0 2.25-1.007 2.25-2.25z" android:fillColor="@color/fluent_default_icon_tint"/>
|
||||||
|
</vector>
|
|
@ -128,4 +128,5 @@
|
||||||
<string name="sk_announcements">Announcements</string>
|
<string name="sk_announcements">Announcements</string>
|
||||||
<string name="sk_mark_as_read">Mark as read</string>
|
<string name="sk_mark_as_read">Mark as read</string>
|
||||||
<string name="sk_settings_about_instance">About instance</string>
|
<string name="sk_settings_about_instance">About instance</string>
|
||||||
|
<string name="sk_settings_single_notification">Only show one notification</string>
|
||||||
</resources>
|
</resources>
|
Loading…
Add table
Reference in a new issue