mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
corrected code style
This commit is contained in:
parent
c2c8ee1efd
commit
024ba19499
@ -148,68 +148,62 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
||||
OperationResult opResult = new LogExportResult(opResultCode, currLog);
|
||||
opResult.createNotify(getActivity()).show();
|
||||
}
|
||||
private static class LogExportResult extends OperationResult {
|
||||
|
||||
public LogExportResult(int result, OperationLog log) {
|
||||
super(result, log);
|
||||
}
|
||||
|
||||
/** trivial but necessary to implement the Parcelable protocol. */
|
||||
public LogExportResult(Parcel source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
public static Creator<LogExportResult> CREATOR = new Creator<LogExportResult>() {
|
||||
public LogExportResult createFromParcel(final Parcel source) {
|
||||
return new LogExportResult(source);
|
||||
}
|
||||
|
||||
public LogExportResult[] newArray(final int size) {
|
||||
return new LogExportResult[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an indented String of an entire OperationLog
|
||||
* @param operationLog log to be converted to indented, printable format
|
||||
*
|
||||
* @param opLog log to be converted to indented, printable format
|
||||
* @param basePadding padding to add at the start of all log entries, made for use with SubLogs
|
||||
* @return printable, indented version of passed operationLog
|
||||
*/
|
||||
private String getPrintableOperationLog(OperationResult.OperationLog operationLog, String basePadding) {
|
||||
private String getPrintableOperationLog(OperationResult.OperationLog opLog, String basePadding) {
|
||||
String log = "";
|
||||
Iterator<LogEntryParcel> logIterator = operationLog.iterator();
|
||||
while(logIterator.hasNext()) {
|
||||
for (Iterator<LogEntryParcel> logIterator = opLog.iterator(); logIterator.hasNext(); ) {
|
||||
log += getPrintableLogEntry(logIterator.next(), basePadding) + "\n";
|
||||
}
|
||||
log = log.substring(0, log.length() - 1);//gets rid of extra new line
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns an indented String of a LogEntryParcel including any sub-logs it may contain
|
||||
*
|
||||
* @param entryParcel log entryParcel whose String representation is to be obtained
|
||||
* @return indented version of passed log entryParcel in a readable format
|
||||
*/
|
||||
private String getPrintableLogEntry(OperationResult.LogEntryParcel entryParcel,
|
||||
String basePadding) {
|
||||
|
||||
String logText = "";
|
||||
final String indent = " ";//4 spaces = 1 Indent level
|
||||
|
||||
String padding = basePadding;
|
||||
for (int i = 0; i < entryParcel.mIndent; i++) {
|
||||
padding += indent;
|
||||
}
|
||||
logText = padding;
|
||||
String logText = padding;
|
||||
|
||||
switch (entryParcel.mType.mLevel) {
|
||||
case DEBUG: logText+="[DEBUG]"; break;
|
||||
case INFO: logText+="[INFO]"; break;
|
||||
case WARN: logText+="[WARN]"; break;
|
||||
case ERROR: logText+="[ERROR]"; break;
|
||||
case START: logText+="[START]"; break;
|
||||
case OK: logText+="[OK]"; break;
|
||||
case CANCELLED: logText+="[CANCELLED]"; break;
|
||||
case DEBUG:
|
||||
logText += "[DEBUG]";
|
||||
break;
|
||||
case INFO:
|
||||
logText += "[INFO]";
|
||||
break;
|
||||
case WARN:
|
||||
logText += "[WARN]";
|
||||
break;
|
||||
case ERROR:
|
||||
logText += "[ERROR]";
|
||||
break;
|
||||
case START:
|
||||
logText += "[START]";
|
||||
break;
|
||||
case OK:
|
||||
logText += "[OK]";
|
||||
break;
|
||||
case CANCELLED:
|
||||
logText += "[CANCELLED]";
|
||||
break;
|
||||
}
|
||||
|
||||
// special case: first parameter may be a quantity
|
||||
@ -224,7 +218,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
||||
}
|
||||
|
||||
if (entryParcel instanceof SubLogEntryParcel) {
|
||||
|
||||
OperationResult subResult = ((SubLogEntryParcel) entryParcel).getSubResult();
|
||||
LogEntryParcel subEntry = subResult.getLog().getLast();
|
||||
if (subEntry != null) {
|
||||
@ -250,6 +243,30 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
||||
}, this.getActivity().getSupportFragmentManager(), title, message, exportFile, null);
|
||||
}
|
||||
|
||||
private static class LogExportResult extends OperationResult {
|
||||
|
||||
public static Creator<LogExportResult> CREATOR = new Creator<LogExportResult>() {
|
||||
public LogExportResult createFromParcel(final Parcel source) {
|
||||
return new LogExportResult(source);
|
||||
}
|
||||
|
||||
public LogExportResult[] newArray(final int size) {
|
||||
return new LogExportResult[size];
|
||||
}
|
||||
};
|
||||
|
||||
public LogExportResult(int result, OperationLog log) {
|
||||
super(result, log);
|
||||
}
|
||||
|
||||
/**
|
||||
* trivial but necessary to implement the Parcelable protocol.
|
||||
*/
|
||||
public LogExportResult(Parcel source) {
|
||||
super(source);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
LogEntryParcel parcel = mAdapter.getItem(position);
|
||||
|
Loading…
Reference in New Issue
Block a user