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;
|
||||
|
||||
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(
|
||||
EditorInfo.class, "IME_FLAG_FORCE_ASCII");
|
||||
private static final Integer OBJ_IME_FLAG_FORCE_ASCII = (Integer) CompatUtils
|
||||
.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) {
|
||||
if (OBJ_IME_FLAG_FORCE_ASCII == null)
|
||||
return false;
|
||||
|
|
|
@ -40,6 +40,10 @@ public class InputMethodManagerCompatWrapper {
|
|||
|
||||
private InputMethodManager mImm;
|
||||
|
||||
private InputMethodManagerCompatWrapper() {
|
||||
// This wrapper class is not publicly instantiable.
|
||||
}
|
||||
|
||||
public static InputMethodManagerCompatWrapper getInstance() {
|
||||
if (sInstance.mImm == null)
|
||||
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(
|
||||
Context context, CharSequence text) {
|
||||
if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null
|
||||
|
|
|
@ -30,6 +30,7 @@ public class SuggestionsInfoCompatUtils {
|
|||
? OBJ_RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS : 0;
|
||||
|
||||
private SuggestionsInfoCompatUtils() {
|
||||
// This utility class is not publicly instantiable.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue