am ae0fab95: Load KeyCodeDescriptionMapper class lazily
* commit 'ae0fab9550f1d9159d819dbb0b7cc86c2bf2937c': Load KeyCodeDescriptionMapper class lazilymain
commit
56d3d782ec
|
@ -67,7 +67,6 @@ public final class AccessibilityUtils {
|
|||
|
||||
// These only need to be initialized if the kill switch is off.
|
||||
sInstance.initInternal(context);
|
||||
KeyCodeDescriptionMapper.init();
|
||||
}
|
||||
|
||||
public static AccessibilityUtils getInstance() {
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.android.inputmethod.latin.R;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
public final class KeyCodeDescriptionMapper {
|
||||
final class KeyCodeDescriptionMapper {
|
||||
private static final String TAG = KeyCodeDescriptionMapper.class.getSimpleName();
|
||||
private static final String SPOKEN_LETTER_RESOURCE_NAME_FORMAT = "spoken_accented_letter_%04X";
|
||||
private static final String SPOKEN_SYMBOL_RESOURCE_NAME_FORMAT = "spoken_symbol_%04X";
|
||||
|
@ -40,24 +40,16 @@ public final class KeyCodeDescriptionMapper {
|
|||
// The resource ID of the string spoken for obscured keys
|
||||
private static final int OBSCURED_KEY_RES_ID = R.string.spoken_description_dot;
|
||||
|
||||
private static KeyCodeDescriptionMapper sInstance = new KeyCodeDescriptionMapper();
|
||||
|
||||
// Sparse array of spoken description resource IDs indexed by key codes
|
||||
private final SparseIntArray mKeyCodeMap;
|
||||
|
||||
public static void init() {
|
||||
sInstance.initInternal();
|
||||
}
|
||||
private static final KeyCodeDescriptionMapper sInstance = new KeyCodeDescriptionMapper();
|
||||
|
||||
public static KeyCodeDescriptionMapper getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private KeyCodeDescriptionMapper() {
|
||||
mKeyCodeMap = new SparseIntArray();
|
||||
}
|
||||
// Sparse array of spoken description resource IDs indexed by key codes
|
||||
private final SparseIntArray mKeyCodeMap = new SparseIntArray();
|
||||
|
||||
private void initInternal() {
|
||||
private KeyCodeDescriptionMapper() {
|
||||
// Special non-character codes defined in Keyboard
|
||||
mKeyCodeMap.put(Constants.CODE_SPACE, R.string.spoken_description_space);
|
||||
mKeyCodeMap.put(Constants.CODE_DELETE, R.string.spoken_description_delete);
|
||||
|
|
|
@ -47,7 +47,7 @@ import java.util.List;
|
|||
* virtual views, thus conveying their logical structure.
|
||||
* </p>
|
||||
*/
|
||||
public final class KeyboardAccessibilityNodeProvider extends AccessibilityNodeProviderCompat {
|
||||
final class KeyboardAccessibilityNodeProvider extends AccessibilityNodeProviderCompat {
|
||||
private static final String TAG = KeyboardAccessibilityNodeProvider.class.getSimpleName();
|
||||
private static final int UNDEFINED = Integer.MIN_VALUE;
|
||||
|
||||
|
|
|
@ -381,14 +381,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
|||
final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
|
||||
mLanguageOnSpacebarTextSize = keyHeight * mLanguageOnSpacebarTextRatio;
|
||||
|
||||
final MainKeyboardAccessibilityDelegate accessibilityDelegate;
|
||||
if (AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
|
||||
accessibilityDelegate = new MainKeyboardAccessibilityDelegate(this, mKeyDetector);
|
||||
accessibilityDelegate.setKeyboard(keyboard);
|
||||
mAccessibilityDelegate = new MainKeyboardAccessibilityDelegate(this, mKeyDetector);
|
||||
mAccessibilityDelegate.setKeyboard(keyboard);
|
||||
} else {
|
||||
accessibilityDelegate = null;
|
||||
mAccessibilityDelegate = null;
|
||||
}
|
||||
mAccessibilityDelegate = accessibilityDelegate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue