diff options
author | Adithya Abraham Philip <adithyaphilip@gmail.com> | 2015-02-28 02:11:39 +0530 |
---|---|---|
committer | Adithya Abraham Philip <adithyaphilip@gmail.com> | 2015-02-28 02:11:39 +0530 |
commit | 23cbd786eae8720769e775e4f8785da47115110f (patch) | |
tree | 1374c44810cf478a2cd6097ebfca9d5ae74458bf | |
parent | 960a1631857b6bbad2e6fedeab63fe7cc1edd063 (diff) | |
download | open-keychain-23cbd786eae8720769e775e4f8785da47115110f.tar.gz open-keychain-23cbd786eae8720769e775e4f8785da47115110f.tar.bz2 open-keychain-23cbd786eae8720769e775e4f8785da47115110f.zip |
cleaned up log export
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/LogDisplayFragment.java | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/LogDisplayFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/LogDisplayFragment.java index 94d9a60c9..997b977ff 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/LogDisplayFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/LogDisplayFragment.java @@ -118,7 +118,7 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe } private void exportLog() { - Toast.makeText(this.getActivity(),"Exporting log",Toast.LENGTH_LONG).show(); + 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) { String subLogText=null; if (entry instanceof SubLogEntryParcel) { - Log.d("ADI DisplayFragment",entry.toString()); OperationResult result = ((SubLogEntryParcel) entry).getSubResult(); LogEntryParcel subEntry = result.getLog().getLast(); @@ -158,7 +157,7 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe for(int i=0;i<entry.mIndent;i++) subPadding+=" ";//2 spaces = 1 Indent subLogText=subPadding+"[SUB]"; - + switch (subEntry.mType.mLevel) { case DEBUG: subLogText+="[DEBUG]"; break; case INFO: subLogText+="[INFO]"; break; @@ -180,11 +179,15 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe } } - } else { - Log.d("ADIExportLogDisplayFragment","NOTSUBLOG:"+entry.toString()); } String logText = ""; + + String padding = ""; + for(int i =0;i<entry.mIndent;i++) { + padding +=" "; //4 spaces = 1 Indent level + } + switch (entry.mType.mLevel) { case DEBUG: logText="[DEBUG]"; break; case INFO: logText="[INFO]"; break; @@ -206,10 +209,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe entry.mParameters); } - String padding = ""; - for(int i =0;i<entry.mIndent;i++) { - padding +=" "; //4 spaces = 1 Indent level - } logText = padding + logText; if(subLogText!=null) //subLog exists @@ -227,19 +226,11 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe FileHelper.saveFile(new FileHelper.FileDialogCallback() { @Override public void onFileSelected(File file, boolean checked) { - writeToLogFile(getOperationLog(),file); + writeToLogFile(mResult.getLog(),file); } }, 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 public void onItemClick(AdapterView<?> parent, View view, int position, long id) { LogEntryParcel parcel = mAdapter.getItem(position); @@ -300,7 +291,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe if (entry instanceof SubLogEntryParcel) { ih.mSub.setVisibility(View.VISIBLE); convertView.setClickable(false); - Log.d("ADI DisplayFragment",entry.toString()); convertView.setPadding((entry.mIndent) * dipFactor, 0, 0, 0); OperationResult result = ((SubLogEntryParcel) entry).getSubResult(); @@ -332,7 +322,6 @@ public class LogDisplayFragment extends ListFragment implements OnItemClickListe } } else { - Log.d("ADI DisplayFragment","NOT:"+entry.toString()); ih.mSub.setVisibility(View.GONE); ih.mSecond.setVisibility(View.GONE); convertView.setClickable(true); |