import-log: add output to logcat (for debugging)

This commit is contained in:
Vincent Breitmoser 2014-06-06 17:28:36 +02:00
parent e083ccc370
commit 118225d7d2
3 changed files with 19 additions and 8 deletions

View File

@ -126,10 +126,13 @@ public class OperationResultParcel implements Parcelable {
MSG_IS_SUCCESS (R.string.msg_is_success), MSG_IS_SUCCESS (R.string.msg_is_success),
; ;
private int mMsgId; private final int mMsgId;
LogType(int msgId) { LogType(int msgId) {
mMsgId = msgId; mMsgId = msgId;
} }
public int getMsgId() {
return mMsgId;
}
} }
/** Enumeration of possible log levels. */ /** Enumeration of possible log levels. */

View File

@ -152,13 +152,14 @@ public class PgpImportExport {
} }
} }
mProviderHelper.savePublicKeyRing(key); mProviderHelper.resetLog();
/*switch(status) { OperationResultParcel result = mProviderHelper.savePublicKeyRing(key);
case RETURN_UPDATED: oldKeys++; break; for(OperationResultParcel.LogEntryParcel loge : result.mLog) {
case RETURN_OK: newKeys++; break; Log.d(Constants.TAG,
case RETURN_BAD: badKeys++; break; loge.mIndent
}*/ + new String(new char[loge.mIndent]).replace("\0", " ")
// TODO proper import feedback + mContext.getString(loge.mType.getMsgId(), (Object[]) loge.mParameters));
}
newKeys += 1; newKeys += 1;
} catch (PgpGeneralException e) { } catch (PgpGeneralException e) {

View File

@ -79,6 +79,13 @@ public class ProviderHelper {
mIndent = indent; mIndent = indent;
} }
public void resetLog() {
if(mLog != null) {
mLog.clear();
mIndent = 0;
}
}
public static class NotFoundException extends Exception { public static class NotFoundException extends Exception {
public NotFoundException() { public NotFoundException() {
} }