Export cancellable - minor changes

This commit is contained in:
grait 2014-03-11 04:49:52 +05:30
parent 3f649d4458
commit ccdf646c19
3 changed files with 10 additions and 6 deletions

View File

@ -42,6 +42,7 @@ import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
import org.sufficientlysecure.keychain.util.HkpKeyServer; import org.sufficientlysecure.keychain.util.HkpKeyServer;
import org.sufficientlysecure.keychain.util.IterableIterator; import org.sufficientlysecure.keychain.util.IterableIterator;
import org.sufficientlysecure.keychain.util.KeyServer.AddKeyException; import org.sufficientlysecure.keychain.util.KeyServer.AddKeyException;
import org.sufficientlysecure.keychain.util.KeychainServiceListener;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater;
@ -51,9 +52,6 @@ import android.os.Environment;
public class PgpImportExport { public class PgpImportExport {
public interface KeychainServiceListener{
public boolean hasServiceStopped();
}
private Context mContext; private Context mContext;
private ProgressDialogUpdater mProgress; private ProgressDialogUpdater mProgress;
@ -201,7 +199,7 @@ public class PgpImportExport {
if (secretKeyRing != null) { if (secretKeyRing != null) {
secretKeyRing.encode(arOutStream); secretKeyRing.encode(arOutStream);
} }
if(mKeychainServiceListener.hasServiceStopped()==true){ if(mKeychainServiceListener.hasServiceStopped()){
arOutStream.close(); arOutStream.close();
return null; return null;
} }
@ -214,7 +212,7 @@ public class PgpImportExport {
publicKeyRing.encode(arOutStream); publicKeyRing.encode(arOutStream);
} }
if(mKeychainServiceListener.hasServiceStopped() == true){ if(mKeychainServiceListener.hasServiceStopped()){
arOutStream.close(); arOutStream.close();
return null; return null;
} }

View File

@ -56,6 +56,7 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry;
import org.sufficientlysecure.keychain.util.HkpKeyServer; import org.sufficientlysecure.keychain.util.HkpKeyServer;
import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.InputData;
import org.sufficientlysecure.keychain.util.KeychainServiceListener;
import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Log;
import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater;
@ -73,7 +74,7 @@ import android.os.RemoteException;
* data from the activities or other apps, queues these intents, executes them, and stops itself * data from the activities or other apps, queues these intents, executes them, and stops itself
* after doing them. * after doing them.
*/ */
public class KeychainIntentService extends IntentService implements ProgressDialogUpdater, PgpImportExport.KeychainServiceListener { public class KeychainIntentService extends IntentService implements ProgressDialogUpdater, KeychainServiceListener {
/* extras that can be given by intent */ /* extras that can be given by intent */
public static final String EXTRA_MESSENGER = "messenger"; public static final String EXTRA_MESSENGER = "messenger";

View File

@ -0,0 +1,5 @@
package org.sufficientlysecure.keychain.util;
public interface KeychainServiceListener {
boolean hasServiceStopped();
}