Add MoreKeysPanel argument to Controller methods

Bug: 9334755
Change-Id: I5a7104f4c98982f11fb4e060fa83c21bfc360558
main
Tadashi G. Takaoka 2013-07-25 18:07:46 +09:00
parent 09e4530ca7
commit 0e08d70fe5
4 changed files with 18 additions and 15 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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) {}
};
/**

View File

@ -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();
}
};