mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-02 13:32:19 -05:00
cleaned up log export
This commit is contained in:
parent
960a163185
commit
23cbd786ea
@ -118,7 +118,7 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void exportLog() {
|
private void exportLog() {
|
||||||
Toast.makeText(this.getActivity(),"Exporting log",Toast.LENGTH_LONG).show();
|
|
||||||
showExportLogDialog(new File(Constants.Path.APP_DIR, "export.log"));
|
showExportLogDialog(new File(Constants.Path.APP_DIR, "export.log"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +149,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
private String getPrintableLogEntry(OperationResult.LogEntryParcel entry) {
|
private String getPrintableLogEntry(OperationResult.LogEntryParcel entry) {
|
||||||
String subLogText=null;
|
String subLogText=null;
|
||||||
if (entry instanceof SubLogEntryParcel) {
|
if (entry instanceof SubLogEntryParcel) {
|
||||||
Log.d("ADI DisplayFragment",entry.toString());
|
|
||||||
|
|
||||||
OperationResult result = ((SubLogEntryParcel) entry).getSubResult();
|
OperationResult result = ((SubLogEntryParcel) entry).getSubResult();
|
||||||
LogEntryParcel subEntry = result.getLog().getLast();
|
LogEntryParcel subEntry = result.getLog().getLast();
|
||||||
@ -180,11 +179,15 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
Log.d("ADIExportLogDisplayFragment","NOTSUBLOG:"+entry.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String logText = "";
|
String logText = "";
|
||||||
|
|
||||||
|
String padding = "";
|
||||||
|
for(int i =0;i<entry.mIndent;i++) {
|
||||||
|
padding +=" "; //4 spaces = 1 Indent level
|
||||||
|
}
|
||||||
|
|
||||||
switch (entry.mType.mLevel) {
|
switch (entry.mType.mLevel) {
|
||||||
case DEBUG: logText="[DEBUG]"; break;
|
case DEBUG: logText="[DEBUG]"; break;
|
||||||
case INFO: logText="[INFO]"; break;
|
case INFO: logText="[INFO]"; break;
|
||||||
@ -206,10 +209,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
entry.mParameters);
|
entry.mParameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
String padding = "";
|
|
||||||
for(int i =0;i<entry.mIndent;i++) {
|
|
||||||
padding +=" "; //4 spaces = 1 Indent level
|
|
||||||
}
|
|
||||||
logText = padding + logText;
|
logText = padding + logText;
|
||||||
|
|
||||||
if(subLogText!=null) //subLog exists
|
if(subLogText!=null) //subLog exists
|
||||||
@ -227,19 +226,11 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
FileHelper.saveFile(new FileHelper.FileDialogCallback() {
|
FileHelper.saveFile(new FileHelper.FileDialogCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFileSelected(File file, boolean checked) {
|
public void onFileSelected(File file, boolean checked) {
|
||||||
writeToLogFile(getOperationLog(),file);
|
writeToLogFile(mResult.getLog(),file);
|
||||||
}
|
}
|
||||||
}, this.getActivity().getSupportFragmentManager(), title, message, exportFile, null);
|
}, this.getActivity().getSupportFragmentManager(), title, message, exportFile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private OperationResult.OperationLog getOperationLog(){
|
|
||||||
OperationResult operationResult = this.getActivity().getIntent().getParcelableExtra(
|
|
||||||
LogDisplayFragment.EXTRA_RESULT);
|
|
||||||
OperationResult.OperationLog operationResultLog = operationResult.getLog();
|
|
||||||
|
|
||||||
return operationResultLog;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
LogEntryParcel parcel = mAdapter.getItem(position);
|
LogEntryParcel parcel = mAdapter.getItem(position);
|
||||||
@ -300,7 +291,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
if (entry instanceof SubLogEntryParcel) {
|
if (entry instanceof SubLogEntryParcel) {
|
||||||
ih.mSub.setVisibility(View.VISIBLE);
|
ih.mSub.setVisibility(View.VISIBLE);
|
||||||
convertView.setClickable(false);
|
convertView.setClickable(false);
|
||||||
Log.d("ADI DisplayFragment",entry.toString());
|
|
||||||
convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0);
|
convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0);
|
||||||
|
|
||||||
OperationResult result = ((SubLogEntryParcel) entry).getSubResult();
|
OperationResult result = ((SubLogEntryParcel) entry).getSubResult();
|
||||||
@ -332,7 +322,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.d("ADI DisplayFragment","NOT:"+entry.toString());
|
|
||||||
ih.mSub.setVisibility(View.GONE);
|
ih.mSub.setVisibility(View.GONE);
|
||||||
ih.mSecond.setVisibility(View.GONE);
|
ih.mSecond.setVisibility(View.GONE);
|
||||||
convertView.setClickable(true);
|
convertView.setClickable(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user