Commit 317feaa3 authored by Habib Kazemi's avatar Habib Kazemi Committed by Geoffrey Métais

Prevent search subtitle again on rotation

Signed-off-by: default avatarGeoffrey Métais <geoffrey.metais@gmail.com>
parent c3adf43a
......@@ -25,6 +25,7 @@ class SubtitlesModel(private val context: Context, private val mediaPath: String
val observableSearchEpisode = ObservableField<String>()
val observableSearchSeason = ObservableField<String>()
val observableSearchLanguage = ObservableField<String>()
private var previousSearchLanguage: String? = null
val manualSearchEnabled = ObservableBoolean(false)
val isApiLoading = ObservableBoolean(false)
......@@ -44,8 +45,11 @@ class SubtitlesModel(private val context: Context, private val mediaPath: String
init {
observableSearchLanguage.addOnPropertyChangedCallback(object: Observable.OnPropertyChangedCallback() {
override fun onPropertyChanged(sender: Observable?, propertyId: Int) {
saveLastUsedLanguage(observableSearchLanguage.get() ?: "")
search(!manualSearchEnabled.get())
if (observableSearchLanguage.get() != previousSearchLanguage) {
previousSearchLanguage = observableSearchLanguage.get()
saveLastUsedLanguage(observableSearchLanguage.get() ?: "")
search(!manualSearchEnabled.get())
}
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment