Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class OverlayManager @Inject internal constructor(
}

private fun onOrientationChanged() {
overlayBackStack.forEachReversed { it.changeOrientation() }
overlayBackStack.forEach { it.changeOrientation() }
}

override fun dump(writer: PrintWriter, prefix: CharSequence) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import android.text.InputType
import android.view.inputmethod.EditorInfo

import androidx.annotation.StringRes
import androidx.core.widget.doAfterTextChanged

import com.buzbuz.smartautoclicker.core.ui.R
import com.buzbuz.smartautoclicker.core.ui.databinding.IncludeFieldTextInputBinding
Expand All @@ -34,11 +33,13 @@ fun IncludeFieldTextInputBinding.setLabel(@StringRes labelResId: Int) {

fun IncludeFieldTextInputBinding.setText(text: String?, type: Int = InputType.TYPE_CLASS_TEXT) {
textField.apply {
if (hasFocus()) return
val initialized = tag as? Boolean ?: false
if (initialized && hasFocus()) return

inputType = type
imeOptions = EditorInfo.IME_ACTION_DONE
setText(text)
tag = true
}
}

Expand All @@ -51,5 +52,7 @@ fun IncludeFieldTextInputBinding.setError(@StringRes messageId: Int, isError: Bo
}

fun IncludeFieldTextInputBinding.setOnTextChangedListener(listener: (Editable) -> Unit) {
textField.addTextChangedListener(OnAfterTextChangedListener(listener))
textField.addTextChangedListener(OnAfterTextChangedListener { editable ->
if (textField.hasFocus()) listener(editable)
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,25 @@ fun IncludeFieldTextInputWithCheckboxBinding.setup(

fun IncludeFieldTextInputWithCheckboxBinding.setNumericValue(value: String, force: Boolean = false) {
textField.apply {
if (hasFocus() && !force) return
val initialized = tag as? Boolean ?: false
if (initialized && hasFocus() && !force) return

inputType = InputType.TYPE_CLASS_NUMBER
imeOptions = EditorInfo.IME_ACTION_DONE
textField.setText(value)
tag = true
}
}

fun IncludeFieldTextInputWithCheckboxBinding.setTextValue(value: String?, force: Boolean = false) {
textField.apply {
if (hasFocus() && !force) return
val initialized = tag as? Boolean ?: false
if (initialized && hasFocus() && !force) return

inputType = InputType.TYPE_CLASS_TEXT
imeOptions = EditorInfo.IME_ACTION_DONE
textField.setText(value)
tag = true
}
}

Expand All @@ -83,7 +87,9 @@ fun IncludeFieldTextInputWithCheckboxBinding.setError(@StringRes messageId: Int,
}

fun IncludeFieldTextInputWithCheckboxBinding.setOnTextChangedListener(listener: (Editable) -> Unit) {
textField.addTextChangedListener(OnAfterTextChangedListener(listener))
textField.addTextChangedListener(OnAfterTextChangedListener { editable ->
if (textField.hasFocus()) listener(editable)
})
}

fun IncludeFieldTextInputWithCheckboxBinding.setOnCheckboxClickedListener(listener: () -> Unit) {
Expand Down
Loading
Loading