ime done
This commit is contained in:
parent
861b982842
commit
d32feb7724
|
@ -8,6 +8,9 @@ import android.view.ViewGroup
|
|||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import kotlinx.android.synthetic.main.fragment_input.*
|
||||
import android.view.inputmethod.EditorInfo
|
||||
|
||||
|
||||
|
||||
class InputFragment: Fragment() {
|
||||
|
||||
|
@ -21,6 +24,15 @@ class InputFragment: Fragment() {
|
|||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
mEditText.setOnEditorActionListener() { _, actionId, _ ->
|
||||
if(actionId == EditorInfo.IME_ACTION_DONE){
|
||||
button.performClick();
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
button.setOnClickListener {
|
||||
val directions = InputFragmentDirections.actionInputFragmentToSubmissionFragment()
|
||||
directions.writtenText = mEditText.text.toString()
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:theme="@style/AppTheme"
|
||||
android:orientation="vertical"
|
||||
android:id="@+id/splashFragmentContainer"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -26,6 +25,8 @@
|
|||
<com.google.android.material.textfield.TextInputEditText
|
||||
style="@style/Widget.MaterialComponents.TextInputEditText.OutlinedBox"
|
||||
android:id="@+id/mEditText"
|
||||
android:imeOptions="actionDone"
|
||||
android:singleLine="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
|
Reference in New Issue