mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-27 23:40:33 +05:30
add pref to clear bookmarks
This commit is contained in:
parent
9601b3b32e
commit
c5714bb206
@ -111,6 +111,7 @@ object PreferenceKeys {
|
|||||||
const val CLEAR_WATCH_POSITIONS = "clear_watch_positions"
|
const val CLEAR_WATCH_POSITIONS = "clear_watch_positions"
|
||||||
const val SHARE_WITH_TIME_CODE = "share_with_time_code"
|
const val SHARE_WITH_TIME_CODE = "share_with_time_code"
|
||||||
const val CONFIRM_UNSUBSCRIBE = "confirm_unsubscribing"
|
const val CONFIRM_UNSUBSCRIBE = "confirm_unsubscribing"
|
||||||
|
const val CLEAR_BOOKMARKS = "clear_bookmarks"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* History
|
* History
|
||||||
|
@ -10,6 +10,7 @@ import androidx.fragment.app.FragmentManager
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.github.libretube.api.RetrofitInstance
|
import com.github.libretube.api.RetrofitInstance
|
||||||
import com.github.libretube.api.obj.PlaylistId
|
import com.github.libretube.api.obj.PlaylistId
|
||||||
|
import com.github.libretube.api.obj.StreamItem
|
||||||
import com.github.libretube.databinding.PlaylistRowBinding
|
import com.github.libretube.databinding.PlaylistRowBinding
|
||||||
import com.github.libretube.extensions.TAG
|
import com.github.libretube.extensions.TAG
|
||||||
import com.github.libretube.extensions.toID
|
import com.github.libretube.extensions.toID
|
||||||
@ -27,7 +28,7 @@ import retrofit2.HttpException
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class PlaylistAdapter(
|
class PlaylistAdapter(
|
||||||
private val videoFeed: MutableList<com.github.libretube.api.obj.StreamItem>,
|
private val videoFeed: MutableList<StreamItem>,
|
||||||
private val playlistId: String,
|
private val playlistId: String,
|
||||||
private val isOwner: Boolean,
|
private val isOwner: Boolean,
|
||||||
private val childFragmentManager: FragmentManager
|
private val childFragmentManager: FragmentManager
|
||||||
@ -37,7 +38,7 @@ class PlaylistAdapter(
|
|||||||
return videoFeed.size
|
return videoFeed.size
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems(newItems: List<com.github.libretube.api.obj.StreamItem>) {
|
fun updateItems(newItems: List<StreamItem>) {
|
||||||
val oldSize = videoFeed.size
|
val oldSize = videoFeed.size
|
||||||
videoFeed.addAll(newItems)
|
videoFeed.addAll(newItems)
|
||||||
notifyItemRangeInserted(oldSize, videoFeed.size)
|
notifyItemRangeInserted(oldSize, videoFeed.size)
|
||||||
|
@ -44,6 +44,14 @@ class HistorySettings : BasePreferenceFragment() {
|
|||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val resetBookmarks = findPreference<Preference>(PreferenceKeys.CLEAR_BOOKMARKS)
|
||||||
|
resetBookmarks?.setOnPreferenceClickListener {
|
||||||
|
showClearDialog(R.string.clear_bookmarks) {
|
||||||
|
Database.playlistBookmarkDao().deleteAll()
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showClearDialog(title: Int, action: () -> Unit) {
|
private fun showClearDialog(title: Int, action: () -> Unit) {
|
||||||
|
@ -383,6 +383,7 @@
|
|||||||
<string name="trending">What\'s trending now</string>
|
<string name="trending">What\'s trending now</string>
|
||||||
<string name="bookmarks">Bookmarks</string>
|
<string name="bookmarks">Bookmarks</string>
|
||||||
<string name="bookmark">Bookmark</string>
|
<string name="bookmark">Bookmark</string>
|
||||||
|
<string name="clear_bookmarks">Clear bookmarks</string>
|
||||||
|
|
||||||
<!-- Notification channel strings -->
|
<!-- Notification channel strings -->
|
||||||
<string name="download_channel_name">Download Service</string>
|
<string name="download_channel_name">Download Service</string>
|
||||||
|
@ -59,4 +59,13 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
<PreferenceCategory app:title="@string/bookmarks">
|
||||||
|
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/clear_bookmarks"
|
||||||
|
app:icon="@drawable/ic_bookmark"
|
||||||
|
app:key="clear_bookmarks" />
|
||||||
|
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user