Commit ca16ad98 authored by Niklas Fix's avatar Niklas Fix 🎓

add dispatch TOuch Event to base

parent 3ae1a11d
package de.akamu.tudarmstadt
import android.content.Context
import android.content.Intent
import android.view.MotionEvent
import android.view.inputmethod.InputMethodManager
import androidx.appcompat.app.AppCompatActivity
import de.akamu.tudarmstadt.api.V2API
import de.akamu.tudarmstadt.events.JWTRefreshedEvent
......@@ -41,4 +44,13 @@ abstract class BaseActivity : AppCompatActivity() {
fun onJWTRefreshedEvent(e: JWTRefreshedEvent) {
AppUserUtil.saveLoginToken(this, V2API.getToken())
}
override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
if (currentFocus != null) {
val imm: InputMethodManager =
getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(currentFocus!!.windowToken, 0)
}
return super.dispatchTouchEvent(ev)
}
}
\ No newline at end of file
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