Hide keyboard on clicking connect (#103)
This commit is contained in:
parent
2333e5ec11
commit
8af19cbd9a
|
@ -7,6 +7,7 @@ import android.content.SharedPreferences
|
|||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import com.h.pixeldroid.api.PixelfedAPI
|
||||
|
@ -18,6 +19,7 @@ import retrofit2.Call
|
|||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var OAUTH_SCHEME: String
|
||||
|
@ -70,7 +72,8 @@ class LoginActivity : AppCompatActivity() {
|
|||
} catch (e: IllegalArgumentException) {
|
||||
return failedRegistration(getString(R.string.invalid_domain))
|
||||
}
|
||||
|
||||
|
||||
hideKeyboard()
|
||||
loadingAnimation(true)
|
||||
|
||||
preferences.edit()
|
||||
|
@ -79,6 +82,15 @@ class LoginActivity : AppCompatActivity() {
|
|||
registerAppToServer("https://$normalizedDomain")
|
||||
|
||||
}
|
||||
private fun hideKeyboard() {
|
||||
val view = currentFocus
|
||||
if (view != null) {
|
||||
(getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(
|
||||
view.windowToken,
|
||||
InputMethodManager.HIDE_NOT_ALWAYS
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun normalizeDomain(domain: String): String {
|
||||
var d = domain.replace("http://", "")
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textUri" />
|
||||
|
||||
<Button
|
||||
|
|
Loading…
Reference in New Issue