1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 12:32:31 +01:00

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} OR (sst.progress_time <= ${StreamStateEntity.PLAYBACK_SAVE_THRESHOLD_START_MILLISECONDS}
AND sst.progress_time <= s.duration * 1000 / 4) 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 - ${StreamStateEntity.PLAYBACK_FINISHED_END_MILLISECONDS}
OR sst.progress_time >= s.duration * 1000 * 3 / 4) AND sst.progress_time >= s.duration * 1000 * 3 / 4)
) )
AND ( AND (
:uploadDateBefore IS NULL :uploadDateBefore IS NULL

View File

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

View File

@ -31,9 +31,9 @@ import java.util.concurrent.TimeUnit
class FeedViewModel( class FeedViewModel(
private val application: Application, private val application: Application,
groupId: Long = FeedGroupEntity.GROUP_ALL_ID, groupId: Long = FeedGroupEntity.GROUP_ALL_ID,
initialShowPlayedItems: Boolean = true, initialShowPlayedItems: Boolean,
initialShowPartiallyPlayedItems: Boolean = true, initialShowPartiallyPlayedItems: Boolean,
initialShowFutureItems: Boolean = true initialShowFutureItems: Boolean
) : ViewModel() { ) : ViewModel() {
private val feedDatabaseManager = FeedDatabaseManager(application) private val feedDatabaseManager = FeedDatabaseManager(application)
@ -119,39 +119,33 @@ class FeedViewModel(
val t4: OffsetDateTime? val t4: OffsetDateTime?
) )
fun setShowPlayedItems(showPlayedItems: Boolean) { fun setSaveShowPlayedItems(showPlayedItems: Boolean) {
this.showPlayedItems.onNext(showPlayedItems) this.showPlayedItems.onNext(showPlayedItems)
}
fun saveShowPlayedItemsToPreferences(showPlayedItems: Boolean) =
PreferenceManager.getDefaultSharedPreferences(application).edit { PreferenceManager.getDefaultSharedPreferences(application).edit {
this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems) this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
this.apply() this.apply()
} }
}
fun getShowPlayedItemsFromPreferences() = getShowPlayedItemsFromPreferences(application) fun getShowPlayedItemsFromPreferences() = getShowPlayedItemsFromPreferences(application)
fun setShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) { fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems) this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems)
}
fun saveShowPartiallyPlayedItemsToPreferences(showPartiallyPlayedItems: Boolean) =
PreferenceManager.getDefaultSharedPreferences(application).edit { PreferenceManager.getDefaultSharedPreferences(application).edit {
this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems) this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
this.apply() this.apply()
} }
}
fun getShowPartiallyPlayedItemsFromPreferences() = getShowPartiallyPlayedItemsFromPreferences(application) fun getShowPartiallyPlayedItemsFromPreferences() = getShowPartiallyPlayedItemsFromPreferences(application)
fun setShowFutureItems(showFutureItems: Boolean) { fun setSaveShowFutureItems(showFutureItems: Boolean) {
this.showFutureItems.onNext(showFutureItems) this.showFutureItems.onNext(showFutureItems)
}
fun saveShowFutureItemsToPreferences(showFutureItems: Boolean) =
PreferenceManager.getDefaultSharedPreferences(application).edit { PreferenceManager.getDefaultSharedPreferences(application).edit {
this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems) this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
this.apply() this.apply()
} }
}
fun getShowFutureItemsFromPreferences() = getShowFutureItemsFromPreferences(application) 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 * 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%. * 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 * @param info the item to mark as watched
* @return a Maybe containing the ID of the item if successful * @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. \nYouTube is an example of a service that offers this fast method with its RSS feed.
\n \n
\nSo the choice boils down to what you prefer: speed or precise information.</string> \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="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="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> <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="unknown_quality">Unknown quality</string>
<string name="feed_toggle_show_future_items">Show future items</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_toggle_hide_future_items">Hide future items</string>
<string name="feed_show_watched">Fully Watched</string> <string name="feed_show_watched">Fully watched</string>
<string name="feed_show_partially_watched">Partially Watched</string> <string name="feed_show_partially_watched">Partially watched</string>
<string name="feed_show_upcoming">Upcoming</string> <string name="feed_show_upcoming">Upcoming</string>
<string name="sort">Sort</string> <string name="sort">Sort</string>
</resources> </resources>