aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android')
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java31
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardTheme.java42
-rw-r--r--java/src/com/android/inputmethod/latin/settings/Settings.java4
3 files changed, 49 insertions, 28 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 949f03794..6074a8106 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -45,28 +45,6 @@ import com.android.inputmethod.latin.utils.ResourceUtils;
public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private static final String TAG = KeyboardSwitcher.class.getSimpleName();
- public static final class KeyboardTheme {
- public final int mThemeId;
- public final int mStyleId;
-
- // Note: The themeId should be aligned with "themeId" attribute of Keyboard style
- // in values/style.xml.
- public KeyboardTheme(final int themeId, final int styleId) {
- mThemeId = themeId;
- mStyleId = styleId;
- }
- }
-
- public static final int THEME_INDEX_ICS = 0;
- public static final int THEME_INDEX_GB = 1;
- public static final int THEME_INDEX_KLP = 2;
- public static final int DEFAULT_THEME_INDEX = THEME_INDEX_KLP;
- public static final KeyboardTheme[] KEYBOARD_THEMES = {
- new KeyboardTheme(THEME_INDEX_ICS, R.style.KeyboardTheme_ICS),
- new KeyboardTheme(THEME_INDEX_GB, R.style.KeyboardTheme_GB),
- new KeyboardTheme(THEME_INDEX_KLP, R.style.KeyboardTheme_KLP),
- };
-
private SubtypeSwitcher mSubtypeSwitcher;
private SharedPreferences mPrefs;
@@ -88,7 +66,8 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
* what user actually typed. */
private boolean mIsAutoCorrectionActive;
- private KeyboardTheme mKeyboardTheme = KEYBOARD_THEMES[DEFAULT_THEME_INDEX];
+ private KeyboardTheme mKeyboardTheme =
+ KeyboardTheme.KEYBOARD_THEMES[KeyboardTheme.DEFAULT_THEME_INDEX];
private Context mThemeContext;
private static final KeyboardSwitcher sInstance = new KeyboardSwitcher();
@@ -127,13 +106,13 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
final SharedPreferences prefs) {
final Resources res = context.getResources();
final int index = Settings.readKeyboardThemeIndex(prefs, res);
- if (index >= 0 && index < KEYBOARD_THEMES.length) {
- return KEYBOARD_THEMES[index];
+ if (index >= 0 && index < KeyboardTheme.KEYBOARD_THEMES.length) {
+ return KeyboardTheme.KEYBOARD_THEMES[index];
}
final int defaultThemeIndex = Settings.resetAndGetDefaultKeyboardThemeIndex(prefs, res);
Log.w(TAG, "Illegal keyboard theme in preference: " + index + ", default to "
+ defaultThemeIndex);
- return KEYBOARD_THEMES[defaultThemeIndex];
+ return KeyboardTheme.KEYBOARD_THEMES[defaultThemeIndex];
}
private boolean updateKeyboardThemeAndContextThemeWrapper(final Context context,
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java
new file mode 100644
index 000000000..d15942728
--- /dev/null
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardTheme.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.keyboard;
+
+import com.android.inputmethod.latin.R;
+
+public final class KeyboardTheme {
+ public static final int THEME_INDEX_ICS = 0;
+ public static final int THEME_INDEX_GB = 1;
+ public static final int THEME_INDEX_KLP = 2;
+ public static final int DEFAULT_THEME_INDEX = THEME_INDEX_KLP;
+
+ public static final KeyboardTheme[] KEYBOARD_THEMES = {
+ new KeyboardTheme(THEME_INDEX_ICS, R.style.KeyboardTheme_ICS),
+ new KeyboardTheme(THEME_INDEX_GB, R.style.KeyboardTheme_GB),
+ new KeyboardTheme(THEME_INDEX_KLP, R.style.KeyboardTheme_KLP),
+ };
+
+ public final int mThemeId;
+ public final int mStyleId;
+
+ // Note: The themeId should be aligned with "themeId" attribute of Keyboard style
+ // in values/style.xml.
+ public KeyboardTheme(final int themeId, final int styleId) {
+ mThemeId = themeId;
+ mStyleId = styleId;
+ }
+}
diff --git a/java/src/com/android/inputmethod/latin/settings/Settings.java b/java/src/com/android/inputmethod/latin/settings/Settings.java
index 1ba92adb1..4cb02284a 100644
--- a/java/src/com/android/inputmethod/latin/settings/Settings.java
+++ b/java/src/com/android/inputmethod/latin/settings/Settings.java
@@ -23,7 +23,7 @@ import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.util.Log;
-import com.android.inputmethod.keyboard.KeyboardSwitcher;
+import com.android.inputmethod.keyboard.KeyboardTheme;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.InputAttributes;
import com.android.inputmethod.latin.R;
@@ -292,7 +292,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
try {
return Integer.parseInt(defaultThemeIndexString);
} catch (final NumberFormatException e) {
- final int defaultThemeIndex = KeyboardSwitcher.DEFAULT_THEME_INDEX;
+ final int defaultThemeIndex = KeyboardTheme.DEFAULT_THEME_INDEX;
Log.e(TAG, "Corrupted default keyoard theme in resource: " + defaultThemeIndexString
+ ", default to " + defaultThemeIndex, e);
return defaultThemeIndex;