Implemented the suggested changes

This commit is contained in:
Jared Fantaye 2023-02-09 21:18:21 +01:00
parent cd8d57040c
commit bc29f40d69
5 changed files with 21 additions and 30 deletions

View File

@ -74,7 +74,7 @@ abstract class FeedDAO {
OR (sst.progress_time <= ${StreamStateEntity.PLAYBACK_SAVE_THRESHOLD_START_MILLISECONDS}
AND sst.progress_time <= s.duration * 1000 / 4)
OR (sst.progress_time >= s.duration * 1000 - ${StreamStateEntity.PLAYBACK_FINISHED_END_MILLISECONDS}
OR sst.progress_time >= s.duration * 1000 * 3 / 4)
AND sst.progress_time >= s.duration * 1000 * 3 / 4)
)
AND (
:uploadDateBefore IS NULL

View File

@ -259,7 +259,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
getString(R.string.feed_show_upcoming)
)
val checkedDialogItems = booleanArrayOf(!showPlayedItems, !showPartiallyPlayedItems, !showFutureItems)
val checkedDialogItems = booleanArrayOf(showPlayedItems, showPartiallyPlayedItems, showFutureItems)
val builder = AlertDialog.Builder(context!!)
builder.setTitle(R.string.feed_hide_streams_title)
@ -268,17 +268,14 @@ class FeedFragment : BaseStateFragment<FeedState>() {
}
builder.setPositiveButton(R.string.ok) { _, _ ->
showPlayedItems = !checkedDialogItems[0]
viewModel.setShowPlayedItems(showPlayedItems)
viewModel.saveShowPlayedItemsToPreferences(showPlayedItems)
showPlayedItems = checkedDialogItems[0]
viewModel.setSaveShowPlayedItems(showPlayedItems)
showPartiallyPlayedItems = !checkedDialogItems[1]
viewModel.setShowPartiallyPlayedItems(showPartiallyPlayedItems)
viewModel.saveShowPartiallyPlayedItemsToPreferences(showPartiallyPlayedItems)
showPartiallyPlayedItems = checkedDialogItems[1]
viewModel.setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems)
showFutureItems = !checkedDialogItems[2]
viewModel.setShowFutureItems(showFutureItems)
viewModel.saveShowFutureItemsToPreferences(showFutureItems)
showFutureItems = checkedDialogItems[2]
viewModel.setSaveShowFutureItems(showFutureItems)
}
builder.setNegativeButton(R.string.cancel, null)

View File

@ -31,9 +31,9 @@ import java.util.concurrent.TimeUnit
class FeedViewModel(
private val application: Application,
groupId: Long = FeedGroupEntity.GROUP_ALL_ID,
initialShowPlayedItems: Boolean = true,
initialShowPartiallyPlayedItems: Boolean = true,
initialShowFutureItems: Boolean = true
initialShowPlayedItems: Boolean,
initialShowPartiallyPlayedItems: Boolean,
initialShowFutureItems: Boolean
) : ViewModel() {
private val feedDatabaseManager = FeedDatabaseManager(application)
@ -119,39 +119,33 @@ class FeedViewModel(
val t4: OffsetDateTime?
)
fun setShowPlayedItems(showPlayedItems: Boolean) {
fun setSaveShowPlayedItems(showPlayedItems: Boolean) {
this.showPlayedItems.onNext(showPlayedItems)
}
fun saveShowPlayedItemsToPreferences(showPlayedItems: Boolean) =
PreferenceManager.getDefaultSharedPreferences(application).edit {
this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
this.apply()
}
}
fun getShowPlayedItemsFromPreferences() = getShowPlayedItemsFromPreferences(application)
fun setShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems)
}
fun saveShowPartiallyPlayedItemsToPreferences(showPartiallyPlayedItems: Boolean) =
PreferenceManager.getDefaultSharedPreferences(application).edit {
this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
this.apply()
}
}
fun getShowPartiallyPlayedItemsFromPreferences() = getShowPartiallyPlayedItemsFromPreferences(application)
fun setShowFutureItems(showFutureItems: Boolean) {
fun setSaveShowFutureItems(showFutureItems: Boolean) {
this.showFutureItems.onNext(showFutureItems)
}
fun saveShowFutureItemsToPreferences(showFutureItems: Boolean) =
PreferenceManager.getDefaultSharedPreferences(application).edit {
this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
this.apply()
}
}
fun getShowFutureItemsFromPreferences() = getShowFutureItemsFromPreferences(application)

View File

@ -87,7 +87,7 @@ public class HistoryRecordManager {
* Marks a stream item as watched such that it is hidden from the feed if watched videos are
* hidden. Adds a history entry and updates the stream progress to 100%.
*
* @see FeedViewModel#setShowPlayedItems
* @see FeedViewModel#setSaveShowPlayedItems
* @param info the item to mark as watched
* @return a Maybe containing the ID of the item if successful
*/

View File

@ -691,7 +691,7 @@
\nYouTube is an example of a service that offers this fast method with its RSS feed.
\n
\nSo the choice boils down to what you prefer: speed or precise information.</string>
<string name="feed_hide_streams_title">Hide the following streams</string>
<string name="feed_hide_streams_title">Show the following streams</string>
<string name="feed_show_hide_streams">Show/Hide streams</string>
<string name="content_not_supported">This content is not yet supported by NewPipe.\n\nIt will hopefully be supported in a future version.</string>
<string name="detail_sub_channel_thumbnail_view_description">Channel\'s avatar thumbnail</string>
@ -760,8 +760,8 @@
<string name="unknown_quality">Unknown quality</string>
<string name="feed_toggle_show_future_items">Show future items</string>
<string name="feed_toggle_hide_future_items">Hide future items</string>
<string name="feed_show_watched">Fully Watched</string>
<string name="feed_show_partially_watched">Partially Watched</string>
<string name="feed_show_watched">Fully watched</string>
<string name="feed_show_partially_watched">Partially watched</string>
<string name="feed_show_upcoming">Upcoming</string>
<string name="sort">Sort</string>
</resources>