Commit e364ee65 authored by Fynn Godau's avatar Fynn Godau Committed by Isabelle K
Browse files

Hide keyboard when pressing go

parent 365f2e62
package rocks.ism.decentral.geminiclient package rocks.ism.decentral.geminiclient
import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.view.KeyEvent import android.view.KeyEvent
import android.view.inputmethod.InputMethodManager
import android.widget.Button import android.widget.Button
import android.widget.EditText import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
...@@ -37,6 +39,11 @@ class MainActivity : AppCompatActivity() { ...@@ -37,6 +39,11 @@ class MainActivity : AppCompatActivity() {
// Create handlers // Create handlers
goButton.setOnClickListener { goButton.setOnClickListener {
goToPage(URI.create(uriField.text.toString())) goToPage(URI.create(uriField.text.toString()))
// Hide keyboard
uriField.clearFocus()
val inputService = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputService.hideSoftInputFromWindow(uriField.windowToken, 0)
} }
uriField.setOnKeyListener { _, keyCode, event -> uriField.setOnKeyListener { _, keyCode, event ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment