diff options
Diffstat (limited to 'OpenKeychain')
3 files changed, 6 insertions, 38 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/NullProgressable.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/NullProgressable.java deleted file mode 100644 index 5ef4f7998..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/NullProgressable.java +++ /dev/null @@ -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) { -    } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index bb095c340..4fde8e581 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -36,7 +36,6 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKey;  import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;  import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;  import org.sufficientlysecure.keychain.pgp.KeyRing; -import org.sufficientlysecure.keychain.pgp.NullProgressable;  import org.sufficientlysecure.keychain.pgp.PgpHelper;  import org.sufficientlysecure.keychain.pgp.PgpImportExport;  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.Log;  import org.sufficientlysecure.keychain.util.ProgressFixedScaler; +import org.sufficientlysecure.keychain.util.ProgressScaler;  import java.io.ByteArrayOutputStream;  import java.io.IOException; @@ -633,7 +633,7 @@ public class ProviderHelper {      }      public SaveKeyringResult savePublicKeyRing(UncachedKeyRing keyRing) { -        return savePublicKeyRing(keyRing, new NullProgressable()); +        return savePublicKeyRing(keyRing, new ProgressScaler());      }      /** Save a public keyring into the database. diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java index 95a259336..5256f5212 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ProgressScaler.java @@ -28,6 +28,10 @@ public class ProgressScaler implements Progressable {      final Progressable mWrapped;      final int mFrom, mTo, mMax; +    public ProgressScaler() { +        mWrapped = null; +        mFrom = mTo = mMax = 0; +    }      public ProgressScaler(Progressable wrapped, int from, int to, int max) {          this.mWrapped = wrapped;          this.mFrom = from;  | 
