Cleanup: Make some classes as final

Change-Id: I6009b3c1950ba32b7f1e205a3db2307fe0cd688e
main
Tadashi G. Takaoka 2012-09-27 18:16:16 +09:00
parent 1775201671
commit a28a05e971
89 changed files with 138 additions and 140 deletions

View File

@ -47,7 +47,7 @@ import com.android.inputmethod.latin.CollectionUtils;
* virtual views, thus conveying their logical structure. * virtual views, thus conveying their logical structure.
* </p> * </p>
*/ */
public class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat { public final class AccessibilityEntityProvider extends AccessibilityNodeProviderCompat {
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;

View File

@ -32,7 +32,7 @@ import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.keyboard.PointerTracker; import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
public class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat { public final class AccessibleKeyboardViewProxy extends AccessibilityDelegateCompat {
private static final AccessibleKeyboardViewProxy sInstance = new AccessibleKeyboardViewProxy(); private static final AccessibleKeyboardViewProxy sInstance = new AccessibleKeyboardViewProxy();
private InputMethodService mInputMethod; private InputMethodService mInputMethod;

View File

@ -30,7 +30,7 @@ import com.android.inputmethod.latin.R;
import java.util.HashMap; import java.util.HashMap;
public class KeyCodeDescriptionMapper { public final class KeyCodeDescriptionMapper {
private static final String TAG = KeyCodeDescriptionMapper.class.getSimpleName(); private static final String TAG = KeyCodeDescriptionMapper.class.getSimpleName();
// The resource ID of the string spoken for obscured keys // The resource ID of the string spoken for obscured keys

View File

@ -20,7 +20,7 @@ import android.media.AudioManager;
import java.lang.reflect.Method; import java.lang.reflect.Method;
public class AudioManagerCompatWrapper { public final class AudioManagerCompatWrapper {
private static final Method METHOD_isWiredHeadsetOn = CompatUtils.getMethod( private static final Method METHOD_isWiredHeadsetOn = CompatUtils.getMethod(
AudioManager.class, "isWiredHeadsetOn"); AudioManager.class, "isWiredHeadsetOn");
private static final Method METHOD_isBluetoothA2dpOn = CompatUtils.getMethod( private static final Method METHOD_isBluetoothA2dpOn = CompatUtils.getMethod(

View File

@ -27,7 +27,7 @@ import java.lang.reflect.Method;
// TODO: Override this class with the concrete implementation if we need to take care of the // TODO: Override this class with the concrete implementation if we need to take care of the
// performance. // performance.
public class InputMethodManagerCompatWrapper { public final class InputMethodManagerCompatWrapper {
private static final String TAG = InputMethodManagerCompatWrapper.class.getSimpleName(); private static final String TAG = InputMethodManagerCompatWrapper.class.getSimpleName();
private static final Method METHOD_switchToNextInputMethod = CompatUtils.getMethod( private static final Method METHOD_switchToNextInputMethod = CompatUtils.getMethod(
InputMethodManager.class, "switchToNextInputMethod", IBinder.class, Boolean.TYPE); InputMethodManager.class, "switchToNextInputMethod", IBinder.class, Boolean.TYPE);

View File

@ -138,7 +138,7 @@ public class Key implements Comparable<Key> {
private final OptionalAttributes mOptionalAttributes; private final OptionalAttributes mOptionalAttributes;
private static class OptionalAttributes { private static final class OptionalAttributes {
/** Text to output when pressed. This can be multiple characters, like ".com" */ /** Text to output when pressed. This can be multiple characters, like ".com" */
public final String mOutputText; public final String mOutputText;
public final int mAltCode; public final int mAltCode;

View File

@ -33,7 +33,7 @@ import java.util.Locale;
/** /**
* Unique identifier for each keyboard type. * Unique identifier for each keyboard type.
*/ */
public class KeyboardId { public final class KeyboardId {
public static final int MODE_TEXT = 0; public static final int MODE_TEXT = 0;
public static final int MODE_URL = 1; public static final int MODE_URL = 1;
public static final int MODE_EMAIL = 2; public static final int MODE_EMAIL = 2;

View File

@ -61,7 +61,7 @@ import java.util.HashMap;
* A {@link KeyboardLayoutSet} needs to be created for each * A {@link KeyboardLayoutSet} needs to be created for each
* {@link android.view.inputmethod.EditorInfo}. * {@link android.view.inputmethod.EditorInfo}.
*/ */
public class KeyboardLayoutSet { public final class KeyboardLayoutSet {
private static final String TAG = KeyboardLayoutSet.class.getSimpleName(); private static final String TAG = KeyboardLayoutSet.class.getSimpleName();
private static final boolean DEBUG_CACHE = LatinImeLogger.sDBG; private static final boolean DEBUG_CACHE = LatinImeLogger.sDBG;
@ -77,7 +77,7 @@ public class KeyboardLayoutSet {
CollectionUtils.newHashMap(); CollectionUtils.newHashMap();
private static final KeysCache sKeysCache = new KeysCache(); private static final KeysCache sKeysCache = new KeysCache();
public static class KeyboardLayoutSetException extends RuntimeException { public static final class KeyboardLayoutSetException extends RuntimeException {
public final KeyboardId mKeyboardId; public final KeyboardId mKeyboardId;
public KeyboardLayoutSetException(final Throwable cause, final KeyboardId keyboardId) { public KeyboardLayoutSetException(final Throwable cause, final KeyboardId keyboardId) {
@ -86,13 +86,13 @@ public class KeyboardLayoutSet {
} }
} }
private static class ElementParams { private static final class ElementParams {
int mKeyboardXmlId; int mKeyboardXmlId;
boolean mProximityCharsCorrectionEnabled; boolean mProximityCharsCorrectionEnabled;
public ElementParams() {} public ElementParams() {}
} }
private static class Params { private static final class Params {
String mKeyboardLayoutSetName; String mKeyboardLayoutSetName;
int mMode; int mMode;
EditorInfo mEditorInfo; EditorInfo mEditorInfo;
@ -203,7 +203,7 @@ public class KeyboardLayoutSet {
params.mLanguageSwitchKeyEnabled); params.mLanguageSwitchKeyEnabled);
} }
public static class Builder { public static final class Builder {
private final Context mContext; private final Context mContext;
private final String mPackageName; private final String mPackageName;
private final Resources mResources; private final Resources mResources;

View File

@ -39,12 +39,12 @@ import com.android.inputmethod.latin.SettingsValues;
import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.WordComposer;
public class KeyboardSwitcher implements KeyboardState.SwitchActions { public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private static final String TAG = KeyboardSwitcher.class.getSimpleName(); private static final String TAG = KeyboardSwitcher.class.getSimpleName();
public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20110916"; public static final String PREF_KEYBOARD_LAYOUT = "pref_keyboard_layout_20110916";
static class KeyboardTheme { static final class KeyboardTheme {
public final int mThemeId; public final int mThemeId;
public final int mStyleId; public final int mStyleId;

View File

@ -83,7 +83,7 @@ import java.util.WeakHashMap;
* @attr ref R.styleable#MainKeyboardView_ignoreAltCodeKeyTimeout * @attr ref R.styleable#MainKeyboardView_ignoreAltCodeKeyTimeout
* @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint * @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
*/ */
public class MainKeyboardView extends KeyboardView implements PointerTracker.KeyEventHandler, public final class MainKeyboardView extends KeyboardView implements PointerTracker.KeyEventHandler,
SuddenJumpingTouchEventHandler.ProcessMotionEvent { SuddenJumpingTouchEventHandler.ProcessMotionEvent {
private static final String TAG = MainKeyboardView.class.getSimpleName(); private static final String TAG = MainKeyboardView.class.getSimpleName();
@ -136,7 +136,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
private final KeyTimerHandler mKeyTimerHandler; private final KeyTimerHandler mKeyTimerHandler;
private static class KeyTimerHandler extends StaticInnerHandlerWrapper<MainKeyboardView> private static final class KeyTimerHandler extends StaticInnerHandlerWrapper<MainKeyboardView>
implements TimerProxy { implements TimerProxy {
private static final int MSG_TYPING_STATE_EXPIRED = 0; private static final int MSG_TYPING_STATE_EXPIRED = 0;
private static final int MSG_REPEAT_KEY = 1; private static final int MSG_REPEAT_KEY = 1;

View File

@ -16,7 +16,7 @@
package com.android.inputmethod.keyboard; package com.android.inputmethod.keyboard;
public class MoreKeysDetector extends KeyDetector { public final class MoreKeysDetector extends KeyDetector {
private final int mSlideAllowanceSquare; private final int mSlideAllowanceSquare;
private final int mSlideAllowanceSquareTop; private final int mSlideAllowanceSquareTop;

View File

@ -27,7 +27,7 @@ import com.android.inputmethod.keyboard.internal.MoreKeySpec;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.StringUtils;
public class MoreKeysKeyboard extends Keyboard { public final class MoreKeysKeyboard extends Keyboard {
private final int mDefaultKeyCoordX; private final int mDefaultKeyCoordX;
MoreKeysKeyboard(final MoreKeysKeyboardParams params) { MoreKeysKeyboard(final MoreKeysKeyboardParams params) {

View File

@ -33,7 +33,7 @@ import com.android.inputmethod.latin.R;
* A view that renders a virtual {@link MoreKeysKeyboard}. It handles rendering of keys and * A view that renders a virtual {@link MoreKeysKeyboard}. It handles rendering of keys and
* detecting key presses and touch movements. * detecting key presses and touch movements.
*/ */
public class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel { public final class MoreKeysKeyboardView extends KeyboardView implements MoreKeysPanel {
private final int[] mCoordinates = new int[2]; private final int[] mCoordinates = new int[2];
private final KeyDetector mKeyDetector; private final KeyDetector mKeyDetector;

View File

@ -34,7 +34,7 @@ import com.android.inputmethod.research.ResearchLogger;
import java.util.ArrayList; import java.util.ArrayList;
public class PointerTracker implements PointerTrackerQueue.Element { public final class PointerTracker implements PointerTrackerQueue.Element {
private static final String TAG = PointerTracker.class.getSimpleName(); private static final String TAG = PointerTracker.class.getSimpleName();
private static final boolean DEBUG_EVENT = false; private static final boolean DEBUG_EVENT = false;
private static final boolean DEBUG_MOVE_EVENT = false; private static final boolean DEBUG_MOVE_EVENT = false;
@ -121,7 +121,7 @@ public class PointerTracker implements PointerTrackerQueue.Element {
} }
} }
static class PointerTrackerParams { static final class PointerTrackerParams {
public final boolean mSlidingKeyInputEnabled; public final boolean mSlidingKeyInputEnabled;
public final int mTouchNoiseThresholdTime; public final int mTouchNoiseThresholdTime;
public final float mTouchNoiseThresholdDistance; public final float mTouchNoiseThresholdDistance;

View File

@ -18,7 +18,7 @@ package com.android.inputmethod.keyboard.internal;
import android.util.Log; import android.util.Log;
public class AlphabetShiftState { public final class AlphabetShiftState {
private static final String TAG = AlphabetShiftState.class.getSimpleName(); private static final String TAG = AlphabetShiftState.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false;

View File

@ -16,7 +16,7 @@ package com.android.inputmethod.keyboard.internal;
import com.android.inputmethod.latin.ResizableIntArray; import com.android.inputmethod.latin.ResizableIntArray;
public class GestureStrokeWithPreviewPoints extends GestureStroke { public final class GestureStrokeWithPreviewPoints extends GestureStroke {
public static final int PREVIEW_CAPACITY = 256; public static final int PREVIEW_CAPACITY = 256;
private final ResizableIntArray mPreviewEventTimes = new ResizableIntArray(PREVIEW_CAPACITY); private final ResizableIntArray mPreviewEventTimes = new ResizableIntArray(PREVIEW_CAPACITY);

View File

@ -46,7 +46,7 @@ import java.util.Locale;
* Note that the '\' is also parsed by XML parser and CSV parser as well. * Note that the '\' is also parsed by XML parser and CSV parser as well.
* See {@link KeyboardIconsSet} about icon_name. * See {@link KeyboardIconsSet} about icon_name.
*/ */
public class KeySpecParser { public final class KeySpecParser {
private static final boolean DEBUG = LatinImeLogger.sDBG; private static final boolean DEBUG = LatinImeLogger.sDBG;
private static final int MAX_STRING_REFERENCE_INDIRECTION = 10; private static final int MAX_STRING_REFERENCE_INDIRECTION = 10;
@ -318,7 +318,7 @@ public class KeySpecParser {
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class KeySpecParserError extends RuntimeException { public static final class KeySpecParserError extends RuntimeException {
public KeySpecParserError(final String message) { public KeySpecParserError(final String message) {
super(message); super(message);
} }

View File

@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParserException;
import java.util.HashMap; import java.util.HashMap;
public class KeyStylesSet { public final class KeyStylesSet {
private static final String TAG = KeyStylesSet.class.getSimpleName(); private static final String TAG = KeyStylesSet.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
@ -45,7 +45,7 @@ public class KeyStylesSet {
mStyles.put(EMPTY_STYLE_NAME, mEmptyKeyStyle); mStyles.put(EMPTY_STYLE_NAME, mEmptyKeyStyle);
} }
private static class EmptyKeyStyle extends KeyStyle { private static final class EmptyKeyStyle extends KeyStyle {
EmptyKeyStyle(final KeyboardTextsSet textsSet) { EmptyKeyStyle(final KeyboardTextsSet textsSet) {
super(textsSet); super(textsSet);
} }
@ -71,7 +71,7 @@ public class KeyStylesSet {
} }
} }
private static class DeclaredKeyStyle extends KeyStyle { private static final class DeclaredKeyStyle extends KeyStyle {
private final HashMap<String, KeyStyle> mStyles; private final HashMap<String, KeyStyle> mStyles;
private final String mParentStyleName; private final String mParentStyleName;
private final SparseArray<Object> mStyleAttributes = CollectionUtils.newSparseArray(); private final SparseArray<Object> mStyleAttributes = CollectionUtils.newSparseArray();

View File

@ -23,7 +23,7 @@ import android.util.SparseIntArray;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils; import com.android.inputmethod.latin.ResourceUtils;
public class KeyVisualAttributes { public final class KeyVisualAttributes {
public final Typeface mTypeface; public final Typeface mTypeface;
public final float mLetterRatio; public final float mLetterRatio;

View File

@ -21,7 +21,7 @@ import com.android.inputmethod.latin.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
public class KeyboardCodesSet { public final class KeyboardCodesSet {
private static final HashMap<String, int[]> sLanguageToCodesMap = CollectionUtils.newHashMap(); private static final HashMap<String, int[]> sLanguageToCodesMap = CollectionUtils.newHashMap();
private static final HashMap<String, Integer> sNameToIdMap = CollectionUtils.newHashMap(); private static final HashMap<String, Integer> sNameToIdMap = CollectionUtils.newHashMap();

View File

@ -27,7 +27,7 @@ import com.android.inputmethod.latin.R;
import java.util.HashMap; import java.util.HashMap;
public class KeyboardIconsSet { public final class KeyboardIconsSet {
private static final String TAG = KeyboardIconsSet.class.getSimpleName(); private static final String TAG = KeyboardIconsSet.class.getSimpleName();
public static final int ICON_UNDEFINED = 0; public static final int ICON_UNDEFINED = 0;

View File

@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParser;
* Some of the key size defaults can be overridden per row from what the {@link Keyboard} * Some of the key size defaults can be overridden per row from what the {@link Keyboard}
* defines. * defines.
*/ */
public class KeyboardRow { public final class KeyboardRow {
// keyWidth enum constants // keyWidth enum constants
private static final int KEYWIDTH_NOT_ENUM = 0; private static final int KEYWIDTH_NOT_ENUM = 0;
private static final int KEYWIDTH_FILL_RIGHT = -1; private static final int KEYWIDTH_FILL_RIGHT = -1;

View File

@ -34,7 +34,7 @@ import com.android.inputmethod.latin.Constants;
* *
* The actions are {@link SwitchActions}'s methods. * The actions are {@link SwitchActions}'s methods.
*/ */
public class KeyboardState { public final class KeyboardState {
private static final String TAG = KeyboardState.class.getSimpleName(); private static final String TAG = KeyboardState.class.getSimpleName();
private static final boolean DEBUG_EVENT = false; private static final boolean DEBUG_EVENT = false;
private static final boolean DEBUG_ACTION = false; private static final boolean DEBUG_ACTION = false;
@ -92,7 +92,7 @@ public class KeyboardState {
private final SavedKeyboardState mSavedKeyboardState = new SavedKeyboardState(); private final SavedKeyboardState mSavedKeyboardState = new SavedKeyboardState();
static class SavedKeyboardState { static final class SavedKeyboardState {
public boolean mIsValid; public boolean mIsValid;
public boolean mIsAlphabetMode; public boolean mIsAlphabetMode;
public boolean mIsAlphabetShiftLocked; public boolean mIsAlphabetShiftLocked;

View File

@ -21,7 +21,7 @@ import com.android.inputmethod.latin.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
public class KeysCache { public final class KeysCache {
private final HashMap<Key, Key> mMap = CollectionUtils.newHashMap(); private final HashMap<Key, Key> mMap = CollectionUtils.newHashMap();
public void clear() { public void clear() {

View File

@ -22,7 +22,7 @@ import com.android.inputmethod.latin.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
public class PointerTrackerQueue { public final class PointerTrackerQueue {
private static final String TAG = PointerTrackerQueue.class.getSimpleName(); private static final String TAG = PointerTrackerQueue.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false;

View File

@ -39,7 +39,7 @@ import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper; import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
public class PreviewPlacerView extends RelativeLayout { public final class PreviewPlacerView extends RelativeLayout {
// The height of extra area above the keyboard to draw gesture trails. // The height of extra area above the keyboard to draw gesture trails.
// Proportional to the keyboard height. // Proportional to the keyboard height.
private static final float EXTRA_GESTURE_TRAIL_AREA_ABOVE_KEYBOARD_RATIO = 0.25f; private static final float EXTRA_GESTURE_TRAIL_AREA_ABOVE_KEYBOARD_RATIO = 0.25f;
@ -79,7 +79,7 @@ public class PreviewPlacerView extends RelativeLayout {
private final DrawingHandler mDrawingHandler; private final DrawingHandler mDrawingHandler;
private static class DrawingHandler extends StaticInnerHandlerWrapper<PreviewPlacerView> { private static final class DrawingHandler extends StaticInnerHandlerWrapper<PreviewPlacerView> {
private static final int MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 0; private static final int MSG_DISMISS_GESTURE_FLOATING_PREVIEW_TEXT = 0;
private static final int MSG_UPDATE_GESTURE_PREVIEW_TRAIL = 1; private static final int MSG_UPDATE_GESTURE_PREVIEW_TRAIL = 1;

View File

@ -18,7 +18,7 @@ package com.android.inputmethod.keyboard.internal;
import android.util.Log; import android.util.Log;
/* package */ class ShiftKeyState extends ModifierKeyState { /* package */ final class ShiftKeyState extends ModifierKeyState {
private static final int PRESSING_ON_SHIFTED = 3; // both temporary shifted & shift locked private static final int PRESSING_ON_SHIFTED = 3; // both temporary shifted & shift locked
private static final int IGNORING = 4; private static final int IGNORING = 4;

View File

@ -28,7 +28,7 @@ import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
public class SuddenJumpingTouchEventHandler { public final class SuddenJumpingTouchEventHandler {
private static final String TAG = SuddenJumpingTouchEventHandler.class.getSimpleName(); private static final String TAG = SuddenJumpingTouchEventHandler.class.getSimpleName();
private static boolean DEBUG_MODE = LatinImeLogger.sDBG; private static boolean DEBUG_MODE = LatinImeLogger.sDBG;

View File

@ -49,7 +49,7 @@ import com.android.inputmethod.compat.CompatUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TreeSet; import java.util.TreeSet;
public class AdditionalSubtypeSettings extends PreferenceFragment { public final class AdditionalSubtypeSettings extends PreferenceFragment {
private SharedPreferences mPrefs; private SharedPreferences mPrefs;
private SubtypeLocaleAdapter mSubtypeLocaleAdapter; private SubtypeLocaleAdapter mSubtypeLocaleAdapter;
private KeyboardLayoutSetAdapter mKeyboardLayoutSetAdapter; private KeyboardLayoutSetAdapter mKeyboardLayoutSetAdapter;

View File

@ -24,7 +24,7 @@ import java.io.File;
* the package file. Open it correctly thus requires the name of the package it is in, but * the package file. Open it correctly thus requires the name of the package it is in, but
* also the offset in the file and the length of this data. This class encapsulates these three. * also the offset in the file and the length of this data. This class encapsulates these three.
*/ */
class AssetFileAddress { final class AssetFileAddress {
public final String mFilename; public final String mFilename;
public final long mOffset; public final long mOffset;
public final long mLength; public final long mLength;

View File

@ -30,7 +30,7 @@ import com.android.inputmethod.latin.VibratorUtils;
* It offers a consistent and simple interface that allows LatinIME to forget about the * It offers a consistent and simple interface that allows LatinIME to forget about the
* complexity of settings and the like. * complexity of settings and the like.
*/ */
public class AudioAndHapticFeedbackManager { public final class AudioAndHapticFeedbackManager {
final private SettingsValues mSettingsValues; final private SettingsValues mSettingsValues;
final private AudioManager mAudioManager; final private AudioManager mAudioManager;
final private VibratorUtils mVibratorUtils; final private VibratorUtils mVibratorUtils;

View File

@ -23,7 +23,7 @@ import android.util.Log;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class AutoCorrection { public final class AutoCorrection {
private static final boolean DBG = LatinImeLogger.sDBG; private static final boolean DBG = LatinImeLogger.sDBG;
private static final String TAG = AutoCorrection.class.getSimpleName(); private static final String TAG = AutoCorrection.class.getSimpleName();
private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4; private static final int MINIMUM_SAFETY_NET_CHAR_LENGTH = 4;

View File

@ -22,7 +22,7 @@ import android.app.backup.SharedPreferencesBackupHelper;
/** /**
* Backs up the Latin IME shared preferences. * Backs up the Latin IME shared preferences.
*/ */
public class BackupAgent extends BackupAgentHelper { public final class BackupAgent extends BackupAgentHelper {
@Override @Override
public void onCreate() { public void onCreate() {

View File

@ -30,7 +30,7 @@ import java.util.Locale;
/** /**
* Implements a static, compacted, binary dictionary of standard words. * Implements a static, compacted, binary dictionary of standard words.
*/ */
public class BinaryDictionary extends Dictionary { public final class BinaryDictionary extends Dictionary {
public static final String DICTIONARY_PACK_AUTHORITY = public static final String DICTIONARY_PACK_AUTHORITY =
"com.android.inputmethod.latin.dictionarypack"; "com.android.inputmethod.latin.dictionarypack";

View File

@ -30,7 +30,6 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -40,7 +39,7 @@ import java.util.Locale;
* Group class for static methods to help with creation and getting of the binary dictionary * Group class for static methods to help with creation and getting of the binary dictionary
* file from the dictionary provider * file from the dictionary provider
*/ */
public class BinaryDictionaryFileDumper { public final class BinaryDictionaryFileDumper {
private static final String TAG = BinaryDictionaryFileDumper.class.getSimpleName(); private static final String TAG = BinaryDictionaryFileDumper.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false;

View File

@ -37,7 +37,7 @@ import java.util.Locale;
/** /**
* Helper class to get the address of a mmap'able dictionary file. * Helper class to get the address of a mmap'able dictionary file.
*/ */
class BinaryDictionaryGetter { final class BinaryDictionaryGetter {
/** /**
* Used for Log actions from this class * Used for Log actions from this class
@ -178,7 +178,7 @@ class BinaryDictionaryGetter {
context.getApplicationInfo().sourceDir, afd.getStartOffset(), afd.getLength()); context.getApplicationInfo().sourceDir, afd.getStartOffset(), afd.getLength());
} }
static private class DictPackSettings { private static final class DictPackSettings {
final SharedPreferences mDictPreferences; final SharedPreferences mDictPreferences;
public DictPackSettings(final Context context) { public DictPackSettings(final Context context) {
Context dictPackContext = null; Context dictPackContext = null;
@ -237,7 +237,7 @@ class BinaryDictionaryGetter {
/** /**
* Utility class for the {@link #getCachedWordLists} method * Utility class for the {@link #getCachedWordLists} method
*/ */
private static class FileAndMatchLevel { private static final class FileAndMatchLevel {
final File mFile; final File mFile;
final int mMatchLevel; final int mMatchLevel;
public FileAndMatchLevel(final File file, final int matchLevel) { public FileAndMatchLevel(final File file, final int matchLevel) {

View File

@ -25,7 +25,7 @@ import java.util.TreeSet;
/** /**
* A TreeSet that is bounded in size and throws everything that's smaller than its limit * A TreeSet that is bounded in size and throws everything that's smaller than its limit
*/ */
public class BoundedTreeSet extends TreeSet<SuggestedWordInfo> { public final class BoundedTreeSet extends TreeSet<SuggestedWordInfo> {
private final int mCapacity; private final int mCapacity;
public BoundedTreeSet(final Comparator<SuggestedWordInfo> comparator, final int capacity) { public BoundedTreeSet(final Comparator<SuggestedWordInfo> comparator, final int capacity) {
super(comparator); super(comparator);

View File

@ -30,7 +30,7 @@ import android.util.Log;
import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
public class DebugSettings extends PreferenceFragment public final class DebugSettings extends PreferenceFragment
implements SharedPreferences.OnSharedPreferenceChangeListener { implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = DebugSettings.class.getSimpleName(); private static final String TAG = DebugSettings.class.getSimpleName();

View File

@ -20,7 +20,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
public class DebugSettingsActivity extends PreferenceActivity { public final class DebugSettingsActivity extends PreferenceActivity {
@Override @Override
public Intent getIntent() { public Intent getIntent() {
final Intent modIntent = new Intent(super.getIntent()); final Intent modIntent = new Intent(super.getIntent());

View File

@ -18,7 +18,7 @@ package com.android.inputmethod.latin;
import java.util.Locale; import java.util.Locale;
public class DicTraverseSession { public final class DicTraverseSession {
static { static {
JniUtils.loadNativeLibrary(); JniUtils.loadNativeLibrary();
} }

View File

@ -29,7 +29,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
/** /**
* Class for a collection of dictionaries that behave like one dictionary. * Class for a collection of dictionaries that behave like one dictionary.
*/ */
public class DictionaryCollection extends Dictionary { public final class DictionaryCollection extends Dictionary {
private final String TAG = DictionaryCollection.class.getSimpleName(); private final String TAG = DictionaryCollection.class.getSimpleName();
protected final CopyOnWriteArrayList<Dictionary> mDictionaries; protected final CopyOnWriteArrayList<Dictionary> mDictionaries;

View File

@ -29,7 +29,7 @@ import java.util.Locale;
/** /**
* Factory for dictionary instances. * Factory for dictionary instances.
*/ */
public class DictionaryFactory { public final class DictionaryFactory {
private static final String TAG = DictionaryFactory.class.getSimpleName(); private static final String TAG = DictionaryFactory.class.getSimpleName();
// This class must be located in the same package as LatinIME.java. // This class must be located in the same package as LatinIME.java.
private static final String RESOURCE_PACKAGE_NAME = private static final String RESOURCE_PACKAGE_NAME =

View File

@ -27,7 +27,7 @@ import android.net.Uri;
/** /**
* Takes action to reload the necessary data when a dictionary pack was added/removed. * Takes action to reload the necessary data when a dictionary pack was added/removed.
*/ */
public class DictionaryPackInstallBroadcastReceiver extends BroadcastReceiver { public final class DictionaryPackInstallBroadcastReceiver extends BroadcastReceiver {
final LatinIME mService; final LatinIME mService;
/** /**

View File

@ -48,7 +48,7 @@ public class ExpandableDictionary extends Dictionary {
// Use this lock before touching mUpdatingDictionary & mRequiresDownload // Use this lock before touching mUpdatingDictionary & mRequiresDownload
private Object mUpdatingLock = new Object(); private Object mUpdatingLock = new Object();
private static class Node { private static final class Node {
Node() {} Node() {}
char mCode; char mCode;
int mFrequency; int mFrequency;
@ -60,7 +60,7 @@ public class ExpandableDictionary extends Dictionary {
LinkedList<NextWord> mNGrams; // Supports ngram LinkedList<NextWord> mNGrams; // Supports ngram
} }
private static class NodeArray { private static final class NodeArray {
Node[] mData; Node[] mData;
int mLength = 0; int mLength = 0;
private static final int INCREMENT = 2; private static final int INCREMENT = 2;
@ -88,7 +88,7 @@ public class ExpandableDictionary extends Dictionary {
public int notifyTypedAgainAndGetFrequency(); public int notifyTypedAgainAndGetFrequency();
} }
private static class NextStaticWord implements NextWord { private static final class NextStaticWord implements NextWord {
public final Node mWord; public final Node mWord;
private final int mFrequency; private final int mFrequency;
public NextStaticWord(Node word, int frequency) { public NextStaticWord(Node word, int frequency) {
@ -117,7 +117,7 @@ public class ExpandableDictionary extends Dictionary {
} }
} }
private static class NextHistoryWord implements NextWord { private static final class NextHistoryWord implements NextWord {
public final Node mWord; public final Node mWord;
public final ForgettingCurveParams mFcp; public final ForgettingCurveParams mFcp;
@ -703,7 +703,7 @@ public class ExpandableDictionary extends Dictionary {
mRoots = new NodeArray(); mRoots = new NodeArray();
} }
private class LoadDictionaryTask extends Thread { private final class LoadDictionaryTask extends Thread {
LoadDictionaryTask() {} LoadDictionaryTask() {}
@Override @Override
public void run() { public void run() {

View File

@ -21,7 +21,7 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
public class FileTransforms { public final class FileTransforms {
public static OutputStream getCryptedStream(OutputStream out) { public static OutputStream getCryptedStream(OutputStream out) {
// Crypt the stream. // Crypt the stream.
return out; return out;

View File

@ -23,7 +23,7 @@ import android.view.inputmethod.EditorInfo;
/** /**
* Class to hold attributes of the input field. * Class to hold attributes of the input field.
*/ */
public class InputAttributes { public final class InputAttributes {
private final String TAG = InputAttributes.class.getSimpleName(); private final String TAG = InputAttributes.class.getSimpleName();
final public boolean mInputTypeNoAutoCorrect; final public boolean mInputTypeNoAutoCorrect;

View File

@ -17,7 +17,7 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
// TODO: This class is not thread-safe. // TODO: This class is not thread-safe.
public class InputPointers { public final class InputPointers {
private final int mDefaultCapacity; private final int mDefaultCapacity;
private final ResizableIntArray mXCoordinates; private final ResizableIntArray mXCoordinates;
private final ResizableIntArray mYCoordinates; private final ResizableIntArray mYCoordinates;

View File

@ -23,7 +23,7 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
public class InputView extends LinearLayout { public final class InputView extends LinearLayout {
private View mSuggestionStripContainer; private View mSuggestionStripContainer;
private View mKeyboardView; private View mKeyboardView;
private int mKeyboardTopPadding; private int mKeyboardTopPadding;

View File

@ -22,7 +22,7 @@ import android.text.TextUtils;
* This class encapsulates data about a word previously composed, but that has been * This class encapsulates data about a word previously composed, but that has been
* committed already. This is used for resuming suggestion, and cancel auto-correction. * committed already. This is used for resuming suggestion, and cancel auto-correction.
*/ */
public class LastComposedWord { public final class LastComposedWord {
// COMMIT_TYPE_USER_TYPED_WORD is used when the word committed is the exact typed word, with // COMMIT_TYPE_USER_TYPED_WORD is used when the word committed is the exact typed word, with
// no hinting from the IME. It happens when some external event happens (rotating the device, // no hinting from the IME. It happens when some external event happens (rotating the device,
// for example) or when auto-correction is off by settings or editor attributes. // for example) or when auto-correction is off by settings or editor attributes.

View File

@ -85,7 +85,7 @@ import java.util.Locale;
/** /**
* Input method implementation for Qwerty'ish keyboard. * Input method implementation for Qwerty'ish keyboard.
*/ */
public class LatinIME extends InputMethodService implements KeyboardActionListener, public final class LatinIME extends InputMethodService implements KeyboardActionListener,
SuggestionStripView.Listener, TargetApplicationGetter.OnTargetApplicationKnownListener, SuggestionStripView.Listener, TargetApplicationGetter.OnTargetApplicationKnownListener,
Suggest.SuggestInitializationListener { Suggest.SuggestInitializationListener {
private static final String TAG = LatinIME.class.getSimpleName(); private static final String TAG = LatinIME.class.getSimpleName();
@ -183,7 +183,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public final UIHandler mHandler = new UIHandler(this); public final UIHandler mHandler = new UIHandler(this);
public static class UIHandler extends StaticInnerHandlerWrapper<LatinIME> { public static final class UIHandler extends StaticInnerHandlerWrapper<LatinIME> {
private static final int MSG_UPDATE_SHIFT_STATE = 0; private static final int MSG_UPDATE_SHIFT_STATE = 0;
private static final int MSG_PENDING_IMS_CALLBACK = 1; private static final int MSG_PENDING_IMS_CALLBACK = 1;
private static final int MSG_UPDATE_SUGGESTION_STRIP = 2; private static final int MSG_UPDATE_SUGGESTION_STRIP = 2;

View File

@ -21,7 +21,7 @@ import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChangeListener { public final class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChangeListener {
public static boolean sDBG = false; public static boolean sDBG = false;
public static boolean sVISUALDEBUG = false; public static boolean sVISUALDEBUG = false;

View File

@ -19,7 +19,7 @@ package com.android.inputmethod.latin;
import java.util.Arrays; import java.util.Arrays;
// TODO: This class is not thread-safe. // TODO: This class is not thread-safe.
public class ResizableIntArray { public final class ResizableIntArray {
private int[] mArray; private int[] mArray;
private int mLength; private int mLength;

View File

@ -41,7 +41,7 @@ import java.util.regex.Pattern;
* all the time to find out what text is in the buffer, when we need it to determine caps mode * all the time to find out what text is in the buffer, when we need it to determine caps mode
* for example. * for example.
*/ */
public class RichInputConnection { public final class RichInputConnection {
private static final String TAG = RichInputConnection.class.getSimpleName(); private static final String TAG = RichInputConnection.class.getSimpleName();
private static final boolean DBG = false; private static final boolean DBG = false;
private static final boolean DEBUG_PREVIOUS_TEXT = false; private static final boolean DEBUG_PREVIOUS_TEXT = false;
@ -415,7 +415,7 @@ public class RichInputConnection {
/** /**
* Represents a range of text, relative to the current cursor position. * Represents a range of text, relative to the current cursor position.
*/ */
public static class Range { public static final class Range {
/** Characters before selection start */ /** Characters before selection start */
public final int mCharsBefore; public final int mCharsBefore;

View File

@ -19,7 +19,7 @@ package com.android.inputmethod.latin;
import android.content.Intent; import android.content.Intent;
import android.preference.PreferenceActivity; import android.preference.PreferenceActivity;
public class SettingsActivity extends PreferenceActivity { public final class SettingsActivity extends PreferenceActivity {
private static final String DEFAULT_FRAGMENT = Settings.class.getName(); private static final String DEFAULT_FRAGMENT = Settings.class.getName();
@Override @Override

View File

@ -30,7 +30,7 @@ import com.android.inputmethod.latin.LocaleUtils.RunInLocale;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
public class SubtypeLocale { public final class SubtypeLocale {
static final String TAG = SubtypeLocale.class.getSimpleName(); static final String TAG = SubtypeLocale.class.getSimpleName();
// This class must be located in the same package as LatinIME.java. // This class must be located in the same package as LatinIME.java.
private static final String RESOURCE_PACKAGE_NAME = private static final String RESOURCE_PACKAGE_NAME =

View File

@ -38,7 +38,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
public class SubtypeSwitcher { public final class SubtypeSwitcher {
private static boolean DBG = LatinImeLogger.sDBG; private static boolean DBG = LatinImeLogger.sDBG;
private static final String TAG = SubtypeSwitcher.class.getSimpleName(); private static final String TAG = SubtypeSwitcher.class.getSimpleName();
@ -60,7 +60,7 @@ public class SubtypeSwitcher {
private boolean mIsNetworkConnected; private boolean mIsNetworkConnected;
static class NeedsToDisplayLanguage { static final class NeedsToDisplayLanguage {
private int mEnabledSubtypeCount; private int mEnabledSubtypeCount;
private boolean mIsSystemLanguageSameAsInputLanguage; private boolean mIsSystemLanguageSameAsInputLanguage;

View File

@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentHashMap;
* This class loads a dictionary and provides a list of suggestions for a given sequence of * This class loads a dictionary and provides a list of suggestions for a given sequence of
* characters. This includes corrections and completions. * characters. This includes corrections and completions.
*/ */
public class Suggest { public final class Suggest {
public static final String TAG = Suggest.class.getSimpleName(); public static final String TAG = Suggest.class.getSimpleName();
// Session id for // Session id for
@ -362,7 +362,8 @@ public class Suggest {
return suggestionsList; return suggestionsList;
} }
private static class SuggestedWordInfoComparator implements Comparator<SuggestedWordInfo> { private static final class SuggestedWordInfoComparator
implements Comparator<SuggestedWordInfo> {
// This comparator ranks the word info with the higher frequency first. That's because // This comparator ranks the word info with the higher frequency first. That's because
// that's the order we want our elements in. // that's the order we want our elements in.
@Override @Override

View File

@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
public class SuggestedWords { public final class SuggestedWords {
private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST = private static final ArrayList<SuggestedWordInfo> EMPTY_WORD_INFO_LIST =
CollectionUtils.newArrayList(0); CollectionUtils.newArrayList(0);
public static final SuggestedWords EMPTY = new SuggestedWords( public static final SuggestedWords EMPTY = new SuggestedWords(
@ -117,7 +117,7 @@ public class SuggestedWords {
return suggestionsList; return suggestionsList;
} }
public static class SuggestedWordInfo { public static final class SuggestedWordInfo {
public static final int MAX_SCORE = Integer.MAX_VALUE; public static final int MAX_SCORE = Integer.MAX_VALUE;
public static final int KIND_TYPED = 0; // What user typed public static final int KIND_TYPED = 0; // What user typed
public static final int KIND_CORRECTION = 1; // Simple correction/suggestion public static final int KIND_CORRECTION = 1; // Simple correction/suggestion

View File

@ -23,7 +23,7 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.util.Log; import android.util.Log;
public class SuggestionSpanPickedNotificationReceiver extends BroadcastReceiver { public final class SuggestionSpanPickedNotificationReceiver extends BroadcastReceiver {
private static final boolean DBG = LatinImeLogger.sDBG; private static final boolean DBG = LatinImeLogger.sDBG;
private static final String TAG = private static final String TAG =
SuggestionSpanPickedNotificationReceiver.class.getSimpleName(); SuggestionSpanPickedNotificationReceiver.class.getSimpleName();

View File

@ -24,7 +24,7 @@ import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
public class SynchronouslyLoadedContactsBinaryDictionary extends ContactsBinaryDictionary { public final class SynchronouslyLoadedContactsBinaryDictionary extends ContactsBinaryDictionary {
private boolean mClosed; private boolean mClosed;
public SynchronouslyLoadedContactsBinaryDictionary(final Context context, final Locale locale) { public SynchronouslyLoadedContactsBinaryDictionary(final Context context, final Locale locale) {

View File

@ -23,7 +23,7 @@ import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import java.util.ArrayList; import java.util.ArrayList;
public class SynchronouslyLoadedUserBinaryDictionary extends UserBinaryDictionary { public final class SynchronouslyLoadedUserBinaryDictionary extends UserBinaryDictionary {
public SynchronouslyLoadedUserBinaryDictionary(final Context context, final String locale) { public SynchronouslyLoadedUserBinaryDictionary(final Context context, final String locale) {
this(context, locale, false); this(context, locale, false);

View File

@ -22,8 +22,7 @@ import android.content.pm.PackageManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.LruCache; import android.util.LruCache;
public class TargetApplicationGetter extends AsyncTask<String, Void, ApplicationInfo> { public final class TargetApplicationGetter extends AsyncTask<String, Void, ApplicationInfo> {
private static final int MAX_CACHE_ENTRIES = 64; // arbitrary private static final int MAX_CACHE_ENTRIES = 64; // arbitrary
private static LruCache<String, ApplicationInfo> sCache = private static LruCache<String, ApplicationInfo> sCache =
new LruCache<String, ApplicationInfo>(MAX_CACHE_ENTRIES); new LruCache<String, ApplicationInfo>(MAX_CACHE_ENTRIES);
@ -32,6 +31,7 @@ public class TargetApplicationGetter extends AsyncTask<String, Void, Application
if (null == packageName) return null; if (null == packageName) return null;
return sCache.get(packageName); return sCache.get(packageName);
} }
public static void removeApplicationInfoCache(final String packageName) { public static void removeApplicationInfoCache(final String packageName) {
sCache.remove(packageName); sCache.remove(packageName);
} }

View File

@ -38,7 +38,7 @@ import java.util.Map;
* *
* All the methods in this class are static. * All the methods in this class are static.
*/ */
public class UserHistoryDictIOUtils { public final class UserHistoryDictIOUtils {
private static final String TAG = UserHistoryDictIOUtils.class.getSimpleName(); private static final String TAG = UserHistoryDictIOUtils.class.getSimpleName();
private static final boolean DEBUG = false; private static final boolean DEBUG = false;

View File

@ -42,7 +42,7 @@ import java.util.concurrent.locks.ReentrantLock;
* Locally gathers stats about the words user types and various other signals like auto-correction * Locally gathers stats about the words user types and various other signals like auto-correction
* cancellation or manual picks. This allows the keyboard to adapt to the typist over time. * cancellation or manual picks. This allows the keyboard to adapt to the typist over time.
*/ */
public class UserHistoryDictionary extends ExpandableDictionary { public final class UserHistoryDictionary extends ExpandableDictionary {
private static final String TAG = UserHistoryDictionary.class.getSimpleName(); private static final String TAG = UserHistoryDictionary.class.getSimpleName();
private static final String NAME = UserHistoryDictionary.class.getSimpleName(); private static final String NAME = UserHistoryDictionary.class.getSimpleName();
public static final boolean DBG_SAVE_RESTORE = false; public static final boolean DBG_SAVE_RESTORE = false;
@ -283,7 +283,7 @@ public class UserHistoryDictionary extends ExpandableDictionary {
/** /**
* Async task to write pending words to the binarydicts. * Async task to write pending words to the binarydicts.
*/ */
private static class UpdateBinaryTask extends AsyncTask<Void, Void, Void> private static final class UpdateBinaryTask extends AsyncTask<Void, Void, Void>
implements BigramDictionaryInterface { implements BigramDictionaryInterface {
private final UserHistoryDictionaryBigramList mBigramList; private final UserHistoryDictionaryBigramList mBigramList;
private final boolean mAddLevel0Bigrams; private final boolean mAddLevel0Bigrams;

View File

@ -26,7 +26,7 @@ import java.util.Set;
* All bigrams including stale ones in SQL DB should be stored in this class to avoid adding stale * All bigrams including stale ones in SQL DB should be stored in this class to avoid adding stale
* bigrams when we write to the SQL DB. * bigrams when we write to the SQL DB.
*/ */
public class UserHistoryDictionaryBigramList { public final class UserHistoryDictionaryBigramList {
public static final byte FORGETTING_CURVE_INITIAL_VALUE = 0; public static final byte FORGETTING_CURVE_INITIAL_VALUE = 0;
private static final String TAG = UserHistoryDictionaryBigramList.class.getSimpleName(); private static final String TAG = UserHistoryDictionaryBigramList.class.getSimpleName();
private static final HashMap<String, Byte> EMPTY_BIGRAM_MAP = CollectionUtils.newHashMap(); private static final HashMap<String, Byte> EMPTY_BIGRAM_MAP = CollectionUtils.newHashMap();

View File

@ -36,7 +36,7 @@ public final class UserHistoryForgettingCurveUtils {
// This utility class is not publicly instantiable. // This utility class is not publicly instantiable.
} }
public static class ForgettingCurveParams { public static final class ForgettingCurveParams {
private byte mFc; private byte mFc;
long mLastTouchedTime = 0; long mLastTouchedTime = 0;
private final boolean mIsValid; private final boolean mIsValid;
@ -195,7 +195,7 @@ public final class UserHistoryForgettingCurveUtils {
return (elapsedTime < ELAPSED_TIME_MAX - 1 || level > 0); return (elapsedTime < ELAPSED_TIME_MAX - 1 || level > 0);
} }
private static class MathUtils { private static final class MathUtils {
public static final int[][] SCORE_TABLE = new int[FC_LEVEL_MAX][ELAPSED_TIME_MAX + 1]; public static final int[][] SCORE_TABLE = new int[FC_LEVEL_MAX][ELAPSED_TIME_MAX + 1];
static { static {
for (int i = 0; i < FC_LEVEL_MAX; ++i) { for (int i = 0; i < FC_LEVEL_MAX; ++i) {

View File

@ -24,7 +24,7 @@ import java.util.Arrays;
/** /**
* A place to store the currently composing word with information such as adjacent key codes as well * A place to store the currently composing word with information such as adjacent key codes as well
*/ */
public class WordComposer { public final class WordComposer {
private static final int N = BinaryDictionary.MAX_WORD_LENGTH; private static final int N = BinaryDictionary.MAX_WORD_LENGTH;
public static final int CAPS_MODE_OFF = 0; public static final int CAPS_MODE_OFF = 0;

View File

@ -19,7 +19,7 @@ package com.android.inputmethod.latin;
/** /**
* Information container for a word list. * Information container for a word list.
*/ */
public class WordListInfo { public final class WordListInfo {
public final String mId; public final String mId;
public final String mLocale; public final String mLocale;
public WordListInfo(final String id, final String locale) { public WordListInfo(final String id, final String locale) {

View File

@ -36,28 +36,28 @@ public final class XmlParseUtils {
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class IllegalStartTag extends ParseException { public static final class IllegalStartTag extends ParseException {
public IllegalStartTag(XmlPullParser parser, String parent) { public IllegalStartTag(XmlPullParser parser, String parent) {
super("Illegal start tag " + parser.getName() + " in " + parent, parser); super("Illegal start tag " + parser.getName() + " in " + parent, parser);
} }
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class IllegalEndTag extends ParseException { public static final class IllegalEndTag extends ParseException {
public IllegalEndTag(XmlPullParser parser, String parent) { public IllegalEndTag(XmlPullParser parser, String parent) {
super("Illegal end tag " + parser.getName() + " in " + parent, parser); super("Illegal end tag " + parser.getName() + " in " + parent, parser);
} }
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class IllegalAttribute extends ParseException { public static final class IllegalAttribute extends ParseException {
public IllegalAttribute(XmlPullParser parser, String attribute) { public IllegalAttribute(XmlPullParser parser, String attribute) {
super("Tag " + parser.getName() + " has illegal attribute " + attribute, parser); super("Tag " + parser.getName() + " has illegal attribute " + attribute, parser);
} }
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class NonEmptyTag extends ParseException{ public static final class NonEmptyTag extends ParseException{
public NonEmptyTag(String tag, XmlPullParser parser) { public NonEmptyTag(String tag, XmlPullParser parser) {
super(tag + " must be empty tag", parser); super(tag + " must be empty tag", parser);
} }

View File

@ -27,10 +27,10 @@ import java.util.ArrayList;
import java.util.Map; import java.util.Map;
import java.util.Stack; import java.util.Stack;
public class BinaryDictIOUtils { public final class BinaryDictIOUtils {
private static final boolean DBG = false; private static final boolean DBG = false;
private static class Position { private static final class Position {
public static final int NOT_READ_GROUPCOUNT = -1; public static final int NOT_READ_GROUPCOUNT = -1;
public int mAddress; public int mAddress;

View File

@ -43,7 +43,7 @@ import java.util.TreeMap;
* *
* All the methods in this class are static. * All the methods in this class are static.
*/ */
public class BinaryDictInputOutput { public final class BinaryDictInputOutput {
private static final boolean DBG = MakedictLog.DBG; private static final boolean DBG = MakedictLog.DBG;
@ -124,7 +124,7 @@ public class BinaryDictInputOutput {
/** /**
* A class grouping utility function for our specific character encoding. * A class grouping utility function for our specific character encoding.
*/ */
private static class CharEncoding { private static final class CharEncoding {
private static final int MINIMAL_ONE_BYTE_CHARACTER_VALUE = 0x20; private static final int MINIMAL_ONE_BYTE_CHARACTER_VALUE = 0x20;
private static final int MAXIMAL_ONE_BYTE_CHARACTER_VALUE = 0xFF; private static final int MAXIMAL_ONE_BYTE_CHARACTER_VALUE = 0xFF;

View File

@ -23,7 +23,7 @@ import java.util.ArrayList;
/** /**
* Raw char group info straight out of a file. This will contain numbers for addresses. * Raw char group info straight out of a file. This will contain numbers for addresses.
*/ */
public class CharGroupInfo { public final class CharGroupInfo {
public final int mOriginalAddress; public final int mOriginalAddress;
public final int mEndAddress; public final int mEndAddress;

View File

@ -221,7 +221,7 @@ public final class FormatSpec {
/** /**
* Options about file format. * Options about file format.
*/ */
public static class FormatOptions { public static final class FormatOptions {
public final int mVersion; public final int mVersion;
public final boolean mSupportsDynamicUpdate; public final boolean mSupportsDynamicUpdate;
public FormatOptions(final int version) { public FormatOptions(final int version) {

View File

@ -28,8 +28,7 @@ import java.util.LinkedList;
/** /**
* A dictionary that can fusion heads and tails of words for more compression. * A dictionary that can fusion heads and tails of words for more compression.
*/ */
public class FusionDictionary implements Iterable<Word> { public final class FusionDictionary implements Iterable<Word> {
private static final boolean DBG = MakedictLog.DBG; private static final boolean DBG = MakedictLog.DBG;
/** /**
@ -40,7 +39,7 @@ public class FusionDictionary implements Iterable<Word> {
* This class also contains fields to cache size and address, to help with binary * This class also contains fields to cache size and address, to help with binary
* generation. * generation.
*/ */
public static class Node { public static final class Node {
ArrayList<CharGroup> mData; ArrayList<CharGroup> mData;
// To help with binary generation // To help with binary generation
int mCachedSize = Integer.MIN_VALUE; int mCachedSize = Integer.MIN_VALUE;
@ -60,7 +59,7 @@ public class FusionDictionary implements Iterable<Word> {
* *
* This represents an "attribute", that is either a bigram or a shortcut. * This represents an "attribute", that is either a bigram or a shortcut.
*/ */
public static class WeightedString { public static final class WeightedString {
public final String mWord; public final String mWord;
public int mFrequency; public int mFrequency;
public WeightedString(String word, int frequency) { public WeightedString(String word, int frequency) {
@ -94,7 +93,7 @@ public class FusionDictionary implements Iterable<Word> {
* value is the frequency of this terminal. A terminal may have non-null shortcuts and/or * value is the frequency of this terminal. A terminal may have non-null shortcuts and/or
* bigrams, but a non-terminal may not. Moreover, children, if present, are null. * bigrams, but a non-terminal may not. Moreover, children, if present, are null.
*/ */
public static class CharGroup { public static final class CharGroup {
public static final int NOT_A_TERMINAL = -1; public static final int NOT_A_TERMINAL = -1;
final int mChars[]; final int mChars[];
ArrayList<WeightedString> mShortcutTargets; ArrayList<WeightedString> mShortcutTargets;
@ -253,7 +252,7 @@ public class FusionDictionary implements Iterable<Word> {
* *
* There are no options at the moment, so this class is empty. * There are no options at the moment, so this class is empty.
*/ */
public static class DictionaryOptions { public static final class DictionaryOptions {
public final boolean mGermanUmlautProcessing; public final boolean mGermanUmlautProcessing;
public final boolean mFrenchLigatureProcessing; public final boolean mFrenchLigatureProcessing;
public final HashMap<String, String> mAttributes; public final HashMap<String, String> mAttributes;
@ -511,7 +510,7 @@ public class FusionDictionary implements Iterable<Word> {
* is ignored. * is ignored.
* This comparator imposes orderings that are inconsistent with equals. * This comparator imposes orderings that are inconsistent with equals.
*/ */
static private class CharGroupComparator implements java.util.Comparator<CharGroup> { static private final class CharGroupComparator implements java.util.Comparator<CharGroup> {
@Override @Override
public int compare(CharGroup c1, CharGroup c2) { public int compare(CharGroup c1, CharGroup c2) {
if (c1.mChars[0] == c2.mChars[0]) return 0; if (c1.mChars[0] == c2.mChars[0]) return 0;
@ -746,9 +745,8 @@ public class FusionDictionary implements Iterable<Word> {
* *
* This is purely for convenience. * This is purely for convenience.
*/ */
public static class DictionaryIterator implements Iterator<Word> { public static final class DictionaryIterator implements Iterator<Word> {
private static final class Position {
private static class Position {
public Iterator<CharGroup> pos; public Iterator<CharGroup> pos;
public int length; public int length;
public Position(ArrayList<CharGroup> groups) { public Position(ArrayList<CharGroup> groups) {

View File

@ -21,7 +21,7 @@ import android.util.Log;
/** /**
* Wrapper to redirect log events to the right output medium. * Wrapper to redirect log events to the right output medium.
*/ */
public class MakedictLog { public final class MakedictLog {
public static final boolean DBG = false; public static final boolean DBG = false;
private static final String TAG = MakedictLog.class.getSimpleName(); private static final String TAG = MakedictLog.class.getSimpleName();

View File

@ -22,7 +22,7 @@ package com.android.inputmethod.latin.makedict;
* An attribute is either a bigram or a shortcut. * An attribute is either a bigram or a shortcut.
* All instances of this class are always immutable. * All instances of this class are always immutable.
*/ */
public class PendingAttribute { public final class PendingAttribute {
public final int mFrequency; public final int mFrequency;
public final int mAddress; public final int mAddress;
public PendingAttribute(final int frequency, final int address) { public PendingAttribute(final int frequency, final int address) {

View File

@ -19,7 +19,7 @@ package com.android.inputmethod.latin.makedict;
/** /**
* Simple exception thrown when a file format is not recognized. * Simple exception thrown when a file format is not recognized.
*/ */
public class UnsupportedFormatException extends Exception { public final class UnsupportedFormatException extends Exception {
public UnsupportedFormatException(String description) { public UnsupportedFormatException(String description) {
super(description); super(description);
} }

View File

@ -26,7 +26,7 @@ import java.util.Arrays;
* *
* This is chiefly used to iterate a dictionary. * This is chiefly used to iterate a dictionary.
*/ */
public class Word implements Comparable<Word> { public final class Word implements Comparable<Word> {
public final String mWord; public final String mWord;
public final int mFrequency; public final int mFrequency;
public final ArrayList<WeightedString> mShortcutTargets; public final ArrayList<WeightedString> mShortcutTargets;

View File

@ -50,7 +50,7 @@ import java.util.TreeMap;
/** /**
* Service for spell checking, using LatinIME's dictionaries and mechanisms. * Service for spell checking, using LatinIME's dictionaries and mechanisms.
*/ */
public class AndroidSpellCheckerService extends SpellCheckerService public final class AndroidSpellCheckerService extends SpellCheckerService
implements SharedPreferences.OnSharedPreferenceChangeListener { implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = AndroidSpellCheckerService.class.getSimpleName(); private static final String TAG = AndroidSpellCheckerService.class.getSimpleName();
private static final boolean DBG = false; private static final boolean DBG = false;
@ -201,8 +201,8 @@ public class AndroidSpellCheckerService extends SpellCheckerService
} }
// TODO: remove this class and replace it by storage local to the session. // TODO: remove this class and replace it by storage local to the session.
public static class SuggestionsGatherer { public static final class SuggestionsGatherer {
public static class Result { public static final class Result {
public final String[] mSuggestions; public final String[] mSuggestions;
public final boolean mHasRecommendedSuggestions; public final boolean mHasRecommendedSuggestions;
public Result(final String[] gatheredSuggestions, public Result(final String[] gatheredSuggestions,

View File

@ -26,7 +26,7 @@ import com.android.inputmethod.latin.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
public class AndroidSpellCheckerSession extends AndroidWordLevelSpellCheckerSession { public final class AndroidSpellCheckerSession extends AndroidWordLevelSpellCheckerSession {
private static final String TAG = AndroidSpellCheckerSession.class.getSimpleName(); private static final String TAG = AndroidSpellCheckerSession.class.getSimpleName();
private static final boolean DBG = false; private static final boolean DBG = false;
private final static String[] EMPTY_STRING_ARRAY = new String[0]; private final static String[] EMPTY_STRING_ARRAY = new String[0];

View File

@ -50,7 +50,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
protected final SuggestionsCache mSuggestionsCache = new SuggestionsCache(); protected final SuggestionsCache mSuggestionsCache = new SuggestionsCache();
private final ContentObserver mObserver; private final ContentObserver mObserver;
private static class SuggestionsParams { private static final class SuggestionsParams {
public final String[] mSuggestions; public final String[] mSuggestions;
public final int mFlags; public final int mFlags;
public SuggestionsParams(String[] suggestions, int flags) { public SuggestionsParams(String[] suggestions, int flags) {
@ -59,7 +59,7 @@ public abstract class AndroidWordLevelSpellCheckerSession extends Session {
} }
} }
protected static class SuggestionsCache { protected static final class SuggestionsCache {
private static final char CHAR_DELIMITER = '\uFFFC'; private static final char CHAR_DELIMITER = '\uFFFC';
private static final int MAX_CACHE_SIZE = 50; private static final int MAX_CACHE_SIZE = 50;
private final LruCache<String, SuggestionsParams> mUnigramSuggestionsInfoCache = private final LruCache<String, SuggestionsParams> mUnigramSuggestionsInfoCache =

View File

@ -22,7 +22,7 @@ import com.android.inputmethod.keyboard.ProximityInfo;
/** /**
* A simple container for both a Dictionary and a ProximityInfo. * A simple container for both a Dictionary and a ProximityInfo.
*/ */
public class DictAndProximity { public final class DictAndProximity {
public final Dictionary mDictionary; public final Dictionary mDictionary;
public final ProximityInfo mProximityInfo; public final ProximityInfo mProximityInfo;
public DictAndProximity(final Dictionary dictionary, final ProximityInfo proximityInfo) { public DictAndProximity(final Dictionary dictionary, final ProximityInfo proximityInfo) {

View File

@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
* the client code, but may help with sloppy clients. * the client code, but may help with sloppy clients.
*/ */
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class DictionaryPool extends LinkedBlockingQueue<DictAndProximity> { public final class DictionaryPool extends LinkedBlockingQueue<DictAndProximity> {
private final static String TAG = DictionaryPool.class.getSimpleName(); private final static String TAG = DictionaryPool.class.getSimpleName();
// How many seconds we wait for a dictionary to become available. Past this delay, we give up in // How many seconds we wait for a dictionary to become available. Past this delay, we give up in
// fear some bug caused a deadlock, and reset the whole pool. // fear some bug caused a deadlock, and reset the whole pool.

View File

@ -22,7 +22,7 @@ import com.android.inputmethod.latin.Constants;
import java.util.TreeMap; import java.util.TreeMap;
public class SpellCheckerProximityInfo { public final class SpellCheckerProximityInfo {
/* public for test */ /* public for test */
final public static int NUL = Constants.NOT_A_CODE; final public static int NUL = Constants.NOT_A_CODE;
@ -53,7 +53,7 @@ public class SpellCheckerProximityInfo {
return result; return result;
} }
private static class Latin { private static final class Latin {
// This is a map from the code point to the index in the PROXIMITY array. // This is a map from the code point to the index in the PROXIMITY array.
// At the time the native code to read the binary dictionary needs the proximity info be // At the time the native code to read the binary dictionary needs the proximity info be
// passed as a flat array spaced by MAX_PROXIMITY_CHARS_SIZE columns, one for each input // passed as a flat array spaced by MAX_PROXIMITY_CHARS_SIZE columns, one for each input
@ -122,7 +122,7 @@ public class SpellCheckerProximityInfo {
} }
} }
private static class Cyrillic { private static final class Cyrillic {
final private static TreeMap<Integer, Integer> INDICES = CollectionUtils.newTreeMap(); final private static TreeMap<Integer, Integer> INDICES = CollectionUtils.newTreeMap();
// TODO: The following table is solely based on the keyboard layout. Consult with Russian // TODO: The following table is solely based on the keyboard layout. Consult with Russian
// speakers on commonly misspelled words/letters. // speakers on commonly misspelled words/letters.

View File

@ -23,7 +23,7 @@ import android.preference.PreferenceActivity;
/** /**
* Spell checker preference screen. * Spell checker preference screen.
*/ */
public class SpellCheckerSettingsActivity extends PreferenceActivity { public final class SpellCheckerSettingsActivity extends PreferenceActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View File

@ -24,7 +24,7 @@ import com.android.inputmethod.latin.R;
/** /**
* Preference screen. * Preference screen.
*/ */
public class SpellCheckerSettingsFragment extends PreferenceFragment { public final class SpellCheckerSettingsFragment extends PreferenceFragment {
/** /**
* Empty constructor for fragment generation. * Empty constructor for fragment generation.
*/ */

View File

@ -30,14 +30,14 @@ import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils; import com.android.inputmethod.latin.Utils;
public class MoreSuggestions extends Keyboard { public final class MoreSuggestions extends Keyboard {
public static final int SUGGESTION_CODE_BASE = 1024; public static final int SUGGESTION_CODE_BASE = 1024;
MoreSuggestions(final MoreSuggestionsParam params) { MoreSuggestions(final MoreSuggestionsParam params) {
super(params); super(params);
} }
private static class MoreSuggestionsParam extends KeyboardParams { private static final class MoreSuggestionsParam extends KeyboardParams {
private final int[] mWidths = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mWidths = new int[SuggestionStripView.MAX_SUGGESTIONS];
private final int[] mRowNumbers = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mRowNumbers = new int[SuggestionStripView.MAX_SUGGESTIONS];
private final int[] mColumnOrders = new int[SuggestionStripView.MAX_SUGGESTIONS]; private final int[] mColumnOrders = new int[SuggestionStripView.MAX_SUGGESTIONS];
@ -163,7 +163,7 @@ public class MoreSuggestions extends Keyboard {
} }
} }
public static class Builder extends KeyboardBuilder<MoreSuggestionsParam> { public static final class Builder extends KeyboardBuilder<MoreSuggestionsParam> {
private final MoreSuggestionsView mPaneView; private final MoreSuggestionsView mPaneView;
private SuggestedWords mSuggestions; private SuggestedWords mSuggestions;
private int mFromPos; private int mFromPos;
@ -216,7 +216,7 @@ public class MoreSuggestions extends Keyboard {
} }
} }
private static class Divider extends Key.Spacer { private static final class Divider extends Key.Spacer {
private final Drawable mIcon; private final Drawable mIcon;
public Divider(final KeyboardParams params, final Drawable icon, final int x, public Divider(final KeyboardParams params, final Drawable icon, final int x,

View File

@ -40,7 +40,7 @@ import com.android.inputmethod.latin.R;
* A view that renders a virtual {@link MoreSuggestions}. It handles rendering of keys and detecting * A view that renders a virtual {@link MoreSuggestions}. It handles rendering of keys and detecting
* key presses and touch movements. * key presses and touch movements.
*/ */
public class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel { public final class MoreSuggestionsView extends KeyboardView implements MoreKeysPanel {
private final int[] mCoordinates = new int[2]; private final int[] mCoordinates = new int[2];
final KeyDetector mModalPanelKeyDetector; final KeyDetector mModalPanelKeyDetector;

View File

@ -70,7 +70,7 @@ import com.android.inputmethod.research.ResearchLogger;
import java.util.ArrayList; import java.util.ArrayList;
public class SuggestionStripView extends RelativeLayout implements OnClickListener, public final class SuggestionStripView extends RelativeLayout implements OnClickListener,
OnLongClickListener { OnLongClickListener {
public interface Listener { public interface Listener {
public boolean addWordToUserDictionary(String word); public boolean addWordToUserDictionary(String word);
@ -105,7 +105,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
private final UiHandler mHandler = new UiHandler(this); private final UiHandler mHandler = new UiHandler(this);
private static class UiHandler extends StaticInnerHandlerWrapper<SuggestionStripView> { private static final class UiHandler extends StaticInnerHandlerWrapper<SuggestionStripView> {
private static final int MSG_HIDE_PREVIEW = 0; private static final int MSG_HIDE_PREVIEW = 0;
public UiHandler(SuggestionStripView outerInstance) { public UiHandler(SuggestionStripView outerInstance) {
@ -131,7 +131,7 @@ public class SuggestionStripView extends RelativeLayout implements OnClickListen
} }
} }
private static class SuggestionStripViewParams { private static final class SuggestionStripViewParams {
private static final int DEFAULT_SUGGESTIONS_COUNT_IN_STRIP = 3; private static final int DEFAULT_SUGGESTIONS_COUNT_IN_STRIP = 3;
private static final float DEFAULT_CENTER_SUGGESTION_PERCENTILE = 0.40f; private static final float DEFAULT_CENTER_SUGGESTION_PERCENTILE = 0.40f;
private static final int DEFAULT_MAX_MORE_SUGGESTIONS_ROW = 2; private static final int DEFAULT_MAX_MORE_SUGGESTIONS_ROW = 2;