diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java index 1e904563..04697e96 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java @@ -596,7 +596,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati for (Notification notificationsAlreadyPresent : notificationList) { //We compare the date of each status and we only add status having a date greater than the another, it is inserted at this position //Pinned messages are ignored because their date can be older - if (notificationReceived.created_at.after(notificationsAlreadyPresent.created_at)) { + if (notificationReceived.id.compareTo(notificationsAlreadyPresent.id) > 0) { if (!notificationList.contains(notificationReceived)) { notificationList.add(position, notificationReceived); notificationAdapter.notifyItemInserted(position); diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentNotificationContainer.java b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentNotificationContainer.java index f74f2f75..52b94a23 100644 --- a/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentNotificationContainer.java +++ b/app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentNotificationContainer.java @@ -19,6 +19,8 @@ import android.content.Context; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; +import android.os.Handler; +import android.os.Looper; import android.service.notification.StatusBarNotification; import android.view.LayoutInflater; import android.view.View; @@ -42,8 +44,11 @@ import java.util.concurrent.atomic.AtomicBoolean; import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; +import app.fedilab.android.activities.MainActivity; +import app.fedilab.android.client.entities.app.StatusCache; import app.fedilab.android.databinding.FragmentNotificationContainerBinding; import app.fedilab.android.databinding.PopupNotificationSettingsBinding; +import app.fedilab.android.exception.DBException; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.ThemeHelper; import app.fedilab.android.ui.pageadapter.FedilabNotificationPageAdapter; @@ -90,8 +95,21 @@ public class FragmentNotificationContainer extends Fragment { ThemeHelper.changeButtonColor(requireActivity(), dialogView.displayPollResults); ThemeHelper.changeButtonColor(requireActivity(), dialogView.displayUpdatesFromPeople); ThemeHelper.changeButtonColor(requireActivity(), dialogView.displayFollows); + DrawableCompat.setTintList(DrawableCompat.wrap(dialogView.displayAllCategories.getThumbDrawable()), ThemeHelper.getSwitchCompatThumbDrawable(requireActivity())); DrawableCompat.setTintList(DrawableCompat.wrap(dialogView.displayAllCategories.getTrackDrawable()), ThemeHelper.getSwitchCompatTrackDrawable(requireActivity())); + //Clear notifications from cache + dialogView.clearNotificationCache.setOnClickListener(v2 -> new Thread(() -> { + try { + new StatusCache(requireActivity()).deleteNotifications(MainActivity.currentUserID, MainActivity.currentInstance); + Handler mainHandler = new Handler(Looper.getMainLooper()); + changes.set(true); + Runnable myRunnable = () -> Toasty.info(requireActivity(), getString(R.string.notification_remove_from_cache), Toasty.LENGTH_SHORT).show(); + mainHandler.post(myRunnable); + } catch (DBException e) { + e.printStackTrace(); + } + }).start()); dialogView.clearAllNotif.setOnClickListener(v1 -> { AlertDialog.Builder db = new AlertDialog.Builder(requireActivity(), Helper.dialogStyle()); db.setTitle(R.string.delete_notification_ask_all); diff --git a/app/src/main/res/layout/popup_notification_settings.xml b/app/src/main/res/layout/popup_notification_settings.xml index a90ac656..0f6c45a9 100644 --- a/app/src/main/res/layout/popup_notification_settings.xml +++ b/app/src/main/res/layout/popup_notification_settings.xml @@ -23,6 +23,7 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + Max indentation in threads Unlisted replies It only concerns \"public\" replies. When enabled, your replies will automatically have the visibility \"unlisted\" instead of \"public\" + Notifications have been removed from cache.