Skip to content

Commit bc29f40

Browse files
committed
Implemented the suggested changes
1 parent cd8d570 commit bc29f40

5 files changed

Lines changed: 21 additions & 30 deletions

File tree

app/src/main/java/org/schabi/newpipe/database/feed/dao/FeedDAO.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ abstract class FeedDAO {
7474
OR (sst.progress_time <= ${StreamStateEntity.PLAYBACK_SAVE_THRESHOLD_START_MILLISECONDS}
7575
AND sst.progress_time <= s.duration * 1000 / 4)
7676
OR (sst.progress_time >= s.duration * 1000 - ${StreamStateEntity.PLAYBACK_FINISHED_END_MILLISECONDS}
77-
OR sst.progress_time >= s.duration * 1000 * 3 / 4)
77+
AND sst.progress_time >= s.duration * 1000 * 3 / 4)
7878
)
7979
AND (
8080
:uploadDateBefore IS NULL

app/src/main/java/org/schabi/newpipe/local/feed/FeedFragment.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
259259
getString(R.string.feed_show_upcoming)
260260
)
261261

262-
val checkedDialogItems = booleanArrayOf(!showPlayedItems, !showPartiallyPlayedItems, !showFutureItems)
262+
val checkedDialogItems = booleanArrayOf(showPlayedItems, showPartiallyPlayedItems, showFutureItems)
263263

264264
val builder = AlertDialog.Builder(context!!)
265265
builder.setTitle(R.string.feed_hide_streams_title)
@@ -268,17 +268,14 @@ class FeedFragment : BaseStateFragment<FeedState>() {
268268
}
269269

270270
builder.setPositiveButton(R.string.ok) { _, _ ->
271-
showPlayedItems = !checkedDialogItems[0]
272-
viewModel.setShowPlayedItems(showPlayedItems)
273-
viewModel.saveShowPlayedItemsToPreferences(showPlayedItems)
271+
showPlayedItems = checkedDialogItems[0]
272+
viewModel.setSaveShowPlayedItems(showPlayedItems)
274273

275-
showPartiallyPlayedItems = !checkedDialogItems[1]
276-
viewModel.setShowPartiallyPlayedItems(showPartiallyPlayedItems)
277-
viewModel.saveShowPartiallyPlayedItemsToPreferences(showPartiallyPlayedItems)
274+
showPartiallyPlayedItems = checkedDialogItems[1]
275+
viewModel.setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems)
278276

279-
showFutureItems = !checkedDialogItems[2]
280-
viewModel.setShowFutureItems(showFutureItems)
281-
viewModel.saveShowFutureItemsToPreferences(showFutureItems)
277+
showFutureItems = checkedDialogItems[2]
278+
viewModel.setSaveShowFutureItems(showFutureItems)
282279
}
283280
builder.setNegativeButton(R.string.cancel, null)
284281

app/src/main/java/org/schabi/newpipe/local/feed/FeedViewModel.kt

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ import java.util.concurrent.TimeUnit
3131
class FeedViewModel(
3232
private val application: Application,
3333
groupId: Long = FeedGroupEntity.GROUP_ALL_ID,
34-
initialShowPlayedItems: Boolean = true,
35-
initialShowPartiallyPlayedItems: Boolean = true,
36-
initialShowFutureItems: Boolean = true
34+
initialShowPlayedItems: Boolean,
35+
initialShowPartiallyPlayedItems: Boolean,
36+
initialShowFutureItems: Boolean
3737
) : ViewModel() {
3838
private val feedDatabaseManager = FeedDatabaseManager(application)
3939

@@ -119,39 +119,33 @@ class FeedViewModel(
119119
val t4: OffsetDateTime?
120120
)
121121

122-
fun setShowPlayedItems(showPlayedItems: Boolean) {
122+
fun setSaveShowPlayedItems(showPlayedItems: Boolean) {
123123
this.showPlayedItems.onNext(showPlayedItems)
124-
}
125-
126-
fun saveShowPlayedItemsToPreferences(showPlayedItems: Boolean) =
127124
PreferenceManager.getDefaultSharedPreferences(application).edit {
128125
this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
129126
this.apply()
130127
}
128+
}
131129

132130
fun getShowPlayedItemsFromPreferences() = getShowPlayedItemsFromPreferences(application)
133131

134-
fun setShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
132+
fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
135133
this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems)
136-
}
137-
138-
fun saveShowPartiallyPlayedItemsToPreferences(showPartiallyPlayedItems: Boolean) =
139134
PreferenceManager.getDefaultSharedPreferences(application).edit {
140135
this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
141136
this.apply()
142137
}
138+
}
143139

144140
fun getShowPartiallyPlayedItemsFromPreferences() = getShowPartiallyPlayedItemsFromPreferences(application)
145141

146-
fun setShowFutureItems(showFutureItems: Boolean) {
142+
fun setSaveShowFutureItems(showFutureItems: Boolean) {
147143
this.showFutureItems.onNext(showFutureItems)
148-
}
149-
150-
fun saveShowFutureItemsToPreferences(showFutureItems: Boolean) =
151144
PreferenceManager.getDefaultSharedPreferences(application).edit {
152145
this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
153146
this.apply()
154147
}
148+
}
155149

156150
fun getShowFutureItemsFromPreferences() = getShowFutureItemsFromPreferences(application)
157151

app/src/main/java/org/schabi/newpipe/local/history/HistoryRecordManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public HistoryRecordManager(final Context context) {
8787
* Marks a stream item as watched such that it is hidden from the feed if watched videos are
8888
* hidden. Adds a history entry and updates the stream progress to 100%.
8989
*
90-
* @see FeedViewModel#setShowPlayedItems
90+
* @see FeedViewModel#setSaveShowPlayedItems
9191
* @param info the item to mark as watched
9292
* @return a Maybe containing the ID of the item if successful
9393
*/

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@
691691
\nYouTube is an example of a service that offers this fast method with its RSS feed.
692692
\n
693693
\nSo the choice boils down to what you prefer: speed or precise information.</string>
694-
<string name="feed_hide_streams_title">Hide the following streams</string>
694+
<string name="feed_hide_streams_title">Show the following streams</string>
695695
<string name="feed_show_hide_streams">Show/Hide streams</string>
696696
<string name="content_not_supported">This content is not yet supported by NewPipe.\n\nIt will hopefully be supported in a future version.</string>
697697
<string name="detail_sub_channel_thumbnail_view_description">Channel\'s avatar thumbnail</string>
@@ -760,8 +760,8 @@
760760
<string name="unknown_quality">Unknown quality</string>
761761
<string name="feed_toggle_show_future_items">Show future items</string>
762762
<string name="feed_toggle_hide_future_items">Hide future items</string>
763-
<string name="feed_show_watched">Fully Watched</string>
764-
<string name="feed_show_partially_watched">Partially Watched</string>
763+
<string name="feed_show_watched">Fully watched</string>
764+
<string name="feed_show_partially_watched">Partially watched</string>
765765
<string name="feed_show_upcoming">Upcoming</string>
766766
<string name="sort">Sort</string>
767767
</resources>

0 commit comments

Comments
 (0)