From 66d30a4b226556f2f58b3701c6bc1974384486db Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Wed, 22 Oct 2014 00:07:23 +0900 Subject: [PATCH] Remove BuildCompatUtils.VERSION_CODES_LXX Finally it is turned out to be a XXL-size Lollipop. Change-Id: Icbd22506be9de514eba287cdd8d97fbfd070ac09 --- .../inputmethod/compat/BuildCompatUtils.java | 7 ------- .../compat/CursorAnchorInfoCompatWrapper.java | 6 +++--- .../compat/ViewOutlineProviderCompatUtils.java | 3 ++- .../inputmethod/keyboard/KeyboardTheme.java | 3 ++- .../inputmethod/latin/settings/Settings.java | 2 +- .../latin/utils/CursorAnchorInfoUtils.java | 4 ++-- .../inputmethod/keyboard/KeyboardThemeTests.java | 16 ++++++++-------- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/java/src/com/android/inputmethod/compat/BuildCompatUtils.java b/java/src/com/android/inputmethod/compat/BuildCompatUtils.java index 7d1717bd1..5d56f12ae 100644 --- a/java/src/com/android/inputmethod/compat/BuildCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/BuildCompatUtils.java @@ -33,11 +33,4 @@ public final class BuildCompatUtils { public static final int EFFECTIVE_SDK_INT = IS_RELEASE_BUILD ? Build.VERSION.SDK_INT : Build.VERSION.SDK_INT + 1; - - /** - * API version for L-release. - */ - // TODO: Substitute this constant reference with Build.VERSION_CODES.L* once the *next* version - // becomes available. - public static final int VERSION_CODES_LXX = 21; } diff --git a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java index 550d47485..380f8d9b9 100644 --- a/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java +++ b/java/src/com/android/inputmethod/compat/CursorAnchorInfoCompatWrapper.java @@ -50,10 +50,10 @@ public class CursorAnchorInfoCompatWrapper { // This class is not publicly instantiable. } - @TargetApi(BuildCompatUtils.VERSION_CODES_LXX) + @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Nullable public static CursorAnchorInfoCompatWrapper wrap(@Nullable final CursorAnchorInfo instance) { - if (Build.VERSION.SDK_INT < BuildCompatUtils.VERSION_CODES_LXX) { + if (BuildCompatUtils.EFFECTIVE_SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return null; } if (instance == null) { @@ -110,7 +110,7 @@ public class CursorAnchorInfoCompatWrapper { throw new UnsupportedOperationException("not supported."); } - @TargetApi(BuildCompatUtils.VERSION_CODES_LXX) + @TargetApi(Build.VERSION_CODES.LOLLIPOP) private static final class RealWrapper extends CursorAnchorInfoCompatWrapper { @Nonnull diff --git a/java/src/com/android/inputmethod/compat/ViewOutlineProviderCompatUtils.java b/java/src/com/android/inputmethod/compat/ViewOutlineProviderCompatUtils.java index 52b8b74e8..0c8e5b77d 100644 --- a/java/src/com/android/inputmethod/compat/ViewOutlineProviderCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/ViewOutlineProviderCompatUtils.java @@ -17,6 +17,7 @@ package com.android.inputmethod.compat; import android.inputmethodservice.InputMethodService; +import android.os.Build; import android.view.View; public class ViewOutlineProviderCompatUtils { @@ -34,7 +35,7 @@ public class ViewOutlineProviderCompatUtils { }; public static InsetsUpdater setInsetsOutlineProvider(final View view) { - if (BuildCompatUtils.EFFECTIVE_SDK_INT < BuildCompatUtils.VERSION_CODES_LXX) { + if (BuildCompatUtils.EFFECTIVE_SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return EMPTY_INSETS_UPDATER; } return ViewOutlineProviderCompatUtilsLXX.setInsetsOutlineProvider(view); diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java index 8a9688ac4..006d08696 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java @@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard; import android.content.Context; import android.content.SharedPreferences; +import android.os.Build; import android.os.Build.VERSION_CODES; import android.preference.PreferenceManager; import android.util.Log; @@ -54,7 +55,7 @@ public final class KeyboardTheme implements Comparable { VERSION_CODES.ICE_CREAM_SANDWICH), new KeyboardTheme(THEME_ID_LXX_LIGHT, "LXXLight", R.style.KeyboardTheme_LXX_Light, // Default theme for LXX. - BuildCompatUtils.VERSION_CODES_LXX), + Build.VERSION_CODES.LOLLIPOP), new KeyboardTheme(THEME_ID_LXX_DARK, "LXXDark", R.style.KeyboardTheme_LXX_Dark, // This has never been selected as default theme. VERSION_CODES.BASE), diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java index 391fc1982..c40ffb653 100644 --- a/java/src/com/android/inputmethod/latin/settings/Settings.java +++ b/java/src/com/android/inputmethod/latin/settings/Settings.java @@ -78,7 +78,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang public static final boolean ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS = BuildCompatUtils.EFFECTIVE_SDK_INT <= Build.VERSION_CODES.KITKAT; public static final boolean SHOULD_SHOW_LXX_SUGGESTION_UI = - BuildCompatUtils.EFFECTIVE_SDK_INT >= BuildCompatUtils.VERSION_CODES_LXX; + BuildCompatUtils.EFFECTIVE_SDK_INT >= Build.VERSION_CODES.LOLLIPOP; public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY = "pref_show_language_switch_key"; public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST = diff --git a/java/src/com/android/inputmethod/latin/utils/CursorAnchorInfoUtils.java b/java/src/com/android/inputmethod/latin/utils/CursorAnchorInfoUtils.java index 6c1449cee..c90d30c42 100644 --- a/java/src/com/android/inputmethod/latin/utils/CursorAnchorInfoUtils.java +++ b/java/src/com/android/inputmethod/latin/utils/CursorAnchorInfoUtils.java @@ -96,7 +96,7 @@ public final class CursorAnchorInfoUtils { @Nullable public static CursorAnchorInfoCompatWrapper extractFromTextView( @Nonnull final TextView textView) { - if (Build.VERSION.SDK_INT < BuildCompatUtils.VERSION_CODES_LXX) { + if (BuildCompatUtils.EFFECTIVE_SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return null; } return CursorAnchorInfoCompatWrapper.wrap(extractFromTextViewInternal(textView)); @@ -108,7 +108,7 @@ public final class CursorAnchorInfoUtils { * @return the {@link CursorAnchorInfo} object based on the current layout. {@code null} if it * is not feasible. */ - @TargetApi(BuildCompatUtils.VERSION_CODES_LXX) + @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Nullable private static CursorAnchorInfo extractFromTextViewInternal(@Nonnull final TextView textView) { final Layout layout = textView.getLayout(); diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java index d642a1073..33e88c13b 100644 --- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java +++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java @@ -16,13 +16,13 @@ package com.android.inputmethod.keyboard; -import static com.android.inputmethod.compat.BuildCompatUtils.VERSION_CODES_LXX; import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_ICS; import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_KLP; import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_DARK; import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_LIGHT; import android.content.SharedPreferences; +import android.os.Build; import android.os.Build.VERSION_CODES; import android.preference.PreferenceManager; import android.test.AndroidTestCase; @@ -131,7 +131,7 @@ public class KeyboardThemeTests extends AndroidTestCase { } public void testKeyboardThemePreferenceOnLxx() { - assertKeyboardThemePreferenceOnLxx(VERSION_CODES_LXX); + assertKeyboardThemePreferenceOnLxx(Build.VERSION_CODES.LOLLIPOP); } /* @@ -184,7 +184,7 @@ public class KeyboardThemeTests extends AndroidTestCase { } public void testDefaultKeyboardThemeOnLxx() { - assertDefaultKeyboardThemeOnLxx(VERSION_CODES_LXX); + assertDefaultKeyboardThemeOnLxx(Build.VERSION_CODES.LOLLIPOP); } /* @@ -251,7 +251,7 @@ public class KeyboardThemeTests extends AndroidTestCase { // Upgrading keyboard on L. public void testUpgradeKeyboardToLxxOnLxx() { - assertUpgradeKeyboardToLxxOnLxx(VERSION_CODES_LXX); + assertUpgradeKeyboardToLxxOnLxx(Build.VERSION_CODES.LOLLIPOP); } /* @@ -304,7 +304,7 @@ public class KeyboardThemeTests extends AndroidTestCase { private void assertUpgradePlatformToLxxFrom(final int oldSdkVersion) { // Forced to switch to LXX theme. - final int newSdkVersion = VERSION_CODES_LXX; + final int newSdkVersion = Build.VERSION_CODES.LOLLIPOP; assertUpgradePlatformFromTo( oldSdkVersion, newSdkVersion, THEME_ID_NULL, THEME_ID_LXX_LIGHT); assertUpgradePlatformFromTo( @@ -329,8 +329,8 @@ public class KeyboardThemeTests extends AndroidTestCase { // Update platform from L to L. public void testUpgradePlatformToLxxFromLxx() { - final int oldSdkVersion = VERSION_CODES_LXX; - final int newSdkVersion = VERSION_CODES_LXX; + final int oldSdkVersion = Build.VERSION_CODES.LOLLIPOP; + final int newSdkVersion = Build.VERSION_CODES.LOLLIPOP; assertUpgradePlatformFromTo( oldSdkVersion, newSdkVersion, THEME_ID_NULL, THEME_ID_LXX_LIGHT); assertUpgradePlatformFromTo( @@ -419,7 +419,7 @@ public class KeyboardThemeTests extends AndroidTestCase { setKeyboardThemePreference(KeyboardTheme.KLP_KEYBOARD_THEME_KEY, THEME_ID_NULL); setKeyboardThemePreference(KeyboardTheme.LXX_KEYBOARD_THEME_KEY, THEME_ID_NULL); - final int sdkVersion = VERSION_CODES_LXX; + final int sdkVersion = Build.VERSION_CODES.LOLLIPOP; final String oldPrefKey = KeyboardTheme.getPreferenceKey(sdkVersion); setKeyboardThemePreference(oldPrefKey, THEME_ID_LXX_DARK);