mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
ditch NullProgressable
This commit is contained in:
parent
8981fcf93d
commit
56f760e3f8
@ -21,11 +21,11 @@ package org.sufficientlysecure.keychain.support;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import org.spongycastle.util.Arrays;
|
import org.spongycastle.util.Arrays;
|
||||||
import org.sufficientlysecure.keychain.pgp.NullProgressable;
|
|
||||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||||
import org.sufficientlysecure.keychain.service.OperationResults;
|
import org.sufficientlysecure.keychain.service.OperationResults;
|
||||||
|
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -59,7 +59,7 @@ public class KeyringTestingHelper {
|
|||||||
// Should throw an exception; key is not yet saved
|
// Should throw an exception; key is not yet saved
|
||||||
retrieveKeyAndExpectNotFound(providerHelper, masterKeyId);
|
retrieveKeyAndExpectNotFound(providerHelper, masterKeyId);
|
||||||
|
|
||||||
OperationResults.SaveKeyringResult saveKeyringResult = providerHelper.savePublicKeyRing(ring, new NullProgressable());
|
OperationResults.SaveKeyringResult saveKeyringResult = providerHelper.savePublicKeyRing(ring, new ProgressScaler());
|
||||||
|
|
||||||
boolean saveSuccess = saveKeyringResult.success();
|
boolean saveSuccess = saveKeyringResult.success();
|
||||||
|
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.sufficientlysecure.keychain.pgp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* No-op implementation of Progressable
|
|
||||||
*/
|
|
||||||
public class NullProgressable implements Progressable {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setProgress(String message, int current, int total) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setProgress(int resourceId, int current, int total) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setProgress(int current, int total) {
|
|
||||||
}
|
|
||||||
}
|
|
@ -36,7 +36,6 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKey;
|
|||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||||
import org.sufficientlysecure.keychain.pgp.NullProgressable;
|
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpHelper;
|
import org.sufficientlysecure.keychain.pgp.PgpHelper;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpImportExport;
|
import org.sufficientlysecure.keychain.pgp.PgpImportExport;
|
||||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||||
@ -62,6 +61,7 @@ import org.sufficientlysecure.keychain.util.FileImportCache;
|
|||||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
import org.sufficientlysecure.keychain.util.ProgressFixedScaler;
|
import org.sufficientlysecure.keychain.util.ProgressFixedScaler;
|
||||||
|
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -633,7 +633,7 @@ public class ProviderHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SaveKeyringResult savePublicKeyRing(UncachedKeyRing keyRing) {
|
public SaveKeyringResult savePublicKeyRing(UncachedKeyRing keyRing) {
|
||||||
return savePublicKeyRing(keyRing, new NullProgressable());
|
return savePublicKeyRing(keyRing, new ProgressScaler());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Save a public keyring into the database.
|
/** Save a public keyring into the database.
|
||||||
|
@ -28,6 +28,10 @@ public class ProgressScaler implements Progressable {
|
|||||||
final Progressable mWrapped;
|
final Progressable mWrapped;
|
||||||
final int mFrom, mTo, mMax;
|
final int mFrom, mTo, mMax;
|
||||||
|
|
||||||
|
public ProgressScaler() {
|
||||||
|
mWrapped = null;
|
||||||
|
mFrom = mTo = mMax = 0;
|
||||||
|
}
|
||||||
public ProgressScaler(Progressable wrapped, int from, int to, int max) {
|
public ProgressScaler(Progressable wrapped, int from, int to, int max) {
|
||||||
this.mWrapped = wrapped;
|
this.mWrapped = wrapped;
|
||||||
this.mFrom = from;
|
this.mFrom = from;
|
||||||
|
Loading…
Reference in New Issue
Block a user