@@ -12,6 +12,7 @@ import io.reactivex.rxjava3.core.Flowable
1212import io.reactivex.rxjava3.functions.Function4
1313import io.reactivex.rxjava3.processors.BehaviorProcessor
1414import io.reactivex.rxjava3.schedulers.Schedulers
15+ import org.schabi.newpipe.R
1516import org.schabi.newpipe.database.feed.model.FeedGroupEntity
1617import org.schabi.newpipe.database.stream.StreamWithState
1718import org.schabi.newpipe.local.feed.item.StreamItem
@@ -25,15 +26,12 @@ import java.time.OffsetDateTime
2526import java.util.concurrent.TimeUnit
2627
2728class FeedViewModel (
28- applicationContext : Context ,
29+ val applicationContext : Context ,
2930 groupId : Long = FeedGroupEntity .GROUP_ALL_ID ,
3031 initialShowPlayedItems : Boolean = true
3132) : ViewModel() {
3233 private var feedDatabaseManager: FeedDatabaseManager = FeedDatabaseManager (applicationContext)
3334 private var sharedPreferences = PreferenceManager .getDefaultSharedPreferences(applicationContext)
34- companion object {
35- const val SHOW_PLAYED_ITEMS_PREFERENCE = " show_played_items_preference_tag"
36- }
3735
3836 private val toggleShowPlayedItems = BehaviorProcessor .create<Boolean >()
3937 private val streamItems = toggleShowPlayedItems
@@ -88,11 +86,11 @@ class FeedViewModel(
8886 }
8987
9088 fun savePlayedItemsToggle (showPlayedItems : Boolean ) = sharedPreferences.edit {
91- this .putBoolean(SHOW_PLAYED_ITEMS_PREFERENCE , showPlayedItems)
89+ this .putBoolean(applicationContext.getString( R .string.show_played_items_filter_key) , showPlayedItems)
9290 this .apply ()
9391 }
9492
95- fun getSavedPlayedItemsToggle () = sharedPreferences.getBoolean(SHOW_PLAYED_ITEMS_PREFERENCE , true )
93+ fun getSavedPlayedItemsToggle () = sharedPreferences.getBoolean(applicationContext.getString( R .string.show_played_items_filter_key) , true )
9694
9795 class Factory (
9896 private val context : Context ,
0 commit comments