From 4aa79e4bce40e7d21c590178889d27a84128e00a Mon Sep 17 00:00:00 2001 From: Daniel Alome Date: Tue, 5 May 2026 09:22:27 +0100 Subject: [PATCH] (fix) Keyboard blocking the UI when typing in keystore generator --- .../fragments/KeystoreGeneratorFragment.kt | 30 +++++++++++++++++++ .../layout/fragment_keystore_generator.xml | 7 ++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/keystore-generator/src/main/kotlin/com/appdevforall/keygen/plugin/fragments/KeystoreGeneratorFragment.kt b/keystore-generator/src/main/kotlin/com/appdevforall/keygen/plugin/fragments/KeystoreGeneratorFragment.kt index 3c492659..7b10aa4c 100644 --- a/keystore-generator/src/main/kotlin/com/appdevforall/keygen/plugin/fragments/KeystoreGeneratorFragment.kt +++ b/keystore-generator/src/main/kotlin/com/appdevforall/keygen/plugin/fragments/KeystoreGeneratorFragment.kt @@ -1,9 +1,11 @@ package com.appdevforall.keygen.plugin.fragments +import android.graphics.Rect import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.EditText import android.widget.LinearLayout import android.widget.TextView import android.widget.Toast @@ -97,6 +99,7 @@ class KeystoreGeneratorFragment : Fragment(), BuildStatusListener { super.onViewCreated(view, savedInstanceState) initializeViews(view) setupClickListeners() + setupFocusScroll() updateButtonStates() } @@ -175,6 +178,33 @@ class KeystoreGeneratorFragment : Fragment(), BuildStatusListener { } } + private fun setupFocusScroll() { + val fields = arrayOf( + keystoreNameInput, + keystorePasswordInput, + keyAliasInput, + keyPasswordInput, + certificateNameInput, + organizationalUnitInput, + organizationInput, + cityInput, + stateInput, + countryInput + ) + for (field in fields) { + field.setOnFocusChangeListener { focused, hasFocus -> + if (hasFocus) { + focused.post { + focused.requestRectangleOnScreen( + Rect(0, 0, focused.width, focused.height), + false + ) + } + } + } + } + } + private fun clearValidationErrors() { tilKeystoreName.error = null tilKeystorePassword.error = null diff --git a/keystore-generator/src/main/res/layout/fragment_keystore_generator.xml b/keystore-generator/src/main/res/layout/fragment_keystore_generator.xml index f51663c6..08d24b08 100644 --- a/keystore-generator/src/main/res/layout/fragment_keystore_generator.xml +++ b/keystore-generator/src/main/res/layout/fragment_keystore_generator.xml @@ -3,7 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + android:orientation="vertical" + android:paddingBottom="100dp"> - -