summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Justin Ghan <justinghan@google.com> 2022-09-24 07:36:51 -0700
committer Justin Ghan <justinghan@google.com> 2022-09-24 07:36:51 -0700
commit9892bebd7d4b75c7e1a7aad662aad602566d08d7 (patch)
tree21908975e3852a587d5678f0b2d1a5049a559b50
parent789753961d6e54fe4a45dad91bb7ef15590916fb (diff)
Fix ink position in test handwriting IME
Bug: 217957587 Test: m HandwritingIme Change-Id: Ie8f7dc2802d5de97b4b7561f0896a61d34bf237e
-rw-r--r--tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java15
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java b/tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java
index 94b1f863f197..e94c79ecca00 100644
--- a/tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java
+++ b/tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java
@@ -19,13 +19,11 @@ package com.google.android.test.handwritingime;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Insets;
import android.graphics.Paint;
import android.graphics.Path;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.WindowMetrics;
@@ -33,9 +31,8 @@ class InkView extends View {
private static final long FINISH_TIMEOUT = 1500;
private final HandwritingIme.HandwritingFinisher mHwCanceller;
private final HandwritingIme.StylusConsumer mConsumer;
- private final int mTopInset;
- private Paint mPaint;
- private Path mPath;
+ private final Paint mPaint;
+ private final Path mPath;
private float mX, mY;
private static final float STYLUS_MOVE_TOLERANCE = 1;
private Runnable mFinishRunnable;
@@ -59,12 +56,8 @@ class InkView extends View {
WindowManager wm = context.getSystemService(WindowManager.class);
WindowMetrics metrics = wm.getCurrentWindowMetrics();
- Insets insets = metrics.getWindowInsets()
- .getInsetsIgnoringVisibility(WindowInsets.Type.systemBars());
setLayoutParams(new ViewGroup.LayoutParams(
- metrics.getBounds().width() - insets.left - insets.right,
- metrics.getBounds().height() - insets.top - insets.bottom));
- mTopInset = insets.top;
+ metrics.getBounds().width(), metrics.getBounds().height()));
}
@Override
@@ -76,14 +69,12 @@ class InkView extends View {
}
private void stylusStart(float x, float y) {
- y = y - mTopInset;
mPath.moveTo(x, y);
mX = x;
mY = y;
}
private void stylusMove(float x, float y) {
- y = y - mTopInset;
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
if (mPath.isEmpty()) {