hide keyboard on crypto error/success
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -332,6 +332,9 @@ public class EncryptTextFragment
|
||||
|
||||
@Override
|
||||
public void onQueuedOperationSuccess(SignEncryptResult result) {
|
||||
super.onQueuedOperationSuccess(result);
|
||||
|
||||
hideKeyboard();
|
||||
|
||||
if (mShareAfterEncrypt) {
|
||||
// Share encrypted message/file
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user