aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rwxr-xr-xjava/res/xml/kbd_symbols_black.xml141
-rwxr-xr-xjava/res/xml/kbd_symbols_shift_black.xml104
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java38
-rw-r--r--java/src/com/android/inputmethod/latin/LatinKeyboard.java3
4 files changed, 270 insertions, 16 deletions
diff --git a/java/res/xml/kbd_symbols_black.xml b/java/res/xml/kbd_symbols_black.xml
new file mode 100755
index 000000000..5652f7fca
--- /dev/null
+++ b/java/res/xml/kbd_symbols_black.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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.
+*/
+-->
+
+<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="10%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+ >
+
+ <Row>
+ <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="¹½⅓¼⅛"
+ />
+ <Key android:codes="50" android:keyLabel="2"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="²⅔"
+ />
+ <Key android:codes="51" android:keyLabel="3"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="³¾⅜"
+ />
+ <Key android:codes="52" android:keyLabel="4"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="⁴"
+ />
+ <Key android:codes="53" android:keyLabel="5"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="⅝"
+ />
+ <Key android:codes="54" android:keyLabel="6"/>
+ <Key android:codes="55" android:keyLabel="7"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="⅞"
+ />
+ <Key android:codes="56" android:keyLabel="8"/>
+ <Key android:codes="57" android:keyLabel="9"/>
+ <Key android:codes="48" android:keyLabel="0"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="ⁿ∅"
+ android:keyEdgeFlags="right"/>
+ </Row>
+
+ <Row>
+ <Key android:codes="64" android:keyLabel="\@" android:keyEdgeFlags="left"/>
+ <Key android:codes="35" android:keyLabel="\#"/>
+ <Key android:codes="36" android:keyLabel="$"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="¢£€¥₣₤₱"
+ />
+ <Key android:codes="37" android:keyLabel="%"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="‰"
+ />
+ <Key android:codes="38" android:keyLabel="&amp;"/>
+ <Key android:codes="42" android:keyLabel="*"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="†‡★"
+ />
+ <Key android:codes="45" android:keyLabel="-"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="_–—"
+ />
+ <Key android:keyLabel="+"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="±"
+ />
+ <Key android:codes="40" android:keyLabel="("
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="[{&lt;"
+ />
+ <Key android:codes="41" android:keyLabel=")" android:keyEdgeFlags="right"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="]}&gt;"
+ />
+ </Row>
+
+ <Row>
+ <Key android:codes="-1" android:keyLabel="@string/label_alt_key"
+ android:keyWidth="15%p" android:isModifier="true"
+ android:isSticky="true" android:keyEdgeFlags="left"/>
+ <Key android:codes="33" android:keyLabel="!"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="¡"
+ />
+ <Key android:codes="34" android:keyLabel="&quot;"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="“”«»˝"
+ />
+ <Key android:codes="39" android:keyLabel="\'"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="‘’"
+ />
+ <Key android:codes="58" android:keyLabel=":"/>
+ <Key android:codes="59" android:keyLabel=";"/>
+ <Key android:codes="47" android:keyLabel="/" />
+ <Key android:codes="63" android:keyLabel="\?"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="¿"
+ />
+ <Key android:codes="-5" android:keyIcon="@drawable/sym_bkeyboard_delete" android:keyWidth="15%p" android:keyEdgeFlags="right"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:isRepeatable="true"/>
+ </Row>
+
+ <Row android:rowEdgeFlags="bottom">
+ <Key android:codes="-2" android:keyLabel="@string/label_alpha_key"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="_"
+ android:keyWidth="20%p" android:keyEdgeFlags="left"/>
+ <Key android:codes="@integer/key_f1" android:keyWidth="10%p"/>
+ <Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
+ android:keyWidth="40%p"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:isRepeatable="true"/>
+ <Key android:codes="46" android:keyLabel="."
+ android:popupKeyboard="@xml/popup_punctuation"
+ android:keyWidth="10%p"/>
+ <Key android:codes="10" android:keyIcon="@drawable/sym_bkeyboard_return" android:keyWidth="20%p" android:keyEdgeFlags="right"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ />
+ </Row>
+</Keyboard>
diff --git a/java/res/xml/kbd_symbols_shift_black.xml b/java/res/xml/kbd_symbols_shift_black.xml
new file mode 100755
index 000000000..dc8425125
--- /dev/null
+++ b/java/res/xml/kbd_symbols_shift_black.xml
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, 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.
+*/
+-->
+
+<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
+ android:keyWidth="10%p"
+ android:horizontalGap="0px"
+ android:verticalGap="0px"
+ android:keyHeight="@dimen/key_height"
+ >
+
+ <Row>
+ <Key android:keyLabel="~" android:keyEdgeFlags="left"/>
+ <Key android:keyLabel="`"/>
+ <Key android:keyLabel="|"/>
+ <Key android:keyLabel="•"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="♪♥♠♦♣"
+ />
+ <Key android:keyLabel="√"/>
+ <Key android:keyLabel="π"/>
+ <Key android:keyLabel="÷"/>
+ <Key android:keyLabel="×"/>
+ <Key android:keyLabel="{"/>
+ <Key android:keyLabel="}" android:keyEdgeFlags="right"/>
+ </Row>
+
+ <Row>
+ <Key android:codes="9" android:keyLabel="\u21E5" android:keyEdgeFlags="left"/>
+ <Key android:keyLabel="£"/>
+ <Key android:keyLabel="¢"/>
+ <Key android:keyLabel="€"/>
+ <Key android:keyLabel="°"/>
+ <Key android:keyLabel="^"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="↑↓←→"
+ />
+ <Key android:keyLabel="_"/>
+ <Key android:keyLabel="="
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="≠≈∞"
+ />
+ <Key android:keyLabel="["/>
+ <Key android:keyLabel="]" android:keyEdgeFlags="right"/>
+ </Row>
+
+ <Row>
+ <Key android:codes="-1" android:keyLabel="@string/label_alt_key"
+ android:keyWidth="15%p" android:isModifier="true"
+ android:isSticky="true" android:keyEdgeFlags="left"/>
+ <Key android:keyLabel="™"/>
+ <Key android:keyLabel="®"/>
+ <Key android:keyLabel="©"/>
+ <Key android:keyLabel="¶"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="§"
+ />
+ <Key android:keyLabel="\\"/>
+ <Key android:keyLabel="&lt;"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="≤«‹"
+ />
+ <Key android:keyLabel="&gt;"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="≥»›"
+ />
+ <Key android:codes="-5" android:keyIcon="@drawable/sym_bkeyboard_delete" android:keyWidth="15%p" android:keyEdgeFlags="right"
+ android:iconPreview="@drawable/sym_keyboard_feedback_delete"
+ android:isRepeatable="true"/>
+ </Row>
+
+ <Row android:rowEdgeFlags="bottom">
+ <Key android:codes="-2" android:keyLabel="@string/label_alpha_key" android:keyWidth="20%p"
+ android:popupKeyboard="@xml/kbd_popup_template"
+ android:popupCharacters="_"
+ android:keyEdgeFlags="left"/>
+ <Key android:keyLabel="„" android:keyWidth="10%p" />
+ <Key android:codes="32" android:keyIcon="@drawable/sym_bkeyboard_space"
+ android:keyWidth="40%p"
+ android:iconPreview="@drawable/sym_keyboard_feedback_space"
+ android:isRepeatable="true"/>
+ <Key android:keyLabel="…" android:keyWidth="10%p" />
+ <Key android:codes="10" android:keyIcon="@drawable/sym_bkeyboard_return"
+ android:keyWidth="20%p" android:keyEdgeFlags="right"
+ android:iconPreview="@drawable/sym_keyboard_feedback_return"
+ />
+ </Row>
+</Keyboard>
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index 864bf73fa..fefe1cc42 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -91,14 +91,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
KeyboardSwitcher(Context context, LatinIME ims) {
mContext = context;
- mKeyboards = new HashMap<KeyboardId, LatinKeyboard>();
- mSymbolsId = new KeyboardId(R.xml.kbd_symbols, false);
- mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift, false);
- mInputMethodService = ims;
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ims);
- int mLayoutId = Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT, DEFAULT_LAYOUT_ID));
+ mLayoutId = Integer.valueOf(prefs.getString(PREF_KEYBOARD_LAYOUT, DEFAULT_LAYOUT_ID));
prefs.registerOnSharedPreferenceChangeListener(this);
+
+ mKeyboards = new HashMap<KeyboardId, LatinKeyboard>();
+ mSymbolsId = makeSymbolsId(false);
+ mSymbolsShiftedId = makeSymbolsShiftedId(false);
+ mInputMethodService = ims;
changeLatinKeyboardView(mLayoutId, false);
}
@@ -117,6 +118,16 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputView = inputView;
}
+ private KeyboardId makeSymbolsId(boolean hasVoice) {
+ return new KeyboardId(
+ isBlackSym() ? R.xml.kbd_symbols_black : R.xml.kbd_symbols, hasVoice);
+ }
+
+ private KeyboardId makeSymbolsShiftedId(boolean hasVoice) {
+ return new KeyboardId(
+ isBlackSym() ? R.xml.kbd_symbols_shift_black : R.xml.kbd_symbols_shift, hasVoice);
+ }
+
void makeKeyboards(boolean forceCreate) {
if (forceCreate) mKeyboards.clear();
// Configuration change is coming after the keyboard gets recreated. So don't rely on that.
@@ -126,9 +137,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
if (displayWidth == mLastDisplayWidth) return;
mLastDisplayWidth = displayWidth;
if (!forceCreate) mKeyboards.clear();
- mSymbolsId = new KeyboardId(R.xml.kbd_symbols, mHasVoice && !mVoiceOnPrimary);
- mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift,
- mHasVoice && !mVoiceOnPrimary);
+ mSymbolsId = makeSymbolsId(mHasVoice && !mVoiceOnPrimary);
+ mSymbolsShiftedId = makeSymbolsShiftedId(mHasVoice && !mVoiceOnPrimary);
}
/**
@@ -227,7 +237,8 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
orig.updateConfiguration(conf, null);
LatinKeyboard keyboard = new LatinKeyboard(
mContext, id.mXml, id.mKeyboardMode);
- keyboard.setVoiceMode(hasVoiceButton(id.mXml == R.xml.kbd_symbols), mHasVoice);
+ keyboard.setVoiceMode(hasVoiceButton(id.mXml == R.xml.kbd_symbols
+ || id.mXml == R.xml.kbd_symbols_black), mHasVoice);
keyboard.setLanguageSwitcher(mLanguageSwitcher);
keyboard.setBlackFlag(isBlackSym());
if (id.mKeyboardMode == KEYBOARDMODE_NORMAL
@@ -256,8 +267,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
int keyboardRowsResId = isBlackSym() ? R.xml.kbd_qwerty_black : R.xml.kbd_qwerty;
if (isSymbols) {
return (mode == MODE_PHONE)
- ? new KeyboardId(R.xml.kbd_phone_symbols, hasVoice)
- : new KeyboardId(R.xml.kbd_symbols, hasVoice);
+ ? new KeyboardId(R.xml.kbd_phone_symbols, hasVoice) : makeSymbolsId(hasVoice);
}
switch (mode) {
case MODE_TEXT:
@@ -268,7 +278,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
break;
case MODE_SYMBOLS:
- return new KeyboardId(R.xml.kbd_symbols, hasVoice);
+ return makeSymbolsId(hasVoice);
case MODE_PHONE:
return new KeyboardId(R.xml.kbd_phone, hasVoice);
case MODE_URL:
@@ -404,8 +414,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
// TODO: Generalize for any theme
public boolean isBlackSym () {
- return (mLayoutId == 6 && (mLanguageSwitcher == null
- || mLanguageSwitcher.getEnabledLanguages() == null
- || mLanguageSwitcher.getInputLanguage().startsWith("en_")));
+ return (mLayoutId == 6);
}
}
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboard.java b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
index eba0ec04e..1a9350a83 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboard.java
@@ -123,7 +123,8 @@ public class LatinKeyboard extends Keyboard {
setDefaultBounds(m123MicPreviewIcon);
sSpacebarVerticalCorrection = res.getDimensionPixelOffset(
R.dimen.spacebar_vertical_correction);
- mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty;
+ mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty
+ || xmlLayoutResId == R.xml.kbd_qwerty_black;
mSpaceKeyIndex = indexOf((int) ' ');
}