mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
incorporate androidlib
This commit is contained in:
parent
20cf3f0825
commit
5eb5cd1421
63 changed files with 1451 additions and 108 deletions
|
|
@ -0,0 +1,20 @@
|
|||
package com.geeksville.mesh.android
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.Toast
|
||||
|
||||
/// show a toast
|
||||
fun Context.toast(message: CharSequence) =
|
||||
Toast.makeText(this, message, Toast.LENGTH_SHORT).show()
|
||||
|
||||
/// Utility function to hide the soft keyboard per stack overflow
|
||||
fun Activity.hideKeyboard() {
|
||||
// Check if no view has focus:
|
||||
currentFocus?.let { v ->
|
||||
val imm =
|
||||
getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||
imm?.hideSoftInputFromWindow(v.windowToken, 0)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue