fixed wrong loading bug, fixed editing bug
This commit is contained in:
@ -48,7 +48,7 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
||||
val pathExists = File(dbPath).exists()
|
||||
updateMainButtonsState(pathExists)
|
||||
|
||||
if (!editText.text.isNullOrBlank()) {
|
||||
if (pathExists && !editText.text.isNullOrBlank()) {
|
||||
buttonLoad.performClick()
|
||||
}
|
||||
}
|
||||
@ -154,21 +154,26 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
||||
questionnaireFiles[button] = entry.file
|
||||
}
|
||||
updateButtonTexts()
|
||||
|
||||
val alwaysButtons = questionnaireEntries.mapIndexedNotNull { idx, entry ->
|
||||
val btn = dynamicButtons.getOrNull(idx)
|
||||
if (entry.condition is QuestionItem.Condition.AlwaysAvailable) btn else null
|
||||
}
|
||||
setButtonsEnabled(alwaysButtons)
|
||||
|
||||
dynamicButtons.forEach { button ->
|
||||
button.setOnClickListener {
|
||||
val clientCode = editText.text.toString().trim()
|
||||
GlobalValues.LAST_CLIENT_CODE = clientCode
|
||||
|
||||
// Optional: LAST_CLIENT_CODE synchronisieren (rein informativ)
|
||||
GlobalValues.LAST_CLIENT_CODE = GlobalValues.LOADED_CLIENT_CODE
|
||||
|
||||
startQuestionnaireForButton(button)
|
||||
setButtonsEnabled(dynamicButtons.filter { it == button })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun restorePreviousClientCode() {
|
||||
GlobalValues.LAST_CLIENT_CODE?.let { editText.setText(it) }
|
||||
}
|
||||
@ -276,10 +281,13 @@ class HandlerOpeningScreen(private val activity: MainActivity) {
|
||||
questionnaireFiles = questionnaireFiles,
|
||||
buttonPoints = buttonPoints,
|
||||
updateButtonTexts = { updateButtonTexts() },
|
||||
setButtonsEnabled = { setButtonsEnabled(it) }
|
||||
setButtonsEnabled = { setButtonsEnabled(it) },
|
||||
// Vor "Bearbeiten" ggf. den Load-Button ausführen
|
||||
triggerLoad = { buttonLoad.performClick() }
|
||||
).setup()
|
||||
}
|
||||
|
||||
|
||||
private fun setupUploadButton() {
|
||||
uploadButton.text = "Upload"
|
||||
uploadButton.setOnClickListener {
|
||||
|
||||
Reference in New Issue
Block a user