am ca6e5dfe: Remove DrawingHandler.Callbacks.dismissAllKeyPreviews()

* commit 'ca6e5dfedbb57f6ec31880f2799b40a6b2adadbc':
  Remove DrawingHandler.Callbacks.dismissAllKeyPreviews()
main
Tadashi G. Takaoka 2014-10-29 11:02:55 +00:00 committed by Android Git Automerger
commit 68fbe04873
4 changed files with 8 additions and 32 deletions

View File

@ -451,13 +451,6 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
windowContentView.addView(mDrawingPreviewPlacerView); windowContentView.addView(mDrawingPreviewPlacerView);
} }
// Implements {@link DrawingHandler.Callbacks} method.
@Override
public void dismissAllKeyPreviews() {
mKeyPreviewChoreographer.dismissAllKeyPreviews();
PointerTracker.setReleasedKeyGraphicsToAllKeys();
}
@Override @Override
public void showKeyPreview(final Key key) { public void showKeyPreview(final Key key) {
// If the key is invalid or has no key preview, we must not show key preview. // If the key is invalid or has no key preview, we must not show key preview.
@ -673,6 +666,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
@Override @Override
public void onShowMoreKeysPanel(final MoreKeysPanel panel) { public void onShowMoreKeysPanel(final MoreKeysPanel panel) {
locatePreviewPlacerView(); locatePreviewPlacerView();
// Dismiss another {@link MoreKeysPanel} that may be being showed.
onDismissMoreKeysPanel();
// Dismiss all key previews that may be being showed.
PointerTracker.setReleasedKeyGraphicsToAllKeys();
// Dismiss sliding key input preview that may be being showed.
dismissSlidingKeyInputPreview();
panel.showInParent(mDrawingPreviewPlacerView); panel.showInParent(mDrawingPreviewPlacerView);
mMoreKeysPanel = panel; mMoreKeysPanel = panel;
} }
@ -740,7 +739,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
public void cancelAllOngoingEvents() { public void cancelAllOngoingEvents() {
mKeyTimerHandler.cancelAllMessages(); mKeyTimerHandler.cancelAllMessages();
mDrawingHandler.cancelAllMessages(); mDrawingHandler.cancelAllMessages();
dismissAllKeyPreviews(); PointerTracker.setReleasedKeyGraphicsToAllKeys();
dismissGestureFloatingPreviewText(); dismissGestureFloatingPreviewText();
dismissSlidingKeyInputPreview(); dismissSlidingKeyInputPreview();
PointerTracker.dismissAllMoreKeysPanels(); PointerTracker.dismissAllMoreKeysPanels();

View File

@ -29,7 +29,6 @@ import javax.annotation.Nonnull;
public class DrawingHandler extends LeakGuardHandlerWrapper<Callbacks> { public class DrawingHandler extends LeakGuardHandlerWrapper<Callbacks> {
public interface Callbacks { public interface Callbacks {
public void dismissKeyPreviewWithoutDelay(Key key); public void dismissKeyPreviewWithoutDelay(Key key);
public void dismissAllKeyPreviews();
public void showGestureFloatingPreviewText(SuggestedWords suggestedWords); public void showGestureFloatingPreviewText(SuggestedWords suggestedWords);
} }
@ -60,20 +59,11 @@ public class DrawingHandler extends LeakGuardHandlerWrapper<Callbacks> {
sendMessageDelayed(obtainMessage(MSG_DISMISS_KEY_PREVIEW, key), delay); sendMessageDelayed(obtainMessage(MSG_DISMISS_KEY_PREVIEW, key), delay);
} }
private void cancelAllDismissKeyPreviews() {
removeMessages(MSG_DISMISS_KEY_PREVIEW);
final Callbacks callbacks = getOwnerInstance();
if (callbacks == null) {
return;
}
callbacks.dismissAllKeyPreviews();
}
public void dismissGestureFloatingPreviewText(final long delay) { public void dismissGestureFloatingPreviewText(final long delay) {
sendMessageDelayed(obtainMessage(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT), delay); sendMessageDelayed(obtainMessage(MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT), delay);
} }
public void cancelAllMessages() { public void cancelAllMessages() {
cancelAllDismissKeyPreviews(); removeMessages(MSG_DISMISS_KEY_PREVIEW);
} }
} }

View File

@ -28,7 +28,6 @@ import com.android.inputmethod.latin.utils.ViewLayoutUtils;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
/** /**
* This class controls pop up key previews. This class decides: * This class controls pop up key previews. This class decides:
@ -69,12 +68,6 @@ public final class KeyPreviewChoreographer {
return mShowingKeyPreviewViews.containsKey(key); return mShowingKeyPreviewViews.containsKey(key);
} }
public void dismissAllKeyPreviews() {
for (final Key key : new HashSet<>(mShowingKeyPreviewViews.keySet())) {
dismissKeyPreview(key, false /* withAnimation */);
}
}
public void dismissKeyPreview(final Key key, final boolean withAnimation) { public void dismissKeyPreview(final Key key, final boolean withAnimation) {
if (key == null) { if (key == null) {
return; return;

View File

@ -344,12 +344,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
if (mSuggestedWords.size() <= mStartIndexOfMoreSuggestions) { if (mSuggestedWords.size() <= mStartIndexOfMoreSuggestions) {
return false; return false;
} }
// Dismiss another {@link MoreKeysPanel} that may be being showed, for example
// {@link MoreKeysKeyboardView}.
mMainKeyboardView.onDismissMoreKeysPanel();
// Dismiss all key previews and sliding key input preview that may be being showed.
mMainKeyboardView.dismissAllKeyPreviews();
mMainKeyboardView.dismissSlidingKeyInputPreview();
final int stripWidth = getWidth(); final int stripWidth = getWidth();
final View container = mMoreSuggestionsContainer; final View container = mMoreSuggestionsContainer;
final int maxWidth = stripWidth - container.getPaddingLeft() - container.getPaddingRight(); final int maxWidth = stripWidth - container.getPaddingLeft() - container.getPaddingRight();