iink SDK on Device

Answered

Scroll is not working

 I have made a sample code with the below code to enable scrolling for multiple scribbling pad:

 

<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    tools:context=".MainActivity">

</androidx.core.widget.NestedScrollView>

 

When I keep com.myscript.iink.uireferenceimplementation.EditorView inside above code, then the scribbling is not working. But, if I don't use the above code, the scribbling is working.


I want to keep com.myscript.iink.uireferenceimplementation.EditorView inside the scroll view for multiple editor view. Can you please help me with this?


Best Answer

Dear Raju,


thank you for contacting us.


Currently, this is more an Android integration issue. If you cannot write, this would tend to make me think that the layerViews (Background, Model, Temporary, Capture) were not set: https://developer-support.myscript.com/support/discussions/topics/16000025947


Otherwise, to implement a nestedScrollView, you should be able to find some help on the internet:

-https://stackoverflow.com/questions/33962307/framelayout-does-not-match-the-height-of-nestedscrollview/33962667

-https://stackoverflow.com/questions/34409565/android-framelayout-inside-nestedscrollview-takes-full-screen


Best regards,


Olivier




Answer

Dear Raju,


thank you for contacting us.


Currently, this is more an Android integration issue. If you cannot write, this would tend to make me think that the layerViews (Background, Model, Temporary, Capture) were not set: https://developer-support.myscript.com/support/discussions/topics/16000025947


Otherwise, to implement a nestedScrollView, you should be able to find some help on the internet:

-https://stackoverflow.com/questions/33962307/framelayout-does-not-match-the-height-of-nestedscrollview/33962667

-https://stackoverflow.com/questions/34409565/android-framelayout-inside-nestedscrollview-takes-full-screen


Best regards,


Olivier



Dear Oliver

Thank you for answering.

I have set layerViews (Background, Model, Temporary, Capture) as in the snippet below.  Still it is not working. 

<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    >

    <com.myscript.iink.uireferenceimplementation.EditorView
        android:id="@+id/editor_view"
        android:layout_width="match_parent"
        android:layout_height="180dp"
        android:background="@android:color/white">

        <com.myscript.iink.uireferenceimplementation.LayerView
            android:id="@+id/layer_background"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="0dp"
            android:layout_marginLeft="0dp"
            android:layout_marginBottom="0dp"
            android:layout_marginRight="0dp"
            custom:layerType="BACKGROUND"/>

         <com.myscript.iink.uireferenceimplementation.LayerView
              android:id="@+id/layer_model"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_marginTop="0dp"
              android:layout_marginLeft="0dp"
              android:layout_marginBottom="0dp"
              android:layout_marginRight="0dp"
              custom:layerType="MODEL"/>

         <com.myscript.iink.uireferenceimplementation.LayerView
              android:id="@+id/layer_temporary"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_marginTop="0dp"
              android:layout_marginLeft="0dp"
              android:layout_marginBottom="0dp"
              android:layout_marginRight="0dp"
              custom:layerType="TEMPORARY"/>


        <com.myscript.iink.uireferenceimplementation.LayerView
            android:id="@+id/layer_capture"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="0dp"
            android:layout_marginLeft="0dp"
            android:layout_marginBottom="0dp"
            android:layout_marginRight="0dp"
            custom:layerType="CAPTURE"/>

        <com.myscript.iink.uireferenceimplementation.SmartGuideView
            android:id="@+id/smart_guide_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:visibility="invisible">

            <TextView
                android:id="@+id/style_view"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:gravity="center"
                android:paddingLeft="@dimen/smart_guide_horizontal_padding"
                android:paddingRight="@dimen/smart_guide_horizontal_padding"
                android:paddingTop="@dimen/smart_guide_vertical_padding"
                android:paddingBottom="@dimen/smart_guide_vertical_padding"
                android:textSize="@dimen/smart_guide_text_size"
                android:text="@string/style_view_string_normal"
                android:textColor="@color/control_gray"
                android:background="@drawable/rectangle_border"/>

            <HorizontalScrollView
                android:id="@+id/scroll_view"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:fillViewport="true"
                android:background="@drawable/bottom_border">

                <LinearLayout
                    android:id="@+id/stack_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="@dimen/smart_guide_horizontal_padding"
                    android:gravity="left|center"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/word_view"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textSize="@dimen/smart_guide_text_size"
                        android:text="hello"
                        android:textColor="@color/word_gray"/>

                </LinearLayout>

            </HorizontalScrollView>

            <TextView
                android:id="@+id/more_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:paddingLeft="@dimen/smart_guide_horizontal_padding"
                android:paddingRight="@dimen/smart_guide_horizontal_padding"
                android:paddingTop="@dimen/smart_guide_vertical_padding"
                android:paddingBottom="@dimen/smart_guide_vertical_padding"
                android:textSize="@dimen/smart_guide_text_size"
                android:text="@string/more_view_string"
                android:textColor="@color/control_gray"
                android:background="@drawable/bottom_border"/>

        </com.myscript.iink.uireferenceimplementation.SmartGuideView>

    </com.myscript.iink.uireferenceimplementation.EditorView>

</merge>

 Other solution also I have used but the same issue is coming. As per suggestions I have tried using NestedScrollView both parent and child section, but it is not giving me any results.

You can also check the apk that I have attached here: REMOVED

Thanks for your time. Much appreciated.

Dear Raju Sen,


thank you for the APK. Currently, I just want to make sure: which field are you trying to write in and is not working? Is it the lines at the bottom, above the "SAVE" button?


Thank you,


Best regards,


Olivier

Dear Oliver,


image

Please find the screen shot above for the field which has the problem of scribbling is not working when scrollView is there.


Thanks -

Raju Sen


Hey Olivier,

 I realised that I have not explained to you my purpose of doing the things above. Using MyScript I want to simultaneously achieve the 2 things below:
1) Capture the image of handwriting written by the user
2) Use the suggested text to capture it and use it for internal action (like firing an api)

Which is exactly why I'm trying to do the things above. I hope this helps. Will be very thankful for your response.

Thanks -

Raju Sen

Dear Raju,


Currently, I am a bit puzzled, as when writing on horizontal line, it is properly captured, while a vertical one is not.


Honestly, I am afraid we are in the limits of the support. You should rather look for help on Android forums, as this looks more like an Android integration issue than a MyScript iink issue.


Best regards,


Olivier

Dear Oliver,

   Thanks for your answer.

   Can you implement scrollView or nestedScrollView at you sample project "GetStarted". So that you can understand the real issues.

Thanks -

Raju Sen


Dear Oliver,

 How can I put external text to EditorView ? Give me example.

Thanks -

Raju Sen

Dear Raju Sen,


thank you for the update.


Currently, there are several possibilities:

-If in a text part, you can add text using the import function: editor.import_(MimeType.TEXT, "this is a test", null);

-If in a text document part, you can add a text block as follows: editor.addBlock(0,0, "Text", MimeType.TEXT, "this is a test");


Best regards,


Olivier

Dear Oliver,

  Thanks for you valuable answer.

  I want another help from you. I want auto scroll  of scribble area on button click. 

I am using 

editorView.scrollTo(0, yPosition);
renderer.setViewOffset(0.0f, yPosition*scrollCount); It is not working properly. Thanks - Raju Sen

Dear Raju Sen,


currently, can you please try to call the "invalidate" function just after calling the "setViewOffset"?:

editorView.invalidate(renderer, EnumSet.allOf(IRenderTarget.LayerType.class));


This will normally refresh all the layers.


Best regards,


Olivier

Dear Oliver,

 Thanks for your suggestion.

Thanks -

Raju Sen


 Dear Oliver,

 If I set "<uses-permission android:name="android.permission.INTERNET" />" in AndroidManifest.xml app is crashing. If I do not set that permission app is working fine. I have mention the logcat below. 

Process: careclues.com.miniemr, PID: 8463
    java.lang.RuntimeException: Unable to start activity ComponentInfo{careclues.com.miniemr/careclues.com.miniemr.PatientChiefComplaint}: java.lang.IllegalArgumentException: invalid certificate
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2974)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3059)
        at android.app.ActivityThread.-wrap11(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1724)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:7000)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
     Caused by: java.lang.IllegalArgumentException: invalid certificate
        at com.myscript.iink.NativeFunctions.createEngine(Native Method)
        at com.myscript.iink.Engine.<init>(Engine.java:20)
        at com.myscript.iink.Engine.create(Engine.java:39)
        at careclues.com.miniemr.EMRApplication.getEngine(EMRApplication.java:17)
        at careclues.com.miniemr.PatientChiefComplaint.onCreate(PatientChiefComplaint.java:105)
        at android.app.Activity.performCreate(Activity.java:7258)
        at android.app.Activity.performCreate(Activity.java:7249)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1222)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)

 Thanks -

Raju Sen

 

Dear Raju Sen,

Currently, the reason is that when you do not have the internet connection, your certificate is time-limited and after 30 days, your application will no longer be able to start.

Then, when allowing the internet connection, the app tries to connect to ou license server. When checking your console, you have the following error message: Mismatch between certificate and application

To solve this, you should create a new application in your ATK console, whose identifier is the package name that can be found in the AndroidManifest.xml (https://developer.myscript.com/support/account/on-device-license-management/#applications).

Let me know if you need any other help.

Best regards,

Olivier