iink SDK on Device

Answered

editor.pointerEvents second argument (processGestures) ignored

Hello,

I'm feeding a bunch of collected pointerEvents to the editor via "editor.pointerEvents(eventsQ, false)". The events register, but the gestures (in particular cross out to erase gesture) register as well, so the second argument seems to be ignored. 

Is this a bug or am I missing something?

The main issue comes when I feed a bunch of events and "t" and "l" characters end up being processed as gestures, thus erasing parts of the input.

Also, is there a dedicated erase mode? For example, if I can click on a button to enable erase mode and whatever I draw over will be erased?

Thanks,
Andrey


Best Answer

Dear Andrey,


Thank you for your question.


We are currently a bit puzzled as it is the first time this behavior is raised. We also tried to reproduce it but were not able too.


You are indeed proceeding correctly in "batch mode" (adding strokes from an external device), as processGestures boolean shall be set to false.


Nevertheless, we noticed you  are in a "Text Document" part. As by default this part has guide lines, we do not recommend to use it in batch mode. Can you give a try in a "text" part, and setting the guidelines option to false ("text.guides.enable" option to "false")?


Let us know if this works properly.


Best regards,


Olivier




UPDATE: This seems to be happening only on the subsequent submissions. The first time I send the pointer event list, the gestures are ignored. The second/third/etc times, the gestures are interpreted even with the "false" flag. 

I'm using iink 1.1 for Android with "contentPackage.createPart("Text Document");"


Answer

Dear Andrey,


Thank you for your question.


We are currently a bit puzzled as it is the first time this behavior is raised. We also tried to reproduce it but were not able too.


You are indeed proceeding correctly in "batch mode" (adding strokes from an external device), as processGestures boolean shall be set to false.


Nevertheless, we noticed you  are in a "Text Document" part. As by default this part has guide lines, we do not recommend to use it in batch mode. Can you give a try in a "text" part, and setting the guidelines option to false ("text.guides.enable" option to "false")?


Let us know if this works properly.


Best regards,


Olivier



Hello Olivier,

Thanks for looking into this. "Text" mode doesn't have all the features I'm looking for while "Text Document" does. The lines are actually important for my configuration, as well as match suggestions and the ability to erase an existing word without the whole sentence collapsing and closing the gap where the word was. In "Text" mode, it's awkward to replace or add a word mid sentence—from what I understand, I need to cross out the word, "break" the sentence where the word goes, write the word, then "join" the sentence once more. In "Text Document" mode, everything stays where I wrote it, so I can easily correct or erase+replace the word without the whole structure rearranging. I'm using an eInk tablet, so minimizing movement is a priority.

That being said, I set the mode to "Text" and got this error: "E/SmartGuideView: Failed to edit block "MainBlock": CONFIGURATION_BUNDLE_NOT_FOUND: error: no such configuration bundle en_US".

I'll try to provide more details, so you can replicate it.

First, I collect the strokes into an array list (using editorView.setOnTouchListener(new View.OnTouchListener()), then I dispatch them when a certain threshold had been reached:

editor.waitForIdle();
PointerEvent[] eventsQ = new PointerEvent[events.size()]; // initialize PointerEvent array
eventsQ = events.toArray(eventsQ); // convert events array to PointerEvent array
editor.pointerEvents(eventsQ, false); // send stored values to the editor
events = new ArrayList<>();

The first batch works perfectly, but with the next batch, gestures are interpreted—I can erase what I wrote. Ideally, I would be able to enable and disable the gestures, so I can write without kinks, then erase when I need to (I can set it to interpret gestures if only one "up/down" stroke had been registered to create separation between "erasing" and "writing").

Thanks again for looking into this.

Dear Andrey,


thank you for the update.


Currently, all what you are describing is normally available in the Text mode, as you can see running our code samples.


Nevertheless, what puzzles me is the CONFIGURATION_BUNDLE_NOT_FOUND error message, which usually occurs when the iink SDK is not able to load the en_US.conf file.


Can you please check the following:

-The en_US.conf file is located into the assets -> conf directory?

-Both the en-US-ak-cur.res and en_US-lk-text.res resources are located into the assets -> en_US directory?


Can you then please again try to run your project?


Let us know of this helps and also may solve the erasures issue?


Best regards,


Olivier

Hello Olivier,

Perhaps I dismissed the text mode too soon. Does it have the ability to not collapse the sentence when erasing a word, instead leaving a blank space?

Below is a screenshot of my en_US.conf file and the list of assets. The "Text Document" mode works fine, so it's probably not an asset issue. Perhaps it has something to do with #EnableAlienCharacters commented out? Or some other bit of configuration that is specific to text mode? The error comes from SmartGuideView. Does text mode support word match candidates? Maybe the way I have it configured is specific to Text Document mode.

image


I really like the Text Document mode and would prefer to use it over the Text mode. The fact that it ignores gestures the first time around, but doesn't in subsequent edits suggests a pretty specific bug, which I think we can drill down and figure out.

To replicate the setup, I think all you'll need is to create a setOnTouchListener, record the strokes, then feed them back into the Text Document editor as per the code I posted above. Then write a word and cross it out + submit (you should get the word still), then cross the word out and submit (word should be erased).

I don't know how editor.pointerEvents(events, processGestures) handles the "processGestures" after it's called, but the issue is probably in there. Maybe the "false" flag is only listened to when initially creating the content block?

Dear Andrey,


My apologies, as I provided you with a wrong information.


The pointerEvents API with processGestures set to false only works at one condition, when you send all the strokes at once! If calling the pointerEvents several times, gestures are indeed detected.


Currently, I recommend you wait for the 1.2 release (it should be released shortly -ideally before end on month-, unless unexpected last minute issue), which will contain the "gesture.enable" configuration. All you will need is set it as follows: conf.setBoolean("gesture.enable", false);


This will normally answer your use-case.


Best regards,


Olivier

Perfect! Thanks, Olivier. I'm looking forward to the 1.2 release!

Hi Olivier,

I just set up 1.2 and the gesture.enable flag doesn't seem to work. I have it set up so the strokes get sent every 100 events with "conf.setBoolean("gesture.enable", false);", but the editor still interprets the gestures. For example, I wrote the following: "The little green turtle is swimming around. She is swimming swiftly." Here is what it ends up looking like. The gesture interpretation ends up erasing the words:

image



Dear Rev,


Currently, I just tried again on my side, and it works fine on the 1.2 release (when setting gestures, text is easily erased, while not the case when deactivated).


Based on in this question on your other post, I am wondering if you properly updated to the 1.2 release. Can you please check it again?

If you are sure of it, can you please export the above sentence "The little green turtle is swimming around. She is swimming swiftly." as JIIX, and provide it us? This will allow us to reproduce!


Thank you,


Best regards,


Olivier

Hello Olivier,

I downloaded the latest Get Started source from github, added the touch listener code to MainActivity that stores values in an array and sends them after 100 strokes, and set conf.setBoolean("gesture.enable", false);

I can confirm that the gestures are not being interpreted. The issue is in my configuration.

Since the setting and general flow is the same, I suspect that you're right and my application never upgraded to version 1.2.

To upgrade, I updated my gradle files and synced project. What else do I need to do in order to update an existing project from 1.1 to 1.2?

Thanks,
Andrey


Got it figured out. I forgot to change the UIReferenceImplementation gradle file. It's looking good now. Thanks for your help!