diff --git a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java index fdac8a2ad..20a2857cd 100644 --- a/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java +++ b/app/src/main/java/app/fedilab/android/helper/SpannableHelper.java @@ -40,6 +40,7 @@ import android.text.style.QuoteSpan; import android.text.style.URLSpan; import android.view.LayoutInflater; import android.view.View; +import android.webkit.URLUtil; import android.widget.Toast; import androidx.annotation.NonNull; @@ -446,7 +447,7 @@ public class SpannableHelper { for (Map.Entry entry : urlDetails.entrySet()) { String value = entry.getValue(); - if (value.startsWith("@") || value.startsWith("#")) { + if (value.startsWith("@") || value.startsWith("#") || !URLUtil.isValidUrl(value)) { continue; } SpannableString contentUrl; 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 52b94a233..6079fcb37 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,8 +19,6 @@ 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; @@ -44,11 +42,8 @@ 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; @@ -98,18 +93,6 @@ public class FragmentNotificationContainer extends Fragment { 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 0f6c45a97..aee425626 100644 --- a/app/src/main/res/layout/popup_notification_settings.xml +++ b/app/src/main/res/layout/popup_notification_settings.xml @@ -105,21 +105,6 @@ - -