mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 15:32:48 +00:00
address some warnings
This commit is contained in:
parent
4377effa9e
commit
017c057585
27 changed files with 81 additions and 84 deletions
|
@ -111,13 +111,11 @@ public class ProximityInfo {
|
|||
return count;
|
||||
}
|
||||
|
||||
private long createNativeProximityInfo(
|
||||
@NonNull final TouchPositionCorrection touchPositionCorrection) {
|
||||
final List<Key>[] gridNeighborKeys = mGridNeighbors;
|
||||
private long createNativeProximityInfo(@NonNull final TouchPositionCorrection touchPositionCorrection) {
|
||||
final int[] proximityCharsArray = new int[mGridSize * MAX_PROXIMITY_CHARS_SIZE];
|
||||
Arrays.fill(proximityCharsArray, Constants.NOT_A_CODE);
|
||||
for (int i = 0; i < mGridSize; ++i) {
|
||||
final List<Key> neighborKeys = gridNeighborKeys[i];
|
||||
final List<Key> neighborKeys = mGridNeighbors[i];
|
||||
final int proximityCharsLength = neighborKeys.size();
|
||||
int infoIndex = i * MAX_PROXIMITY_CHARS_SIZE;
|
||||
for (int j = 0; j < proximityCharsLength; ++j) {
|
||||
|
@ -243,10 +241,9 @@ public class ProximityInfo {
|
|||
}
|
||||
|
||||
private void computeNearestNeighbors() {
|
||||
final int defaultWidth = mMostCommonKeyWidth;
|
||||
final int keyCount = mSortedKeys.size();
|
||||
final int gridSize = mGridNeighbors.length;
|
||||
final int threshold = (int) (defaultWidth * SEARCH_DISTANCE);
|
||||
final int threshold = (int) (mMostCommonKeyWidth * SEARCH_DISTANCE);
|
||||
final int thresholdSquared = threshold * threshold;
|
||||
// Round-up so we don't have any pixels outside the grid
|
||||
final int lastPixelXCoordinate = mGridWidth * mCellWidth - 1;
|
||||
|
|
|
@ -147,7 +147,7 @@ open class CursorAnchorInfoCompatWrapper internal constructor() {
|
|||
*/
|
||||
const val FLAG_IS_RTL = 0x04
|
||||
|
||||
@kotlin.jvm.JvmStatic
|
||||
@JvmStatic
|
||||
@TargetApi(VERSION_CODES.LOLLIPOP)
|
||||
fun wrap(instance: CursorAnchorInfo?): CursorAnchorInfoCompatWrapper? {
|
||||
return if (Build.VERSION.SDK_INT < VERSION_CODES.LOLLIPOP) {
|
||||
|
|
|
@ -6,12 +6,9 @@ import java.util.*
|
|||
object EditorInfoCompatUtils {
|
||||
// Note that EditorInfo.IME_FLAG_FORCE_ASCII has been introduced
|
||||
// in API level 16 (Build.VERSION_CODES.JELLY_BEAN).
|
||||
private val FIELD_IME_FLAG_FORCE_ASCII = CompatUtils.getField(
|
||||
EditorInfo::class.java, "IME_FLAG_FORCE_ASCII")
|
||||
private val OBJ_IME_FLAG_FORCE_ASCII: Int? = CompatUtils.getFieldValue(
|
||||
null /* receiver */, null /* defaultValue */, FIELD_IME_FLAG_FORCE_ASCII) as Int
|
||||
private val FIELD_HINT_LOCALES = CompatUtils.getField(
|
||||
EditorInfo::class.java, "hintLocales")
|
||||
private val FIELD_IME_FLAG_FORCE_ASCII = CompatUtils.getField(EditorInfo::class.java, "IME_FLAG_FORCE_ASCII")
|
||||
private val OBJ_IME_FLAG_FORCE_ASCII: Int? = CompatUtils.getFieldValue(null, null, FIELD_IME_FLAG_FORCE_ASCII) as? Int
|
||||
private val FIELD_HINT_LOCALES = CompatUtils.getField(EditorInfo::class.java, "hintLocales")
|
||||
|
||||
@JvmStatic
|
||||
fun hasFlagForceAscii(imeOptions: Int): Boolean {
|
||||
|
@ -20,8 +17,7 @@ object EditorInfoCompatUtils {
|
|||
|
||||
@JvmStatic
|
||||
fun imeActionName(imeOptions: Int): String {
|
||||
val actionId = imeOptions and EditorInfo.IME_MASK_ACTION
|
||||
return when (actionId) {
|
||||
return when (val actionId = imeOptions and EditorInfo.IME_MASK_ACTION) {
|
||||
EditorInfo.IME_ACTION_UNSPECIFIED -> "actionUnspecified"
|
||||
EditorInfo.IME_ACTION_NONE -> "actionNone"
|
||||
EditorInfo.IME_ACTION_GO -> "actionGo"
|
||||
|
@ -57,8 +53,7 @@ object EditorInfoCompatUtils {
|
|||
if (editorInfo == null) {
|
||||
return null
|
||||
}
|
||||
val localeList = CompatUtils.getFieldValue(editorInfo, null, FIELD_HINT_LOCALES)
|
||||
?: return null
|
||||
val localeList = CompatUtils.getFieldValue(editorInfo, null, FIELD_HINT_LOCALES) ?: return null
|
||||
return if (LocaleListCompatUtils.isEmpty(localeList)) {
|
||||
null
|
||||
} else LocaleListCompatUtils[localeList, 0]
|
||||
|
|
|
@ -8,8 +8,7 @@ import java.security.NoSuchAlgorithmException
|
|||
object MD5Calculator {
|
||||
@Throws(IOException::class)
|
||||
fun checksum(`in`: InputStream): String? { // This code from the Android documentation for MessageDigest. Nearly verbatim.
|
||||
val digester: MessageDigest
|
||||
digester = try {
|
||||
val digester: MessageDigest = try {
|
||||
MessageDigest.getInstance("MD5")
|
||||
} catch (e: NoSuchAlgorithmException) {
|
||||
return null // Platform does not support MD5 : can't check, so return null
|
||||
|
@ -26,4 +25,4 @@ object MD5Calculator {
|
|||
}
|
||||
return s.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,10 +88,10 @@ class InputTransaction(// Initial conditions
|
|||
|
||||
companion object {
|
||||
// UPDATE_LATER is stronger than UPDATE_NOW. The reason for this is, if we have to update later,
|
||||
// it's because something will change that we can't evaluate now, which means that even if we
|
||||
// re-evaluate now we'll have to do it again later. The only case where that wouldn't apply
|
||||
// would be if we needed to update now to find out the new state right away, but then we
|
||||
// can't do it with this deferred mechanism anyway.
|
||||
// it's because something will change that we can't evaluate now, which means that even if we
|
||||
// re-evaluate now we'll have to do it again later. The only case where that wouldn't apply
|
||||
// would be if we needed to update now to find out the new state right away, but then we
|
||||
// can't do it with this deferred mechanism anyway.
|
||||
const val SHIFT_NO_UPDATE = 0
|
||||
const val SHIFT_UPDATE_NOW = 1
|
||||
const val SHIFT_UPDATE_LATER = 2
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public final class AlphabetShiftState {
|
||||
private static final String TAG = AlphabetShiftState.class.getSimpleName();
|
||||
private static final boolean DEBUG = false;
|
||||
|
@ -112,6 +114,7 @@ public final class AlphabetShiftState {
|
|||
return mState == MANUAL_SHIFTED_FROM_AUTO;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString(mState);
|
||||
|
|
|
@ -46,7 +46,7 @@ public final class DrawingPreviewPlacerView extends RelativeLayout {
|
|||
}
|
||||
|
||||
public void addPreview(final AbstractDrawingPreview preview) {
|
||||
if (mPreviews.indexOf(preview) < 0) {
|
||||
if (!mPreviews.contains(preview)) {
|
||||
mPreviews.add(preview);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setPreviewPosition(final PointerTracker tracker) {
|
||||
public void setPreviewPosition(@NonNull final PointerTracker tracker) {
|
||||
if (!isPreviewEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
|
|||
* @param canvas The canvas where preview text is drawn.
|
||||
*/
|
||||
@Override
|
||||
public void drawPreview(final Canvas canvas) {
|
||||
public void drawPreview(@NonNull final Canvas canvas) {
|
||||
if (!isPreviewEnabled() || mSuggestedWords.isEmpty()
|
||||
|| TextUtils.isEmpty(mSuggestedWords.getWord(0))) {
|
||||
return;
|
||||
|
@ -161,8 +161,6 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
|
|||
}
|
||||
final String text = mSuggestedWords.getWord(0);
|
||||
|
||||
final RectF rectangle = mGesturePreviewRectangle;
|
||||
|
||||
final int textHeight = mParams.mGesturePreviewTextHeight;
|
||||
final float textWidth = mParams.getTextPaint().measureText(text);
|
||||
final float hPad = mParams.mGesturePreviewHorizontalPadding;
|
||||
|
@ -175,7 +173,7 @@ public class GestureFloatingTextDrawingPreview extends AbstractDrawingPreview {
|
|||
mParams.mDisplayWidth - rectWidth);
|
||||
final float rectY = CoordinateUtils.y(mLastPointerCoords)
|
||||
- mParams.mGesturePreviewTextOffset - rectHeight;
|
||||
rectangle.set(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
|
||||
mGesturePreviewRectangle.set(rectX, rectY, rectX + rectWidth, rectY + rectHeight);
|
||||
|
||||
mPreviewTextX = (int)(rectX + hPad + textWidth / 2.0f);
|
||||
mPreviewTextY = (int)(rectY + vPad) + textHeight;
|
||||
|
|
|
@ -146,7 +146,7 @@ public final class GestureStrokeRecognitionPoints {
|
|||
}
|
||||
|
||||
// TODO: Make this package private
|
||||
public final boolean isStartOfAGesture() {
|
||||
public boolean isStartOfAGesture() {
|
||||
if (!hasDetectedFastMove()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public final class GestureStrokeRecognitionPoints {
|
|||
mLastMajorEventY = y;
|
||||
}
|
||||
|
||||
private final boolean hasDetectedFastMove() {
|
||||
private boolean hasDetectedFastMove() {
|
||||
return mDetectFastMoveTime > 0;
|
||||
}
|
||||
|
||||
|
@ -303,18 +303,18 @@ public final class GestureStrokeRecognitionPoints {
|
|||
}
|
||||
|
||||
// TODO: Make this package private
|
||||
public final boolean hasRecognitionTimePast(
|
||||
public boolean hasRecognitionTimePast(
|
||||
final long currentTime, final long lastRecognitionTime) {
|
||||
return currentTime > lastRecognitionTime + mRecognitionParams.mRecognitionMinimumTime;
|
||||
}
|
||||
|
||||
// TODO: Make this package private
|
||||
public final void appendAllBatchPoints(final InputPointers out) {
|
||||
public void appendAllBatchPoints(final InputPointers out) {
|
||||
appendBatchPoints(out, getLength());
|
||||
}
|
||||
|
||||
// TODO: Make this package private
|
||||
public final void appendIncrementalBatchPoints(final InputPointers out) {
|
||||
public void appendIncrementalBatchPoints(final InputPointers out) {
|
||||
appendBatchPoints(out, mIncrementalRecognitionSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
|
|||
import android.content.res.TypedArray;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Colors;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||
|
||||
/**
|
||||
|
|
|
@ -102,9 +102,8 @@ final class GestureTrailDrawingPoints {
|
|||
eventTimes[i] -= elapsedTime;
|
||||
}
|
||||
final int[] xCoords = mXCoordinates.getPrimitiveArray();
|
||||
final int downIndex = trailSize;
|
||||
xCoords[downIndex] = markAsDownEvent(xCoords[downIndex]);
|
||||
mCurrentTimeBase = downTime - eventTimes[downIndex];
|
||||
xCoords[trailSize] = markAsDownEvent(xCoords[trailSize]);
|
||||
mCurrentTimeBase = downTime - eventTimes[trailSize];
|
||||
mCurrentStrokeId = strokeId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import android.graphics.Rect;
|
|||
import android.os.Handler;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.dslul.openboard.inputmethod.keyboard.PointerTracker;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +58,7 @@ public final class GestureTrailsDrawingPreview extends AbstractDrawingPreview im
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setKeyboardViewGeometry(final int[] originCoords, final int width,
|
||||
public void setKeyboardViewGeometry(@NonNull final int[] originCoords, final int width,
|
||||
final int height) {
|
||||
super.setKeyboardViewGeometry(originCoords, width, height);
|
||||
mOffscreenOffsetY = (int)(height
|
||||
|
@ -127,7 +129,7 @@ public final class GestureTrailsDrawingPreview extends AbstractDrawingPreview im
|
|||
* @param canvas The canvas where the preview is drawn.
|
||||
*/
|
||||
@Override
|
||||
public void drawPreview(final Canvas canvas) {
|
||||
public void drawPreview(@NonNull final Canvas canvas) {
|
||||
if (!isPreviewEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -154,7 +156,7 @@ public final class GestureTrailsDrawingPreview extends AbstractDrawingPreview im
|
|||
* @param tracker The new location of the preview is based on the points in PointerTracker.
|
||||
*/
|
||||
@Override
|
||||
public void setPreviewPosition(final PointerTracker tracker) {
|
||||
public void setPreviewPosition(@NonNull final PointerTracker tracker) {
|
||||
if (!isPreviewEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -16,14 +16,8 @@
|
|||
|
||||
package org.dslul.openboard.inputmethod.keyboard.internal;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorInflater;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.res.TypedArray;
|
||||
import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public final class KeyboardIconsSet {
|
|||
NAME_SWITCH_ONEHANDED_KEY, R.styleable.Keyboard_iconSwitchOneHandedMode,
|
||||
};
|
||||
|
||||
private static int NUM_ICONS = NAMES_AND_ATTR_IDS.length / 2;
|
||||
private static final int NUM_ICONS = NAMES_AND_ATTR_IDS.length / 2;
|
||||
private static final String[] ICON_NAMES = new String[NUM_ICONS];
|
||||
private final Drawable[] mIcons = new Drawable[NUM_ICONS];
|
||||
private final int[] mIconResourceIds = new int[NUM_ICONS];
|
||||
|
|
|
@ -91,15 +91,12 @@ public class KeyboardParams {
|
|||
new TouchPositionCorrection();
|
||||
|
||||
// Comparator to sort {@link Key}s from top-left to bottom-right order.
|
||||
private static final Comparator<Key> ROW_COLUMN_COMPARATOR = new Comparator<Key>() {
|
||||
@Override
|
||||
public int compare(final Key lhs, final Key rhs) {
|
||||
if (lhs.getY() < rhs.getY()) return -1;
|
||||
if (lhs.getY() > rhs.getY()) return 1;
|
||||
if (lhs.getX() < rhs.getX()) return -1;
|
||||
if (lhs.getX() > rhs.getX()) return 1;
|
||||
return 0;
|
||||
}
|
||||
private static final Comparator<Key> ROW_COLUMN_COMPARATOR = (lhs, rhs) -> {
|
||||
if (lhs.getY() < rhs.getY()) return -1;
|
||||
if (lhs.getY() > rhs.getY()) return 1;
|
||||
if (lhs.getX() < rhs.getX()) return -1;
|
||||
if (lhs.getX() > rhs.getX()) return 1;
|
||||
return 0;
|
||||
};
|
||||
|
||||
public KeyboardParams() {
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
|
|||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.dslul.openboard.inputmethod.event.Event;
|
||||
import org.dslul.openboard.inputmethod.latin.common.Constants;
|
||||
import org.dslul.openboard.inputmethod.latin.settings.Settings;
|
||||
|
@ -73,8 +75,9 @@ public final class KeyboardState {
|
|||
|
||||
private final SwitchActions mSwitchActions;
|
||||
|
||||
private ShiftKeyState mShiftKeyState = new ShiftKeyState("Shift");
|
||||
private ModifierKeyState mSymbolKeyState = new ModifierKeyState("Symbol");
|
||||
private final ShiftKeyState mShiftKeyState = new ShiftKeyState("Shift");
|
||||
private final ModifierKeyState mSymbolKeyState = new ModifierKeyState("Symbol");
|
||||
private final AlphabetShiftState mAlphabetShiftState = new AlphabetShiftState();
|
||||
|
||||
// TODO: Merge {@link #mSwitchState}, {@link #mIsAlphabetMode}, {@link #mAlphabetShiftState},
|
||||
// {@link #mIsSymbolShifted}, {@link #mPrevMainKeyboardWasShiftLocked}, and
|
||||
|
@ -93,7 +96,6 @@ public final class KeyboardState {
|
|||
private static final int MODE_CLIPBOARD = 3;
|
||||
private static final int MODE_NUMPAD = 4;
|
||||
private int mMode = MODE_ALPHABET;
|
||||
private AlphabetShiftState mAlphabetShiftState = new AlphabetShiftState();
|
||||
private boolean mIsSymbolShifted;
|
||||
private boolean mPrevMainKeyboardWasShiftLocked;
|
||||
private boolean mPrevSymbolsKeyboardWasShifted;
|
||||
|
@ -111,6 +113,7 @@ public final class KeyboardState {
|
|||
public int mMode;
|
||||
public int mShiftMode;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
if (!mIsValid) {
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.dslul.openboard.inputmethod.latin.utils.RunInLocale;
|
|||
import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public final class KeyboardTextsTable {
|
|||
return text;
|
||||
}
|
||||
// Validity check.
|
||||
if (index >= 0 && index < TEXTS_DEFAULT.length) {
|
||||
if (index < TEXTS_DEFAULT.length) {
|
||||
return TEXTS_DEFAULT[index];
|
||||
}
|
||||
// Throw exception for debugging purpose.
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.util.Log;
|
|||
import org.dslul.openboard.inputmethod.annotations.UsedForTesting;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Utilities for matrix operations. Don't instantiate objects inside this class to prevent
|
||||
|
@ -154,10 +155,10 @@ public class MatrixUtils {
|
|||
Log.d(TAG, "Dump matrix: " + title);
|
||||
Log.d(TAG, "/*---------------------");
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < row; ++i) {
|
||||
for (float[] floats : a) {
|
||||
sb.setLength(0);
|
||||
for (int j = 0; j < column; ++j) {
|
||||
sb.append(String.format("%4f", a[i][j])).append(' ');
|
||||
sb.append(String.format(Locale.ROOT, "%4f", floats[j])).append(' ');
|
||||
}
|
||||
Log.d(TAG, sb.toString());
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/* package */ class ModifierKeyState {
|
||||
protected static final String TAG = ModifierKeyState.class.getSimpleName();
|
||||
protected static final boolean DEBUG = false;
|
||||
|
@ -67,6 +69,7 @@ import android.util.Log;
|
|||
return mState == CHORDING;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString(mState);
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class NonDistinctMultitouchHelper {
|
|||
private static final int MAIN_POINTER_TRACKER_ID = 0;
|
||||
private int mOldPointerCount = 1;
|
||||
private Key mOldKey;
|
||||
private int[] mLastCoords = CoordinateUtils.newInstance();
|
||||
private final int[] mLastCoords = CoordinateUtils.newInstance();
|
||||
|
||||
public void processMotionEvent(final MotionEvent me, final KeyDetector keyDetector) {
|
||||
final int pointerCount = me.getPointerCount();
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public final class PointerTrackerQueue {
|
||||
|
@ -176,10 +178,9 @@ public final class PointerTrackerQueue {
|
|||
|
||||
public boolean hasModifierKeyOlderThan(final Element pointer) {
|
||||
synchronized (mExpandableArrayOfActivePointers) {
|
||||
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
|
||||
final int arraySize = mArraySize;
|
||||
for (int index = 0; index < arraySize; index++) {
|
||||
final Element element = expandableArray.get(index);
|
||||
final Element element = mExpandableArrayOfActivePointers.get(index);
|
||||
if (element == pointer) {
|
||||
return false; // Stop searching modifier key.
|
||||
}
|
||||
|
@ -193,10 +194,9 @@ public final class PointerTrackerQueue {
|
|||
|
||||
public boolean isAnyInDraggingFinger() {
|
||||
synchronized (mExpandableArrayOfActivePointers) {
|
||||
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
|
||||
final int arraySize = mArraySize;
|
||||
for (int index = 0; index < arraySize; index++) {
|
||||
final Element element = expandableArray.get(index);
|
||||
final Element element = mExpandableArrayOfActivePointers.get(index);
|
||||
if (element.isInDraggingFinger()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -210,29 +210,28 @@ public final class PointerTrackerQueue {
|
|||
if (DEBUG) {
|
||||
Log.d(TAG, "cancelAllPointerTracker: " + this);
|
||||
}
|
||||
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
|
||||
final int arraySize = mArraySize;
|
||||
for (int index = 0; index < arraySize; index++) {
|
||||
final Element element = expandableArray.get(index);
|
||||
final Element element = mExpandableArrayOfActivePointers.get(index);
|
||||
element.cancelTrackingForAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
synchronized (mExpandableArrayOfActivePointers) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
final ArrayList<Element> expandableArray = mExpandableArrayOfActivePointers;
|
||||
final int arraySize = mArraySize;
|
||||
for (int index = 0; index < arraySize; index++) {
|
||||
final Element element = expandableArray.get(index);
|
||||
final Element element = mExpandableArrayOfActivePointers.get(index);
|
||||
if (sb.length() > 0) {
|
||||
sb.append(" ");
|
||||
}
|
||||
sb.append(element.toString());
|
||||
}
|
||||
return "[" + sb.toString() + "]";
|
||||
return "[" + sb + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.dslul.openboard.inputmethod.keyboard.internal;
|
|||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/* package */ final class ShiftKeyState extends ModifierKeyState {
|
||||
private static final int PRESSING_ON_SHIFTED = 3; // both temporary shifted & shift locked
|
||||
private static final int IGNORING = 4;
|
||||
|
@ -53,6 +55,7 @@ import android.util.Log;
|
|||
return mState == IGNORING;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString(mState);
|
||||
|
|
|
@ -21,6 +21,8 @@ import android.graphics.Canvas;
|
|||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.dslul.openboard.inputmethod.keyboard.PointerTracker;
|
||||
import org.dslul.openboard.inputmethod.latin.R;
|
||||
import org.dslul.openboard.inputmethod.latin.common.CoordinateUtils;
|
||||
|
@ -79,7 +81,7 @@ public final class SlidingKeyInputDrawingPreview extends AbstractDrawingPreview
|
|||
* @param canvas The canvas where the preview is drawn.
|
||||
*/
|
||||
@Override
|
||||
public void drawPreview(final Canvas canvas) {
|
||||
public void drawPreview(@NonNull final Canvas canvas) {
|
||||
if (!isPreviewEnabled() || !mShowsSlidingKeyInputPreview) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,8 +61,8 @@ public class SmoothingUtils {
|
|||
Arrays.fill(m0[i], 0);
|
||||
for (int j = 0; j < COEFF_COUNT; ++j) {
|
||||
final int pow = i + j;
|
||||
for (int k = 0; k < N; ++k) {
|
||||
m0[i][j] += (float) Math.pow(xs[k], pow);
|
||||
for (float x : xs) {
|
||||
m0[i][j] += (float) Math.pow(x, pow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,8 +35,9 @@ public abstract class UniqueKeysCache {
|
|||
@Override
|
||||
public void clear() {}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Key getUniqueKey(Key key) { return key; }
|
||||
public Key getUniqueKey(@NonNull Key key) { return key; }
|
||||
};
|
||||
|
||||
@NonNull
|
||||
|
@ -63,8 +64,9 @@ public abstract class UniqueKeysCache {
|
|||
mCache.clear();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Key getUniqueKey(final Key key) {
|
||||
public Key getUniqueKey(@NonNull final Key key) {
|
||||
if (!mEnabled) {
|
||||
return key;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.dslul.openboard.inputmethod.latin.suggestions;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
|
@ -125,8 +126,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
|
||||
/**
|
||||
* Construct a {@link SuggestionStripView} for showing suggestions to be picked by the user.
|
||||
* @param context
|
||||
* @param attrs
|
||||
*/
|
||||
public SuggestionStripView(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.suggestionStripViewStyle);
|
||||
|
@ -172,8 +171,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
final Resources res = context.getResources();
|
||||
mMoreSuggestionsModalTolerance = res.getDimensionPixelOffset(
|
||||
R.dimen.config_more_suggestions_modal_tolerance);
|
||||
mMoreSuggestionsSlidingDetector = new GestureDetector(
|
||||
context, mMoreSuggestionsSlidingListener);
|
||||
mMoreSuggestionsSlidingDetector = new GestureDetector(context, mMoreSuggestionsSlidingListener);
|
||||
|
||||
final TypedArray keyboardAttr = context.obtainStyledAttributes(attrs,
|
||||
R.styleable.Keyboard, defStyle, R.style.SuggestionStripView);
|
||||
|
@ -202,7 +200,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
|
||||
/**
|
||||
* A connection back to the input method.
|
||||
* @param listener
|
||||
*/
|
||||
public void setListener(final Listener listener, final View inputView) {
|
||||
mListener = listener;
|
||||
|
@ -231,6 +228,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
mLayoutHelper.setMoreSuggestionsHeight(remainingHeight);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility") // why would "null" need to call View#performClick?
|
||||
public void clear() {
|
||||
mSuggestionsStrip.removeAllViews();
|
||||
removeAllDebugInfoViews();
|
||||
|
@ -291,6 +289,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("ClickableViewAccessibility") // no need for View#performClick, we return false mostly anyway
|
||||
public boolean onLongClick(final View view) {
|
||||
if (view == mClipboardKey) {
|
||||
ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
|
@ -490,6 +489,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("ClickableViewAccessibility") // ok, perform click again, but why?
|
||||
public boolean onTouchEvent(final MotionEvent me) {
|
||||
if (!mMoreSuggestionsView.isShowingInParent()) {
|
||||
// Ignore any touch event while more suggestions panel hasn't been shown.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue