diff options
author | Alex Fong <alexfongg@gmail.com> | 2016-03-12 10:32:38 +0800 |
---|---|---|
committer | Alex Fong <alexfongg@gmail.com> | 2016-03-12 12:46:20 +0800 |
commit | b5211b33de683f5e903a2ad2d5028e2176c88eb8 (patch) | |
tree | 2c3b4af8ba0232c68b4e33a090dd99a6572f4b73 | |
parent | bd2c41df22edcd5bac82f57d4ff7f63c6caa91f4 (diff) | |
download | open-keychain-b5211b33de683f5e903a2ad2d5028e2176c88eb8.tar.gz open-keychain-b5211b33de683f5e903a2ad2d5028e2176c88eb8.tar.bz2 open-keychain-b5211b33de683f5e903a2ad2d5028e2176c88eb8.zip |
Provisional backup-code text selection fix
For issue #1779, a provisional fix where selection is still possible, but more difficult.
Preventing selection altogether is not possible due to the implementation in the Masked-Edittext dependency.
To be updated when Masked-Edittext fixes this bug.
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java index f1d9b270d..e7ff6ce46 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BackupCodeFragment.java @@ -43,6 +43,7 @@ import android.support.v4.app.FragmentManager.OnBackStackChangedListener; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; +import android.view.ActionMode; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -237,6 +238,30 @@ public class BackupCodeFragment extends CryptoOperationFragment<BackupKeyringPar mCodeEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); setupEditTextSuccessListener(mCodeEditText); + // prevent selection action mode, partially circumventing text selection bug + mCodeEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() { + @Override + public boolean onCreateActionMode(ActionMode mode, Menu menu) { + return false; + } + + @Override + public boolean onPrepareActionMode(ActionMode mode, Menu menu) { + return false; + } + + @Override + public boolean onActionItemClicked(ActionMode mode, MenuItem item) { + return false; + } + + @Override + public void onDestroyActionMode(ActionMode mode) { + + } + }); + + TextView codeDisplayText = (TextView) view.findViewById(R.id.backup_code_display); setupAutomaticLinebreak(codeDisplayText); |