@@ -46,7 +46,48 @@
android:popupCharacters="@string/alternates_for_i" />
<Key android:keyLabel="j" android:keyEdgeFlags="right" />
</Row>
<Row>

<Row android:keyboardMode="@+id/mode_normal">
<Key android:keyLabel="k" android:keyEdgeFlags="left"
android:horizontalGap="5%p" />
<Key android:keyLabel="l" />
<Key android:keyLabel="m" />
<Key android:keyLabel="n"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_n" />
<Key android:keyLabel="o"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_o" />
<Key android:keyLabel="p" />
<Key android:keyLabel="q" />
<Key android:keyLabel="r" />
<Key android:keyLabel="s"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_s"
android:keyEdgeFlags="right" />
</Row>

<Row android:keyboardMode="@+id/mode_voice">
<Key android:keyLabel="k" android:keyEdgeFlags="left"
android:horizontalGap="5%p" />
<Key android:keyLabel="l" />
<Key android:keyLabel="m" />
<Key android:keyLabel="n"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_n" />
<Key android:keyLabel="o"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_o" />
<Key android:keyLabel="p" />
<Key android:keyLabel="q" />
<Key android:keyLabel="r" />
<Key android:keyLabel="s"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_s"
android:keyEdgeFlags="right" />
</Row>

<Row android:keyboardMode="@+id/mode_variants">
<Key android:keyLabel="k" android:keyEdgeFlags="left" />
<Key android:keyLabel="l" />
<Key android:keyLabel="m" />
@@ -62,14 +103,17 @@
<Key android:keyLabel="s"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_s" />
<Key android:keyLabel="t" android:keyEdgeFlags="right" />
<Key android:codes="@integer/key_variants" android:keyLabel="áž"
android:isModifier="true" android:isSticky="true"
android:keyEdgeFlags="right" />
</Row>

<Row>
<Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:keyLabel="t" />
<Key android:keyLabel="u"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_u" />
@@ -81,27 +125,69 @@
android:popupCharacters="@string/alternates_for_y"
/>
<Key android:keyLabel="z"/>
<Key android:keyLabel=","/>
<Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_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="123"
<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:keyEdgeFlags="left" android:keyWidth="20%p"/>
<Key android:keyLabel="," android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="25%p" android:isRepeatable="true"/>
<Key android:codes="46" android:keyLabel="."
android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="15%p"/>
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:keyWidth="10%p"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="20%p" />
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
</Row>

<Row android:keyboardMode="@+id/mode_voice" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:keyEdgeFlags="left" android:keyWidth="16%p"/>
<Key
android:codes="@integer/key_voice"
android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p"/>
<Key android:keyLabel="," android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="30%p" android:isRepeatable="true"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:keyWidth="21%p" 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_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="20%p" android:keyEdgeFlags="right"/>
<Key android:codes="-3" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
android:keyWidth="16%p" />
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="14%p" android:keyEdgeFlags="right"/>
</Row>

<Row android:keyboardMode="@+id/mode_variants" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:keyEdgeFlags="left" android:keyWidth="20%p"/>
<Key android:keyLabel="," android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="25%p" 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_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="20%p" />
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
</Row>

</Keyboard>
@@ -46,6 +46,7 @@
android:popupCharacters="@string/alternates_for_i" />
<Key android:keyLabel="j" android:keyEdgeFlags="right" />
</Row>

<Row>
<Key android:keyLabel="k" android:keyEdgeFlags="left" />
<Key android:keyLabel="l" />
@@ -62,14 +63,17 @@
<Key android:keyLabel="s"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_s" />
<Key android:keyLabel="t" android:keyEdgeFlags="right" />
<Key android:codes="@integer/key_variants" android:keyLabel="áž"
android:isModifier="true" android:isSticky="true"
android:keyEdgeFlags="right" />
</Row>

<Row>
<Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:keyLabel="t" />
<Key android:keyLabel="u"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_u" />
@@ -81,32 +85,33 @@
android:popupCharacters="@string/alternates_for_y"
/>
<Key android:keyLabel="z"/>
<Key android:keyLabel=","/>
<Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_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="123"
android:keyEdgeFlags="left" android:keyWidth="18%p"/>
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:keyEdgeFlags="left" android:keyWidth="16%p"/>
<Key
android:codes="@integer/key_voice"
android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p"/>
<Key android:codes="46" android:keyLabel="."
android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="15%p"/>
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
<Key android:keyLabel="," android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="21%p" android:isRepeatable="true"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
<Key android:codes="46" android:keyLabel="."
android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="10%p"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="18%p" android:keyEdgeFlags="right"/>
<Key android:codes="-3" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
android:keyWidth="16%p" />
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="14%p" android:keyEdgeFlags="right"/>
</Row>

</Keyboard>
@@ -22,7 +22,7 @@
android:keyWidth="10%p" android:horizontalGap="0px"
android:verticalGap="0px" android:keyHeight="@dimen/key_height">

<Row android:rowEdgeFlags="bottom">
<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
<Key android:codes="4" android:keyIcon="@drawable/nav_keyboard_back"
android:iconPreview="@drawable/nav_keyboard_feedback_back"
android:keyWidth="15%p" android:keyEdgeFlags="left" />
@@ -44,4 +44,29 @@
android:keyWidth="15%p" android:keyEdgeFlags="right" />
</Row>

<Row android:keyboardMode="@+id/mode_voice" android:rowEdgeFlags="bottom">
<Key android:codes="@integer/key_back" android:keyIcon="@drawable/nav_keyboard_back"
android:iconPreview="@drawable/nav_keyboard_feedback_back"
android:keyWidth="13%p" android:keyEdgeFlags="left" />
<Key android:codes="@integer/key_voice" android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p" />
<Key android:codes="@integer/key_dpad_up" android:keyIcon="@drawable/nav_keyboard_up"
android:iconPreview="@drawable/nav_keyboard_feedback_up"
android:keyWidth="12%p" />
<Key android:codes="@integer/key_dpad_down" android:keyIcon="@drawable/nav_keyboard_down"
android:iconPreview="@drawable/nav_keyboard_feedback_down"
android:keyWidth="12%p" />
<Key android:codes="@integer/key_dpad_left" android:keyIcon="@drawable/nav_keyboard_left"
android:iconPreview="@drawable/nav_keyboard_feedback_left"
android:keyWidth="12%p" />
<Key android:codes="@integer/key_dpad_right" android:keyIcon="@drawable/nav_keyboard_right"
android:iconPreview="@drawable/nav_keyboard_feedback_right"
android:keyWidth="12%p" />
<Key android:codes="@integer/key_dpad_center" android:keyLabel="OK"
android:keyWidth="12%p" />
<Key android:codes="@integer/key_done" android:keyIcon="@drawable/sym_keyboard_show"
android:iconPreview="@drawable/sym_keyboard_feedback_show"
android:keyWidth="14%p" android:keyEdgeFlags="right" />
</Row>
</Keyboard>

This file was deleted.

@@ -0,0 +1,202 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, 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="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
<Key android:codes="119" android:keyLabel="w"/>
<Key android:codes="101" android:keyLabel="e"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_e"
/>
<Key android:codes="114" android:keyLabel="r"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_r"/>
<Key android:codes="116" android:keyLabel="t"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_t"/>
<Key android:codes="121" android:keyLabel="y"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_y"
/>
<Key android:codes="117" android:keyLabel="u"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_u"
/>
<Key android:keyLabel="@string/key_i"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_i"
/>
<Key android:codes="111" android:keyLabel="o"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_o"
/>
<Key android:codes="112" android:keyLabel="p" android:keyEdgeFlags="right"/>
</Row>

<Row>
<Key android:codes="97" android:keyLabel="a"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_a"
android:keyEdgeFlags="left" />
<Key android:codes="115" android:keyLabel="s"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_s" />
<Key android:codes="100" android:keyLabel="d"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_d" />
<Key android:codes="102" android:keyLabel="f" />
<Key android:codes="103" android:keyLabel="g"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_g" />
<Key android:codes="104" android:keyLabel="h" />
<Key android:codes="106" android:keyLabel="j" />
<Key android:codes="107" android:keyLabel="k" />
<Key android:codes="108" android:keyLabel="l"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_l" />
<Key android:codes="@integer/key_variants" android:keyLabel="áž"
android:isModifier="true" android:isSticky="true"
android:keyEdgeFlags="right" />
</Row>

<Row>
<Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:codes="122" android:keyLabel="z"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_z"/>
<Key android:codes="120" android:keyLabel="x"/>
<Key android:codes="99" android:keyLabel="c"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_c"
/>
<Key android:codes="118" android:keyLabel="v"/>
<Key android:codes="98" android:keyLabel="b"/>
<Key android:codes="110" android:keyLabel="n"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_n"
/>
<Key android:codes="109" android:keyLabel="m"/>
<Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
android:keyWidth="15%p" android:keyEdgeFlags="right"
android:iconPreview="@drawable/sym_keyboard_feedback_delete"
android:isRepeatable="true"/>
</Row>

<Row android:keyboardMode="@+id/mode_normal" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
<Key android:keyLabel="," android:keyWidth="10%p" />
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="25%p" 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_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="20%p" />
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
</Row>

<Row android:keyboardMode="@+id/mode_url" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
<!-- <Key android:keyLabel="@string/popular_domain_0"
android:keyOutputText="@string/popular_domain_0"
android:popupKeyboard="@xml/popup_domains"
android:keyWidth="15%p"/> -->
<Key android:keyLabel="/" android:keyWidth="15%p"/>
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="15%p" android:isRepeatable="true"/>
<Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="15%p"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="20%p" />
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
</Row>

<Row android:keyboardMode="@+id/mode_email" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="20%p" android:keyEdgeFlags="left"/>
<Key android:keyLabel="\@" android:keyWidth="15%p"/>
<!-- <Key android:keyLabel="@string/popular_domain_0"
android:keyOutputText="@string/popular_domain_0"
android:popupKeyboard="@xml/popup_domains"
android:keyWidth="15%p"/> -->
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="15%p" android:isRepeatable="true"/>
<Key android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="15%p"/>
<Key android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="20%p"/>
<Key android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right"/>
</Row>

<Row android:keyboardMode="@+id/mode_im" android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="20%p" android:keyEdgeFlags="left"
android:state_single="true"/>
<Key android:keyLabel="," android:keyWidth="10%p"/>
<Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="25%p" android:isRepeatable="true"/>
<Key
android:codes="46"
android:keyLabel="."
android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="10%p" />
<Key
android:keyLabel=":-)" android:keyOutputText=":-) "
android:popupKeyboard="@xml/popup_smileys"
android:keyWidth="20%p" />
<Key
android:codes="-4"
android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="15%p" android:keyEdgeFlags="right" />
</Row>
</Keyboard>
@@ -0,0 +1,261 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2008, 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="113"
android:keyLabel="q"
android:keyEdgeFlags="left" />
<Key android:codes="119" android:keyLabel="w"/>
<Key android:codes="101" android:keyLabel="e"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_e"
/>
<Key android:codes="114" android:keyLabel="r"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_r"/>
<Key android:codes="116" android:keyLabel="t"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_t"/>
<Key android:codes="121" android:keyLabel="y"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_y"
/>
<Key android:codes="117" android:keyLabel="u"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_u"
/>
<Key android:keyLabel="@string/key_i"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_i"
/>
<Key android:codes="111" android:keyLabel="o"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_o"
/>
<Key android:codes="112" android:keyLabel="p" android:keyEdgeFlags="right"/>
</Row>

<Row>
<Key android:codes="97" android:keyLabel="a"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_a"
android:keyEdgeFlags="left" />
<Key android:codes="115" android:keyLabel="s"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_s" />
<Key android:codes="100" android:keyLabel="d"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_d" />
<Key android:codes="102" android:keyLabel="f" />
<Key android:codes="103" android:keyLabel="g"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_g" />
<Key android:codes="104" android:keyLabel="h" />
<Key android:codes="106" android:keyLabel="j" />
<Key android:codes="107" android:keyLabel="k" />
<Key android:codes="108" android:keyLabel="l"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_l" />
<Key android:codes="@integer/key_variants" android:keyLabel="áž"
android:isModifier="true" android:isSticky="true"
android:keyEdgeFlags="right" />
</Row>

<Row>
<Key android:codes="-1" android:keyIcon="@drawable/sym_keyboard_shift"
android:keyWidth="15%p" android:isModifier="true"
android:iconPreview="@drawable/sym_keyboard_feedback_shift"
android:isSticky="true" android:keyEdgeFlags="left"/>
<Key android:codes="122" android:keyLabel="z"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_z"/>
<Key android:codes="120" android:keyLabel="x"/>
<Key android:codes="99" android:keyLabel="c"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_c"
/>
<Key android:codes="118" android:keyLabel="v"/>
<Key android:codes="98" android:keyLabel="b"/>
<Key android:codes="110" android:keyLabel="n"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="@string/alternates_for_n"
/>
<Key android:codes="109" android:keyLabel="m"/>
<Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete"
android:keyWidth="15%p" android:keyEdgeFlags="right"
android:iconPreview="@drawable/sym_keyboard_feedback_delete"
android:isRepeatable="true"/>
</Row>

<Row
android:keyboardMode="@+id/mode_normal"
android:rowEdgeFlags="bottom">
<Key
android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="16%p" android:keyEdgeFlags="left"/>
<Key
android:codes="@integer/key_voice"
android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p"/>
<Key
android:keyLabel="," android:keyWidth="10%p" />
<Key
android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="21%p" 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_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="16%p" />
<Key
android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="14%p" android:keyEdgeFlags="right"/>
</Row>

<Row
android:keyboardMode="@+id/mode_url"
android:rowEdgeFlags="bottom">
<Key
android:codes="-2"
android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_" android:keyWidth="16%p"
android:keyEdgeFlags="left" />
<Key
android:codes="@integer/key_voice"
android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p" />
<!--
<Key android:keyLabel="@string/popular_domain_0"
android:keyOutputText="@string/popular_domain_0"
android:popupKeyboard="@xml/popup_domains" android:keyWidth="15%p"/>
-->
<Key
android:keyLabel="/" android:keyWidth="14%p" />
<Key
android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="15%p" android:isRepeatable="true" />
<Key
android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="10%p" />
<Key
android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="16%p" />
<Key
android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="14%p" android:keyEdgeFlags="right" />
</Row>

<Row
android:keyboardMode="@+id/mode_email"
android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="16%p" android:keyEdgeFlags="left"/>
<Key
android:codes="@integer/key_voice"
android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p"/>
<Key
android:keyLabel="\@"
android:keyWidth="14%p"/>
<!-- <Key android:keyLabel="@string/popular_domain_0"
android:keyOutputText="@string/popular_domain_0"
android:popupKeyboard="@xml/popup_domains"
android:keyWidth="15%p"/> -->
<Key
android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="15%p" android:isRepeatable="true"/>
<Key
android:keyLabel="." android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="10%p"/>
<Key
android:codes="10" android:keyIcon="@drawable/sym_keyboard_return"
android:iconPreview="@drawable/sym_keyboard_feedback_return"
android:keyWidth="16%p"/>
<Key
android:codes="-4" android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="14%p" android:keyEdgeFlags="right"/>
</Row>

<Row
android:keyboardMode="@+id/mode_im"
android:rowEdgeFlags="bottom">
<Key
android:codes="-2"
android:keyLabel="@string/label_symbol_key"
android:popupKeyboard="@xml/kbd_popup_template"
android:popupCharacters="_"
android:keyWidth="16%p"
android:keyEdgeFlags="left" />
<Key
android:codes="@integer/key_voice"
android:keyIcon="@drawable/sym_keyboard_mic"
android:iconPreview="@drawable/sym_keyboard_feedback_mic"
android:keyWidth="13%p"/>
<Key
android:keyLabel=","
android:keyWidth="10%p" />
<Key
android:codes="32"
android:keyIcon="@drawable/sym_keyboard_space"
android:iconPreview="@drawable/sym_keyboard_feedback_space"
android:keyWidth="21%p" android:isRepeatable="true"/>
<Key
android:codes="46"
android:keyLabel="."
android:popupKeyboard="@xml/popup_punctuation"
android:keyWidth="10%p" />
<Key
android:keyLabel=":-)"
android:keyOutputText=":-) "
android:popupKeyboard="@xml/popup_smileys"
android:keyWidth="16%p" />
<Key
android:codes="-4"
android:keyIcon="@drawable/sym_keyboard_done"
android:iconPreview="@drawable/sym_keyboard_feedback_done"
android:keyWidth="14%p" android:keyEdgeFlags="right" />
</Row>
</Keyboard>

@@ -52,8 +52,6 @@ public class TeclaApp extends Application {
private static final long BOOT_TIMEOUT = 60000;
private static final int WAKE_LOCK_TIMEOUT = 5000;

public int KEYCODE_VOICE;

private PowerManager mPowerManager;
private KeyguardManager mKeyguardManager;
private KeyguardLock mKeyguardLock;
@@ -91,8 +89,6 @@ private void init() {
if (TeclaApp.DEBUG) android.os.Debug.waitForDebugger();
Log.d(TAG, "TECLA APP STARTING ON " + Build.MODEL + " BY " + Build.MANUFACTURER);

KEYCODE_VOICE = getResources().getInteger(R.integer.key_voice);

persistence = new Persistence(this);
highlighter = new Highlighter(this);

@@ -147,7 +143,7 @@ public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, "Screen on");
persistence.setScreenOn();
requestSoftIME();
if (persistence.isPersistentKeyboardEnabled()) requestShowIMEView();
}
// if (intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) {
// if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, CLASS_TAG + "Phone state changed");
@@ -163,16 +159,16 @@ public void onReceive(Context context, Intent intent) {

};

public void requestSoftIME() {
requestSoftIME(0);
public void requestShowIMEView() {
requestShowIMEView(0);
}

public void requestSoftIME(long delay) {
mHandler.removeCallbacks(mRequestSoftIMERunnable);
mHandler.postDelayed(mRequestSoftIMERunnable, delay);
public void requestShowIMEView(long delay) {
mHandler.removeCallbacks(mRequestShowIMERunnable);
mHandler.postDelayed(mRequestShowIMERunnable, delay);
}

private Runnable mRequestSoftIMERunnable = new Runnable() {
private Runnable mRequestShowIMERunnable = new Runnable() {

@Override
public void run() {
@@ -182,7 +178,7 @@ public void run() {

};

public void hideSoftIME() {
public void requestHideIMEView() {
if (DEBUG) Log.d(TAG, "Broadcasting hide IME intent...");
sendBroadcast(new Intent(ACTION_HIDE_IME));
}
@@ -243,23 +239,27 @@ public void queueSplash() {
if (isDefaultIME()) {
long now = SystemClock.uptimeMillis();
if (persistence.isPersistentKeyboardEnabled()) {
// Show configuration splash
if (now < BOOT_TIMEOUT) {
// If just booted, wait a bit before calling splash
Log.w(TeclaApp.TAG, "Delayed call to show splash screen");
new Handler().postAtTime(new Runnable() {

public void run() {
showSplashScreen();
}

}, BOOT_TIMEOUT);
mHandler.removeCallbacks(mShowSplashRunnable);
mHandler.postAtTime(mShowSplashRunnable, BOOT_TIMEOUT);
} else {
showSplashScreen();
mHandler.post(mShowSplashRunnable);
}
}
}
}

private Runnable mShowSplashRunnable = new Runnable() {

@Override
public void run() {
// Show configuration splash
showSplashScreen();
}

};

public void showSplashScreen() {
if (DEBUG) Log.d(TAG, "Showing splash screen...");
@@ -35,7 +35,6 @@
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup;
@@ -56,8 +55,9 @@ public class TeclaPrefs extends PreferenceActivity

private CheckBoxPreference mQuickFixes;
private CheckBoxPreference mShowSuggestions;

private CheckBoxPreference mPrefVoiceInput;
private CheckBoxPreference mPrefVariantsKey;

private CheckBoxPreference mPrefPersistentKeyboard;
private Preference mPrefAutohideTimeout;
private CheckBoxPreference mPrefConnectToShield;
@@ -88,6 +88,7 @@ private void init() {
mQuickFixes = (CheckBoxPreference) findPreference(QUICK_FIXES_KEY);
mShowSuggestions = (CheckBoxPreference) findPreference(SHOW_SUGGESTIONS_KEY);
mPrefVoiceInput = (CheckBoxPreference) findPreference(Persistence.PREF_VOICE_INPUT);
mPrefVariantsKey = (CheckBoxPreference) findPreference(Persistence.PREF_VARIANTS_KEY);
mPrefPersistentKeyboard = (CheckBoxPreference) findPreference(Persistence.PREF_PERSISTENT_KEYBOARD);
mPrefAutohideTimeout = (Preference) findPreference(Persistence.PREF_AUTOHIDE_TIMEOUT);
mAutohideTimeoutDialog = new NavKbdTimeoutDialog(this);
@@ -248,39 +249,39 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,

public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(Persistence.PREF_VOICE_INPUT)) {
if (key.equals(Persistence.PREF_VOICE_INPUT) || key.equals(Persistence.PREF_VARIANTS_KEY)) {
if (mPrefPersistentKeyboard.isChecked()) {
//Reset IME
TeclaApp.getInstance().hideSoftIME();
TeclaApp.getInstance().requestSoftIME();
TeclaApp.getInstance().requestHideIMEView();
TeclaApp.getInstance().requestShowIMEView();
}
}
if (key.equals(Persistence.PREF_PERSISTENT_KEYBOARD)) {
if (mPrefPersistentKeyboard.isChecked()) {
// Show keyboard immediately if Tecla Access IME is selected
TeclaApp.getInstance().requestSoftIME();
TeclaApp.getInstance().requestShowIMEView();
} else {
mPrefSelfScanning.setChecked(false);
mPrefSelfScanning.setEnabled(false);
mPrefInverseScanning.setChecked(false);
mPrefInverseScanning.setEnabled(false);
mPrefFullScreenSwitch.setChecked(false);
mPrefConnectToShield.setChecked(false);
TeclaApp.getInstance().hideSoftIME();
TeclaApp.getInstance().requestHideIMEView();
}
}
if (key.equals(Persistence.PREF_AUTOHIDE_TIMEOUT)) {
if (mPrefPersistentKeyboard.isChecked()) {
// Show keyboard immediately if Tecla Access IME is selected
TeclaApp.getInstance().requestSoftIME();
TeclaApp.getInstance().requestShowIMEView();
} else {
mPrefSelfScanning.setChecked(false);
mPrefSelfScanning.setEnabled(false);
mPrefInverseScanning.setChecked(false);
mPrefInverseScanning.setEnabled(false);
mPrefFullScreenSwitch.setChecked(false);
mPrefConnectToShield.setChecked(false);
TeclaApp.getInstance().hideSoftIME();
TeclaApp.getInstance().requestHideIMEView();
}
}
if (key.equals(Persistence.PREF_CONNECT_TO_SHIELD)) {
@@ -72,15 +72,14 @@ protected void onStart() {
//and we won't want to unregister, either:
mReceiver=null;
}
TeclaApp.getInstance().requestSoftIME(4000);
TeclaApp.getInstance().requestShowIMEView(4000);
Log.d(TeclaApp.TAG, CLASS_TAG + "Splash started.");
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.w(TeclaApp.TAG, CLASS_TAG + "Splash called again!");
TeclaApp.getInstance().requestSoftIME(4000);
Log.w(TeclaApp.TAG, CLASS_TAG + "Ignoring duplicate call to show Splash");
}

// All intents will be processed here
@@ -105,7 +104,7 @@ protected void onDestroy() {
if (mReceiver != null)
unregisterReceiver(mReceiver);
// Sometimes IME hides so show it again!
TeclaApp.getInstance().requestSoftIME();
TeclaApp.getInstance().requestShowIMEView();
if (!mConnectToShieldCalled) {
connectToShield();
}
@@ -21,8 +21,6 @@

import ca.idi.tekla.R;
import ca.idi.tekla.TeclaApp;
import ca.idi.tekla.R.id;
import ca.idi.tekla.R.xml;

public class KeyboardSwitcher {

@@ -42,7 +40,9 @@ public class KeyboardSwitcher {
public static final int KEYBOARDMODE_URL = R.id.mode_url;
public static final int KEYBOARDMODE_EMAIL = R.id.mode_email;
public static final int KEYBOARDMODE_IM = R.id.mode_im;

public static final int KEYBOARDMODE_VOICE = R.id.mode_voice;
public static final int KEYBOARDMODE_VARIANTS = R.id.mode_variants;

private static final int SYMBOLS_MODE_STATE_NONE = 0;
private static final int SYMBOLS_MODE_STATE_BEGIN = 1;
private static final int SYMBOLS_MODE_STATE_SYMBOL = 2;
@@ -54,7 +54,7 @@ public class KeyboardSwitcher {
private KeyboardId mSymbolsShiftedId;

private KeyboardId mCurrentId;
private Map<KeyboardId, LatinKeyboard> mKeyboards;
private Map<KeyboardId, TeclaKeyboard> mKeyboards;

private int mMode;
private int mImeOptions;
@@ -67,7 +67,7 @@ public class KeyboardSwitcher {

KeyboardSwitcher(TeclaIME context) {
mContext = context;
mKeyboards = new HashMap<KeyboardId, LatinKeyboard>();
mKeyboards = new HashMap<KeyboardId, TeclaKeyboard>();
mSymbolsId = new KeyboardId(R.xml.kbd_symbols);
mSymbolsShiftedId = new KeyboardId(R.xml.kbd_symbols_shift);
}
@@ -134,7 +134,7 @@ void setKeyboardMode(int mode, int imeOptions, boolean isSymbols) {
mIsSymbols = isSymbols;
mIMEView.setPreviewEnabled(true);
KeyboardId id = getKeyboardId(mode, imeOptions, isSymbols);
LatinKeyboard keyboard = getKeyboard(id);
TeclaKeyboard keyboard = getKeyboard(id);

if (mode == MODE_PHONE) {
mIMEView.setPhoneKeyboard(keyboard);
@@ -149,9 +149,9 @@ void setKeyboardMode(int mode, int imeOptions, boolean isSymbols) {

}

private LatinKeyboard getKeyboard(KeyboardId id) {
private TeclaKeyboard getKeyboard(KeyboardId id) {
if (!mKeyboards.containsKey(id)) {
LatinKeyboard keyboard = new LatinKeyboard(
TeclaKeyboard keyboard = new TeclaKeyboard(
mContext, id.mXml, id.mMode);
if (id.mEnableShiftLock) {
keyboard.enableShiftLock();
@@ -166,6 +166,8 @@ private KeyboardId getKeyboardId(int mode, int imeOptions, boolean isSymbols) {
boolean useVoiceInput =
TeclaApp.getInstance().isVoiceInputSupported() &&
TeclaApp.persistence.isVoiceInputEnabled();
boolean scanVariants =
TeclaApp.persistence.isVariantsKeyEnabled();

if (isSymbols) {
return (mode == MODE_PHONE)
@@ -174,13 +176,29 @@ private KeyboardId getKeyboardId(int mode, int imeOptions, boolean isSymbols) {

switch (mode) {
case MODE_TEXT:
if (useVoiceInput) {
if (useVoiceInput && scanVariants) {
// Using voice input AND scanning variants
if (mTextMode == MODE_TEXT_QWERTY) {
return new KeyboardId(R.xml.kbd_qwerty_voice_variants, KEYBOARDMODE_NORMAL, true);
} else if (mTextMode == MODE_TEXT_ALPHA) {
return new KeyboardId(R.xml.kbd_alpha_voice_variants, KEYBOARDMODE_NORMAL, true);
}
} else if (useVoiceInput) {
// Using voice input only
if (mTextMode == MODE_TEXT_QWERTY) {
return new KeyboardId(R.xml.kbd_qwerty_voice, KEYBOARDMODE_NORMAL, true);
} else if (mTextMode == MODE_TEXT_ALPHA) {
return new KeyboardId(R.xml.kbd_alpha_voice, KEYBOARDMODE_NORMAL, true);
return new KeyboardId(R.xml.kbd_alpha, KEYBOARDMODE_VOICE, true);
}
}
} else if (scanVariants) {
// Scanning variants only
if (mTextMode == MODE_TEXT_QWERTY) {
return new KeyboardId(R.xml.kbd_qwerty_variants, KEYBOARDMODE_NORMAL, true);
} else if (mTextMode == MODE_TEXT_ALPHA) {
return new KeyboardId(R.xml.kbd_alpha, KEYBOARDMODE_VARIANTS, true);
}
} else
//Default
if (mTextMode == MODE_TEXT_QWERTY) {
return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_NORMAL, true);
} else if (mTextMode == MODE_TEXT_ALPHA) {
@@ -208,7 +226,7 @@ private KeyboardId getKeyboardId(int mode, int imeOptions, boolean isSymbols) {
return new KeyboardId(R.xml.kbd_qwerty, KEYBOARDMODE_IM, true);
case MODE_NAV:
if (useVoiceInput) {
return new KeyboardId(R.xml.kbd_navigation_voice, KEYBOARDMODE_NORMAL, true);
return new KeyboardId(R.xml.kbd_navigation, KEYBOARDMODE_VOICE, true);
}
return new KeyboardId(R.xml.kbd_navigation, KEYBOARDMODE_NORMAL, true);
}
@@ -250,16 +268,16 @@ boolean isAlphabetMode() {

void toggleShift() {
if (mCurrentId.equals(mSymbolsId)) {
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
TeclaKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
TeclaKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
symbolsKeyboard.setShifted(true);
mCurrentId = mSymbolsShiftedId;
mIMEView.setKeyboard(symbolsShiftedKeyboard);
symbolsShiftedKeyboard.setShifted(true);
symbolsShiftedKeyboard.setImeOptions(mContext.getResources(), mMode, mImeOptions);
} else if (mCurrentId.equals(mSymbolsShiftedId)) {
LatinKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
LatinKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
TeclaKeyboard symbolsKeyboard = getKeyboard(mSymbolsId);
TeclaKeyboard symbolsShiftedKeyboard = getKeyboard(mSymbolsShiftedId);
symbolsShiftedKeyboard.setShifted(false);
mCurrentId = mSymbolsId;
mIMEView.setKeyboard(getKeyboard(mSymbolsId));
@@ -27,6 +27,7 @@
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.Keyboard.Key;
import android.media.AudioManager;
import android.os.Debug;
import android.os.Handler;
@@ -254,7 +255,7 @@ public View onCreateInputView() {
mIMEView.setOnKeyboardActionListener(this);
mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_NAV, 0);
if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, CLASS_TAG + "Soft IME view created.");
TeclaApp.highlighter.setView(mIMEView);
TeclaApp.highlighter.setIMEView(mIMEView);
return mIMEView;
}

@@ -560,7 +561,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
public void onWindowHidden() {
super.onWindowHidden();
if (shouldShowIME() && !isNavKbdTimedOut) {
showSoftIME();
showIMEView();
if (TeclaApp.highlighter.isSoftIMEShowing()) {
mKeyboardSwitcher.setKeyboardMode(KeyboardSwitcher.MODE_NAV, 0);
evaluateStartScanning();
@@ -589,7 +590,7 @@ public void onReceive(Context context, Intent intent) {
if (action.equals(SwitchEventProvider.ACTION_SHIELD_CONNECTED)) {
if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, CLASS_TAG + "Received Shield connected intent.");
if (!mShieldConnected) mShieldConnected = true;
showSoftIME();
showIMEView();
evaluateStartScanning();
}
if (action.equals(SwitchEventProvider.ACTION_SHIELD_DISCONNECTED)) {
@@ -599,7 +600,7 @@ public void onReceive(Context context, Intent intent) {
}
if (action.equals(TeclaApp.ACTION_SHOW_IME)) {
if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, CLASS_TAG + "Received show IME intent.");
showSoftIME();
showIMEView();
evaluateStartScanning();
evaluateNavKbdTimeout();
//TODO: Assume/force persistent keyboard preference
@@ -820,40 +821,55 @@ private void handleShift() {
}

private void handleCharacter(int primaryCode, int[] keyCodes) {
if (isAlphabet(primaryCode) && isPredictionOn() && !isCursorTouchingWord()) {
if (!mPredicting) {
mPredicting = true;
mComposing.setLength(0);
mWord.reset();
}
}
if (mIMEView.isShifted()) {
// TODO: This doesn't work with ß, need to fix it in the next release.
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|| keyCodes[0] > Character.MAX_CODE_POINT) {
return;
if (TeclaApp.persistence.isVariantsOn() && hasVariants(primaryCode)) {
//TODO: Just switch keyboard
} else {
if (isAlphabet(primaryCode) && isPredictionOn() && !isCursorTouchingWord()) {
if (!mPredicting) {
mPredicting = true;
mComposing.setLength(0);
mWord.reset();
}
}
primaryCode = new String(keyCodes, 0, 1).toUpperCase().charAt(0);
}
if (mPredicting) {
if (mIMEView.isShifted() && mComposing.length() == 0) {
mWord.setCapitalized(true);
if (mIMEView.isShifted()) {
// TODO: This doesn't work with ß, need to fix it in the next release.
if (keyCodes == null || keyCodes[0] < Character.MIN_CODE_POINT
|| keyCodes[0] > Character.MAX_CODE_POINT) {
return;
}
primaryCode = new String(keyCodes, 0, 1).toUpperCase().charAt(0);
}
mComposing.append((char) primaryCode);
mWord.add(primaryCode, keyCodes);
InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ic.setComposingText(mComposing, 1);
if (mPredicting) {
if (mIMEView.isShifted() && mComposing.length() == 0) {
mWord.setCapitalized(true);
}
mComposing.append((char) primaryCode);
mWord.add(primaryCode, keyCodes);
InputConnection ic = getCurrentInputConnection();
if (ic != null) {
ic.setComposingText(mComposing, 1);
}
postUpdateSuggestions();
} else {
sendKeyChar((char)primaryCode);
}
postUpdateSuggestions();
} else {
sendKeyChar((char)primaryCode);
updateShiftKeyState(getCurrentInputEditorInfo());
measureCps();
TextEntryState.typedCharacter((char) primaryCode, isWordSeparator(primaryCode));
}
updateShiftKeyState(getCurrentInputEditorInfo());
measureCps();
TextEntryState.typedCharacter((char) primaryCode, isWordSeparator(primaryCode));
}

//FIXME: Consider moving to TeclaKeyboardView class
private boolean hasVariants(int keycode) {
//TODO: Return whether the given key has character variants
return false;
}

private boolean isVariantsKeyOn() {
//TODO: Return whether the given key has character variants
return false;
}

private void handleSeparator(int primaryCode) {
boolean pickedDefault = false;
// Handle separator
@@ -910,7 +926,7 @@ private void checkToggleCapsLock() {
private void toggleCapsLock() {
mCapsLock = !mCapsLock;
if (mKeyboardSwitcher.isAlphabetMode()) {
((LatinKeyboard) mIMEView.getKeyboard()).setShiftLocked(mCapsLock);
((TeclaKeyboard) mIMEView.getKeyboard()).setShiftLocked(mCapsLock);
}
}

@@ -1263,7 +1279,7 @@ public void onClick(DialogInterface di, int position) {
private void changeKeyboardMode() {
mKeyboardSwitcher.toggleSymbols();
if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) {
((LatinKeyboard) mIMEView.getKeyboard()).setShiftLocked(mCapsLock);
((TeclaKeyboard) mIMEView.getKeyboard()).setShiftLocked(mCapsLock);
}

updateShiftKeyState(getCurrentInputEditorInfo());
@@ -1398,7 +1414,7 @@ private void handleSwitchEvent(SwitchEvent switchEvent) {

cancelNavKbdTimeout();
if (!TeclaApp.highlighter.isSoftIMEShowing()) {
showSoftIME();
showIMEView();
TeclaApp.highlighter.startSelfScanning();
} else {
if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, CLASS_TAG + "Switch event received: " +
@@ -1512,7 +1528,8 @@ private boolean isSpecialKey(int keycode) {
&& (keycode<=KeyEvent.KEYCODE_DPAD_CENTER))
|| (keycode == KeyEvent.KEYCODE_BACK)
|| (keycode == Keyboard.KEYCODE_DONE)
|| (keycode == TeclaApp.getInstance().KEYCODE_VOICE);
|| (keycode == TeclaKeyboard.KEYCODE_VOICE)
|| (keycode == TeclaKeyboard.KEYCODE_VARIANTS);
}

private void handleSpecialKey(int keyEventCode) {
@@ -1528,12 +1545,26 @@ private void handleSpecialKey(int keyEventCode) {
mKeyboardSwitcher.setKeyboardMode(mLastNonUIKeyboardMode, 0);
evaluateStartScanning();
}
} else if (keyEventCode == TeclaApp.getInstance().KEYCODE_VOICE) {
} else if (keyEventCode == TeclaKeyboard.KEYCODE_VOICE) {
if (thisKBMode == KeyboardSwitcher.MODE_NAV) {
TeclaApp.getInstance().broadcastVoiceCommand();
} else {
TeclaApp.getInstance().startVoiceInput(RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
}
} else if (keyEventCode == TeclaKeyboard.KEYCODE_VARIANTS) {
Key key = mIMEView.getKeyboard().getVariantsKey();
if (key != null) {
Log.d(TeclaApp.TAG, CLASS_TAG + "Variants key code is " + key.codes[0]);
if (key.on) {
//TODO: Move string to resources
TeclaApp.getInstance().showToast("Accents & variants enabled");
TeclaApp.persistence.setVariantsOn();
} else {
//TODO: Move string to resources
TeclaApp.getInstance().showToast("Accents & variants disabled");
TeclaApp.persistence.setVariantsOff();
}
}
} else {
keyDownUp(keyEventCode);
}
@@ -1550,7 +1581,7 @@ private void keyDownUp(int keyEventCode) {
}

private boolean isRepeatableWithTecla(int code) {
if (code == Keyboard.KEYCODE_DONE ||code == TeclaApp.getInstance().KEYCODE_VOICE) {
if (code == TeclaKeyboard.KEYCODE_DONE ||code == TeclaKeyboard.KEYCODE_VOICE) {
return false;
}
return true;
@@ -1719,7 +1750,7 @@ private boolean shouldShowIME() {
return TeclaApp.persistence.isPersistentKeyboardEnabled();
}

private void showSoftIME() {
private void showIMEView() {
if (TeclaApp.highlighter.isSoftIMEShowing()) {
if (TeclaApp.DEBUG) Log.d(TeclaApp.TAG, CLASS_TAG + "Soft IME is already showing");
} else {
@@ -1742,7 +1773,7 @@ public void run() {
// If IME View still not showing...
// We are force-openning the soft IME through an intent since
//it seems to be the only way to make it work
TeclaApp.getInstance().requestSoftIME();
TeclaApp.getInstance().requestShowIMEView();
}
}

@@ -16,7 +16,11 @@

package ca.idi.tekla.ime;

import java.util.Iterator;
import java.util.List;

import ca.idi.tekla.R;
import ca.idi.tekla.TeclaApp;
import ca.idi.tekla.R.dimen;
import ca.idi.tekla.R.drawable;
import ca.idi.tekla.R.string;
@@ -27,9 +31,14 @@
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.Keyboard.Key;
import android.util.Log;
import android.view.inputmethod.EditorInfo;

public class LatinKeyboard extends Keyboard {
public class TeclaKeyboard extends Keyboard {

public static int KEYCODE_VOICE = -202;
public static int KEYCODE_VARIANTS = -222;

private Drawable mShiftLockIcon;
private Drawable mShiftLockPreviewIcon;
@@ -46,11 +55,11 @@ public class LatinKeyboard extends Keyboard {

static int sSpacebarVerticalCorrection;

public LatinKeyboard(Context context, int xmlLayoutResId) {
public TeclaKeyboard(Context context, int xmlLayoutResId) {
this(context, xmlLayoutResId, 0);
}

public LatinKeyboard(Context context, int xmlLayoutResId, int mode) {
public TeclaKeyboard(Context context, int xmlLayoutResId, int mode) {
super(context, xmlLayoutResId, mode);
Resources res = context.getResources();
mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
@@ -62,15 +71,15 @@ public LatinKeyboard(Context context, int xmlLayoutResId, int mode) {
R.dimen.spacebar_vertical_correction);
}

public LatinKeyboard(Context context, int layoutTemplateResId,
public TeclaKeyboard(Context context, int layoutTemplateResId,
CharSequence characters, int columns, int horizontalPadding) {
super(context, layoutTemplateResId, characters, columns, horizontalPadding);
}

@Override
protected Key createKeyFromXml(Resources res, Row parent, int x, int y,
XmlResourceParser parser) {
Key key = new LatinKey(res, parent, x, y, parser);
Key key = new TeclaKey(res, parent, x, y, parser);
if (key.codes[0] == 10) {
mEnterKey = key;
}
@@ -140,8 +149,8 @@ void enableShiftLock() {
int index = getShiftKeyIndex();
if (index >= 0) {
mShiftKey = getKeys().get(index);
if (mShiftKey instanceof LatinKey) {
((LatinKey)mShiftKey).enableShiftLock();
if (mShiftKey instanceof TeclaKey) {
((TeclaKey)mShiftKey).enableShiftLock();
}
mOldShiftIcon = mShiftKey.icon;
mOldShiftPreviewIcon = mShiftKey.iconPreview;
@@ -197,11 +206,11 @@ public boolean isShifted() {
}
}

static class LatinKey extends Keyboard.Key {
static class TeclaKey extends Keyboard.Key {

private boolean mShiftLockEnabled;

public LatinKey(Resources res, Keyboard.Row parent, int x, int y,
public TeclaKey(Resources res, Keyboard.Row parent, int x, int y,
XmlResourceParser parser) {
super(res, parent, x, y, parser);
if (popupCharacters != null && popupCharacters.length() == 0) {
@@ -235,9 +244,108 @@ public boolean isInside(int x, int y) {
if (code == KEYCODE_SHIFT) x += width / 6;
if (code == KEYCODE_DELETE) x -= width / 6;
} else if (code == TeclaIME.KEYCODE_SPACE) {
y += LatinKeyboard.sSpacebarVerticalCorrection;
y += TeclaKeyboard.sSpacebarVerticalCorrection;
}
return super.isInside(x, y);
}
}

/**
* Tag used for logging in this class
*/
private static final String CLASS_TAG = "TeclaKeyboard: ";

public Integer getRowCount() {
List<Key> keyList = getKeys();
Key key;
int rowCounter = 0;
int coord = 0;
for (Iterator<Key> i = keyList.iterator(); i.hasNext();) {
key = i.next();
if (rowCounter == 0) {
rowCounter++;
coord = key.y;
}
if (coord != key.y) {
rowCounter++;
coord = key.y;
}
}
return rowCounter;
}

public Integer getRowStart(int rowNumber) {
int keyCounter = 0;
if (rowNumber != 0) {
List<Key> keyList = getKeys();
Key key;
int rowCounter = 0;
int prevCoord = keyList.get(0).y;
int thisCoord;
while (rowCounter != rowNumber) {
keyCounter++;
key = keyList.get(keyCounter);
thisCoord = key.y;
if (thisCoord != prevCoord) {
// Changed rows
rowCounter++;
prevCoord = thisCoord;
}
}
}
return keyCounter;
}

public Integer getRowEnd(int rowNumber) {
List<Key> keyList = getKeys();
int totalKeys = keyList.size();
int keyCounter = 0;
if (rowNumber == (getRowCount() - 1)) {
keyCounter = totalKeys - 1;
} else {
Key key;
int rowCounter = 0;
int prevCoord = keyList.get(0).y;
int thisCoord;
while (rowCounter <= rowNumber) {
keyCounter++;
key = keyList.get(keyCounter);
thisCoord = key.y;
if (thisCoord != prevCoord) {
// Changed rows
rowCounter++;
prevCoord = thisCoord;
}
}
keyCounter--;
}
return keyCounter;
}

/**
* Get the variants key index
* @return the variants key index or null if the keyboard doesn't have a variants key
*/
public int getVariantsKeyIndex() {
List<Key> keys = getKeys();
int i = 0;
Key key = keys.get(i);
while (((i + 1) < keys.size()) && (key.codes[0] != TeclaKeyboard.KEYCODE_VARIANTS)) {
i++;
key = keys.get(i);
}
Log.d(TeclaApp.TAG, CLASS_TAG + "There are " + keys.size() + " keys.");
Log.d(TeclaApp.TAG, CLASS_TAG + "Variants key index is " + i);
return key.codes[0] == TeclaKeyboard.KEYCODE_VARIANTS? i : -1;
}

public Key getVariantsKey() {
int index = getVariantsKeyIndex();
List<Key> keyList = getKeys();
if (index > -1) {
return keyList.get(index);
}
return null;
}

}
@@ -65,9 +65,13 @@ protected boolean onLongPress(Key key) {
return super.onLongPress(key);
}
}


/**************************** INSTRUMENTATION *******************************/
@Override
public TeclaKeyboard getKeyboard() {
return (TeclaKeyboard) super.getKeyboard();
}

/**************************** INSTRUMENTATION *******************************/

static final boolean DEBUG_AUTO_PLAY = false;
private static final int MSG_TOUCH_DOWN = 1;
@@ -4,18 +4,17 @@

package ca.idi.tekla.util;

import java.util.Iterator;
import java.util.List;

import android.content.Context;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.Keyboard.Key;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.util.Log;
import ca.idi.tekla.TeclaApp;
import ca.idi.tekla.ime.TeclaKeyboard;
import ca.idi.tekla.ime.TeclaKeyboardView;

public class Highlighter {

@@ -32,7 +31,7 @@ public class Highlighter {

private int mScanDepth;
private int mScanKeyCounter, mScanRowCounter;
private KeyboardView mIMEView;
private TeclaKeyboardView mIMEView;
private Handler mHandler;

public Highlighter(Context context) {
@@ -60,10 +59,10 @@ public void handleMessage(Message msg) {
* Set the input method view that the highlighter will work on.
* @param imeView the input method view the highlighter class will work on.
*/
public void setView(KeyboardView imeView) {
public void setIMEView(TeclaKeyboardView imeView) {
TeclaApp.getInstance().broadcastInputViewCreated();
mIMEView = imeView;
if (getRowCount(mIMEView.getKeyboard()) == 1) {
if (mIMEView.getKeyboard().getRowCount() == 1) {
mScanDepth = Highlighter.DEPTH_KEY;
}
}
@@ -108,8 +107,8 @@ public void doSelectRow() {
}

public void move(int direction) {
Keyboard keyboard = mIMEView.getKeyboard();
int rowCount = getRowCount(keyboard);
TeclaKeyboard keyboard = mIMEView.getKeyboard();
int rowCount = keyboard.getRowCount();

if (rowCount == 1) {
mScanDepth = DEPTH_KEY;
@@ -120,8 +119,8 @@ public void move(int direction) {
if (direction == Highlighter.HIGHLIGHT_PREV) mScanRowCounter--;
mScanRowCounter = wrapCounter(mScanRowCounter, 0, rowCount - 1);
}
int fromIndex = getRowStart(keyboard, mScanRowCounter);
int toIndex = getRowEnd(keyboard, mScanRowCounter);
int fromIndex = keyboard.getRowStart(mScanRowCounter);
int toIndex = keyboard.getRowEnd(mScanRowCounter);
if (mScanDepth == Highlighter.DEPTH_KEY) {
if (direction == Highlighter.HIGHLIGHT_NEXT) mScanKeyCounter++;
if (direction == Highlighter.HIGHLIGHT_PREV) mScanKeyCounter--;
@@ -132,21 +131,21 @@ public void move(int direction) {
}

public void stepOut() {
Keyboard keyboard = mIMEView.getKeyboard();
if (getRowCount(keyboard) != 1) {
TeclaKeyboard keyboard = mIMEView.getKeyboard();
if (keyboard.getRowCount() != 1) {
mScanDepth = Highlighter.DEPTH_ROW;
highlightKeys(
getRowStart(keyboard, mScanRowCounter),
getRowEnd(keyboard, mScanRowCounter));
keyboard.getRowStart(mScanRowCounter),
keyboard.getRowEnd(mScanRowCounter));
}
}

public int getScanDepth() {
return mScanDepth;
}

public Keyboard.Key getCurrentKey() {
Keyboard keyboard = mIMEView.getKeyboard();
public TeclaKeyboard.Key getCurrentKey() {
TeclaKeyboard keyboard = mIMEView.getKeyboard();
List<Key> keyList = keyboard.getKeys();
return keyList.get(mScanKeyCounter);
}
@@ -224,7 +223,7 @@ public void run() {
* Start highlighting the current keyboard. Automatically handles single row keyboards.
*/
private void init() {
if (getRowCount(mIMEView.getKeyboard()) > 1) {
if (mIMEView.getKeyboard().getRowCount() > 1) {
//Keyboard has multiple rows
mScanDepth = DEPTH_ROW;
mScanKeyCounter = 0;
@@ -237,41 +236,22 @@ private void init() {
}

private boolean shouldDelayKey(int keyCode) {
if (keyCode == Keyboard.KEYCODE_DONE ||
keyCode == Keyboard.KEYCODE_MODE_CHANGE ||
keyCode == Keyboard.KEYCODE_SHIFT) {
if (keyCode == TeclaKeyboard.KEYCODE_DONE ||
keyCode == TeclaKeyboard.KEYCODE_MODE_CHANGE ||
keyCode == TeclaKeyboard.KEYCODE_SHIFT) {
return false;
}
return true;
}

private void initRowHighlighting() {
mScanDepth = DEPTH_KEY;
mScanKeyCounter = getRowStart(mIMEView.getKeyboard(), mScanRowCounter);
mScanKeyCounter = mIMEView.getKeyboard().getRowStart(mScanRowCounter);
restoreHighlight();
}

private Integer getRowCount(Keyboard keyboard) {
List<Key> keyList = keyboard.getKeys();
Key key;
int rowCounter = 0;
int coord = 0;
for (Iterator<Key> i = keyList.iterator(); i.hasNext();) {
key = i.next();
if (rowCounter == 0) {
rowCounter++;
coord = key.y;
}
if (coord != key.y) {
rowCounter++;
coord = key.y;
}
}
return rowCounter;
}

private void highlightKeys(int fromIndex, int toIndex) {
Keyboard keyboard = mIMEView.getKeyboard();
TeclaKeyboard keyboard = mIMEView.getKeyboard();
List<Key> keyList = keyboard.getKeys();
int totalKeys = keyList.size();
Key key;
@@ -301,52 +281,4 @@ private void redrawInputView () {
mHandler.sendMessage(msg);
}

private Integer getRowStart(Keyboard keyboard, int rowNumber) {
int keyCounter = 0;
if (rowNumber != 0) {
List<Key> keyList = keyboard.getKeys();
Key key;
int rowCounter = 0;
int prevCoord = keyList.get(0).y;
int thisCoord;
while (rowCounter != rowNumber) {
keyCounter++;
key = keyList.get(keyCounter);
thisCoord = key.y;
if (thisCoord != prevCoord) {
// Changed rows
rowCounter++;
prevCoord = thisCoord;
}
}
}
return keyCounter;
}

private Integer getRowEnd(Keyboard keyboard, int rowNumber) {
List<Key> keyList = keyboard.getKeys();
int totalKeys = keyList.size();
int keyCounter = 0;
if (rowNumber == (getRowCount(keyboard) - 1)) {
keyCounter = totalKeys - 1;
} else {
Key key;
int rowCounter = 0;
int prevCoord = keyList.get(0).y;
int thisCoord;
while (rowCounter <= rowNumber) {
keyCounter++;
key = keyList.get(keyCounter);
thisCoord = key.y;
if (thisCoord != prevCoord) {
// Changed rows
rowCounter++;
prevCoord = thisCoord;
}
}
keyCounter--;
}
return keyCounter;
}

}
@@ -16,6 +16,8 @@ public class Persistence {
//public static final String PREF_SHIELD_VERSION = "shield_version";

public static final String PREF_VOICE_INPUT = "voice_input";
public static final String PREF_VARIANTS = "variants";
public static final String PREF_VARIANTS_KEY = "variants_key";
public static final String PREF_PERSISTENT_KEYBOARD = "persistent_keyboard";
public static final String PREF_AUTOHIDE_TIMEOUT = "autohide_timeout";
public static final String PREF_CONNECT_TO_SHIELD = "shield_connect";
@@ -30,7 +32,7 @@ public class Persistence {
public static final int AUTOHIDE_NULL = -999;
public static final int NEVER_AUTOHIDE = -1;

private boolean mScreenOn, mInverseScanningChanged;
private boolean mScreenOn, mInverseScanningChanged, mVariantsOn;;

private SharedPreferences shared_prefs;
private SharedPreferences.Editor prefs_editor;
@@ -58,6 +60,24 @@ public boolean isVoiceInputEnabled() {
return shared_prefs.getBoolean(PREF_VOICE_INPUT, false);
}

public boolean isVariantsKeyEnabled() {
return shared_prefs.getBoolean(PREF_VARIANTS_KEY, false);
}

public boolean isVariantsOn() {
return shared_prefs.getBoolean(PREF_VARIANTS, false);
}

public void setVariantsOn() {
prefs_editor.putBoolean(PREF_VARIANTS, true);
prefs_editor.commit();
}

public void setVariantsOff() {
prefs_editor.putBoolean(PREF_VARIANTS, false);
prefs_editor.commit();
}

public boolean isPersistentKeyboardEnabled() {
return shared_prefs.getBoolean(PREF_PERSISTENT_KEYBOARD, false);
}