clean up PgpImportExport a bit

This commit is contained in:
Vincent Breitmoser 2014-10-03 04:25:00 +02:00
parent 00bbf8c267
commit 662cc53859

View File

@ -47,7 +47,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class PgpImportExport {
@ -116,11 +115,6 @@ public class PgpImportExport {
}
}
/** Imports keys from given data. If keyIds is given only those are imported */
public ImportKeyResult importKeyRings(List<ParcelableKeyRing> entries) {
return importKeyRings(entries.iterator(), entries.size());
}
public ImportKeyResult importKeyRings(Iterator<ParcelableKeyRing> entries, int num) {
updateProgress(R.string.progress_importing, 0, 100);
@ -134,7 +128,11 @@ public class PgpImportExport {
int position = 0;
double progSteps = 100.0 / num;
for (ParcelableKeyRing entry : new IterableIterator<ParcelableKeyRing>(entries)) {
// iterate over all entries
while (entries.hasNext()) {
ParcelableKeyRing entry = entries.next();
// Has this action been cancelled? If so, don't proceed any further
if (mCancelled != null && mCancelled.get()) {
break;