Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose autofillHints from the edit text within the text element #100

Merged
merged 2 commits into from
Feb 2, 2024
Merged
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
10 changes: 10 additions & 0 deletions lib/src/main/java/com/basistheory/android/view/TextElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
Expand All @@ -23,6 +24,7 @@ import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
import android.widget.FrameLayout
import androidx.annotation.RequiresApi
import androidx.appcompat.widget.AppCompatEditText
import androidx.core.content.res.ResourcesCompat
import androidx.core.os.bundleOf
Expand Down Expand Up @@ -261,6 +263,14 @@ open class TextElement @JvmOverloads constructor(
checkIcon?.setTint(value)
}

var autoFillHints: Array<String>?
@RequiresApi(Build.VERSION_CODES.O)
get() = _editText.autofillHints
@RequiresApi(Build.VERSION_CODES.O)
set(value) {
value?.let { _editText.setAutofillHints(*value) }
}

fun addChangeEventListener(listener: (ChangeEvent) -> Unit) {
_eventListeners.change.add(listener)
}
Expand Down
Loading