diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-06-06 16:14:15 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-06-06 16:14:15 +0200 |
commit | b995b836a38ef8a87aa189f408f8542bf5a2c94c (patch) | |
tree | 0828f6fc64152b1c1113c5ce31ccc21495e019d5 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java | |
parent | c84a1ecfff8d3f21ac83ef7b041f22f11e38936b (diff) | |
download | open-keychain-b995b836a38ef8a87aa189f408f8542bf5a2c94c.tar.gz open-keychain-b995b836a38ef8a87aa189f408f8542bf5a2c94c.tar.bz2 open-keychain-b995b836a38ef8a87aa189f408f8542bf5a2c94c.zip |
import-log: improve operationresultparcel, add indentation
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java | 27 |
1 files changed, 23 insertions, 4 deletions
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 ca7e622bb..83b55cc14 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -29,6 +29,9 @@ import android.support.v4.util.LongSparseArray; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.pgp.KeyRing; +import org.sufficientlysecure.keychain.pgp.OperationResultParcel; +import org.sufficientlysecure.keychain.pgp.OperationResultParcel.LogType; +import org.sufficientlysecure.keychain.pgp.OperationResultParcel.LogLevel; import org.sufficientlysecure.keychain.pgp.PgpHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; @@ -59,12 +62,21 @@ import java.util.List; import java.util.Set; public class ProviderHelper { - private Context mContext; - private ContentResolver mContentResolver; + private final Context mContext; + private final ContentResolver mContentResolver; + private final ArrayList<OperationResultParcel.LogEntryParcel> mLog; + private int mIndent; public ProviderHelper(Context context) { - this.mContext = context; - this.mContentResolver = context.getContentResolver(); + this(context, null, 0); + } + + public ProviderHelper(Context context, ArrayList<OperationResultParcel.LogEntryParcel> log, + int indent) { + mContext = context; + mContentResolver = context.getContentResolver(); + mLog = log; + mIndent = indent; } public static class NotFoundException extends Exception { @@ -76,6 +88,13 @@ public class ProviderHelper { } } + public void log(LogLevel level, LogType type) { + mLog.add(new OperationResultParcel.LogEntryParcel(level, type, null, mIndent)); + } + public void log(LogLevel level, LogType type, String[] parameters) { + mLog.add(new OperationResultParcel.LogEntryParcel(level, type, parameters, mIndent)); + } + // If we ever switch to api level 11, we can ditch this whole mess! public static final int FIELD_TYPE_NULL = 1; // this is called integer to stay coherent with the constants in Cursor (api level 11) |