mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Issue 1332: Multiple numeric dialogs appearing (#1356)
Co-authored-by: Jakub Kalinowski <kalj@netcompany.com>
This commit is contained in:
@@ -50,7 +50,6 @@ class NumberPickerFactory
|
||||
@Inject constructor(
|
||||
@ActivityContext private val context: Context
|
||||
) {
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun create(
|
||||
value: Double,
|
||||
@@ -60,6 +59,8 @@ class NumberPickerFactory
|
||||
frequency: Frequency,
|
||||
callback: ListHabitsBehavior.NumberPickerCallback
|
||||
): AlertDialog {
|
||||
clearCurrentDialog()
|
||||
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val view = inflater.inflate(R.layout.number_picker_dialog, null)
|
||||
|
||||
@@ -113,6 +114,7 @@ class NumberPickerFactory
|
||||
}
|
||||
.setOnDismissListener {
|
||||
callback.onNumberPickerDismissed()
|
||||
currentDialog = null
|
||||
}
|
||||
|
||||
if (frequency == DAILY) {
|
||||
@@ -153,6 +155,7 @@ class NumberPickerFactory
|
||||
false
|
||||
}
|
||||
|
||||
currentDialog = dialog
|
||||
return dialog
|
||||
}
|
||||
|
||||
@@ -169,6 +172,14 @@ class NumberPickerFactory
|
||||
val inputMethodManager = context.getSystemService(InputMethodManager::class.java)
|
||||
inputMethodManager?.showSoftInput(v, 0)
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var currentDialog: AlertDialog? = null
|
||||
fun clearCurrentDialog() {
|
||||
currentDialog?.dismiss()
|
||||
currentDialog = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SeparatorWatcherInputFilter(private val nextPicker: NumberPicker) : InputFilter {
|
||||
|
||||
Reference in New Issue
Block a user