Commit 734d24ae authored by Christophe Henry's avatar Christophe Henry

Merge branch 'fix-hide-keyboard' into 'develop'

Fix Keyboard not hidden before login

See merge request !33
parents 54c49a3a d7eb6f65
......@@ -5,6 +5,7 @@ import android.animation.AnimatorListenerAdapter
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.ResultReceiver
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
......@@ -19,7 +20,11 @@ import fr.chenry.android.freshrss.store.Store
import fr.chenry.android.freshrss.utils.InstanceUrl
import fr.chenry.android.freshrss.utils.Try
import fr.chenry.android.freshrss.utils.e
import fr.chenry.android.freshrss.utils.whenNotNull
import fr.chenry.android.freshrss.utils.whenNull
import kotlinx.android.synthetic.main.activity_login.*
import nl.komponents.kovenant.deferred
import nl.komponents.kovenant.resolve
import nl.komponents.kovenant.ui.failUi
import nl.komponents.kovenant.ui.successUi
import java.util.Properties
......@@ -134,11 +139,15 @@ class LoginActivity : AppCompatActivity() {
}
private fun hideKeyboard() {
val deferred = deferred<Unit, Exception>()
val view = this.currentFocus
view?.let {
view.whenNotNull {
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(it.windowToken, 0)
}
imm.hideSoftInputFromWindow(it.windowToken, 0, object : ResultReceiver(null) {
override fun onReceiveResult(resultCode: Int, resultData: Bundle?) = deferred.resolve()
})
}.whenNull { deferred.resolve() }
deferred.promise.get()
}
private fun showProgress(show: Boolean) {
......
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