am 1e11c44d: Make utility classes final
* commit '1e11c44d1b5f9ddf593c5407cb14c458be0056f2': Make utility classes finalmain
commit
090e0972f6
|
@ -37,7 +37,7 @@ import com.android.inputmethod.compat.SettingsSecureCompatUtils;
|
||||||
import com.android.inputmethod.latin.InputTypeUtils;
|
import com.android.inputmethod.latin.InputTypeUtils;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
|
|
||||||
public class AccessibilityUtils {
|
public final class AccessibilityUtils {
|
||||||
private static final String TAG = AccessibilityUtils.class.getSimpleName();
|
private static final String TAG = AccessibilityUtils.class.getSimpleName();
|
||||||
private static final String CLASS = AccessibilityUtils.class.getClass().getName();
|
private static final String CLASS = AccessibilityUtils.class.getClass().getName();
|
||||||
private static final String PACKAGE = AccessibilityUtils.class.getClass().getPackage()
|
private static final String PACKAGE = AccessibilityUtils.class.getClass().getPackage()
|
||||||
|
|
|
@ -24,7 +24,7 @@ import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class CompatUtils {
|
public final class CompatUtils {
|
||||||
private static final String TAG = CompatUtils.class.getSimpleName();
|
private static final String TAG = CompatUtils.class.getSimpleName();
|
||||||
private static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
|
private static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
|
||||||
// TODO: Can these be constants instead of literal String constants?
|
// TODO: Can these be constants instead of literal String constants?
|
||||||
|
|
|
@ -20,7 +20,7 @@ import android.view.inputmethod.EditorInfo;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class EditorInfoCompatUtils {
|
public final class EditorInfoCompatUtils {
|
||||||
// EditorInfo.IME_FLAG_FORCE_ASCII has been introduced since API#16 (JellyBean).
|
// EditorInfo.IME_FLAG_FORCE_ASCII has been introduced since API#16 (JellyBean).
|
||||||
private static final Field FIELD_IME_FLAG_FORCE_ASCII = CompatUtils.getField(
|
private static final Field FIELD_IME_FLAG_FORCE_ASCII = CompatUtils.getField(
|
||||||
EditorInfo.class, "IME_FLAG_FORCE_ASCII");
|
EditorInfo.class, "IME_FLAG_FORCE_ASCII");
|
||||||
|
|
|
@ -20,7 +20,7 @@ import android.inputmethodservice.InputMethodService;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class InputMethodServiceCompatUtils {
|
public final class InputMethodServiceCompatUtils {
|
||||||
private static final Method METHOD_enableHardwareAcceleration =
|
private static final Method METHOD_enableHardwareAcceleration =
|
||||||
CompatUtils.getMethod(InputMethodService.class, "enableHardwareAcceleration");
|
CompatUtils.getMethod(InputMethodService.class, "enableHardwareAcceleration");
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ package com.android.inputmethod.compat;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class SettingsSecureCompatUtils {
|
public final class SettingsSecureCompatUtils {
|
||||||
private static final Field FIELD_ACCESSIBILITY_SPEAK_PASSWORD = CompatUtils.getField(
|
private static final Field FIELD_ACCESSIBILITY_SPEAK_PASSWORD = CompatUtils.getField(
|
||||||
android.provider.Settings.Secure.class, "ACCESSIBILITY_SPEAK_PASSWORD");
|
android.provider.Settings.Secure.class, "ACCESSIBILITY_SPEAK_PASSWORD");
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class SuggestionSpanUtils {
|
public final class SuggestionSpanUtils {
|
||||||
private static final String TAG = SuggestionSpanUtils.class.getSimpleName();
|
private static final String TAG = SuggestionSpanUtils.class.getSimpleName();
|
||||||
// TODO: Use reflection to get field values
|
// TODO: Use reflection to get field values
|
||||||
public static final String ACTION_SUGGESTION_PICKED =
|
public static final String ACTION_SUGGESTION_PICKED =
|
||||||
|
|
|
@ -20,7 +20,7 @@ import android.view.textservice.SuggestionsInfo;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class SuggestionsInfoCompatUtils {
|
public final class SuggestionsInfoCompatUtils {
|
||||||
private static final Field FIELD_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = CompatUtils.getField(
|
private static final Field FIELD_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = CompatUtils.getField(
|
||||||
SuggestionsInfo.class, "RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS");
|
SuggestionsInfo.class, "RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS");
|
||||||
private static final Integer OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = (Integer) CompatUtils
|
private static final Integer OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = (Integer) CompatUtils
|
||||||
|
|
|
@ -22,7 +22,7 @@ import android.view.ViewGroup.MarginLayoutParams;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.RelativeLayout;
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
public class ViewLayoutUtils {
|
public final class ViewLayoutUtils {
|
||||||
private ViewLayoutUtils() {
|
private ViewLayoutUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ import java.util.TreeSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
public class CollectionUtils {
|
public final class CollectionUtils {
|
||||||
private CollectionUtils() {
|
private CollectionUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Utility class for Input Method Framework
|
* Utility class for Input Method Framework
|
||||||
*/
|
*/
|
||||||
public class ImfUtils {
|
public final class ImfUtils {
|
||||||
private ImfUtils() {
|
private ImfUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ package com.android.inputmethod.latin;
|
||||||
|
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
|
|
||||||
public class InputTypeUtils implements InputType {
|
public final class InputTypeUtils implements InputType {
|
||||||
private static final int WEB_TEXT_PASSWORD_INPUT_TYPE =
|
private static final int WEB_TEXT_PASSWORD_INPUT_TYPE =
|
||||||
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_PASSWORD;
|
TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_WEB_PASSWORD;
|
||||||
private static final int WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE =
|
private static final int WEB_TEXT_EMAIL_ADDRESS_INPUT_TYPE =
|
||||||
|
|
|
@ -20,7 +20,7 @@ import android.util.Log;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.define.JniLibName;
|
import com.android.inputmethod.latin.define.JniLibName;
|
||||||
|
|
||||||
public class JniUtils {
|
public final class JniUtils {
|
||||||
private static final String TAG = JniUtils.class.getSimpleName();
|
private static final String TAG = JniUtils.class.getSimpleName();
|
||||||
|
|
||||||
private JniUtils() {
|
private JniUtils() {
|
||||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Locale;
|
||||||
* update/bugfix to this file, consider also updating/fixing the version in the
|
* update/bugfix to this file, consider also updating/fixing the version in the
|
||||||
* dictionary pack.
|
* dictionary pack.
|
||||||
*/
|
*/
|
||||||
public class LocaleUtils {
|
public final class LocaleUtils {
|
||||||
private static final HashMap<String, Long> EMPTY_LT_HASH_MAP = CollectionUtils.newHashMap();
|
private static final HashMap<String, Long> EMPTY_LT_HASH_MAP = CollectionUtils.newHashMap();
|
||||||
private static final String LOCALE_AND_TIME_STR_SEPARATER = ",";
|
private static final String LOCALE_AND_TIME_STR_SEPARATER = ",";
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import android.os.Build;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class ResourceUtils {
|
public final class ResourceUtils {
|
||||||
private ResourceUtils() {
|
private ResourceUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import android.text.TextUtils;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class StringUtils {
|
public final class StringUtils {
|
||||||
private StringUtils() {
|
private StringUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package com.android.inputmethod.latin;
|
||||||
import android.text.format.DateUtils;
|
import android.text.format.DateUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class UserHistoryForgettingCurveUtils {
|
public final class UserHistoryForgettingCurveUtils {
|
||||||
private static final String TAG = UserHistoryForgettingCurveUtils.class.getSimpleName();
|
private static final String TAG = UserHistoryForgettingCurveUtils.class.getSimpleName();
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
private static final int FC_FREQ_MAX = 127;
|
private static final int FC_FREQ_MAX = 127;
|
||||||
|
|
|
@ -16,14 +16,11 @@
|
||||||
|
|
||||||
package com.android.inputmethod.latin;
|
package com.android.inputmethod.latin;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
|
@ -44,9 +41,8 @@ import java.io.PrintWriter;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class Utils {
|
public final class Utils {
|
||||||
private Utils() {
|
private Utils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
@ -183,7 +179,7 @@ public class Utils {
|
||||||
return getStackTrace(Integer.MAX_VALUE - 1);
|
return getStackTrace(Integer.MAX_VALUE - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class UsabilityStudyLogUtils {
|
public static final class UsabilityStudyLogUtils {
|
||||||
// TODO: remove code duplication with ResearchLog class
|
// TODO: remove code duplication with ResearchLog class
|
||||||
private static final String USABILITY_TAG = UsabilityStudyLogUtils.class.getSimpleName();
|
private static final String USABILITY_TAG = UsabilityStudyLogUtils.class.getSimpleName();
|
||||||
private static final String FILENAME = "log.txt";
|
private static final String FILENAME = "log.txt";
|
||||||
|
@ -392,9 +388,7 @@ public class Utils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Stats {
|
public static final class Stats {
|
||||||
static final int NOT_A_SEPARATOR_CODE_POINT = -1;
|
|
||||||
|
|
||||||
public static void onNonSeparator(final char code, final int x,
|
public static void onNonSeparator(final char code, final int x,
|
||||||
final int y) {
|
final int y) {
|
||||||
RingCharBuffer.getInstance().push(code, x, y);
|
RingCharBuffer.getInstance().push(code, x, y);
|
||||||
|
@ -423,7 +417,7 @@ public class Utils {
|
||||||
// TODO: this fails when the separator is more than 1 code point long, but
|
// TODO: this fails when the separator is more than 1 code point long, but
|
||||||
// the backend can't handle it yet. The only case when this happens is with
|
// the backend can't handle it yet. The only case when this happens is with
|
||||||
// smileys and other multi-character keys.
|
// smileys and other multi-character keys.
|
||||||
final int codePoint = TextUtils.isEmpty(separatorString) ? NOT_A_SEPARATOR_CODE_POINT
|
final int codePoint = TextUtils.isEmpty(separatorString) ? Constants.NOT_A_CODE
|
||||||
: separatorString.codePointAt(0);
|
: separatorString.codePointAt(0);
|
||||||
LatinImeLogger.logOnAutoCorrection(typedWord, correctedWord, codePoint);
|
LatinImeLogger.logOnAutoCorrection(typedWord, correctedWord, codePoint);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ package com.android.inputmethod.latin;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
|
|
||||||
public class VibratorUtils {
|
public final class VibratorUtils {
|
||||||
private static final VibratorUtils sInstance = new VibratorUtils();
|
private static final VibratorUtils sInstance = new VibratorUtils();
|
||||||
private Vibrator mVibrator;
|
private Vibrator mVibrator;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
public class XmlParseUtils {
|
public final class XmlParseUtils {
|
||||||
private XmlParseUtils() {
|
private XmlParseUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Enumeration;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
public class JarUtils {
|
public final class JarUtils {
|
||||||
private JarUtils() {
|
private JarUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue