diff --git a/app/src/main/java/com/github/libretube/activities/MainActivity.kt b/app/src/main/java/com/github/libretube/activities/MainActivity.kt
index cb7b75480..2662bd21e 100644
--- a/app/src/main/java/com/github/libretube/activities/MainActivity.kt
+++ b/app/src/main/java/com/github/libretube/activities/MainActivity.kt
@@ -234,11 +234,16 @@ class MainActivity : BaseActivity() {
* Initialize the notification badge showing the amount of new videos
*/
private fun setupSubscriptionsBadge() {
+ if (!PreferenceHelper.getBoolean(
+ PreferenceKeys.NEW_VIDEOS_BADGE,
+ false
+ )) return
+
val subscriptionsViewModel = ViewModelProvider(this)[SubscriptionsViewModel::class.java]
subscriptionsViewModel.fetchSubscriptions()
- val lastSeenVideoId = PreferenceHelper.getLastSeenVideoId()
subscriptionsViewModel.videoFeed.observe(this) {
+ val lastSeenVideoId = PreferenceHelper.getLastSeenVideoId()
val lastSeenVideoIndex = subscriptionsViewModel.videoFeed.value?.indexOfFirst {
lastSeenVideoId == it.url?.toID()
} ?: return@observe
diff --git a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt
index 712b55c02..747346c5a 100644
--- a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt
+++ b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt
@@ -34,6 +34,7 @@ object PreferenceKeys {
const val LEGACY_SUBSCRIPTIONS = "legacy_subscriptions"
const val LEGACY_SUBSCRIPTIONS_COLUMNS = "legacy_subscriptions_columns"
const val ALTERNATIVE_TRENDING_LAYOUT = "trending_layout"
+ const val NEW_VIDEOS_BADGE = "new_videos_badge"
/**
* Instance
diff --git a/app/src/main/res/drawable/ic_badge.xml b/app/src/main/res/drawable/ic_badge.xml
new file mode 100644
index 000000000..843102c2b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_badge.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index b8edbc4d2..80ac7eb7a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -319,4 +319,6 @@
Rename playlist
WiFi
Mobile data
+ Indicator for new videos
+ Show a badge with the amount of new videos
diff --git a/app/src/main/res/xml/advanced_settings.xml b/app/src/main/res/xml/advanced_settings.xml
index 88f0613de..bd0bc574e 100644
--- a/app/src/main/res/xml/advanced_settings.xml
+++ b/app/src/main/res/xml/advanced_settings.xml
@@ -24,6 +24,12 @@
app:key="reset_settings"
app:title="@string/reset" />
+
+