hide keyboard on crypto error/success
This commit is contained in:
@@ -388,6 +388,9 @@ public class EncryptFilesFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQueuedOperationSuccess(final SignEncryptResult result) {
|
public void onQueuedOperationSuccess(final SignEncryptResult result) {
|
||||||
|
super.onQueuedOperationSuccess(result);
|
||||||
|
|
||||||
|
hideKeyboard();
|
||||||
|
|
||||||
// protected by Queueing*Fragment
|
// protected by Queueing*Fragment
|
||||||
FragmentActivity activity = getActivity();
|
FragmentActivity activity = getActivity();
|
||||||
|
|||||||
@@ -332,6 +332,9 @@ public class EncryptTextFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQueuedOperationSuccess(SignEncryptResult result) {
|
public void onQueuedOperationSuccess(SignEncryptResult result) {
|
||||||
|
super.onQueuedOperationSuccess(result);
|
||||||
|
|
||||||
|
hideKeyboard();
|
||||||
|
|
||||||
if (mShareAfterEncrypt) {
|
if (mShareAfterEncrypt) {
|
||||||
// Share encrypted message/file
|
// Share encrypted message/file
|
||||||
|
|||||||
@@ -32,13 +32,11 @@ public abstract class CachingCryptoOperationFragment <T extends Parcelable, S ex
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQueuedOperationSuccess(S result) {
|
public void onQueuedOperationSuccess(S result) {
|
||||||
super.onCryptoOperationSuccess(result);
|
|
||||||
mCachedActionsParcel = null;
|
mCachedActionsParcel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onQueuedOperationError(S result) {
|
public void onQueuedOperationError(S result) {
|
||||||
super.onCryptoOperationError(result);
|
|
||||||
mCachedActionsParcel = null;
|
mCachedActionsParcel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,13 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.ui.base;
|
package org.sufficientlysecure.keychain.ui.base;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.R;
|
import org.sufficientlysecure.keychain.R;
|
||||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
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);
|
abstract public void onCryptoOperationSuccess(S result);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCryptoOperationError(S result) {
|
abstract public void onCryptoOperationError(S result);
|
||||||
result.createNotify(getActivity()).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCryptoOperationCancelled() {
|
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 abstract void onQueuedOperationSuccess(S result);
|
||||||
|
|
||||||
public void onQueuedOperationError(S result) {
|
public void onQueuedOperationError(S result) {
|
||||||
super.onCryptoOperationError(result);
|
hideKeyboard();
|
||||||
|
result.createNotify(getActivity()).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user