From d3945138c0f5e4809ee8339302ca47d878435391 Mon Sep 17 00:00:00 2001 From: ychevalier Date: Thu, 18 Apr 2024 15:08:01 +0200 Subject: [PATCH] Update to 3.0.2 --- .../iink/uireferenceimplementation/Canvas.java | 12 +++++++----- .../FontMetricsProvider.java | 8 ++------ samples/buildSrc/src/main/java/Dependencies.kt | 1 + samples/settings.gradle | 6 +++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/Canvas.java b/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/Canvas.java index e72de47..ae753a4 100644 --- a/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/Canvas.java +++ b/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/Canvas.java @@ -30,10 +30,10 @@ import com.myscript.iink.graphics.Style; import com.myscript.iink.graphics.Transform; -import java.util.HashSet; +import java.util.List; +import java.util.ArrayList; import java.util.Map; import java.util.Objects; -import java.util.Set; public class Canvas implements ICanvas { @@ -80,7 +80,7 @@ public class Canvas implements ICanvas private boolean clearOnStartDraw = true; - private final Set clips; + private final List clips; private final Map typefaceMap; @@ -104,7 +104,7 @@ public Canvas(@Nullable android.graphics.Canvas canvas, Map ty this.xdpi = xdpi; this.ydpi = ydpi; - clips = new HashSet<>(); + clips = new ArrayList(); strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG); strokePaint.setStyle(Paint.Style.STROKE); @@ -367,10 +367,12 @@ public void startGroup(@NonNull String id, float x, float y, float width, float @Override public void endGroup(@NonNull String id) { - if (clips.remove(id)) + int index = clips.lastIndexOf(id); + if (index != -1) { Objects.requireNonNull(canvas); canvas.restore(); + clips.remove(index); } } diff --git a/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/FontMetricsProvider.java b/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/FontMetricsProvider.java index 0270cc6..919b4eb 100644 --- a/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/FontMetricsProvider.java +++ b/samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/FontMetricsProvider.java @@ -19,6 +19,7 @@ import android.text.style.MetricAffectingSpan; import android.text.style.TextAppearanceSpan; import android.util.DisplayMetrics; +import android.util.TypedValue; import androidx.annotation.NonNull; import androidx.collection.LruCache; @@ -88,11 +89,6 @@ public FontMetricsProvider(DisplayMetrics displayMetrics, Map this.typefaceMap = typefaceMap; } - private float x_mm2px(float mm) - { - return (mm / 25.4f) * displayMetrics.xdpi; - } - private float y_mm2px(float mm) { return (mm / 25.4f) * displayMetrics.ydpi; @@ -127,7 +123,7 @@ public Rectangle[] getCharacterBoundingBoxes(@NonNull Text text, TextSpan[] span @Override public float getFontSizePx(Style style) { - return style.getFontSize() * displayMetrics.scaledDensity; + return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, style.getFontSize(), displayMetrics); } @Override diff --git a/samples/buildSrc/src/main/java/Dependencies.kt b/samples/buildSrc/src/main/java/Dependencies.kt index c625151..a0de01d 100644 --- a/samples/buildSrc/src/main/java/Dependencies.kt +++ b/samples/buildSrc/src/main/java/Dependencies.kt @@ -27,4 +27,5 @@ object Versions { // 3rd party const val gson = "2.10.1" + const val okhttp = "4.11.0" } \ No newline at end of file diff --git a/samples/settings.gradle b/samples/settings.gradle index 48669e3..b294d86 100644 --- a/samples/settings.gradle +++ b/samples/settings.gradle @@ -5,9 +5,9 @@ rootProject.name = 'myscript.iink.samples.android.java' -gradle.ext.iinkVersionCode = 2310 -gradle.ext.iinkVersionName = "2.3.1" -gradle.ext.iinkResourcesURL = "https://download.myscript.com/iink/recognitionAssets_iink_2.3" +gradle.ext.iinkVersionCode = 3020 +gradle.ext.iinkVersionName = "3.0.2" +gradle.ext.iinkResourcesURL = "https://download.myscript.com/iink/recognitionAssets_iink_3.0" def projects = [ // samples