iink SDK on Device

Answered

New theme is not applied immediately at app start up.

I made some small changes to the default theme to use a heavier font with text-heading1 and text-heading2 for an Android app. I apply the new theme by calling Editor.setTheme when the app starts in onCreate. However, I get the following problem.

  1. I start the app with a blank screen (no text in the document). Meaning that I cleared the text before leaving the app the last time or I just re-installed the app.
  2. I write in some text (for example "Test") and convert it.
  3. I underline the text to apply text-heading1. The default weight is applied to my text (my custom theme is not applied).
  4. I underline again. Sometimes the default weight is applied to heading 2 and sometimes my custom weight is applied.
  5. I underline again. The normal style is applied.
  6. I underline again. This time my custom weight is applied to heading 1.
So my custom weight is ignored the first time I apply heading 1 to the text, but it is used when I apply it after the first time.
Also, if I open the app with some text already in it, the custom theme is correctly applied from the first time I do an underline.

This can be reproduced by adding the following lines to the sample app "GetStarted".
In getStarted/mainActivity.java, add the following lines in onCreate() after getting the Editor.
 
String theme = ".text-heading1 { font-weight: 700; }.text-heading2 { font-weight: 700; }";
editor.setTheme(theme);

This problem does not appear to be present with the Nebo app, so I was wondering if there was a way to fix it.

Thanks!


Best Answer

Dear Nicolas,


I confirm this issue will be solved in the coming 1.4 release of the iink SDK.


At present, we cannot commit an exact date when this release will be done.


Best regards,


Olivier


Dear Nicolas,


Currently, can you confirm you are in a "Text Document" part and not a "Text" part?


Also, did you try creating 3 paragraphs:

-In the first one, you double underline => You then set the text-heading1

-In the second one, you do a simple underline => You then set the text-heading1

-You leave the third one => Default "text" applies


I just proceeded this way, and it worked immediately. I set my configuration as follows: 

editorView.setEngine(engine);
final Editor editor = editorView.getEditor();
String theme = ".text-heading1 { font-weight: 700; }.text-heading2 { font-weight: 700; }";
editor.setTheme(theme);


Best regards,


Olivier

Thank you for looking into this.

I am indeed in a "Text Document".

And sorry I mixed up text heading 1 and 2 in my description above. I would expect heading 2 when underlining the first time and heading 1 when I underline for the second time. This is what I get, except that I do not get the custom heavy font the first time heading 2 gets applied.

I tried your test with 3 paragraphs and it does work if I do "Convert" after writing all 3 paragraphs. However, if I write the 1st paragraph, double underline it, then do convert, it will not have the custom font weight. If I then write the second paragraph, simple underline, then convert, the second paragraph will have the custom weight (the 1st one remains unchanged).

If I exit and reenter the app, then both paragraphs will have the custom weight when the app opens.

Dear Nicolas,


I just tried to reproduce, but was not able to, it all worked fine on my side.


To avoid any confusion, I applied the following theme: String theme = ".text-heading1 { font-weight: 900; color: #FF0000 }.text-heading2 { font-weight: 100; color: #0000FF }";


I start the application:

-I write some text

-I underline it => text-heading2 is applied

-I underline it => text-heading1 is applied

-I underline it => basic text is applied


So, there might have something we are missing, but the above tests are inline with the specification: https://developer.myscript.com/docs/interactive-ink/1.3/reference/styling/#text-block


Do you have a specific device? Is it possible to have a video, so that we better understand what you are doing?


Best regards,


Olivier

Hi Olivier,

I modified your test a bit and found that the color is applied correctly, it's only the weight that is not applied at first. You can't notice it with your test because the appearance of font weight 100 is the same as the default font weight. So I changed the theme as follows:

String theme = ".text-heading1 { font-weight: 900; color: #FF0000 }.text-heading2 { font-weight: 2000; color: #0000FF }";

Then I did the same test you did. I don't have a video recording app so I just took screenshots.

I start the application:

- I write some text and convert -> Converted

Converted


-I underline it => A blue font is applied but it is not bold. -> Underline1

Underline1


-I underline it => text-heading1 is applied (red and bold) -> Underline2

Underline2


-I underline it => basic text is applied -> Underline3

Underline3

-I underline it => text-heading2 is applied (blue and bold) -> Underline4

Underline4

Please note the difference in font weight between Underline1 and Underline4.

So the color from the theme is applied from the start, but not the weight.

Thanks for your help!

Nicolas

Sorry I forgot to answer your question about the device. It tested with a Huawei MediaPad M5 lite 10 and Samsung Galaxy Note  9. Results are the same with both devices.

Dear Nicolas,


thank you for the clarification, I was indeed able to reproduce.


I then submitted an issue. I keep you updated.


Best regards,


Olivier


1 person likes this

Thank you Olivier!

Answer

Dear Nicolas,


I confirm this issue will be solved in the coming 1.4 release of the iink SDK.


At present, we cannot commit an exact date when this release will be done.


Best regards,


Olivier


1 person likes this