Fix master build.

For some reason, we can't import android.os package in our Constants.

Change-Id: I357ed72d13c5039a83c6e2489cdf5ef74d0ffea8
This commit is contained in:
Dan Zivkovic 2015-02-11 13:32:13 -08:00
parent 12d80ebead
commit 5254c01d4c
10 changed files with 23 additions and 28 deletions

View file

@ -16,20 +16,12 @@
package com.android.inputmethod.latin.common;
import android.os.Build;
import com.android.inputmethod.annotations.UsedForTesting;
import javax.annotation.Nonnull;
public final class Constants {
public static final boolean JELLY_BEAN_OR_HIGHER =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
public static final boolean JELLY_BEAN_MR1_OR_HIGHER =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
public static final class Color {
/**
* The alpha value for fully opaque.

View file

@ -35,7 +35,6 @@ import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.compat.SettingsSecureCompatUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.utils.InputTypeUtils;
public final class AccessibilityUtils {
@ -222,7 +221,7 @@ public final class AccessibilityUtils {
// Platforms starting at SDK version 16 (Build.VERSION_CODES.JELLY_BEAN) should use
// announce events.
if (Constants.JELLY_BEAN_OR_HIGHER) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
event.setEventType(AccessibilityEventCompat.TYPE_ANNOUNCEMENT);
} else {
event.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);

View file

@ -38,7 +38,7 @@ public final class InputMethodSubtypeCompatUtils {
int.class, int.class, String.class, String.class, String.class, boolean.class,
boolean.class, int.class);
static {
if (Constants.JELLY_BEAN_MR1_OR_HIGHER) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null) {
android.util.Log.w(TAG, "Warning!!! Constructor is not defined.");
}
@ -59,7 +59,8 @@ public final class InputMethodSubtypeCompatUtils {
public static InputMethodSubtype newInputMethodSubtype(int nameId, int iconId, String locale,
String mode, String extraValue, boolean isAuxiliary,
boolean overridesImplicitlyEnabledSubtype, int id) {
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null || !Constants.JELLY_BEAN_MR1_OR_HIGHER) {
if (CONSTRUCTOR_INPUT_METHOD_SUBTYPE == null
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
return new InputMethodSubtype(nameId, iconId, locale, mode, extraValue, isAuxiliary,
overridesImplicitlyEnabledSubtype);
}

View file

@ -17,8 +17,7 @@
package com.android.inputmethod.compat;
import android.app.Notification;
import com.android.inputmethod.latin.common.Constants;
import android.os.Build;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@ -74,7 +73,7 @@ public class NotificationCompatUtils {
@SuppressWarnings("deprecation")
public static Notification build(final Notification.Builder builder) {
if (Constants.JELLY_BEAN_OR_HIGHER) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// #build was added in API level 16, JELLY_BEAN
return (Notification) CompatUtils.invoke(builder, null, METHOD_build);
}

View file

@ -899,7 +899,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
* On platforms on which this method is not present, this is a no-op.
*/
public void maybeMoveTheCursorAroundAndRestoreToWorkaroundABug() {
if (!Constants.JELLY_BEAN_OR_HIGHER) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
if (mExpectedSelStart > 0) {
mIC.setSelection(mExpectedSelStart - 1, mExpectedSelStart - 1);
} else {

View file

@ -19,13 +19,13 @@ package com.android.inputmethod.latin.settings;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.common.Constants;
/**
* "Preferences" settings sub screen.
@ -39,6 +39,10 @@ import com.android.inputmethod.latin.common.Constants;
* - Voice input key
*/
public final class PreferencesSettingsFragment extends SubScreenFragment {
private static final boolean VOICE_IME_ENABLED =
Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
@ -73,8 +77,8 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
final Preference voiceInputKeyOption = findPreference(Settings.PREF_VOICE_INPUT_KEY);
if (voiceInputKeyOption != null) {
RichInputMethodManager.getInstance().refreshSubtypeCaches();
voiceInputKeyOption.setEnabled(Constants.JELLY_BEAN_OR_HIGHER);
voiceInputKeyOption.setSummary(Constants.JELLY_BEAN_OR_HIGHER
voiceInputKeyOption.setEnabled(VOICE_IME_ENABLED);
voiceInputKeyOption.setSummary(VOICE_IME_ENABLED
? null : getText(R.string.voice_input_disabled_summary));
}
}

View file

@ -21,6 +21,7 @@ import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
@ -28,7 +29,6 @@ import com.android.inputmethod.compat.AppWorkaroundsUtils;
import com.android.inputmethod.latin.InputAttributes;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.RichInputMethodManager;
import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.utils.AsyncResultHolder;
import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.latin.utils.TargetPackageInfoGetterTask;
@ -137,7 +137,7 @@ public class SettingsValues {
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res)
&& mInputAttributes.mShouldShowVoiceInputKey
&& Constants.JELLY_BEAN_OR_HIGHER;
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
final String autoCorrectionThresholdRawValue = prefs.getString(
Settings.PREF_AUTO_CORRECTION_THRESHOLD,
res.getString(R.string.auto_correction_threshold_mode_index_modest));

View file

@ -20,6 +20,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
@ -31,7 +32,6 @@ import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.common.Constants;
import com.android.inputmethod.latin.common.LocaleUtils;
import java.util.List;
@ -75,7 +75,7 @@ public class UserDictionaryList extends PreferenceFragment {
} finally {
cursor.close();
}
if (!Constants.JELLY_BEAN_OR_HIGHER) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
// For ICS, we need to show "For all languages" in case that the keyboard locale
// is different from the system locale
localeSet.add("");

View file

@ -17,20 +17,19 @@
package com.android.inputmethod.compat;
import android.graphics.Typeface;
import android.os.Build;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.StyleSpan;
import com.android.inputmethod.latin.common.Constants;
import java.util.Locale;
@SmallTest
public class LocaleSpanCompatUtilsTests extends AndroidTestCase {
public void testInstantiatable() {
if (!Constants.JELLY_BEAN_MR1_OR_HIGHER) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
// LocaleSpan isn't yet available.
return;
}

View file

@ -16,14 +16,15 @@
package com.android.inputmethod.keyboard.layout;
import com.android.inputmethod.latin.common.Constants;
import android.os.Build;
/**
* This class offers label strings of Devanagari letters that need the dotted circle to draw
* its glyph.
*/
class DevanagariLetterConstants {
private static final boolean NEEDS_DOTTED_CIRCLE = !Constants.JELLY_BEAN_OR_HIGHER;
private static final boolean NEEDS_DOTTED_CIRCLE =
Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN;
// U+25CC: "" DOTTED CIRCLE
private static final String DOTTED_CIRCLE = NEEDS_DOTTED_CIRCLE ? "\u25CC" : "";