diff options
| author | Tadashi G. Takaoka <takaoka@google.com> | 2011-07-08 16:19:19 -0700 |
|---|---|---|
| committer | Tadashi G. Takaoka <takaoka@google.com> | 2011-07-08 16:26:11 -0700 |
| commit | 8a995157f37365cf79b893e9106d1830d70c39dc (patch) | |
| tree | 5985668ff824a70911a7ddd2bb2f9461e14be156 /java/src/com/android/inputmethod/keyboard/internal/PointerTrackerKeyState.java | |
| parent | 10912baf60b66af3459dea13cd8da73c0f7955c0 (diff) | |
Merge PointerTrackerKeyState into PointerTracker
Bug: 4768084
Change-Id: I0be0e07bff2542db6ba764dcb13505dfbff6994e
Diffstat (limited to 'java/src/com/android/inputmethod/keyboard/internal/PointerTrackerKeyState.java')
| -rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/PointerTrackerKeyState.java | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerKeyState.java b/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerKeyState.java deleted file mode 100644 index 5a12db248..000000000 --- a/java/src/com/android/inputmethod/keyboard/internal/PointerTrackerKeyState.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations under - * the License. - */ - -package com.android.inputmethod.keyboard.internal; - -import com.android.inputmethod.keyboard.KeyDetector; -import com.android.inputmethod.keyboard.PointerTracker; - -/** - * This class keeps track of a key index and a position where {@link PointerTracker} is. - */ -public class PointerTrackerKeyState { - private KeyDetector mKeyDetector; - - // The position and time at which first down event occurred. - private long mDownTime; - private long mUpTime; - - // The current key index where this pointer is. - private int mKeyIndex = KeyDetector.NOT_A_KEY; - // The position where mKeyIndex was recognized for the first time. - private int mKeyX; - private int mKeyY; - - // Last pointer position. - private int mLastX; - private int mLastY; - - public PointerTrackerKeyState(KeyDetector keyDetector) { - if (keyDetector == null) - throw new NullPointerException(); - mKeyDetector = keyDetector; - } - - public void setKeyDetector(KeyDetector keyDetector) { - mKeyDetector = keyDetector; - } - - public int getKeyIndex() { - return mKeyIndex; - } - - public int getKeyX() { - return mKeyX; - } - - public int getKeyY() { - return mKeyY; - } - - public long getDownTime() { - return mDownTime; - } - - public long getUpTime() { - return mUpTime; - } - - public int getLastX() { - return mLastX; - } - - public int getLastY() { - return mLastY; - } - - public int onDownKey(int x, int y, long eventTime) { - mDownTime = eventTime; - return onMoveToNewKey(onMoveKeyInternal(x, y), x, y); - } - - private int onMoveKeyInternal(int x, int y) { - mLastX = x; - mLastY = y; - return mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null); - } - - public int onMoveKey(int x, int y) { - return onMoveKeyInternal(x, y); - } - - public int onMoveToNewKey(int keyIndex, int x, int y) { - mKeyIndex = keyIndex; - mKeyX = x; - mKeyY = y; - return keyIndex; - } - - public int onUpKey(int x, int y, long eventTime) { - mUpTime = eventTime; - mKeyIndex = KeyDetector.NOT_A_KEY; - return onMoveKeyInternal(x, y); - } -} |
