Skip to content

Commit 451409f

Browse files
author
Yevhen Babiichuk (DustDFG)
committed
SharedPreferences.edit applies changes automatically
1 parent 289d22e commit 451409f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ class FeedViewModel(
129129
fun setSaveShowPlayedItems(showPlayedItems: Boolean) {
130130
this.showPlayedItems.onNext(showPlayedItems)
131131
PreferenceManager.getDefaultSharedPreferences(application).edit {
132-
this.putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
133-
this.apply()
132+
putBoolean(application.getString(R.string.feed_show_watched_items_key), showPlayedItems)
134133
}
135134
}
136135

@@ -139,8 +138,7 @@ class FeedViewModel(
139138
fun setSaveShowPartiallyPlayedItems(showPartiallyPlayedItems: Boolean) {
140139
this.showPartiallyPlayedItems.onNext(showPartiallyPlayedItems)
141140
PreferenceManager.getDefaultSharedPreferences(application).edit {
142-
this.putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
143-
this.apply()
141+
putBoolean(application.getString(R.string.feed_show_partially_watched_items_key), showPartiallyPlayedItems)
144142
}
145143
}
146144

@@ -149,8 +147,7 @@ class FeedViewModel(
149147
fun setSaveShowFutureItems(showFutureItems: Boolean) {
150148
this.showFutureItems.onNext(showFutureItems)
151149
PreferenceManager.getDefaultSharedPreferences(application).edit {
152-
this.putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
153-
this.apply()
150+
putBoolean(application.getString(R.string.feed_show_future_items_key), showFutureItems)
154151
}
155152
}
156153

0 commit comments

Comments
 (0)