Fix lazy loading of detail tabs
All checks were successful
Pull Request / build (pull_request) Successful in 3m59s
All checks were successful
Pull Request / build (pull_request) Successful in 3m59s
This commit is contained in:
parent
64ecdd84aa
commit
baa4b9bd1a
@ -34,6 +34,11 @@ class Model(
|
|||||||
private val internalIsFindingCharacters: BooleanProperty = SimpleBooleanProperty(false)
|
private val internalIsFindingCharacters: BooleanProperty = SimpleBooleanProperty(false)
|
||||||
private val internalIsFindingSentences: BooleanProperty = SimpleBooleanProperty(false)
|
private val internalIsFindingSentences: BooleanProperty = SimpleBooleanProperty(false)
|
||||||
|
|
||||||
|
private val internalFinishedFindingWordsBeginning: BooleanProperty = SimpleBooleanProperty(false)
|
||||||
|
private val internalFinishedFindingWordsContaining: BooleanProperty = SimpleBooleanProperty(false)
|
||||||
|
private val internalFinishedFindingCharacters: BooleanProperty = SimpleBooleanProperty(false)
|
||||||
|
private val internalFinishedFindingSentences: BooleanProperty = SimpleBooleanProperty(false)
|
||||||
|
|
||||||
val selectedEntry: ReadOnlyObjectProperty<DictionaryEntryFx> = internalSelectedEntry
|
val selectedEntry: ReadOnlyObjectProperty<DictionaryEntryFx> = internalSelectedEntry
|
||||||
|
|
||||||
val searchResults: ObservableList<DictionaryEntryFx> =
|
val searchResults: ObservableList<DictionaryEntryFx> =
|
||||||
@ -53,6 +58,11 @@ class Model(
|
|||||||
val isFindingCharacters: ReadOnlyBooleanProperty = internalIsFindingCharacters
|
val isFindingCharacters: ReadOnlyBooleanProperty = internalIsFindingCharacters
|
||||||
val isFindingSentences: ReadOnlyBooleanProperty = internalIsFindingSentences
|
val isFindingSentences: ReadOnlyBooleanProperty = internalIsFindingSentences
|
||||||
|
|
||||||
|
val finishedFindingWordsBeginning: ReadOnlyBooleanProperty = internalFinishedFindingWordsBeginning
|
||||||
|
val finishedFindingWordsContaining: ReadOnlyBooleanProperty = internalFinishedFindingWordsContaining
|
||||||
|
val finishedFindingCharacters: ReadOnlyBooleanProperty = internalFinishedFindingCharacters
|
||||||
|
val finishedFindingSentences: ReadOnlyBooleanProperty = internalFinishedFindingSentences
|
||||||
|
|
||||||
private val coroutineScope = MainScope()
|
private val coroutineScope = MainScope()
|
||||||
|
|
||||||
fun search(query: String, searchMode: SearchMode) {
|
fun search(query: String, searchMode: SearchMode) {
|
||||||
@ -72,6 +82,7 @@ class Model(
|
|||||||
.map { it.toFx() }
|
.map { it.toFx() }
|
||||||
)
|
)
|
||||||
internalIsFindingWordsBeginning.value = false
|
internalIsFindingWordsBeginning.value = false
|
||||||
|
internalFinishedFindingWordsBeginning.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +95,7 @@ class Model(
|
|||||||
.map { it.toFx() }
|
.map { it.toFx() }
|
||||||
)
|
)
|
||||||
internalIsFindingWordsContaining.value = false
|
internalIsFindingWordsContaining.value = false
|
||||||
|
internalFinishedFindingWordsContaining.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +108,7 @@ class Model(
|
|||||||
.map { it.toFx() }
|
.map { it.toFx() }
|
||||||
)
|
)
|
||||||
internalIsFindingCharacters.value = false
|
internalIsFindingCharacters.value = false
|
||||||
|
internalFinishedFindingCharacters.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +121,7 @@ class Model(
|
|||||||
.map { it.toFx() }
|
.map { it.toFx() }
|
||||||
)
|
)
|
||||||
internalIsFindingSentences.value = false
|
internalIsFindingSentences.value = false
|
||||||
|
internalFinishedFindingSentences.value = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +130,12 @@ class Model(
|
|||||||
internalWordsContaining.setAll(emptyList())
|
internalWordsContaining.setAll(emptyList())
|
||||||
internalCharacters.setAll(emptyList())
|
internalCharacters.setAll(emptyList())
|
||||||
internalSentences.setAll(emptyList())
|
internalSentences.setAll(emptyList())
|
||||||
|
|
||||||
|
internalFinishedFindingCharacters.value = false
|
||||||
|
internalFinishedFindingWordsBeginning.value = false
|
||||||
|
internalFinishedFindingWordsContaining.value = false
|
||||||
|
internalFinishedFindingSentences.value = false
|
||||||
|
|
||||||
internalSelectedEntry.value = entry
|
internalSelectedEntry.value = entry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,22 +275,22 @@ class DetailsController(
|
|||||||
private fun lazyUpdateTabContent(selectedTabId: String?) {
|
private fun lazyUpdateTabContent(selectedTabId: String?) {
|
||||||
when (selectedTabId) {
|
when (selectedTabId) {
|
||||||
"tabWords" -> {
|
"tabWords" -> {
|
||||||
if (model.wordsContaining.isEmpty()) {
|
if (!model.finishedFindingWordsContaining.value) {
|
||||||
model.findWordsContaining()
|
model.findWordsContaining()
|
||||||
}
|
}
|
||||||
if (model.wordsBeginning.isEmpty()) {
|
if (!model.finishedFindingWordsBeginning.value) {
|
||||||
model.findWordsBeginning()
|
model.findWordsBeginning()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"tabCharacters" -> {
|
"tabCharacters" -> {
|
||||||
if (model.characters.isNotEmpty()) return
|
if (model.finishedFindingCharacters.value) return
|
||||||
|
|
||||||
model.findCharacters()
|
model.findCharacters()
|
||||||
}
|
}
|
||||||
|
|
||||||
"tabSentences" -> {
|
"tabSentences" -> {
|
||||||
if (model.sentences.isNotEmpty()) return
|
if (model.finishedFindingSentences.value) return
|
||||||
|
|
||||||
model.findSentences()
|
model.findSentences()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user