diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-09 00:58:24 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-04-09 00:58:24 +0200 |
commit | 9fb493418e8145ee8ebe0647e6e1c7aab50346ed (patch) | |
tree | ee611147209baa071cd9a73807c1d5d835070349 /OpenKeychain/src/main | |
parent | e9efd0ec8793069add0ae41e22ebb78fc9df147c (diff) | |
download | open-keychain-9fb493418e8145ee8ebe0647e6e1c7aab50346ed.tar.gz open-keychain-9fb493418e8145ee8ebe0647e6e1c7aab50346ed.tar.bz2 open-keychain-9fb493418e8145ee8ebe0647e6e1c7aab50346ed.zip |
Hide keyboard after hiding custom key length field
Diffstat (limited to 'OpenKeychain/src/main')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java index 183f569f1..238980349 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java @@ -28,6 +28,7 @@ import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; +import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; @@ -194,7 +195,7 @@ public class CreateKeyDialogFragment extends DialogFragment { final String customLengthString = getResources().getString(R.string.key_size_custom); final boolean customSelected = customLengthString.equals(selectedItemString); String keyLengthString = customSelected ? mCustomKeyEditText.getText().toString() : selectedItemString; - int keySize = 0; + int keySize; try { keySize = Integer.parseInt(keyLengthString); } catch (NumberFormatException e) { @@ -268,6 +269,13 @@ public class CreateKeyDialogFragment extends DialogFragment { mCustomKeyEditText.setVisibility(visibility); mCustomKeyTextView.setVisibility(visibility); mCustomKeyInfoTextView.setVisibility(visibility); + + // hide keyboard after setting visibility to gone + if (visibility == View.GONE) { + InputMethodManager imm = (InputMethodManager) + getActivity().getSystemService(getActivity().INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(mCustomKeyEditText.getWindowToken(), 0); + } } private void setKeyLengthSpinnerValuesForAlgorithm(int algorithmId) { |