mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
fix: Revert fragment view
This commit is contained in:
@@ -71,16 +71,9 @@ open class ProgressTaskDialogFragment : DialogFragment() {
|
|||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||||
progressTaskViewModel.progressMessageState.collect { state ->
|
progressTaskViewModel.progressMessageState.collect { state ->
|
||||||
titleView?.text = state.title
|
updateView(titleView, state.title)
|
||||||
messageView?.text = state.message
|
updateView(messageView, state.message)
|
||||||
warningView?.apply {
|
updateView(warningView, state.warning)
|
||||||
state.warning?.let { warning ->
|
|
||||||
text = warning
|
|
||||||
visibility = View.VISIBLE
|
|
||||||
} ?: run {
|
|
||||||
visibility = View.GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cancelButton?.isVisible = state.cancelable != null
|
cancelButton?.isVisible = state.cancelable != null
|
||||||
cancelButton?.setOnClickListener {
|
cancelButton?.setOnClickListener {
|
||||||
state.cancelable?.invoke()
|
state.cancelable?.invoke()
|
||||||
@@ -97,6 +90,15 @@ open class ProgressTaskDialogFragment : DialogFragment() {
|
|||||||
return super.onCreateDialog(savedInstanceState)
|
return super.onCreateDialog(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun updateView(textView: TextView?, value: String?) {
|
||||||
|
if (value == null) {
|
||||||
|
textView?.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
textView?.text = value
|
||||||
|
textView?.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = ProgressTaskDialogFragment::class.java.simpleName
|
private val TAG = ProgressTaskDialogFragment::class.java.simpleName
|
||||||
const val PROGRESS_TASK_DIALOG_TAG = "progressDialogFragment"
|
const val PROGRESS_TASK_DIALOG_TAG = "progressDialogFragment"
|
||||||
|
|||||||
Reference in New Issue
Block a user