Merge "Remove unnecessary reference to LatinIME"

This commit is contained in:
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;
import android.graphics.Rect;
import android.inputmethodservice.InputMethodService;
import android.os.Bundle;
import android.support.v4.view.ViewCompat;
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 int UNDEFINED = Integer.MIN_VALUE;
private final InputMethodService mInputMethodService;
private final KeyCodeDescriptionMapper mKeyCodeDescriptionMapper;
private final AccessibilityUtils mAccessibilityUtils;
@ -71,9 +69,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
/** The current keyboard. */
private Keyboard mKeyboard;
public AccessibilityEntityProvider(final KeyboardView keyboardView,
final InputMethodService inputMethod) {
mInputMethodService = inputMethod;
public AccessibilityEntityProvider(final KeyboardView keyboardView) {
mKeyCodeDescriptionMapper = KeyCodeDescriptionMapper.getInstance();
mAccessibilityUtils = AccessibilityUtils.getInstance();
setView(keyboardView);
@ -295,7 +291,7 @@ public final class AccessibilityEntityProvider extends AccessibilityNodeProvider
* @return The context-specific description of the 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 SettingsValues currentSettings = Settings.getInstance().getCurrent();
final String keyCodeDescription = mKeyCodeDescriptionMapper.getDescriptionForKey(

View file

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

View file

@ -17,7 +17,6 @@
package com.android.inputmethod.accessibility;
import android.content.Context;
import android.inputmethodservice.InputMethodService;
import android.os.SystemClock;
import android.support.v4.view.AccessibilityDelegateCompat;
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);
}
private InputMethodService mInputMethod;
private MainKeyboardView mView;
private Keyboard mKeyboard;
private AccessibilityEntityProvider mAccessibilityNodeProvider;
@ -71,8 +69,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
private int mLastKeyboardMode = KEYBOARD_IS_HIDDEN;
private static final int KEYBOARD_IS_HIDDEN = -1;
public static void init(final InputMethodService inputMethod) {
sInstance.initInternal(inputMethod);
public static void init(final Context context) {
sInstance.initInternal(context);
}
public static AccessibleKeyboardViewProxy getInstance() {
@ -83,9 +81,8 @@ public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateComp
// Not publicly instantiable.
}
private void initInternal(final InputMethodService inputMethod) {
mInputMethod = inputMethod;
mEdgeSlop = inputMethod.getResources().getDimensionPixelSize(
private void initInternal(final Context context) {
mEdgeSlop = context.getResources().getDimensionPixelSize(
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
// cache the provider instance.
if (mAccessibilityNodeProvider == null) {
mAccessibilityNodeProvider = new AccessibilityEntityProvider(mView, mInputMethod);
mAccessibilityNodeProvider = new AccessibilityEntityProvider(mView);
}
return mAccessibilityNodeProvider;
}

View file

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