incorporate androidlib

This commit is contained in:
andrekir 2022-09-04 22:52:40 -03:00
parent 20cf3f0825
commit 5eb5cd1421
63 changed files with 1451 additions and 108 deletions

View file

@ -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)
}
}