aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorDan Zivkovic <zivkovic@google.com>2015-02-11 13:32:13 -0800
committerDan Zivkovic <zivkovic@google.com>2015-02-11 13:32:13 -0800
commit5254c01d4cc024527479d4dc5fab2ed2516c395c (patch)
treec51b57953cb3154ab3c3e0260879b5fe0b056aa3 /java/src
parent12d80ebead6a1d7f704a5a3af3b6fe3313ceab05 (diff)
downloadlatinime-5254c01d4cc024527479d4dc5fab2ed2516c395c.tar.gz
latinime-5254c01d4cc024527479d4dc5fab2ed2516c395c.tar.xz
latinime-5254c01d4cc024527479d4dc5fab2ed2516c395c.zip
Fix master build.
For some reason, we can't import android.os package in our Constants. Change-Id: I357ed72d13c5039a83c6e2489cdf5ef74d0ffea8
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java3
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java5
-rw-r--r--java/src/com/android/inputmethod/compat/NotificationCompatUtils.java5
-rw-r--r--java/src/com/android/inputmethod/latin/RichInputConnection.java2
-rw-r--r--java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java10
-rw-r--r--java/src/com/android/inputmethod/latin/settings/SettingsValues.java4
-rw-r--r--java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryList.java4
7 files changed, 18 insertions, 15 deletions
diff --git a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java
index 48aef4b1d..b0072eebe 100644
--- a/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java
+++ b/java/src/com/android/inputmethod/accessibility/AccessibilityUtils.java
@@ -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);
diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
index 853830808..58ad4bd4c 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
@@ -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);
}
diff --git a/java/src/com/android/inputmethod/compat/NotificationCompatUtils.java b/java/src/com/android/inputmethod/compat/NotificationCompatUtils.java
index 0646558e4..70ab972c5 100644
--- a/java/src/com/android/inputmethod/compat/NotificationCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/NotificationCompatUtils.java
@@ -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);
}
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index f020c25eb..0210d7e18 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -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 {
diff --git a/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java
index c5e80f249..d9858e61f 100644
--- a/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java
@@ -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));
}
}
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
index e523246f3..6224071ea 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
@@ -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));
diff --git a/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryList.java b/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryList.java
index c43463ce7..57347ce8c 100644
--- a/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryList.java
+++ b/java/src/com/android/inputmethod/latin/userdictionary/UserDictionaryList.java
@@ -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("");