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 0e2409470..cfe14370d 100644 --- a/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt +++ b/app/src/main/java/com/github/libretube/constants/PreferenceKeys.kt @@ -111,6 +111,7 @@ object PreferenceKeys { const val CLEAR_WATCH_POSITIONS = "clear_watch_positions" const val SHARE_WITH_TIME_CODE = "share_with_time_code" const val CONFIRM_UNSUBSCRIBE = "confirm_unsubscribing" + const val CLEAR_BOOKMARKS = "clear_bookmarks" /** * History diff --git a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt index cea41f117..e2eec73c9 100644 --- a/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt +++ b/app/src/main/java/com/github/libretube/ui/adapters/PlaylistAdapter.kt @@ -10,6 +10,7 @@ import androidx.fragment.app.FragmentManager import androidx.recyclerview.widget.RecyclerView import com.github.libretube.api.RetrofitInstance import com.github.libretube.api.obj.PlaylistId +import com.github.libretube.api.obj.StreamItem import com.github.libretube.databinding.PlaylistRowBinding import com.github.libretube.extensions.TAG import com.github.libretube.extensions.toID @@ -27,7 +28,7 @@ import retrofit2.HttpException import java.io.IOException class PlaylistAdapter( - private val videoFeed: MutableList, + private val videoFeed: MutableList, private val playlistId: String, private val isOwner: Boolean, private val childFragmentManager: FragmentManager @@ -37,7 +38,7 @@ class PlaylistAdapter( return videoFeed.size } - fun updateItems(newItems: List) { + fun updateItems(newItems: List) { val oldSize = videoFeed.size videoFeed.addAll(newItems) notifyItemRangeInserted(oldSize, videoFeed.size) diff --git a/app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt index af4be7d11..45e4f811b 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/HistorySettings.kt @@ -44,6 +44,14 @@ class HistorySettings : BasePreferenceFragment() { } true } + + val resetBookmarks = findPreference(PreferenceKeys.CLEAR_BOOKMARKS) + resetBookmarks?.setOnPreferenceClickListener { + showClearDialog(R.string.clear_bookmarks) { + Database.playlistBookmarkDao().deleteAll() + } + true + } } private fun showClearDialog(title: Int, action: () -> Unit) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 62d3231d3..6d34215f3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -383,6 +383,7 @@ What\'s trending now Bookmarks Bookmark + Clear bookmarks Download Service diff --git a/app/src/main/res/xml/history_settings.xml b/app/src/main/res/xml/history_settings.xml index 642b227d3..e20f559b8 100644 --- a/app/src/main/res/xml/history_settings.xml +++ b/app/src/main/res/xml/history_settings.xml @@ -59,4 +59,13 @@ + + + + + + \ No newline at end of file