From 30f899656c672b22e7784a49eac8287ce2d2b277 Mon Sep 17 00:00:00 2001 From: ShivamPokhriyal Date: Wed, 17 Mar 2021 12:28:38 +0530 Subject: [PATCH 1/2] Add logs to DrawActivity --- app/src/org/commcare/activities/DrawActivity.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/org/commcare/activities/DrawActivity.java b/app/src/org/commcare/activities/DrawActivity.java index 3d9ab8a5b2..400da72037 100644 --- a/app/src/org/commcare/activities/DrawActivity.java +++ b/app/src/org/commcare/activities/DrawActivity.java @@ -23,6 +23,7 @@ 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; @@ -30,6 +31,7 @@ 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; @@ -205,6 +207,8 @@ private void saveAndClose() { 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(); @@ -215,6 +219,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; From e57f829f768061df7012ae10793edc0ab33d5201 Mon Sep 17 00:00:00 2001 From: ShivamPokhriyal Date: Wed, 17 Mar 2021 14:46:56 +0530 Subject: [PATCH 2/2] Add logs while saving signature --- app/src/org/commcare/activities/DrawActivity.java | 1 + app/src/org/commcare/activities/FormEntryActivity.java | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/org/commcare/activities/DrawActivity.java b/app/src/org/commcare/activities/DrawActivity.java index 400da72037..66292aae5a 100644 --- a/app/src/org/commcare/activities/DrawActivity.java +++ b/app/src/org/commcare/activities/DrawActivity.java @@ -203,6 +203,7 @@ 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) { diff --git a/app/src/org/commcare/activities/FormEntryActivity.java b/app/src/org/commcare/activities/FormEntryActivity.java index 3d7479f1ee..55bbece3ad 100644 --- a/app/src/org/commcare/activities/FormEntryActivity.java +++ b/app/src/org/commcare/activities/FormEntryActivity.java @@ -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