am c9c3ea0b
: Merge "Remove redundant override methods and extended classes"
* commit 'c9c3ea0b68a1bad1febb7532fa941b430a1b941a': Remove redundant override methods and extended classes
This commit is contained in:
commit
c1d0d17891
5 changed files with 11 additions and 76 deletions
|
@ -267,7 +267,7 @@ public class KeyboardAccessibilityDelegate<KV extends KeyboardView>
|
|||
* @param touchAction The action of the synthesizing touch event.
|
||||
* @param hoverEvent The base hover event from that the touch event is synthesized.
|
||||
*/
|
||||
protected void simulateTouchEvent(final int touchAction, final MotionEvent hoverEvent) {
|
||||
private void simulateTouchEvent(final int touchAction, final MotionEvent hoverEvent) {
|
||||
final MotionEvent touchEvent = MotionEvent.obtain(hoverEvent);
|
||||
touchEvent.setAction(touchAction);
|
||||
mKeyboardView.onTouchEvent(touchEvent);
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.inputmethod.accessibility;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.android.inputmethod.keyboard.KeyDetector;
|
||||
import com.android.inputmethod.keyboard.MoreKeysKeyboardView;
|
||||
|
||||
public final class MoreSuggestionsAccessibilityDelegate
|
||||
extends MoreKeysKeyboardAccessibilityDelegate {
|
||||
public MoreSuggestionsAccessibilityDelegate(final MoreKeysKeyboardView moreKeysKeyboardView,
|
||||
final KeyDetector keyDetector) {
|
||||
super(moreKeysKeyboardView, keyDetector);
|
||||
}
|
||||
|
||||
// TODO: Remove redundant override method.
|
||||
@Override
|
||||
protected void simulateTouchEvent(final int touchAction, final MotionEvent hoverEvent) {
|
||||
final MotionEvent touchEvent = MotionEvent.obtain(hoverEvent);
|
||||
touchEvent.setAction(touchAction);
|
||||
mKeyboardView.onTouchEvent(touchEvent);
|
||||
touchEvent.recycle();
|
||||
}
|
||||
}
|
|
@ -126,7 +126,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
|||
@Override
|
||||
public void onDownEvent(final int x, final int y, final int pointerId, final long eventTime) {
|
||||
mActivePointerId = pointerId;
|
||||
mCurrentKey = detectKey(x, y, pointerId);
|
||||
mCurrentKey = detectKey(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
|||
return;
|
||||
}
|
||||
final boolean hasOldKey = (mCurrentKey != null);
|
||||
mCurrentKey = detectKey(x, y, pointerId);
|
||||
mCurrentKey = detectKey(x, y);
|
||||
if (hasOldKey && mCurrentKey == null) {
|
||||
// A more keys keyboard is canceled when detecting no key.
|
||||
mController.onCancelMoreKeysPanel();
|
||||
|
@ -149,7 +149,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
|||
}
|
||||
// Calling {@link #detectKey(int,int,int)} here is harmless because the last move event and
|
||||
// the following up event share the same coordinates.
|
||||
mCurrentKey = detectKey(x, y, pointerId);
|
||||
mCurrentKey = detectKey(x, y);
|
||||
if (mCurrentKey != null) {
|
||||
updateReleaseKeyGraphics(mCurrentKey);
|
||||
onKeyInput(mCurrentKey, x, y);
|
||||
|
@ -174,7 +174,7 @@ public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel
|
|||
}
|
||||
}
|
||||
|
||||
private Key detectKey(int x, int y, int pointerId) {
|
||||
private Key detectKey(int x, int y) {
|
||||
final Key oldKey = mCurrentKey;
|
||||
final Key newKey = mKeyDetector.detectHitKey(x, y);
|
||||
if (newKey == oldKey) {
|
||||
|
|
|
@ -56,24 +56,7 @@ final class EmojiPageKeyboardView extends KeyboardView implements
|
|||
private OnKeyEventListener mListener = EMPTY_LISTENER;
|
||||
private final KeyDetector mKeyDetector = new KeyDetector();
|
||||
private final GestureDetector mGestureDetector;
|
||||
private EmojiPageKeyboardAccessibilityDelegate mAccessibilityDelegate;
|
||||
|
||||
private static final class EmojiPageKeyboardAccessibilityDelegate
|
||||
extends KeyboardAccessibilityDelegate<EmojiPageKeyboardView> {
|
||||
public EmojiPageKeyboardAccessibilityDelegate(final EmojiPageKeyboardView keyboardView,
|
||||
final KeyDetector keyDetector) {
|
||||
super(keyboardView, keyDetector);
|
||||
}
|
||||
|
||||
// TODO: Remove redundant override method.
|
||||
@Override
|
||||
protected void simulateTouchEvent(int touchAction, MotionEvent hoverEvent) {
|
||||
final MotionEvent touchEvent = MotionEvent.obtain(hoverEvent);
|
||||
touchEvent.setAction(touchAction);
|
||||
mKeyboardView.onTouchEvent(touchEvent);
|
||||
touchEvent.recycle();
|
||||
}
|
||||
}
|
||||
private KeyboardAccessibilityDelegate<EmojiPageKeyboardView> mAccessibilityDelegate;
|
||||
|
||||
public EmojiPageKeyboardView(final Context context, final AttributeSet attrs) {
|
||||
this(context, attrs, R.attr.keyboardViewStyle);
|
||||
|
@ -100,8 +83,7 @@ final class EmojiPageKeyboardView extends KeyboardView implements
|
|||
mKeyDetector.setKeyboard(keyboard, 0 /* correctionX */, 0 /* correctionY */);
|
||||
if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
|
||||
if (mAccessibilityDelegate == null) {
|
||||
mAccessibilityDelegate = new EmojiPageKeyboardAccessibilityDelegate(
|
||||
this, mKeyDetector);
|
||||
mAccessibilityDelegate = new KeyboardAccessibilityDelegate<>(this, mKeyDetector);
|
||||
}
|
||||
mAccessibilityDelegate.setKeyboard(keyboard);
|
||||
} else {
|
||||
|
|
|
@ -20,8 +20,6 @@ import android.content.Context;
|
|||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.inputmethod.accessibility.AccessibilityUtils;
|
||||
import com.android.inputmethod.accessibility.MoreSuggestionsAccessibilityDelegate;
|
||||
import com.android.inputmethod.keyboard.Key;
|
||||
import com.android.inputmethod.keyboard.Keyboard;
|
||||
import com.android.inputmethod.keyboard.KeyboardActionListener;
|
||||
|
@ -59,16 +57,10 @@ public final class MoreSuggestionsView extends MoreKeysKeyboardView {
|
|||
// above {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call.
|
||||
// With accessibility mode on, {@link #mAccessibilityDelegate} is set to a
|
||||
// {@link MoreKeysKeyboardAccessibilityDelegate} object at the above
|
||||
// {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call. And the object has to be
|
||||
// overwritten by a {@link MoreSuggestionsAccessibilityDelegate} object here.
|
||||
if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
|
||||
if (!(mAccessibilityDelegate instanceof MoreSuggestionsAccessibilityDelegate)) {
|
||||
mAccessibilityDelegate = new MoreSuggestionsAccessibilityDelegate(
|
||||
this, mKeyDetector);
|
||||
mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_suggestions);
|
||||
mAccessibilityDelegate.setCloseAnnounce(R.string.spoken_close_more_suggestions);
|
||||
}
|
||||
mAccessibilityDelegate.setKeyboard(keyboard);
|
||||
// {@link MoreKeysKeyboardView#setKeyboard(Keyboard)} call.
|
||||
if (mAccessibilityDelegate != null) {
|
||||
mAccessibilityDelegate.setOpenAnnounce(R.string.spoken_open_more_suggestions);
|
||||
mAccessibilityDelegate.setCloseAnnounce(R.string.spoken_close_more_suggestions);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue