Merge "Remove boolean return value of dismissing more keys panel"
commit
15c41a61ad
|
@ -1050,14 +1050,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onDismissMoreKeysPanel() {
|
||||
public void onDismissMoreKeysPanel() {
|
||||
dimEntireKeyboard(false /* dimmed */);
|
||||
if (isShowingMoreKeysPanel()) {
|
||||
mPreviewPlacerView.removeView(mMoreKeysPanel.getContainerView());
|
||||
mMoreKeysPanel = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
|||
private final int[] mCoordinates = CoordinateUtils.newInstance();
|
||||
|
||||
protected final KeyDetector mKeyDetector;
|
||||
private Controller mController;
|
||||
private Controller mController = EMPTY_CONTROLLER;
|
||||
protected KeyboardActionListener mListener;
|
||||
private int mOriginX;
|
||||
private int mOriginY;
|
||||
|
@ -173,9 +173,11 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean dismissMoreKeysPanel() {
|
||||
if (mController == null) return false;
|
||||
return mController.onDismissMoreKeysPanel();
|
||||
public void dismissMoreKeysPanel() {
|
||||
if (!isShowingInParent()) {
|
||||
return;
|
||||
}
|
||||
mController.onDismissMoreKeysPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ public interface MoreKeysPanel {
|
|||
/**
|
||||
* Remove the current {@link MoreKeysPanel} from the target view.
|
||||
*/
|
||||
public boolean onDismissMoreKeysPanel();
|
||||
public void onDismissMoreKeysPanel();
|
||||
|
||||
/**
|
||||
* Instructs the parent to cancel the panel (e.g., when entering a different input mode).
|
||||
|
@ -37,6 +37,15 @@ public interface MoreKeysPanel {
|
|||
public void onCancelMoreKeysPanel();
|
||||
}
|
||||
|
||||
public static final Controller EMPTY_CONTROLLER = new Controller() {
|
||||
@Override
|
||||
public void onShowMoreKeysPanel(final MoreKeysPanel panel) {}
|
||||
@Override
|
||||
public void onDismissMoreKeysPanel() {}
|
||||
@Override
|
||||
public void onCancelMoreKeysPanel() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the layout and event handling of this {@link MoreKeysPanel} and calls the
|
||||
* controller's onShowMoreKeysPanel to add the panel's container view.
|
||||
|
@ -57,7 +66,7 @@ public interface MoreKeysPanel {
|
|||
* Dismisses the more keys panel and calls the controller's onDismissMoreKeysPanel to remove
|
||||
* the panel's container view.
|
||||
*/
|
||||
public boolean dismissMoreKeysPanel();
|
||||
public void dismissMoreKeysPanel();
|
||||
|
||||
/**
|
||||
* Process a move event on the more keys panel.
|
||||
|
|
|
@ -162,27 +162,27 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
mSuggestionsStrip.removeAllViews();
|
||||
removeAllViews();
|
||||
addView(mSuggestionsStrip);
|
||||
dismissMoreSuggestions();
|
||||
mMoreSuggestionsView.dismissMoreKeysPanel();
|
||||
}
|
||||
|
||||
private final MoreSuggestionsListener mMoreSuggestionsListener = new MoreSuggestionsListener() {
|
||||
@Override
|
||||
public void onSuggestionSelected(final int index, final SuggestedWordInfo wordInfo) {
|
||||
mListener.pickSuggestionManually(index, wordInfo);
|
||||
dismissMoreSuggestions();
|
||||
mMoreSuggestionsView.dismissMoreKeysPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelInput() {
|
||||
dismissMoreSuggestions();
|
||||
mMoreSuggestionsView.dismissMoreKeysPanel();
|
||||
}
|
||||
};
|
||||
|
||||
private final MoreKeysPanel.Controller mMoreSuggestionsController =
|
||||
new MoreKeysPanel.Controller() {
|
||||
@Override
|
||||
public boolean onDismissMoreKeysPanel() {
|
||||
return mMainKeyboardView.onDismissMoreKeysPanel();
|
||||
public void onDismissMoreKeysPanel() {
|
||||
mMainKeyboardView.onDismissMoreKeysPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -192,14 +192,10 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
|
||||
@Override
|
||||
public void onCancelMoreKeysPanel() {
|
||||
dismissMoreSuggestions();
|
||||
mMoreSuggestionsView.dismissMoreKeysPanel();
|
||||
}
|
||||
};
|
||||
|
||||
boolean dismissMoreSuggestions() {
|
||||
return mMoreSuggestionsView.dismissMoreKeysPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(final View view) {
|
||||
AudioAndHapticFeedbackManager.getInstance().hapticAndAudioFeedback(
|
||||
|
@ -330,6 +326,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
|
|||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
dismissMoreSuggestions();
|
||||
mMoreSuggestionsView.dismissMoreKeysPanel();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue