From 51d3daeccdc697d948c597931d804d738132b8ed Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Tue, 30 Jun 2015 20:22:00 +0530 Subject: made CryptoOperationFragment implement OperationHelper.Callback --- .../keychain/ui/base/CryptoOperationFragment.java | 50 ++++++---------------- 1 file changed, 12 insertions(+), 38 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/base/CryptoOperationFragment.java') 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 31450c841..19d808ba6 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 @@ -29,43 +29,13 @@ import org.sufficientlysecure.keychain.service.input.CryptoInputParcel; * All fragments executing crypto operations need to extend this class. */ public abstract class CryptoOperationFragment - extends Fragment { + extends Fragment implements CryptoOperationHelper.Callback { private CryptoOperationHelper mOperationHelper; public CryptoOperationFragment() { - // this is implemented here instead of by the fragment so that the corresponding methods in - // CryptoOperationFragment may continue using the "protected" modifier. - CryptoOperationHelper.Callback callback = new CryptoOperationHelper.Callback() { - - @Override - public T createOperationInput() { - return CryptoOperationFragment.this.createOperationInput(); - } - - @Override - public void onCryptoOperationSuccess(S result) { - CryptoOperationFragment.this.onCryptoOperationSuccess(result); - } - - @Override - public void onCryptoOperationCancelled() { - CryptoOperationFragment.this.onCryptoOperationCancelled(); - } - - @Override - public void onCryptoOperationError(S result) { - CryptoOperationFragment.this.onCryptoOperationError(result); - } - - @Override - public boolean onCryptoSetProgress(String msg, int progress, int max) { - return CryptoOperationFragment.this.onCryptoSetProgress(msg, progress, max); - } - - }; - - mOperationHelper = new CryptoOperationHelper<>(this, callback); + + mOperationHelper = new CryptoOperationHelper<>(this, this); } public void setProgressMessageResource(int id) { @@ -78,7 +48,8 @@ public abstract class CryptoOperationFragment