Loading tests/HandwritingIme/src/com/google/android/test/handwritingime/HandwritingIme.java +10 −0 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ package com.google.android.test.handwritingime; import android.annotation.Nullable; import android.inputmethodservice.InputMethodService; import android.util.Log; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.FrameLayout; import android.widget.TextView; import android.widget.Toast; import java.util.Random; Loading Loading @@ -79,6 +81,14 @@ public class HandwritingIme extends InputMethodService { view.setPadding(0, 0, 0, 0); view.addView(inner, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, height)); TextView text = new TextView(this); text.setText("Handwriting IME"); text.setTextSize(13f); text.setTextColor(getColor(android.R.color.white)); text.setGravity(Gravity.CENTER); text.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, height)); view.addView(text); inner.setBackgroundColor(0xff0110fe); // blue return view; Loading tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java +4 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ class InkView extends View { private static final long FINISH_TIMEOUT = 2500; private final HandwritingIme.HandwritingFinisher mHwCanceller; private final HandwritingIme.StylusConsumer mConsumer; private final int mTopInset; private Paint mPaint; private Path mPath; private float mX, mY; Loading Loading @@ -63,6 +64,7 @@ class InkView extends View { setLayoutParams(new ViewGroup.LayoutParams( metrics.getBounds().width() - insets.left - insets.right, metrics.getBounds().height() - insets.top - insets.bottom)); mTopInset = insets.top; } @Override Loading @@ -74,12 +76,14 @@ 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()) { Loading Loading
tests/HandwritingIme/src/com/google/android/test/handwritingime/HandwritingIme.java +10 −0 Original line number Diff line number Diff line Loading @@ -18,11 +18,13 @@ package com.google.android.test.handwritingime; import android.annotation.Nullable; import android.inputmethodservice.InputMethodService; import android.util.Log; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.FrameLayout; import android.widget.TextView; import android.widget.Toast; import java.util.Random; Loading Loading @@ -79,6 +81,14 @@ public class HandwritingIme extends InputMethodService { view.setPadding(0, 0, 0, 0); view.addView(inner, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, height)); TextView text = new TextView(this); text.setText("Handwriting IME"); text.setTextSize(13f); text.setTextColor(getColor(android.R.color.white)); text.setGravity(Gravity.CENTER); text.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, height)); view.addView(text); inner.setBackgroundColor(0xff0110fe); // blue return view; Loading
tests/HandwritingIme/src/com/google/android/test/handwritingime/InkView.java +4 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ class InkView extends View { private static final long FINISH_TIMEOUT = 2500; private final HandwritingIme.HandwritingFinisher mHwCanceller; private final HandwritingIme.StylusConsumer mConsumer; private final int mTopInset; private Paint mPaint; private Path mPath; private float mX, mY; Loading Loading @@ -63,6 +64,7 @@ class InkView extends View { setLayoutParams(new ViewGroup.LayoutParams( metrics.getBounds().width() - insets.left - insets.right, metrics.getBounds().height() - insets.top - insets.bottom)); mTopInset = insets.top; } @Override Loading @@ -74,12 +76,14 @@ 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()) { Loading