From 9751a626ec9b2e771afa5b3757e8f8498a328683 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 16 Jan 2012 11:32:49 +0900 Subject: [PATCH] Don't cache resource value that depends on orientation Bug: 5794655 Change-Id: Ib324366c772e20bb54aba63c2f4540dc0f9de515 --- java/src/com/android/inputmethod/latin/LatinIME.java | 5 ++++- java/src/com/android/inputmethod/latin/SettingsValues.java | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 59de798d8..e60f55060 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1019,7 +1019,10 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar @Override public boolean onEvaluateFullscreenMode() { - return super.onEvaluateFullscreenMode() && mSettingsValues.mUseFullScreenMode; + // Reread resource value here, because this method is called by framework anytime as needed. + final boolean isFullscreenModeAllowed = + mSettingsValues.isFullscreenModeAllowed(getResources()); + return super.onEvaluateFullscreenMode() && isFullscreenModeAllowed; } @Override diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java index 83b27f7fe..0ae28d3fc 100644 --- a/java/src/com/android/inputmethod/latin/SettingsValues.java +++ b/java/src/com/android/inputmethod/latin/SettingsValues.java @@ -41,7 +41,6 @@ public class SettingsValues { private final String mSymbolsExcludedFromWordSeparators; public final String mWordSeparators; public final CharSequence mHintToSaveText; - public final boolean mUseFullScreenMode; // From preferences, in the same order as xml/prefs.xml: public final boolean mAutoCap; @@ -107,7 +106,6 @@ public class SettingsValues { mWordSeparators = createWordSeparators(mMagicSpaceStrippers, mMagicSpaceSwappers, mSymbolsExcludedFromWordSeparators, res); mHintToSaveText = context.getText(R.string.hint_add_to_dictionary); - mUseFullScreenMode = res.getBoolean(R.bool.config_use_fullscreen_mode); // Get the settings preferences mAutoCap = prefs.getBoolean(Settings.PREF_AUTO_CAP, true); @@ -294,6 +292,10 @@ public class SettingsValues { return mVoiceKeyOnMain; } + public boolean isFullscreenModeAllowed(Resources res) { + return res.getBoolean(R.bool.config_use_fullscreen_mode); + } + // Accessed from the settings interface, hence public public static float getCurrentKeypressSoundVolume(final SharedPreferences sp, final Resources res) {