Skip to content

Commit

Permalink
feat: support showing keyboard programmatically (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
jleon15 authored Apr 24, 2024
1 parent 5c60331 commit a6cc7e9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: ./gradlew testDebugUnitTest

acceptance:
runs-on: macos-latest
runs-on: macos-13

strategy:
matrix:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class SocialSecurityNumberFragment : Fragment() {
return binding.root
}

private fun autofill() {
binding.socialSecurityNumber.setText("234567890")
private fun autofill() {
binding.socialSecurityNumber.setText("234567890")
}

private fun tokenize() =
Expand Down
8 changes: 7 additions & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'pl.pragmatists:JUnitParams:1.1.1'
testImplementation 'org.robolectric:robolectric:4.10.3'
testImplementation 'org.robolectric:robolectric:4.12.1'
testImplementation 'io.strikt:strikt-core:0.34.1'
testImplementation 'io.mockk:mockk:1.13.8'
testImplementation("com.squareup.okhttp3:mockwebserver:4.11.0")
Expand All @@ -95,5 +95,11 @@ configurations.configureEach {
}
details.useVersion("2.2")
}
if (details.requested.module.toString() == 'org.bouncycastle:bcprov-jdk18on') {
details.artifactSelection {
it.selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
}
details.useVersion("1.78")
}
}
}
7 changes: 7 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 @@ -23,9 +23,11 @@ import android.view.View.OnTouchListener
import android.view.ViewGroup
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
import android.view.inputmethod.InputMethodManager
import android.widget.FrameLayout
import androidx.annotation.RequiresApi
import androidx.appcompat.widget.AppCompatEditText
import androidx.core.content.getSystemService
import androidx.core.content.res.ResourcesCompat
import androidx.core.os.bundleOf
import com.basistheory.android.R
Expand Down Expand Up @@ -156,6 +158,11 @@ open class TextElement @JvmOverloads constructor(
)
}

fun showKeyboard(flags: Int) {
val imm = context.getSystemService<InputMethodManager>()
imm!!.showSoftInput(_editText, flags)
}

fun getDrawables(): Array<Drawable?> {
return _editText.compoundDrawables
}
Expand Down

0 comments on commit a6cc7e9

Please sign in to comment.