diff options
5 files changed, 27 insertions, 6 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java index 7b2796c69..557413ba1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java @@ -388,6 +388,9 @@ public class EncryptFilesFragment @Override public void onQueuedOperationSuccess(final SignEncryptResult result) { + super.onQueuedOperationSuccess(result); + + hideKeyboard(); // protected by Queueing*Fragment FragmentActivity activity = getActivity(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java index e307a85f8..357787f70 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java @@ -332,6 +332,9 @@ public class EncryptTextFragment @Override public void onQueuedOperationSuccess(SignEncryptResult result) { + super.onQueuedOperationSuccess(result); + + hideKeyboard(); if (mShareAfterEncrypt) { // Share encrypted message/file diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CachingCryptoOperationFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CachingCryptoOperationFragment.java index 9ce33f5a6..06361e8cb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CachingCryptoOperationFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CachingCryptoOperationFragment.java @@ -32,13 +32,11 @@ public abstract class CachingCryptoOperationFragment <T extends Parcelable, S ex @Override public void onQueuedOperationSuccess(S result) { - super.onCryptoOperationSuccess(result); mCachedActionsParcel = null; } @Override public void onQueuedOperationError(S result) { - super.onCryptoOperationError(result); mCachedActionsParcel = null; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationFragment.java index e77a05dc2..c22566767 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationFragment.java @@ -18,10 +18,13 @@ package org.sufficientlysecure.keychain.ui.base; +import android.content.Context; import android.content.Intent; import android.os.Parcelable; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; +import android.view.View; +import android.view.inputmethod.InputMethodManager; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.operations.results.OperationResult; @@ -101,12 +104,25 @@ abstract class CryptoOperationFragment<T extends Parcelable, S extends Operation abstract public void onCryptoOperationSuccess(S result); @Override - public void onCryptoOperationError(S result) { - result.createNotify(getActivity()).show(); - } + abstract public void onCryptoOperationError(S result); @Override public void onCryptoOperationCancelled() { } + public void hideKeyboard() { + if (getActivity() == null) { + return; + } + InputMethodManager inputManager = (InputMethodManager) getActivity() + .getSystemService(Context.INPUT_METHOD_SERVICE); + + // check if no view has focus + View v = getActivity().getCurrentFocus(); + if (v == null) + return; + + inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0); + } + } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/QueueingCryptoOperationFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/QueueingCryptoOperationFragment.java index 65b0ac0de..9a88dcf31 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/QueueingCryptoOperationFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/QueueingCryptoOperationFragment.java @@ -69,7 +69,8 @@ public abstract class QueueingCryptoOperationFragment<T extends Parcelable, S ex public abstract void onQueuedOperationSuccess(S result); public void onQueuedOperationError(S result) { - super.onCryptoOperationError(result); + hideKeyboard(); + result.createNotify(getActivity()).show(); } @Override |