Skip to content

Commit

Permalink
Merge pull request #2449 from dimagi/signature-logging
Browse files Browse the repository at this point in the history
Add logs to DrawActivity
  • Loading branch information
ShivamPokhriyal committed Mar 17, 2021
2 parents 2aacf89 + e57f829 commit ed7c5c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/org/commcare/activities/DrawActivity.java
Expand Up @@ -23,13 +23,15 @@
import android.widget.RelativeLayout;

import org.commcare.dalvik.R;
import org.commcare.util.LogTypes;
import org.commcare.utils.FileUtil;
import org.commcare.utils.MediaUtil;
import org.commcare.utils.StringUtils;
import org.commcare.views.dialogs.DialogChoiceItem;
import org.commcare.views.dialogs.PaneledChoiceDialog;
import org.commcare.views.widgets.ImageWidget;
import org.commcare.views.widgets.SignatureWidget;
import org.javarosa.core.services.Logger;

import java.io.File;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -201,10 +203,13 @@ protected void onCreate(Bundle savedInstanceState) {

private void saveAndClose() {
try {
Logger.log(LogTypes.SOFT_ASSERT, "Attempting to save signature");
saveFile(output);
setResult(AppCompatActivity.RESULT_OK);
} catch (FileNotFoundException e) {
e.printStackTrace();
// We shouldn't have gotten a file not found exception since we're using ImageWidget.getTempFileForImageCapture.
Logger.log(LogTypes.TYPE_ERROR_DESIGN, "Couldn't save signature at " + output.toString() + " because of" + e.getMessage());
setResult(AppCompatActivity.RESULT_CANCELED);
}
this.finish();
Expand All @@ -215,6 +220,7 @@ private void saveFile(File f) throws FileNotFoundException {
// apparently on 4.x, the orientation change notification can occur
// sometime before the view is rendered. In that case, the view
// dimensions will not be known.
Logger.log(LogTypes.TYPE_ERROR_ASSERTION, "Found 0 width or height of view while saving signature");
Log.e(t, "view has zero width or zero height");
} else {
FileOutputStream fos;
Expand Down
1 change: 1 addition & 0 deletions app/src/org/commcare/activities/FormEntryActivity.java
Expand Up @@ -332,6 +332,7 @@ public void onActivityResultSessionSafe(int requestCode, int resultCode, Intent
ImageCaptureProcessing.processCaptureResponse(this, FormEntryInstanceState.getInstanceFolder(), true);
break;
case FormEntryConstants.SIGNATURE_CAPTURE:
Logger.log(LogTypes.SOFT_ASSERT, "Signature captured successfully");
boolean saved = ImageCaptureProcessing.processCaptureResponse(this, FormEntryInstanceState.getInstanceFolder(), false);
if (saved && !uiController.questionsView.isQuestionList()) {
// attempt to auto-advance if a signature was captured
Expand Down

0 comments on commit ed7c5c1

Please sign in to comment.