From 8f3e778a21ff2c8855fb0014116eda9eec7f2b5d Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 13 Aug 2014 03:59:37 +0000 Subject: [PATCH] Revert "Remove reference of VERSION_CODES.CUR_DEVELOPMENT" This reverts commit 5380acfd04342b35289599f0bda3eaae1ddac642. Bug: 13888366 Change-Id: Iae0fb6798cef9d59c9de3790123f6acaf8b2746b --- .../android/inputmethod/keyboard/KeyboardTheme.java | 13 ++++++++----- .../inputmethod/keyboard/KeyboardThemeTests.java | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java index 135423393..4c2e0dd1d 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java @@ -38,9 +38,6 @@ public final class KeyboardTheme implements Comparable { public static final int THEME_ID_LXX_DARK = 4; public static final int DEFAULT_THEME_ID = THEME_ID_KLP; - // TODO: Update this constant once the *next* version becomes available. - public static final int VERSION_CODES_LXX = 21; - private static final KeyboardTheme[] KEYBOARD_THEMES = { new KeyboardTheme(THEME_ID_ICS, R.style.KeyboardTheme_ICS, // This has never been selected because we support ICS or later. @@ -50,7 +47,8 @@ public final class KeyboardTheme implements Comparable { VERSION_CODES.ICE_CREAM_SANDWICH), new KeyboardTheme(THEME_ID_LXX_LIGHT, R.style.KeyboardTheme_LXX_Light, // Default theme for LXX. - VERSION_CODES_LXX), + // TODO: Update this constant once the *next* version becomes available. + VERSION_CODES.CUR_DEVELOPMENT), new KeyboardTheme(THEME_ID_LXX_DARK, R.style.KeyboardTheme_LXX_Dark, VERSION_CODES.BASE), }; @@ -102,7 +100,12 @@ public final class KeyboardTheme implements Comparable { } private static int getSdkVersion() { - return Build.VERSION.SDK_INT; + final int sdkVersion = Build.VERSION.SDK_INT; + // TODO: Consider to remove this check once the *next* version becomes available. + if (sdkVersion > VERSION_CODES.KITKAT) { + return VERSION_CODES.CUR_DEVELOPMENT; + } + return sdkVersion; } @UsedForTesting diff --git a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java index 45e1558a8..0c7e4000e 100644 --- a/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java +++ b/tests/src/com/android/inputmethod/keyboard/KeyboardThemeTests.java @@ -20,7 +20,6 @@ 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 static com.android.inputmethod.keyboard.KeyboardTheme.VERSION_CODES_LXX; import android.content.SharedPreferences; import android.os.Build.VERSION_CODES; @@ -32,6 +31,9 @@ import android.test.suitebuilder.annotation.SmallTest; public class KeyboardThemeTests extends AndroidTestCase { private SharedPreferences mPrefs; + // TODO: Remove this constant once the *next* version becomes available. + private static final int VERSION_CODES_LXX = VERSION_CODES.CUR_DEVELOPMENT; + private static final int THEME_ID_NULL = -1; private static final int THEME_ID_UNKNOWN = -2; private static final int THEME_ID_ILLEGAL = -3;