How to change the text of the pop-up messages in Mobile Capture SDK

mceclip1.png

The text of the pop-up messages is defined by the MultiPageImageCaptureScenario.ResourceType

Name Description
LOOKING_FOR_PAGE_TIP Screen message for automatic capture cases, shown when the
camera should be brought closer to the document. I.e., "Looking
for document."
MANUAL_CAPTURE_TIP Screen message for manual capture cases, shown when the camera
is turned on and ready for manual capture. I.e., "Point camera at a
document and make a photo."
PAGE_TITLE Interface source string, storing the page name to display in preview
navigation bar. I.e., "Passport".
ADD_PAGE_TIP Interface source string, storing text to display on a button in case
more images should be captured according to the scenario
settings. I.e.: "Tap to add image of the third document page."

To change the text of the pop-up messages:

- Call the setUISettings Method of the MultiPageImageCaptureScenario.Builder Class.

- Select the appropriate name of the MultiPageImageCaptureScenario.ResourceType and return the desired value.

Code snippet of the create method of the ScenarioFactory class demonstrating the possibility of editing the text of the pop-up messages in the sample-ui-imagecapture-multipage sample:

 @Nullable
 public static MultiPageImageCaptureScenario create(
  Context context,
  Engine engine,
  final CaptureProfile profile,
  String startAsEditorPageId
 )
 {
  MultiPageImageCaptureScenario.Builder builder;
  try {
      String path = getScenarioPath( context, profile );
      builder = new MultiPageImageCaptureScenario.Builder( engine, path );
  } catch( Exception e ) {
      Log.e( LOG_TAG, "Failed to build scenario", e );
      return null;
  }
  builder.setStartAsEditorAtPage( startAsEditorPageId );

  builder.setCaptureSettings( new MultiPageImageCaptureScenario.CaptureSettings() {
      @Override
      public void onConfigureImageCaptureSettings(
    @NonNull ImageCaptureSettings imageCaptureSettings,
    int pageIndex
      )
      {
        imageCaptureSettings.setDocumentSize( profile.documentSize );
        imageCaptureSettings.setAspectRatioMin( profile.aspectRatioMin );
        imageCaptureSettings.setAspectRatioMax( profile.aspectRatioMax );
      }
  } ); 

  //edit the pop-up messages text.
  builder.setUISettings(new MultiPageImageCaptureScenario.UISettings() {
      @org.jetbrains.annotations.Nullable
      @Override
      public String getString(
        @NotNull MultiPageImageCaptureScenario.ResourceType resourceType,
        int i
      )
      {
        if (resourceType.equals(MultiPageImageCaptureScenario.ResourceType.LOOKING_FOR_PAGE_TIP))
        {
            return "test1";
        }
        return null;
      }
  });

  return builder.build();
 }

Result:

mceclip2.png

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Recently viewed