diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-22 00:10:55 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2014-09-22 00:10:55 +0200 |
commit | d63fabace7f535ea9bcd9b5afd3150666910905e (patch) | |
tree | d5c4355e091b97e2526beb33d5d90e4649247ae9 /OpenKeychain/src/main/java/org | |
parent | fc4cdaa24b5df376e918de2583cb95dbb6baa3b0 (diff) | |
download | open-keychain-d63fabace7f535ea9bcd9b5afd3150666910905e.tar.gz open-keychain-d63fabace7f535ea9bcd9b5afd3150666910905e.tar.bz2 open-keychain-d63fabace7f535ea9bcd9b5afd3150666910905e.zip |
Hack to fix #805
Diffstat (limited to 'OpenKeychain/src/main/java/org')
2 files changed, 57 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java index cd754694b..32adba4e2 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java @@ -22,10 +22,12 @@ import android.os.Bundle; import android.support.v4.app.Fragment; import android.text.Editable; import android.text.TextWatcher; +import android.text.method.TextKeyListener; import android.util.Patterns; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; @@ -68,10 +70,10 @@ public class CreateKeyInputFragment extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.create_key_input_fragment, container, false); - mNameEdit = (AutoCompleteTextView) view.findViewById(R.id.name); - mEmailEdit = (AutoCompleteTextView) view.findViewById(R.id.email); - mPassphraseEdit = (EditText) view.findViewById(R.id.passphrase); - mPassphraseEditAgain = (EditText) view.findViewById(R.id.passphrase_again); + mNameEdit = (AutoCompleteTextView) view.findViewById(R.id.create_key_name); + mEmailEdit = (AutoCompleteTextView) view.findViewById(R.id.create_key_email); + mPassphraseEdit = (EditText) view.findViewById(R.id.create_key_passphrase); + mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again); mCreateButton = view.findViewById(R.id.create_key_button); // initial values diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AutoCorrectAutoCompleteTextView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AutoCorrectAutoCompleteTextView.java new file mode 100644 index 000000000..ed373a938 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AutoCorrectAutoCompleteTextView.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.sufficientlysecure.keychain.ui.widget; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.inputmethod.EditorInfo; +import android.widget.AutoCompleteTextView; + +/** + * Hack to re-enable keyboard auto correction in AutoCompleteTextView. + * From http://stackoverflow.com/a/22512858 + */ +public class AutoCorrectAutoCompleteTextView extends AutoCompleteTextView { + + public AutoCorrectAutoCompleteTextView(Context context) { + super(context); + removeFlag(); + } + + public AutoCorrectAutoCompleteTextView(Context context, AttributeSet attrs) { + super(context, attrs); + removeFlag(); + } + + public AutoCorrectAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + removeFlag(); + } + + private void removeFlag() { + int inputType = getInputType(); + inputType &= ~EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE; + setRawInputType(inputType); + } +} |