From 0e08d70fe52737582b6c83dbf48aaf4d83063566 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Thu, 25 Jul 2013 18:07:46 +0900 Subject: [PATCH] Add MoreKeysPanel argument to Controller methods Bug: 9334755 Change-Id: I5a7104f4c98982f11fb4e060fa83c21bfc360558 --- .../inputmethod/keyboard/MainKeyboardView.java | 11 ++++++----- .../inputmethod/keyboard/MoreKeysKeyboardView.java | 4 ++-- .../android/inputmethod/keyboard/MoreKeysPanel.java | 12 +++++++----- .../latin/suggestions/SuggestionStripView.java | 6 +++--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 2d40e819e..f67981e8b 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -1032,8 +1032,9 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack @Override public void onShowMoreKeysPanel(final MoreKeysPanel panel) { locatePreviewPlacerView(); - if (isShowingMoreKeysPanel()) { - onDismissMoreKeysPanel(); + // TODO: Remove this check + if (panel.isShowingInParent()) { + panel.dismissMoreKeysPanel(); } mPreviewPlacerView.addView(panel.getContainerView()); mMoreKeysPanel = panel; @@ -1045,12 +1046,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack } @Override - public void onCancelMoreKeysPanel() { + public void onCancelMoreKeysPanel(final MoreKeysPanel panel) { PointerTracker.dismissAllMoreKeysPanels(); } @Override - public void onDismissMoreKeysPanel() { + public void onDismissMoreKeysPanel(final MoreKeysPanel panel) { dimEntireKeyboard(false /* dimmed */); if (isShowingMoreKeysPanel()) { mPreviewPlacerView.removeView(mMoreKeysPanel.getContainerView()); @@ -1213,7 +1214,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack public void closing() { dismissAllKeyPreviews(); cancelAllMessages(); - onDismissMoreKeysPanel(); + PointerTracker.dismissAllMoreKeysPanels(); mMoreKeysKeyboardCache.clear(); } diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java index ad4b2d86f..94f6a3cf2 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboardView.java @@ -119,7 +119,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel onMoveKeyInternal(x, y, pointerId); if (hasOldKey && mCurrentKey == null) { // If the pointer has moved too far away from any target then cancel the panel. - mController.onCancelMoreKeysPanel(); + mController.onCancelMoreKeysPanel(this); } } @@ -177,7 +177,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel if (!isShowingInParent()) { return; } - mController.onDismissMoreKeysPanel(); + mController.onDismissMoreKeysPanel(this); } @Override diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java b/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java index 1d3e18fd4..886c6286f 100644 --- a/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java +++ b/java/src/com/android/inputmethod/keyboard/MoreKeysPanel.java @@ -22,28 +22,30 @@ public interface MoreKeysPanel { public interface Controller { /** * Add the {@link MoreKeysPanel} to the target view. - * @param panel + * @param panel the panel to be shown. */ public void onShowMoreKeysPanel(final MoreKeysPanel panel); /** * Remove the current {@link MoreKeysPanel} from the target view. + * @param panel the panel to be dismissed. */ - public void onDismissMoreKeysPanel(); + public void onDismissMoreKeysPanel(final MoreKeysPanel panel); /** * Instructs the parent to cancel the panel (e.g., when entering a different input mode). + * @param panel the panel to be canceled. */ - public void onCancelMoreKeysPanel(); + public void onCancelMoreKeysPanel(final MoreKeysPanel panel); } public static final Controller EMPTY_CONTROLLER = new Controller() { @Override public void onShowMoreKeysPanel(final MoreKeysPanel panel) {} @Override - public void onDismissMoreKeysPanel() {} + public void onDismissMoreKeysPanel(final MoreKeysPanel panel) {} @Override - public void onCancelMoreKeysPanel() {} + public void onCancelMoreKeysPanel(final MoreKeysPanel panel) {} }; /** diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java index 81fb1963f..497a791d9 100644 --- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java +++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java @@ -181,8 +181,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick private final MoreKeysPanel.Controller mMoreSuggestionsController = new MoreKeysPanel.Controller() { @Override - public void onDismissMoreKeysPanel() { - mMainKeyboardView.onDismissMoreKeysPanel(); + public void onDismissMoreKeysPanel(final MoreKeysPanel panel) { + mMainKeyboardView.onDismissMoreKeysPanel(panel); } @Override @@ -191,7 +191,7 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick } @Override - public void onCancelMoreKeysPanel() { + public void onCancelMoreKeysPanel(final MoreKeysPanel panel) { mMoreSuggestionsView.dismissMoreKeysPanel(); } };