Merge "Remove unnecessary reference to LatinIME"

main
Tadashi G. Takaoka 2014-04-25 22:20:58 +00:00 committed by Android (Google) Code Review
commit 2cc7c3321d
4 changed files with 11 additions and 19 deletions

View File

@ -17,7 +17,6 @@
package com.android.inputmethod.accessibility; package com.android.inputmethod.accessibility;
import android.graphics.Rect; import android.graphics.Rect;
import android.inputmethodservice.InputMethodService;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewCompat;
import android.support.v4.view.accessibility.AccessibilityEventCompat; import android.support.v4.view.accessibility.AccessibilityEventCompat;
@ -52,7 +51,6 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
private static final String TAG = AccessibilityEntityProvider.class.getSimpleName(); private static final String TAG = AccessibilityEntityProvider.class.getSimpleName();
private static final int UNDEFINED = Integer.MIN_VALUE; private static final int UNDEFINED = Integer.MIN_VALUE;
private final InputMethodService mInputMethodService;
private final KeyCodeDescriptionMapper mKeyCodeDescriptionMapper; private final KeyCodeDescriptionMapper mKeyCodeDescriptionMapper;
private final AccessibilityUtils mAccessibilityUtils; private final AccessibilityUtils mAccessibilityUtils;
@ -71,9 +69,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
/** The current keyboard. */ /** The current keyboard. */
private Keyboard mKeyboard; private Keyboard mKeyboard;
public AccessibilityEntityProvider(final KeyboardView keyboardView, public AccessibilityEntityProvider(final KeyboardView keyboardView) {
final InputMethodService inputMethod) {
mInputMethodService = inputMethod;
mKeyCodeDescriptionMapper = KeyCodeDescriptionMapper.getInstance(); mKeyCodeDescriptionMapper = KeyCodeDescriptionMapper.getInstance();
mAccessibilityUtils = AccessibilityUtils.getInstance(); mAccessibilityUtils = AccessibilityUtils.getInstance();
setView(keyboardView); setView(keyboardView);
@ -295,7 +291,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
* @return The context-specific description of the key. * @return The context-specific description of the key.
*/ */
private String getKeyDescription(final Key key) { private String getKeyDescription(final Key key) {
final EditorInfo editorInfo = mInputMethodService.getCurrentInputEditorInfo(); final EditorInfo editorInfo = mKeyboard.mId.mEditorInfo;
final boolean shouldObscure = mAccessibilityUtils.shouldObscureInput(editorInfo); final boolean shouldObscure = mAccessibilityUtils.shouldObscureInput(editorInfo);
final SettingsValues currentSettings = Settings.getInstance().getCurrent(); final SettingsValues currentSettings = Settings.getInstance().getCurrent();
final String keyCodeDescription = mKeyCodeDescriptionMapper.getDescriptionForKey( final String keyCodeDescription = mKeyCodeDescriptionMapper.getDescriptionForKey(

View File

@ -17,7 +17,6 @@
package com.android.inputmethod.accessibility; package com.android.inputmethod.accessibility;
import android.content.Context; import android.content.Context;
import android.inputmethodservice.InputMethodService;
import android.media.AudioManager; import android.media.AudioManager;
import android.os.Build; import android.os.Build;
import android.os.SystemClock; import android.os.SystemClock;
@ -63,13 +62,13 @@ public final class AccessibilityUtils {
*/ */
private static final boolean ENABLE_ACCESSIBILITY = true; private static final boolean ENABLE_ACCESSIBILITY = true;
public static void init(final InputMethodService inputMethod) { public static void init(final Context context) {
if (!ENABLE_ACCESSIBILITY) return; if (!ENABLE_ACCESSIBILITY) return;
// These only need to be initialized if the kill switch is off. // These only need to be initialized if the kill switch is off.
sInstance.initInternal(inputMethod); sInstance.initInternal(context);
KeyCodeDescriptionMapper.init(); KeyCodeDescriptionMapper.init();
AccessibleKeyboardViewProxy.init(inputMethod); AccessibleKeyboardViewProxy.init(context);
} }
public static AccessibilityUtils getInstance() { public static AccessibilityUtils getInstance() {

View File

@ -17,7 +17,6 @@
package com.android.inputmethod.accessibility; package com.android.inputmethod.accessibility;
import android.content.Context; import android.content.Context;
import android.inputmethodservice.InputMethodService;
import android.os.SystemClock; import android.os.SystemClock;
import android.support.v4.view.AccessibilityDelegateCompat; import android.support.v4.view.AccessibilityDelegateCompat;
import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewCompat;
@ -55,7 +54,6 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
KEYBOARD_MODE_RES_IDS.put(KeyboardId.MODE_URL, R.string.keyboard_mode_url); KEYBOARD_MODE_RES_IDS.put(KeyboardId.MODE_URL, R.string.keyboard_mode_url);
} }
private InputMethodService mInputMethod;
private MainKeyboardView mView; private MainKeyboardView mView;
private Keyboard mKeyboard; private Keyboard mKeyboard;
private AccessibilityEntityProvider mAccessibilityNodeProvider; private AccessibilityEntityProvider mAccessibilityNodeProvider;
@ -71,8 +69,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
private int mLastKeyboardMode = KEYBOARD_IS_HIDDEN; private int mLastKeyboardMode = KEYBOARD_IS_HIDDEN;
private static final int KEYBOARD_IS_HIDDEN = -1; private static final int KEYBOARD_IS_HIDDEN = -1;
public static void init(final InputMethodService inputMethod) { public static void init(final Context context) {
sInstance.initInternal(inputMethod); sInstance.initInternal(context);
} }
public static AccessibleKeyboardViewProxy getInstance() { public static AccessibleKeyboardViewProxy getInstance() {
@ -83,9 +81,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
// Not publicly instantiable. // Not publicly instantiable.
} }
private void initInternal(final InputMethodService inputMethod) { private void initInternal(final Context context) {
mInputMethod = inputMethod; mEdgeSlop = context.getResources().getDimensionPixelSize(
mEdgeSlop = inputMethod.getResources().getDimensionPixelSize(
R.dimen.config_accessibility_edge_slop); R.dimen.config_accessibility_edge_slop);
} }
@ -285,7 +282,7 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
// will call this method multiple times it is a good practice to // will call this method multiple times it is a good practice to
// cache the provider instance. // cache the provider instance.
if (mAccessibilityNodeProvider == null) { if (mAccessibilityNodeProvider == null) {
mAccessibilityNodeProvider = new AccessibilityEntityProvider(mView, mInputMethod); mAccessibilityNodeProvider = new AccessibilityEntityProvider(mView);
} }
return mAccessibilityNodeProvider; return mAccessibilityNodeProvider;
} }

View File

@ -68,7 +68,7 @@ public final class KeyboardId {
public final int mHeight; public final int mHeight;
public final int mMode; public final int mMode;
public final int mElementId; public final int mElementId;
private final EditorInfo mEditorInfo; public final EditorInfo mEditorInfo;
public final boolean mClobberSettingsKey; public final boolean mClobberSettingsKey;
public final boolean mSupportsSwitchingToShortcutIme; public final boolean mSupportsSwitchingToShortcutIme;
public final boolean mLanguageSwitchKeyEnabled; public final boolean mLanguageSwitchKeyEnabled;