Merge "Remove BuildCompatUtils.VERSION_CODES_LXX"

This commit is contained in:
Yohei Yukawa 2014-10-22 02:01:31 +00:00 committed by Android (Google) Code Review
commit baecaa5411
7 changed files with 18 additions and 23 deletions

View file

@ -33,11 +33,4 @@ public final class BuildCompatUtils {
public static final int EFFECTIVE_SDK_INT = IS_RELEASE_BUILD public static final int EFFECTIVE_SDK_INT = IS_RELEASE_BUILD
? Build.VERSION.SDK_INT ? Build.VERSION.SDK_INT
: Build.VERSION.SDK_INT + 1; : 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;
} }

View file

@ -50,10 +50,10 @@ public class CursorAnchorInfoCompatWrapper {
// This class is not publicly instantiable. // This class is not publicly instantiable.
} }
@TargetApi(BuildCompatUtils.VERSION_CODES_LXX) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Nullable @Nullable
public static CursorAnchorInfoCompatWrapper wrap(@Nullable final CursorAnchorInfo instance) { 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; return null;
} }
if (instance == null) { if (instance == null) {
@ -110,7 +110,7 @@ public class CursorAnchorInfoCompatWrapper {
throw new UnsupportedOperationException("not supported."); throw new UnsupportedOperationException("not supported.");
} }
@TargetApi(BuildCompatUtils.VERSION_CODES_LXX) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static final class RealWrapper extends CursorAnchorInfoCompatWrapper { private static final class RealWrapper extends CursorAnchorInfoCompatWrapper {
@Nonnull @Nonnull

View file

@ -17,6 +17,7 @@
package com.android.inputmethod.compat; package com.android.inputmethod.compat;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
import android.os.Build;
import android.view.View; import android.view.View;
public class ViewOutlineProviderCompatUtils { public class ViewOutlineProviderCompatUtils {
@ -34,7 +35,7 @@ public class ViewOutlineProviderCompatUtils {
}; };
public static InsetsUpdater setInsetsOutlineProvider(final View view) { 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 EMPTY_INSETS_UPDATER;
} }
return ViewOutlineProviderCompatUtilsLXX.setInsetsOutlineProvider(view); return ViewOutlineProviderCompatUtilsLXX.setInsetsOutlineProvider(view);

View file

@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Build.VERSION_CODES; import android.os.Build.VERSION_CODES;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
@ -54,7 +55,7 @@ public final class KeyboardTheme implements Comparable<KeyboardTheme> {
VERSION_CODES.ICE_CREAM_SANDWICH), VERSION_CODES.ICE_CREAM_SANDWICH),
new KeyboardTheme(THEME_ID_LXX_LIGHT, "LXXLight", R.style.KeyboardTheme_LXX_Light, new KeyboardTheme(THEME_ID_LXX_LIGHT, "LXXLight", R.style.KeyboardTheme_LXX_Light,
// Default theme for LXX. // Default theme for LXX.
BuildCompatUtils.VERSION_CODES_LXX), Build.VERSION_CODES.LOLLIPOP),
new KeyboardTheme(THEME_ID_LXX_DARK, "LXXDark", R.style.KeyboardTheme_LXX_Dark, new KeyboardTheme(THEME_ID_LXX_DARK, "LXXDark", R.style.KeyboardTheme_LXX_Dark,
// This has never been selected as default theme. // This has never been selected as default theme.
VERSION_CODES.BASE), VERSION_CODES.BASE),

View file

@ -78,7 +78,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final boolean ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS = public static final boolean ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS =
BuildCompatUtils.EFFECTIVE_SDK_INT <= Build.VERSION_CODES.KITKAT; BuildCompatUtils.EFFECTIVE_SDK_INT <= Build.VERSION_CODES.KITKAT;
public static final boolean SHOULD_SHOW_LXX_SUGGESTION_UI = 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 = public static final String PREF_SHOW_LANGUAGE_SWITCH_KEY =
"pref_show_language_switch_key"; "pref_show_language_switch_key";
public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST = public static final String PREF_INCLUDE_OTHER_IMES_IN_LANGUAGE_SWITCH_LIST =

View file

@ -96,7 +96,7 @@ public final class CursorAnchorInfoUtils {
@Nullable @Nullable
public static CursorAnchorInfoCompatWrapper extractFromTextView( public static CursorAnchorInfoCompatWrapper extractFromTextView(
@Nonnull final TextView textView) { @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 null;
} }
return CursorAnchorInfoCompatWrapper.wrap(extractFromTextViewInternal(textView)); 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 * @return the {@link CursorAnchorInfo} object based on the current layout. {@code null} if it
* is not feasible. * is not feasible.
*/ */
@TargetApi(BuildCompatUtils.VERSION_CODES_LXX) @TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Nullable @Nullable
private static CursorAnchorInfo extractFromTextViewInternal(@Nonnull final TextView textView) { private static CursorAnchorInfo extractFromTextViewInternal(@Nonnull final TextView textView) {
final Layout layout = textView.getLayout(); final Layout layout = textView.getLayout();

View file

@ -16,13 +16,13 @@
package com.android.inputmethod.keyboard; 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_ICS;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_KLP; 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_DARK;
import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_LIGHT; import static com.android.inputmethod.keyboard.KeyboardTheme.THEME_ID_LXX_LIGHT;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.Build.VERSION_CODES; import android.os.Build.VERSION_CODES;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
@ -131,7 +131,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
} }
public void testKeyboardThemePreferenceOnLxx() { public void testKeyboardThemePreferenceOnLxx() {
assertKeyboardThemePreferenceOnLxx(VERSION_CODES_LXX); assertKeyboardThemePreferenceOnLxx(Build.VERSION_CODES.LOLLIPOP);
} }
/* /*
@ -184,7 +184,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
} }
public void testDefaultKeyboardThemeOnLxx() { 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. // Upgrading keyboard on L.
public void testUpgradeKeyboardToLxxOnLxx() { 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) { private void assertUpgradePlatformToLxxFrom(final int oldSdkVersion) {
// Forced to switch to LXX theme. // Forced to switch to LXX theme.
final int newSdkVersion = VERSION_CODES_LXX; final int newSdkVersion = Build.VERSION_CODES.LOLLIPOP;
assertUpgradePlatformFromTo( assertUpgradePlatformFromTo(
oldSdkVersion, newSdkVersion, THEME_ID_NULL, THEME_ID_LXX_LIGHT); oldSdkVersion, newSdkVersion, THEME_ID_NULL, THEME_ID_LXX_LIGHT);
assertUpgradePlatformFromTo( assertUpgradePlatformFromTo(
@ -329,8 +329,8 @@ public class KeyboardThemeTests extends AndroidTestCase {
// Update platform from L to L. // Update platform from L to L.
public void testUpgradePlatformToLxxFromLxx() { public void testUpgradePlatformToLxxFromLxx() {
final int oldSdkVersion = VERSION_CODES_LXX; final int oldSdkVersion = Build.VERSION_CODES.LOLLIPOP;
final int newSdkVersion = VERSION_CODES_LXX; final int newSdkVersion = Build.VERSION_CODES.LOLLIPOP;
assertUpgradePlatformFromTo( assertUpgradePlatformFromTo(
oldSdkVersion, newSdkVersion, THEME_ID_NULL, THEME_ID_LXX_LIGHT); oldSdkVersion, newSdkVersion, THEME_ID_NULL, THEME_ID_LXX_LIGHT);
assertUpgradePlatformFromTo( assertUpgradePlatformFromTo(
@ -419,7 +419,7 @@ public class KeyboardThemeTests extends AndroidTestCase {
setKeyboardThemePreference(KeyboardTheme.KLP_KEYBOARD_THEME_KEY, THEME_ID_NULL); setKeyboardThemePreference(KeyboardTheme.KLP_KEYBOARD_THEME_KEY, THEME_ID_NULL);
setKeyboardThemePreference(KeyboardTheme.LXX_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); final String oldPrefKey = KeyboardTheme.getPreferenceKey(sdkVersion);
setKeyboardThemePreference(oldPrefKey, THEME_ID_LXX_DARK); setKeyboardThemePreference(oldPrefKey, THEME_ID_LXX_DARK);