Skip to content

Commit fdf68b8

Browse files
committed
Updating to iink 3.2 and introducing the keyboard input sample.
1 parent 73986fb commit fdf68b8

File tree

31 files changed

+1024
-168
lines changed

31 files changed

+1024
-168
lines changed

samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/Canvas.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,15 @@ public boolean isExtraBrushSupported(@NonNull String brushName)
480480
}
481481

482482
@Override
483-
public void drawStrokeWithExtraBrush(@NonNull InkPoints inkPoints, int temporaryPoints,
483+
public void drawStrokeWithExtraBrush(@NonNull InkPoints[] vInkPoints, int temporaryPoints,
484484
float strokeWidth, @NonNull String brushName, boolean fullStroke, long id)
485485
{
486486
Objects.requireNonNull(canvas);
487487

488488
if (!isExtraBrushSupported(brushName))
489489
return;
490490

491-
if (inkPoints.x.length == 0 || strokeWidth <= 0.f || android.graphics.Color.alpha(fillPaint.getColor()) == 0)
491+
if (vInkPoints.length == 0 || vInkPoints[0].x.length == 0 || strokeWidth <= 0.f || android.graphics.Color.alpha(fillPaint.getColor()) == 0)
492492
return;
493493

494494
if (!glRenderer.isInitialized())
@@ -503,14 +503,14 @@ public void drawStrokeWithExtraBrush(@NonNull InkPoints inkPoints, int temporary
503503
canvas.setMatrix(null); // GLRenderer works with pixels
504504
fillPaint.setXfermode(xferModeSrcOver);
505505

506-
PointF strokeOrigin = glRenderer.drawStroke(inkPoints, temporaryPoints, transformValues, brushName, fullStroke, id, strokeWidth, fillPaint);
506+
PointF strokeOrigin = glRenderer.drawStroke(vInkPoints, temporaryPoints, transformValues, brushName, fullStroke, id, strokeWidth, fillPaint);
507507
Bitmap strokeBitmap = glRenderer.saveStroke();
508508
if (strokeBitmap != null)
509509
canvas.drawBitmap(strokeBitmap, strokeOrigin.x, strokeOrigin.y, fillPaint);
510510

511-
if (temporaryPoints > 0)
511+
if (temporaryPoints > 0 && vInkPoints.length == 1)
512512
{
513-
PointF temporaryOrigin = glRenderer.drawTemporary(inkPoints, temporaryPoints, transformValues, brushName, strokeWidth, fillPaint);
513+
PointF temporaryOrigin = glRenderer.drawTemporary(vInkPoints, temporaryPoints, transformValues, brushName, strokeWidth, fillPaint);
514514
Bitmap temporaryBitmap = glRenderer.saveTemporary();
515515
if (temporaryBitmap != null)
516516
canvas.drawBitmap(temporaryBitmap, temporaryOrigin.x, temporaryOrigin.y, fillPaint);

samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/EditorView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public final void invalidate(@NonNull Renderer renderer, int x, int y, int width
224224

225225
if (layerView != null)
226226
{
227-
layerView.update(renderer, x, y, width, height, layers);
227+
layerView.update(renderer, x, y, width, height);
228228
}
229229
}
230230

samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/InputController.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import androidx.annotation.Nullable;
2727
import androidx.annotation.VisibleForTesting;
28-
import androidx.core.view.GestureDetectorCompat;
2928

3029
public class InputController implements View.OnTouchListener, GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener
3130
{
@@ -47,7 +46,7 @@ public interface ViewListener
4746
private final EditorView editorView;
4847
private final Editor editor;
4948
private int _inputMode;
50-
private final GestureDetectorCompat gestureDetector;
49+
private final GestureDetector gestureDetector;
5150
private final ScaleGestureDetector scaleGestureDetector;
5251
private IInputControllerListener _listener;
5352
private final long eventTimeOffset;
@@ -69,7 +68,7 @@ public InputController(Context context, EditorView editorView, Editor editor)
6968
_listener = null;
7069
_inputMode = INPUT_MODE_AUTO;
7170
scaleGestureDetector = new ScaleGestureDetector(context, this);
72-
gestureDetector = new GestureDetectorCompat(context, this);
71+
gestureDetector = new GestureDetector(context, this);
7372

7473
long rel_t = SystemClock.uptimeMillis();
7574
long abs_t = System.currentTimeMillis();
@@ -106,6 +105,11 @@ public final synchronized IInputControllerListener getListener()
106105
return _listener;
107106
}
108107

108+
public final synchronized int getPreviousPointerId()
109+
{
110+
return previousPointerId;
111+
}
112+
109113
private boolean handleOnTouchForPointer(MotionEvent event, int actionMask, int pointerIndex)
110114
{
111115
final int pointerId = event.getPointerId(pointerIndex);

samples/UIReferenceImplementation/src/main/java/com/myscript/iink/uireferenceimplementation/LayerView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private void restore(android.graphics.Canvas canvas)
216216
canvas.restore();
217217
}
218218

219-
public final void update(Renderer renderer, int x, int y, int width, int height, EnumSet<LayerType> layers)
219+
public final void update(Renderer renderer, int x, int y, int width, int height)
220220
{
221221
boolean emptyArea;
222222

samples/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ subprojects {
1919
abortOnError false
2020
}
2121
android {
22-
// Needed until AGP 8.1.0 is out
2322
compileOptions {
24-
sourceCompatibility JavaVersion.VERSION_17
25-
targetCompatibility JavaVersion.VERSION_17
23+
sourceCompatibility JavaVersion.VERSION_21
24+
targetCompatibility JavaVersion.VERSION_21
2625
}
2726

2827
ndkVersion Versions.ndk

samples/buildSrc/src/main/java/Dependencies.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Copyright MyScript. All rights reserved.
22

33
object Versions {
4-
const val android_gradle_plugin = "8.0.2"
4+
const val android_gradle_plugin = "8.7.1"
55

6-
const val kotlin = "1.8.21"
6+
const val kotlin = "1.9.23"
77

88
// configure versions used by dependencies to harmonize and update easily across all components
9-
const val compileSdk = 33
9+
const val compileSdk = 34
1010
const val minSdk = 23
11-
const val targetSdk = 33
11+
const val targetSdk = 34
1212

1313
// native build tools
1414
const val ndk = "21.4.7075529"
-17.7 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)