Add private constructor to utility classes
Bug: 6129704 Change-Id: I52925ae7bd80683f63efc48649448865a5654f41
This commit is contained in:
parent
d2c5533fd9
commit
fde7efd877
4 changed files with 14 additions and 1 deletions
|
@ -21,12 +21,16 @@ import android.view.inputmethod.EditorInfo;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public class EditorInfoCompatUtils {
|
public class EditorInfoCompatUtils {
|
||||||
|
// 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");
|
||||||
private static final Integer OBJ_IME_FLAG_FORCE_ASCII = (Integer) CompatUtils
|
private static final Integer OBJ_IME_FLAG_FORCE_ASCII = (Integer) CompatUtils
|
||||||
.getFieldValue(null, null, FIELD_IME_FLAG_FORCE_ASCII);
|
.getFieldValue(null, null, FIELD_IME_FLAG_FORCE_ASCII);
|
||||||
|
|
||||||
// EditorInfo.IME_FLAG_FORCE_ASCII has been introduced since API#16 (JellyBean).
|
private EditorInfoCompatUtils() {
|
||||||
|
// This utility class is not publicly instantiable.
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasFlagForceAscii(int imeOptions) {
|
public static boolean hasFlagForceAscii(int imeOptions) {
|
||||||
if (OBJ_IME_FLAG_FORCE_ASCII == null)
|
if (OBJ_IME_FLAG_FORCE_ASCII == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -40,6 +40,10 @@ public class InputMethodManagerCompatWrapper {
|
||||||
|
|
||||||
private InputMethodManager mImm;
|
private InputMethodManager mImm;
|
||||||
|
|
||||||
|
private InputMethodManagerCompatWrapper() {
|
||||||
|
// This wrapper class is not publicly instantiable.
|
||||||
|
}
|
||||||
|
|
||||||
public static InputMethodManagerCompatWrapper getInstance() {
|
public static InputMethodManagerCompatWrapper getInstance() {
|
||||||
if (sInstance.mImm == null)
|
if (sInstance.mImm == null)
|
||||||
Log.w(TAG, "getInstance() is called before initialization");
|
Log.w(TAG, "getInstance() is called before initialization");
|
||||||
|
|
|
@ -77,6 +77,10 @@ public class SuggestionSpanUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SuggestionSpanUtils() {
|
||||||
|
// This utility class is not publicly instantiable.
|
||||||
|
}
|
||||||
|
|
||||||
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(
|
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(
|
||||||
Context context, CharSequence text) {
|
Context context, CharSequence text) {
|
||||||
if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null
|
if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class SuggestionsInfoCompatUtils {
|
||||||
? OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS : 0;
|
? OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS : 0;
|
||||||
|
|
||||||
private SuggestionsInfoCompatUtils() {
|
private SuggestionsInfoCompatUtils() {
|
||||||
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue