aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-06-17 17:05:11 -0700
committerTadashi G. Takaoka <takaoka@google.com>2014-06-18 10:05:59 -0700
commit3ff72dd0daa9baaeb4d6b8ade59d65c1f0e8b34f (patch)
tree0118fdfe3962c8e96b74ae7df5befc9dfb55539d /java/src
parent4c45fff2404b274cf6345221412671a81f0dba46 (diff)
downloadlatinime-3ff72dd0daa9baaeb4d6b8ade59d65c1f0e8b34f.tar.gz
latinime-3ff72dd0daa9baaeb4d6b8ade59d65c1f0e8b34f.tar.xz
latinime-3ff72dd0daa9baaeb4d6b8ade59d65c1f0e8b34f.zip
Consolidate 3 public methods of key preview into one
Change-Id: I0ac92c56bdb636998f7f5e20fba6830b4ac435fa
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java8
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java15
2 files changed, 14 insertions, 9 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 9a859bfdb..c4d7dccd9 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -35,7 +35,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodSubtype;
-import android.widget.TextView;
import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.accessibility.MainKeyboardAccessibilityDelegate;
@@ -461,12 +460,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
}
locatePreviewPlacerView();
- final TextView previewTextView = mKeyPreviewChoreographer.getKeyPreviewTextView(
- key, mDrawingPreviewPlacerView);
getLocationInWindow(mOriginCoords);
- mKeyPreviewChoreographer.placeKeyPreview(key, previewTextView, keyboard.mIconsSet,
- mKeyDrawParams, getWidth(), mOriginCoords);
- mKeyPreviewChoreographer.showKeyPreview(key, previewTextView, isHardwareAccelerated());
+ mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams,
+ getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated());
}
// Implements {@link TimerHandler.Callbacks} method.
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
index 605519b02..d4c671028 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
@@ -57,7 +57,7 @@ public final class KeyPreviewChoreographer {
mParams = params;
}
- public TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) {
+ private TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) {
TextView previewTextView = mShowingKeyPreviewTextViews.remove(key);
if (previewTextView != null) {
return previewTextView;
@@ -134,7 +134,16 @@ public final class KeyPreviewChoreographer {
private static final int STATE_NORMAL = 0;
private static final int STATE_HAS_MOREKEYS = 1;
- public void placeKeyPreview(final Key key, final TextView previewTextView,
+ public void placeKeyPreviewAndShow(final Key key, final KeyboardIconsSet iconsSet,
+ final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
+ final ViewGroup placerView, final boolean withAnimation) {
+ final TextView previewTextView = getKeyPreviewTextView(key, placerView);
+ placeKeyPreview(
+ key, previewTextView, iconsSet, drawParams, keyboardViewWidth, keyboardOrigin);
+ showKeyPreview(key, previewTextView, withAnimation);
+ }
+
+ private void placeKeyPreview(final Key key, final TextView previewTextView,
final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams,
final int keyboardViewWidth, final int[] originCoords) {
previewTextView.setTextColor(drawParams.mPreviewTextColor);
@@ -189,7 +198,7 @@ public final class KeyPreviewChoreographer {
previewTextView.setPivotY(previewHeight);
}
- public void showKeyPreview(final Key key, final TextView previewTextView,
+ private void showKeyPreview(final Key key, final TextView previewTextView,
final boolean withAnimation) {
if (!withAnimation) {
previewTextView.setVisibility(View.VISIBLE);