diff options
author | Daisuke Miyakawa <dmiyakawa@google.com> | 2009-06-16 16:31:48 +0900 |
---|---|---|
committer | Daisuke Miyakawa <dmiyakawa@google.com> | 2009-06-16 16:31:48 +0900 |
commit | e83971e4dafd53e9fb00386355afdbae7e00c0cf (patch) | |
tree | cce08346d5b5f6b79751262c01159d4e57069fe6 | |
parent | 88ebeb3fe2cfc4652432b2dec1d5e9c23c77d684 (diff) | |
download | OpenWnn-e83971e4dafd53e9fb00386355afdbae7e00c0cf.tar.gz |
Update OpenWnn in donut to the latest.
This change includes Tutorial-related change done in cupcake.
210 files changed, 4240 insertions, 3818 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index bf146ea..9c4bb48 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -21,7 +21,7 @@ <uses-permission xmlns:android="http://schemas.android.com/apk/res/android" android:name="android.permission.VIBRATE"/> <application android:label="OpenWnn"> - <service android:name="OpenWnnJAJP" android:label="OpenWnn Japanese" + <service android:name="OpenWnnJAJP" android:label="Japanese IME" android:permission="android.permission.BIND_INPUT_METHOD" android:id="@+id/openwnn_japanese"> <intent-filter> @@ -1,14 +1,14 @@ ------------------------------------------------------------------------------- - OpenWnn for Android README + OpenWnn README - Version 1.21-RC-20090403 + Version 1.3.1 (C) Copyright OMRON SOFTWARE Co., Ltd. 2008,2009 All Rights Reserved. ------------------------------------------------------------------------------- -1. About OpenWnn for Android +1. About OpenWnn - OpenWnn for Android is a IME(Input Method Editor) package which + OpenWnn is a IME(Input Method Editor) package which works on Android's IMF(Input Method Framework). This version contains Japanese, Chinese and English IME. @@ -24,7 +24,7 @@ o Building environment . Building control file (XML, makefile, shell script) - . IME native library source code (C language) + . IME native library source code (C) . IME resource (XML, PNG) . IME source code (Java) @@ -89,6 +89,8 @@ drawable/ | *.xml | *.png | + drawable-ja/ | + *.png | layout/ | *.xml | raw/ | diff --git a/res/drawable/cand_back.xml b/res/drawable/cand_back.xml new file mode 100644 index 0000000..a06d2b3 --- /dev/null +++ b/res/drawable/cand_back.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + + 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. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" + android:drawable="@drawable/cand_back_pressed" /> + <item android:state_pressed="false" + android:drawable="@drawable/cand_back_normal" /> +</selector> diff --git a/res/drawable/cand_back_normal.9.png b/res/drawable/cand_back_normal.9.png Binary files differnew file mode 100644 index 0000000..4ed524b --- /dev/null +++ b/res/drawable/cand_back_normal.9.png diff --git a/res/drawable/cand_back_pressed.9.png b/res/drawable/cand_back_pressed.9.png Binary files differnew file mode 100644 index 0000000..0571ba7 --- /dev/null +++ b/res/drawable/cand_back_pressed.9.png diff --git a/res/drawable/cand_down.png b/res/drawable/cand_down.png Binary files differnew file mode 100644 index 0000000..e73aad2 --- /dev/null +++ b/res/drawable/cand_down.png diff --git a/res/drawable/cand_down_press.png b/res/drawable/cand_down_press.png Binary files differnew file mode 100644 index 0000000..cb72e57 --- /dev/null +++ b/res/drawable/cand_down_press.png diff --git a/res/drawable/cand_up.png b/res/drawable/cand_up.png Binary files differnew file mode 100644 index 0000000..17b59f4 --- /dev/null +++ b/res/drawable/cand_up.png diff --git a/res/drawable/cand_up_press.png b/res/drawable/cand_up_press.png Binary files differnew file mode 100644 index 0000000..e89d647 --- /dev/null +++ b/res/drawable/cand_up_press.png diff --git a/res/drawable/candidate.png b/res/drawable/candidate.png Binary files differnew file mode 100644 index 0000000..e8f8f3f --- /dev/null +++ b/res/drawable/candidate.png diff --git a/res/drawable/dialog_bubble.9.png b/res/drawable/dialog_bubble.9.png Binary files differnew file mode 100644 index 0000000..d77f85f --- /dev/null +++ b/res/drawable/dialog_bubble.9.png diff --git a/res/drawable/dialog_bubble_moji.9.png b/res/drawable/dialog_bubble_moji.9.png Binary files differnew file mode 100644 index 0000000..80f4a0e --- /dev/null +++ b/res/drawable/dialog_bubble_moji.9.png diff --git a/res/drawable/dialog_bubble_symbol.9.png b/res/drawable/dialog_bubble_symbol.9.png Binary files differnew file mode 100644 index 0000000..255653a --- /dev/null +++ b/res/drawable/dialog_bubble_symbol.9.png diff --git a/res/drawable/dialog_bubble_undo.9.png b/res/drawable/dialog_bubble_undo.9.png Binary files differnew file mode 100644 index 0000000..58e5cd8 --- /dev/null +++ b/res/drawable/dialog_bubble_undo.9.png diff --git a/res/drawable/key_12key_caps.png b/res/drawable/key_12key_caps.png Binary files differnew file mode 100644 index 0000000..d0c52c2 --- /dev/null +++ b/res/drawable/key_12key_caps.png diff --git a/res/drawable/key_12key_caps_b.png b/res/drawable/key_12key_caps_b.png Binary files differnew file mode 100644 index 0000000..19b8d2d --- /dev/null +++ b/res/drawable/key_12key_caps_b.png diff --git a/res/drawable/key_12key_dakuten.png b/res/drawable/key_12key_dakuten.png Binary files differindex e40ecfe..8e979cc 100644 --- a/res/drawable/key_12key_dakuten.png +++ b/res/drawable/key_12key_dakuten.png diff --git a/res/drawable/key_12key_dakuten_b.png b/res/drawable/key_12key_dakuten_b.png Binary files differindex 67622ab..5b850bf 100644 --- a/res/drawable/key_12key_dakuten_b.png +++ b/res/drawable/key_12key_dakuten_b.png diff --git a/res/drawable/key_12key_del.png b/res/drawable/key_12key_del.png Binary files differindex 1f65116..4aab087 100644 --- a/res/drawable/key_12key_del.png +++ b/res/drawable/key_12key_del.png diff --git a/res/drawable/key_12key_del_b.png b/res/drawable/key_12key_del_b.png Binary files differindex 8a1811d..ecc2dba 100644 --- a/res/drawable/key_12key_del_b.png +++ b/res/drawable/key_12key_del_b.png diff --git a/res/drawable/key_12key_del_b_landscape.png b/res/drawable/key_12key_del_b_landscape.png Binary files differdeleted file mode 100644 index bcb9bd5..0000000 --- a/res/drawable/key_12key_del_b_landscape.png +++ /dev/null diff --git a/res/drawable/key_12key_eisukana.png b/res/drawable/key_12key_eisukana.png Binary files differindex 18284d3..b28c9cd 100644 --- a/res/drawable/key_12key_eisukana.png +++ b/res/drawable/key_12key_eisukana.png diff --git a/res/drawable/key_12key_enter.png b/res/drawable/key_12key_enter.png Binary files differindex ccab752..b2e729b 100644 --- a/res/drawable/key_12key_enter.png +++ b/res/drawable/key_12key_enter.png diff --git a/res/drawable/key_12key_enter_b.png b/res/drawable/key_12key_enter_b.png Binary files differindex cc4a90d..d26baa6 100644 --- a/res/drawable/key_12key_enter_b.png +++ b/res/drawable/key_12key_enter_b.png diff --git a/res/drawable/key_12key_enter_jp.png b/res/drawable/key_12key_enter_jp.png Binary files differnew file mode 100644 index 0000000..aeb461b --- /dev/null +++ b/res/drawable/key_12key_enter_jp.png diff --git a/res/drawable/key_12key_enter_jp_b.png b/res/drawable/key_12key_enter_jp_b.png Binary files differnew file mode 100644 index 0000000..784a7e9 --- /dev/null +++ b/res/drawable/key_12key_enter_jp_b.png diff --git a/res/drawable/key_12key_hiragana0.png b/res/drawable/key_12key_hiragana0.png Binary files differindex 36e5c8d..6c039d0 100644 --- a/res/drawable/key_12key_hiragana0.png +++ b/res/drawable/key_12key_hiragana0.png diff --git a/res/drawable/key_12key_hiragana1.png b/res/drawable/key_12key_hiragana1.png Binary files differindex 863bdf1..ff33fd5 100644 --- a/res/drawable/key_12key_hiragana1.png +++ b/res/drawable/key_12key_hiragana1.png diff --git a/res/drawable/key_12key_hiragana2.png b/res/drawable/key_12key_hiragana2.png Binary files differindex 0d88729..2338b39 100644 --- a/res/drawable/key_12key_hiragana2.png +++ b/res/drawable/key_12key_hiragana2.png diff --git a/res/drawable/key_12key_hiragana3.png b/res/drawable/key_12key_hiragana3.png Binary files differindex eb0699a..6508763 100644 --- a/res/drawable/key_12key_hiragana3.png +++ b/res/drawable/key_12key_hiragana3.png diff --git a/res/drawable/key_12key_hiragana4.png b/res/drawable/key_12key_hiragana4.png Binary files differindex ffa9935..79d9a03 100644 --- a/res/drawable/key_12key_hiragana4.png +++ b/res/drawable/key_12key_hiragana4.png diff --git a/res/drawable/key_12key_hiragana5.png b/res/drawable/key_12key_hiragana5.png Binary files differindex 1d71465..62769a2 100644 --- a/res/drawable/key_12key_hiragana5.png +++ b/res/drawable/key_12key_hiragana5.png diff --git a/res/drawable/key_12key_hiragana6.png b/res/drawable/key_12key_hiragana6.png Binary files differindex e327e38..a130fb8 100644 --- a/res/drawable/key_12key_hiragana6.png +++ b/res/drawable/key_12key_hiragana6.png diff --git a/res/drawable/key_12key_hiragana7.png b/res/drawable/key_12key_hiragana7.png Binary files differindex 4414fa1..f74e52a 100644 --- a/res/drawable/key_12key_hiragana7.png +++ b/res/drawable/key_12key_hiragana7.png diff --git a/res/drawable/key_12key_hiragana8.png b/res/drawable/key_12key_hiragana8.png Binary files differindex abf63f2..f2a3fdb 100644 --- a/res/drawable/key_12key_hiragana8.png +++ b/res/drawable/key_12key_hiragana8.png diff --git a/res/drawable/key_12key_hiragana9.png b/res/drawable/key_12key_hiragana9.png Binary files differindex 38a54cb..35a2129 100644 --- a/res/drawable/key_12key_hiragana9.png +++ b/res/drawable/key_12key_hiragana9.png diff --git a/res/drawable/key_12key_left.png b/res/drawable/key_12key_left.png Binary files differindex 39ae53d..d604272 100644 --- a/res/drawable/key_12key_left.png +++ b/res/drawable/key_12key_left.png diff --git a/res/drawable/key_12key_left_b.png b/res/drawable/key_12key_left_b.png Binary files differindex f44f71a..02fc93b 100644 --- a/res/drawable/key_12key_left_b.png +++ b/res/drawable/key_12key_left_b.png diff --git a/res/drawable/key_12key_mode_full_alpha.png b/res/drawable/key_12key_mode_full_alpha.png Binary files differnew file mode 100644 index 0000000..fd4f880 --- /dev/null +++ b/res/drawable/key_12key_mode_full_alpha.png diff --git a/res/drawable/key_12key_mode_full_kata.png b/res/drawable/key_12key_mode_full_kata.png Binary files differnew file mode 100644 index 0000000..81b66e2 --- /dev/null +++ b/res/drawable/key_12key_mode_full_kata.png diff --git a/res/drawable/key_12key_del_landscape.png b/res/drawable/key_12key_mode_full_num.png Binary files differindex 9dab665..dc929a1 100644 --- a/res/drawable/key_12key_del_landscape.png +++ b/res/drawable/key_12key_mode_full_num.png diff --git a/res/drawable/key_12key_mode_half_alpha.png b/res/drawable/key_12key_mode_half_alpha.png Binary files differnew file mode 100644 index 0000000..4bf6f99 --- /dev/null +++ b/res/drawable/key_12key_mode_half_alpha.png diff --git a/res/drawable/key_12key_mode_half_kata.png b/res/drawable/key_12key_mode_half_kata.png Binary files differnew file mode 100644 index 0000000..322341a --- /dev/null +++ b/res/drawable/key_12key_mode_half_kata.png diff --git a/res/drawable/key_12key_mode_half_num.png b/res/drawable/key_12key_mode_half_num.png Binary files differnew file mode 100644 index 0000000..68a8760 --- /dev/null +++ b/res/drawable/key_12key_mode_half_num.png diff --git a/res/drawable/key_12key_mode_hira.png b/res/drawable/key_12key_mode_hira.png Binary files differnew file mode 100644 index 0000000..9eb8584 --- /dev/null +++ b/res/drawable/key_12key_mode_hira.png diff --git a/res/drawable/key_12key_period_comma.png b/res/drawable/key_12key_period_comma.png Binary files differnew file mode 100644 index 0000000..d0fdb93 --- /dev/null +++ b/res/drawable/key_12key_period_comma.png diff --git a/res/drawable/key_12key_period_comma_b.png b/res/drawable/key_12key_period_comma_b.png Binary files differnew file mode 100644 index 0000000..aa9ad02 --- /dev/null +++ b/res/drawable/key_12key_period_comma_b.png diff --git a/res/drawable/key_12key_pict_sym.png b/res/drawable/key_12key_pict_sym.png Binary files differindex cef2388..a4845e5 100644 --- a/res/drawable/key_12key_pict_sym.png +++ b/res/drawable/key_12key_pict_sym.png diff --git a/res/drawable/key_12key_pict_sym_b.png b/res/drawable/key_12key_pict_sym_b.png Binary files differindex 612b08b..43225a8 100644 --- a/res/drawable/key_12key_pict_sym_b.png +++ b/res/drawable/key_12key_pict_sym_b.png diff --git a/res/drawable/key_12key_reverse.png b/res/drawable/key_12key_reverse.png Binary files differindex 4eb4dc7..dd40bd9 100644 --- a/res/drawable/key_12key_reverse.png +++ b/res/drawable/key_12key_reverse.png diff --git a/res/drawable/key_12key_reverse_b.png b/res/drawable/key_12key_reverse_b.png Binary files differindex eb990c0..6d96fa3 100644 --- a/res/drawable/key_12key_reverse_b.png +++ b/res/drawable/key_12key_reverse_b.png diff --git a/res/drawable/key_12key_right.png b/res/drawable/key_12key_right.png Binary files differindex a1db3e9..94a288b 100644 --- a/res/drawable/key_12key_right.png +++ b/res/drawable/key_12key_right.png diff --git a/res/drawable/key_12key_right_b.png b/res/drawable/key_12key_right_b.png Binary files differindex fc4c5f8..06e21d0 100644 --- a/res/drawable/key_12key_right_b.png +++ b/res/drawable/key_12key_right_b.png diff --git a/res/drawable/key_12key_space.png b/res/drawable/key_12key_space.png Binary files differindex 41314c4..d67c898 100644 --- a/res/drawable/key_12key_space.png +++ b/res/drawable/key_12key_space.png diff --git a/res/drawable/key_12key_space_b.png b/res/drawable/key_12key_space_b.png Binary files differindex f6af7c8..35d1b19 100644 --- a/res/drawable/key_12key_space_b.png +++ b/res/drawable/key_12key_space_b.png diff --git a/res/drawable/key_12key_space_jp.png b/res/drawable/key_12key_space_jp.png Binary files differnew file mode 100644 index 0000000..4735e01 --- /dev/null +++ b/res/drawable/key_12key_space_jp.png diff --git a/res/drawable/key_12key_space_jp_b.png b/res/drawable/key_12key_space_jp_b.png Binary files differnew file mode 100644 index 0000000..0dc5206 --- /dev/null +++ b/res/drawable/key_12key_space_jp_b.png diff --git a/res/drawable/key_12key_ten.png b/res/drawable/key_12key_ten.png Binary files differnew file mode 100644 index 0000000..7d93f4f --- /dev/null +++ b/res/drawable/key_12key_ten.png diff --git a/res/drawable/key_12key_ten_b.png b/res/drawable/key_12key_ten_b.png Binary files differnew file mode 100644 index 0000000..f65bb2e --- /dev/null +++ b/res/drawable/key_12key_ten_b.png diff --git a/res/drawable/key_mode_change_b.png b/res/drawable/key_mode_change_b.png Binary files differnew file mode 100644 index 0000000..58159d9 --- /dev/null +++ b/res/drawable/key_mode_change_b.png diff --git a/res/drawable/key_mode_panel_kbd_12key.png b/res/drawable/key_mode_panel_kbd_12key.png Binary files differnew file mode 100644 index 0000000..c9a10fd --- /dev/null +++ b/res/drawable/key_mode_panel_kbd_12key.png diff --git a/res/drawable/key_mode_panel_kbd_12key_b.png b/res/drawable/key_mode_panel_kbd_12key_b.png Binary files differnew file mode 100644 index 0000000..eda8c03 --- /dev/null +++ b/res/drawable/key_mode_panel_kbd_12key_b.png diff --git a/res/drawable/key_qwerty_del.png b/res/drawable/key_qwerty_del.png Binary files differindex ad87520..4aab087 100644 --- a/res/drawable/key_qwerty_del.png +++ b/res/drawable/key_qwerty_del.png diff --git a/res/drawable/key_qwerty_del_b.png b/res/drawable/key_qwerty_del_b.png Binary files differindex 8a1811d..ecc2dba 100644 --- a/res/drawable/key_qwerty_del_b.png +++ b/res/drawable/key_qwerty_del_b.png diff --git a/res/drawable/key_qwerty_del_b_landscape.png b/res/drawable/key_qwerty_del_b_landscape.png Binary files differdeleted file mode 100644 index bcb9bd5..0000000 --- a/res/drawable/key_qwerty_del_b_landscape.png +++ /dev/null diff --git a/res/drawable/key_qwerty_enter.png b/res/drawable/key_qwerty_enter.png Binary files differindex ccab752..35a3fb0 100644 --- a/res/drawable/key_qwerty_enter.png +++ b/res/drawable/key_qwerty_enter.png diff --git a/res/drawable/key_qwerty_enter_b.png b/res/drawable/key_qwerty_enter_b.png Binary files differindex cc4a90d..1a4cbfd 100644 --- a/res/drawable/key_qwerty_enter_b.png +++ b/res/drawable/key_qwerty_enter_b.png diff --git a/res/drawable/key_qwerty_enter_jp.png b/res/drawable/key_qwerty_enter_jp.png Binary files differnew file mode 100644 index 0000000..7f002e6 --- /dev/null +++ b/res/drawable/key_qwerty_enter_jp.png diff --git a/res/drawable/key_qwerty_enter_jp_b.png b/res/drawable/key_qwerty_enter_jp_b.png Binary files differnew file mode 100644 index 0000000..a77c39f --- /dev/null +++ b/res/drawable/key_qwerty_enter_jp_b.png diff --git a/res/drawable/key_qwerty_mode_full_alpha.png b/res/drawable/key_qwerty_mode_full_alpha.png Binary files differnew file mode 100644 index 0000000..fd4f880 --- /dev/null +++ b/res/drawable/key_qwerty_mode_full_alpha.png diff --git a/res/drawable/key_qwerty_mode_full_kata.png b/res/drawable/key_qwerty_mode_full_kata.png Binary files differnew file mode 100644 index 0000000..81b66e2 --- /dev/null +++ b/res/drawable/key_qwerty_mode_full_kata.png diff --git a/res/drawable/key_qwerty_del_landscape.png b/res/drawable/key_qwerty_mode_full_num.png Binary files differindex 9dab665..dc929a1 100644 --- a/res/drawable/key_qwerty_del_landscape.png +++ b/res/drawable/key_qwerty_mode_full_num.png diff --git a/res/drawable/key_qwerty_mode_half_alpha.png b/res/drawable/key_qwerty_mode_half_alpha.png Binary files differnew file mode 100644 index 0000000..4bf6f99 --- /dev/null +++ b/res/drawable/key_qwerty_mode_half_alpha.png diff --git a/res/drawable/key_qwerty_mode_half_kata.png b/res/drawable/key_qwerty_mode_half_kata.png Binary files differnew file mode 100644 index 0000000..322341a --- /dev/null +++ b/res/drawable/key_qwerty_mode_half_kata.png diff --git a/res/drawable/key_qwerty_mode_half_num.png b/res/drawable/key_qwerty_mode_half_num.png Binary files differnew file mode 100644 index 0000000..68a8760 --- /dev/null +++ b/res/drawable/key_qwerty_mode_half_num.png diff --git a/res/drawable/key_qwerty_mode_hira.png b/res/drawable/key_qwerty_mode_hira.png Binary files differnew file mode 100644 index 0000000..9eb8584 --- /dev/null +++ b/res/drawable/key_qwerty_mode_hira.png diff --git a/res/drawable/key_qwerty_pict_sym.png b/res/drawable/key_qwerty_pict_sym.png Binary files differindex cef2388..ad89c49 100644 --- a/res/drawable/key_qwerty_pict_sym.png +++ b/res/drawable/key_qwerty_pict_sym.png diff --git a/res/drawable/key_qwerty_pict_sym_b.png b/res/drawable/key_qwerty_pict_sym_b.png Binary files differindex 612b08b..43225a8 100644 --- a/res/drawable/key_qwerty_pict_sym_b.png +++ b/res/drawable/key_qwerty_pict_sym_b.png diff --git a/res/drawable/key_qwerty_space.png b/res/drawable/key_qwerty_space.png Binary files differindex 41314c4..5ffcab5 100644 --- a/res/drawable/key_qwerty_space.png +++ b/res/drawable/key_qwerty_space.png diff --git a/res/drawable/key_qwerty_space_b.png b/res/drawable/key_qwerty_space_b.png Binary files differindex f6af7c8..a9390e2 100644 --- a/res/drawable/key_qwerty_space_b.png +++ b/res/drawable/key_qwerty_space_b.png diff --git a/res/drawable/key_qwerty_space_conv.png b/res/drawable/key_qwerty_space_conv.png Binary files differindex 40b9d91..654bc2d 100644 --- a/res/drawable/key_qwerty_space_conv.png +++ b/res/drawable/key_qwerty_space_conv.png diff --git a/res/drawable/key_qwerty_space_conv_b.png b/res/drawable/key_qwerty_space_conv_b.png Binary files differindex e87c22b..07bd232 100644 --- a/res/drawable/key_qwerty_space_conv_b.png +++ b/res/drawable/key_qwerty_space_conv_b.png diff --git a/res/drawable/key_qwerty_space_pinyin.png b/res/drawable/key_qwerty_space_pinyin.png Binary files differindex 265950d..2ea2029 100644 --- a/res/drawable/key_qwerty_space_pinyin.png +++ b/res/drawable/key_qwerty_space_pinyin.png diff --git a/res/drawable/key_qwerty_space_pinyin_b.png b/res/drawable/key_qwerty_space_pinyin_b.png Binary files differindex 3b085c3..570f881 100644 --- a/res/drawable/key_qwerty_space_pinyin_b.png +++ b/res/drawable/key_qwerty_space_pinyin_b.png diff --git a/res/drawable/keybg_simple.9.png b/res/drawable/keybg_simple.9.png Binary files differnew file mode 100644 index 0000000..160b0e7 --- /dev/null +++ b/res/drawable/keybg_simple.9.png diff --git a/res/drawable/keybg_simple.png b/res/drawable/keybg_simple.png Binary files differdeleted file mode 100644 index 274f1dd..0000000 --- a/res/drawable/keybg_simple.png +++ /dev/null diff --git a/res/drawable/keybg_simple_p.9.png b/res/drawable/keybg_simple_p.9.png Binary files differnew file mode 100644 index 0000000..136cab6 --- /dev/null +++ b/res/drawable/keybg_simple_p.9.png diff --git a/res/drawable/keybg_simple_p.png b/res/drawable/keybg_simple_p.png Binary files differdeleted file mode 100644 index 3ca60bf..0000000 --- a/res/drawable/keybg_simple_p.png +++ /dev/null diff --git a/res/drawable/keybg_simple_psftoff.9.png b/res/drawable/keybg_simple_psftoff.9.png Binary files differnew file mode 100644 index 0000000..fe11c0c --- /dev/null +++ b/res/drawable/keybg_simple_psftoff.9.png diff --git a/res/drawable/keybg_simple_psftoff.png b/res/drawable/keybg_simple_psftoff.png Binary files differdeleted file mode 100644 index 65ded80..0000000 --- a/res/drawable/keybg_simple_psftoff.png +++ /dev/null diff --git a/res/drawable/keybg_simple_psfton.9.png b/res/drawable/keybg_simple_psfton.9.png Binary files differnew file mode 100644 index 0000000..a808e61 --- /dev/null +++ b/res/drawable/keybg_simple_psfton.9.png diff --git a/res/drawable/keybg_simple_psfton.png b/res/drawable/keybg_simple_psfton.png Binary files differdeleted file mode 100644 index c430d64..0000000 --- a/res/drawable/keybg_simple_psfton.png +++ /dev/null diff --git a/res/drawable/keybg_simple_sftoff.9.png b/res/drawable/keybg_simple_sftoff.9.png Binary files differnew file mode 100644 index 0000000..09b40ea --- /dev/null +++ b/res/drawable/keybg_simple_sftoff.9.png diff --git a/res/drawable/keybg_simple_sftoff.png b/res/drawable/keybg_simple_sftoff.png Binary files differdeleted file mode 100644 index 406f79f..0000000 --- a/res/drawable/keybg_simple_sftoff.png +++ /dev/null diff --git a/res/drawable/keybg_simple_sfton.9.png b/res/drawable/keybg_simple_sfton.9.png Binary files differnew file mode 100644 index 0000000..03b5c5f --- /dev/null +++ b/res/drawable/keybg_simple_sfton.9.png diff --git a/res/drawable/keybg_simple_sfton.png b/res/drawable/keybg_simple_sfton.png Binary files differdeleted file mode 100644 index cc6a3c9..0000000 --- a/res/drawable/keybg_simple_sfton.png +++ /dev/null diff --git a/res/drawable/qwerty_bg_b_1.png b/res/drawable/qwerty_bg_b_1.png Binary files differdeleted file mode 100644 index 92bed97..0000000 --- a/res/drawable/qwerty_bg_b_1.png +++ /dev/null diff --git a/res/drawable/qwerty_box_b_1.png b/res/drawable/qwerty_box_b_1.png Binary files differdeleted file mode 100644 index 1b577ec..0000000 --- a/res/drawable/qwerty_box_b_1.png +++ /dev/null diff --git a/res/drawable/qwerty_box_b_2.png b/res/drawable/qwerty_box_b_2.png Binary files differdeleted file mode 100644 index 0e1f771..0000000 --- a/res/drawable/qwerty_box_b_2.png +++ /dev/null diff --git a/res/drawable/qwerty_box_w_1.png b/res/drawable/qwerty_box_w_1.png Binary files differdeleted file mode 100644 index 92021a7..0000000 --- a/res/drawable/qwerty_box_w_1.png +++ /dev/null diff --git a/res/drawable/qwerty_box_w_2.png b/res/drawable/qwerty_box_w_2.png Binary files differdeleted file mode 100644 index eb991e9..0000000 --- a/res/drawable/qwerty_box_w_2.png +++ /dev/null diff --git a/res/drawable/tutorial_12key_enter.png b/res/drawable/tutorial_12key_enter.png Binary files differnew file mode 100644 index 0000000..61abffc --- /dev/null +++ b/res/drawable/tutorial_12key_enter.png diff --git a/res/drawable/tutorial_12key_key.png b/res/drawable/tutorial_12key_key.png Binary files differnew file mode 100644 index 0000000..254eb3c --- /dev/null +++ b/res/drawable/tutorial_12key_key.png diff --git a/res/drawable/tutorial_12key_left.png b/res/drawable/tutorial_12key_left.png Binary files differnew file mode 100644 index 0000000..bd96094 --- /dev/null +++ b/res/drawable/tutorial_12key_left.png diff --git a/res/drawable/tutorial_12key_mode.png b/res/drawable/tutorial_12key_mode.png Binary files differnew file mode 100644 index 0000000..42b939f --- /dev/null +++ b/res/drawable/tutorial_12key_mode.png diff --git a/res/drawable/tutorial_12key_right.png b/res/drawable/tutorial_12key_right.png Binary files differnew file mode 100644 index 0000000..92f9f47 --- /dev/null +++ b/res/drawable/tutorial_12key_right.png diff --git a/res/drawable/tutorial_12key_space_jp.png b/res/drawable/tutorial_12key_space_jp.png Binary files differnew file mode 100644 index 0000000..389efa0 --- /dev/null +++ b/res/drawable/tutorial_12key_space_jp.png diff --git a/res/drawable/tutorial_12key_toggle.png b/res/drawable/tutorial_12key_toggle.png Binary files differnew file mode 100644 index 0000000..9691e5e --- /dev/null +++ b/res/drawable/tutorial_12key_toggle.png diff --git a/res/drawable/tutorial_back.png b/res/drawable/tutorial_back.png Binary files differnew file mode 100644 index 0000000..b775bab --- /dev/null +++ b/res/drawable/tutorial_back.png diff --git a/res/drawable/word_full_space.png b/res/drawable/word_full_space.png Binary files differnew file mode 100644 index 0000000..15b9711 --- /dev/null +++ b/res/drawable/word_full_space.png diff --git a/res/drawable/word_half_space.png b/res/drawable/word_half_space.png Binary files differnew file mode 100644 index 0000000..32d9398 --- /dev/null +++ b/res/drawable/word_half_space.png diff --git a/res/layout/bubble_text.xml b/res/layout/bubble_text.xml new file mode 100644 index 0000000..d754467 --- /dev/null +++ b/res/layout/bubble_text.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + + 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. +--> +<!-- +/* +** +** Copyright 2009, 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. +*/ +--> + +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="14sp" + android:textColor="?android:attr/textColorPrimary" + android:minWidth="32dip" + android:gravity="center" + android:shadowRadius="2.75" + android:shadowColor="#BB000000" + /> diff --git a/res/layout/candidate_scale_up.xml b/res/layout/candidate_scale_up.xml new file mode 100644 index 0000000..506144f --- /dev/null +++ b/res/layout/candidate_scale_up.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + + 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. +--> +<!-- candidate list --> +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:background="@color/candidate_back" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + <TextView + android:id="@+id/candidate_scale_up_text" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@color/candidate_back" + android:textSize="@dimen/candidate_delete_word_size" + android:textColor="@color/candidate_text" + android:gravity="center" + /> + <LinearLayout + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:gravity="center" + > + <jp.co.omronsoft.openwnn.CandidateViewButton + android:id="@+id/candidate_select" + android:layout_height="fill_parent" + android:layout_width="wrap_content" + android:text="@string/button_candidate_select" + /> + <jp.co.omronsoft.openwnn.CandidateViewButton + android:id="@+id/candidate_delete" + android:layout_height="fill_parent" + android:layout_width="wrap_content" + android:text="@string/button_candidate_delete" + android:visibility="gone" + /> + <jp.co.omronsoft.openwnn.CandidateViewButton + android:id="@+id/candidate_cancel" + android:layout_height="fill_parent" + android:layout_width="wrap_content" + android:text="@string/button_candidate_cancel" + /> + </LinearLayout> +</LinearLayout> diff --git a/res/layout/candidates.xml b/res/layout/candidates.xml index 12637f7..a5b638c 100644 --- a/res/layout/candidates.xml +++ b/res/layout/candidates.xml @@ -15,43 +15,59 @@ limitations under the License. --> <!-- candidate list --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - > - - <ScrollView android:id="@+id/candview_scroll" - android:layout_width="fill_parent" - android:layout_height="1px" - android:fadingEdgeLength="0px" - android:scrollbars="vertical" - > - <EditText android:id="@+id/text_candidates_view" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:background="@color/candidate_background" - android:textColor="@color/candidate_text" - android:cursorVisible="true" - android:textColorHighlight="@color/candidate_highlight" - android:paddingLeft="10px" - android:paddingRight="10px" - android:paddingTop="10px" - android:shadowColor="@color/candidate_shadow" - android:shadowRadius="0.1" - /> +<FrameLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + > + <ScrollView + android:id="@+id/candview_scroll" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:fadingEdgeLength="0dip" + android:scrollbars="vertical" + > + <LinearLayout + android:id="@+id/candview_base" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@color/candidate_back" + > + <!--View + android:layout_height="wrap_content" + android:layout_width="fill_parent" + android:background="@drawable/candidate_top" + /--> + <LinearLayout + android:id="@+id/candidates_1st_view" + android:orientation="vertical" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@color/candidate_back" + /> + <RelativeLayout + android:id="@+id/candidates_2nd_view" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="@color/candidate_back" + /> + </LinearLayout> </ScrollView> - <LinearLayout android:id="@+id/read_more" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:fadingEdgeLength="0px" - android:gravity="bottom|right" - > - <TextView android:id="@+id/read_more_text" - android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:gravity="bottom|right" - android:textColor="@color/candidate_text" - /> + + <LinearLayout + android:id="@+id/read_more" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:fadingEdgeLength="0dip" + android:orientation="vertical" + android:gravity="right" + > + <ImageView + android:id="@+id/read_more_text" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + /> </LinearLayout> </FrameLayout> diff --git a/res/layout/keyboard_default_main.xml b/res/layout/keyboard_default_main.xml index f9acb09..b1cc5c9 100644 --- a/res/layout/keyboard_default_main.xml +++ b/res/layout/keyboard_default_main.xml @@ -15,10 +15,10 @@ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" + android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="wrap_content" + android:layout_height="wrap_content" android:fadingEdge="vertical" - android:fadingEdgeLength="5px" - > + android:fadingEdgeLength="5dip" + > </LinearLayout> diff --git a/res/layout/keyboard_default_sub.xml b/res/layout/keyboard_default_sub.xml index 0fe62a5..ab9dec3 100644 --- a/res/layout/keyboard_default_sub.xml +++ b/res/layout/keyboard_default_sub.xml @@ -19,23 +19,23 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/indicator_textbackground_default" - android:paddingLeft="2px" - android:paddingTop="2px" - android:paddingRight="2px" - android:paddingBottom="2px" + android:paddingLeft="2dip" + android:paddingTop="2dip" + android:paddingRight="2dip" + android:paddingBottom="2dip" android:gravity="right" android:fadingEdge="vertical" - android:fadingEdgeLength="2px" + android:fadingEdgeLength="2dip" android:orientation="horizontal"> <TextView android:id="@+id/shift" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingLeft="5px" - android:paddingTop="0px" - android:paddingRight="5px" - android:paddingBottom="0px" - android:textSize="10px" + android:paddingLeft="5dip" + android:paddingTop="0dip" + android:paddingRight="5dip" + android:paddingBottom="0dip" + android:textSize="10dip" android:textStyle="bold" android:fadingEdge="horizontal" android:text="@string/indicator_caps"/> @@ -43,12 +43,12 @@ <TextView android:id="@+id/alt" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="2px" - android:paddingLeft="5px" - android:paddingTop="0px" - android:paddingRight="5px" - android:paddingBottom="0px" - android:textSize="10px" + android:layout_marginLeft="2dip" + android:paddingLeft="5dip" + android:paddingTop="0dip" + android:paddingRight="5dip" + android:paddingBottom="0dip" + android:textSize="10dip" android:textStyle="bold" android:fadingEdge="horizontal" android:text="@string/indicator_alt"/> diff --git a/res/layout/user_dictionary_tools_list.xml b/res/layout/user_dictionary_tools_list.xml index 6b87d71..22a99fb 100644 --- a/res/layout/user_dictionary_tools_list.xml +++ b/res/layout/user_dictionary_tools_list.xml @@ -15,9 +15,31 @@ limitations under the License. --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="wrap_content"> + android:orientation="vertical" + android:paddingTop="5sp" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <LinearLayout + android:orientation="horizontal" + android:gravity="center" + android:layout_width="fill_parent" + android:layout_height="wrap_content"> + <Button + android:id="@+id/user_dictionary_left_button" + android:text="@string/user_dictionary_prev_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + <TextView + android:id="@+id/user_dictionary_position_indicator" + android:gravity="center" + android:layout_width="100sp" + android:layout_height="wrap_content"/> + <Button + android:id="@+id/user_dictionary_right_button" + android:text="@string/user_dictionary_next_button" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" @@ -33,7 +55,7 @@ android:layout_marginLeft="0dip" android:layout_marginBottom="1dip" android:text="@string/user_dictionary_title_read" - android:textSize="16px" + android:textSize="16dip" android:textColor="?android:attr/textColorTertiary" android:background="#FFFFFF" android:focusable="false"/> @@ -46,7 +68,7 @@ android:layout_marginLeft="1dip" android:layout_marginBottom="1dip" android:text="@string/user_dictionary_title_candidate" - android:textSize="16px" + android:textSize="16dip" android:textColor="?android:attr/textColorTertiary" android:background="#FFFFFF" android:focusable="false"/> @@ -62,4 +84,4 @@ android:padding="1dip"> </TableLayout> </ScrollView> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/res/values-ja/bools.xml b/res/values-ja/bools.xml deleted file mode 100644 index d9600c7..0000000 --- a/res/values-ja/bools.xml +++ /dev/null @@ -1,5 +0,0 @@ -<resources> - <!-- If this input method should be used as the default for ja, - set im_is_default true. --> - <bool name="im_is_default">false</bool> -</resources> diff --git a/res/values-ja/string.xml b/res/values-ja/string.xml index 2f75fe5..ccbbd98 100644 --- a/res/values-ja/string.xml +++ b/res/values-ja/string.xml @@ -21,31 +21,35 @@ <string name="preference_key_setting_menu">キーボード設定</string> - <string name="preference_key_sound_title">キークリック音</string> - <string name="preference_key_sound_summary">キー押下時にクリック音を鳴らします。</string> + <string name="preference_key_sound_title">キー操作音</string> + <string name="preference_key_sound_summary">キーを押した時に音を鳴らす</string> - <string name="preference_key_vibration_title">キークリックバイブ</string> - <string name="preference_key_vibration_summary">キー押下時にバイブレーションさせます。</string> + <string name="preference_key_vibration_title">キー操作バイブ</string> + <string name="preference_key_vibration_summary">キーを押した時に振動で知らせる</string> <string name="preference_preview_title">キーポップアップ</string> - <string name="preference_preview_summary">キー押下時にキーの刻印をポップアップさせます。</string> + <string name="preference_preview_summary">入力時に選択したキーを拡大表示する</string> - <string name="preference_auto_caps_title">先頭大文字変換</string> - <string name="preference_auto_caps_summary">英字入力で文章先頭文字を自動的に大文字にします。</string> + <string name="preference_auto_caps_title">自動大文字変換</string> + <string name="preference_auto_caps_summary">英字入力で文頭文字を大文字にする</string> - <string name="preference_keyboard_skin_title">キーボードデザイン</string> - <string name="preference_keyboard_skin_summary">キーボードデザインを切り替えます。</string> + <string name="preference_keyboard_skin_title">キーボードのデザイン</string> + <string name="preference_keyboard_skin_summary">キーボードのデザインを切り替える</string> + + <string name="preference_keyboard_android_default">標準</string> + <string name="preference_keyboard_simple">シンプル</string> + <string name="preference_keyboard_metal">メタリック</string> <string name="preference_conversion_menu">変換設定</string> <string name="preference_prediction_title">予測変換</string> - <string name="preference_prediction_summary">予測候補を表示します。</string> + <string name="preference_prediction_summary">文字を入力すると変換候補を表示する</string> - <string name="preference_correct_spell_title">タイプミス補正</string> - <string name="preference_correct_spell_summary">タイプミスを補正した候補を表示します。</string> + <string name="preference_correct_spell_title">入力ミス補正</string> + <string name="preference_correct_spell_summary">入力間違いの修正候補を表示する</string> <string name="preference_input_learning_title">候補学習</string> - <string name="preference_input_learning_summary">確定した候補を学習します。</string> + <string name="preference_input_learning_summary">変換で確定した語句を学習する</string> <string name="preference_aboutime_menu">IMEについて</string> @@ -57,16 +61,16 @@ <string name="preference_user_dictionary">ユーザー辞書</string> <string name="preference_user_dictionary_edit_words_title">単語登録/編集/削除</string> - <string name="preference_user_dictionary_edit_words_summary">ユーザー辞書の単語を編集します。</string> - <string name="preference_user_dictionary_edit_words_summary_ja">日本語ユーザー辞書の単語を編集します。</string> - <string name="preference_user_dictionary_edit_words_summary_en">英語ユーザー辞書の単語を編集します。</string> - <string name="preference_user_dictionary_edit_words_summary_zhcn">中国語ユーザー辞書の単語を編集します。</string> + <string name="preference_user_dictionary_edit_words_summary">ユーザー辞書の単語を編集する</string> + <string name="preference_user_dictionary_edit_words_summary_ja">日本語ユーザー辞書の単語を編集する</string> + <string name="preference_user_dictionary_edit_words_summary_en">英語ユーザー辞書の単語を編集する</string> + <string name="preference_user_dictionary_edit_words_summary_zhcn">中国語ユーザー辞書の単語を編集する</string> - <string name="preference_user_dictionary_clear_learning_title">学習辞書初期化</string> - <string name="preference_user_dictionary_clear_learning_summary">学習辞書の内容をすべて消去します。</string> + <string name="preference_user_dictionary_clear_learning_title">学習辞書リセット</string> + <string name="preference_user_dictionary_clear_learning_summary">学習辞書の内容をすべて消去する</string> - <string name="preference_user_dictionary_clear_user_title">ユーザー辞書初期化</string> - <string name="preference_user_dictionary_clear_user_summary">ユーザー辞書の内容をすべて消去します。</string> + <string name="preference_user_dictionary_clear_user_title">ユーザー辞書全消去</string> + <string name="preference_user_dictionary_clear_user_summary">ユーザー辞書の内容をすべて消去する</string> <!-- Dialog Messages --> <string name="dialog_button_ok">OK</string> @@ -93,24 +97,40 @@ <string name="user_dictionary_delete_complete">削除しました。</string> <string name="user_dictionary_delete_fail">削除に失敗しました。</string> <string name="user_dictionary_words_duplication_message">すでに登録されています。</string> - <string name="user_dictionary_over_max_text_size_message">登録可能文字列長を超えています。</string> + <string name="user_dictionary_over_max_text_size_message">登録できる最大文字数を超えています。</string> <string name="user_dictionary_creating_wordlist">生成中</string> - <string name="user_dictionary_init">ユーザー辞書初期化</string> + <string name="user_dictionary_init">ユーザー辞書全消去</string> <!-- IME dependency --> <!-- OpenWnn English --> - <string name="openwnn_english_copyright">Ver.1.21-RC-20090403\nオムロン ソフトウェア(株)</string> + <string name="openwnn_english_copyright">Ver.1.3.1\nオムロン ソフトウェア(株)</string> <!-- OpenWnn Japanese --> - <string name="openwnn_japanese_copyright">Ver.1.21-RC-20090403\nオムロン ソフトウェア(株)</string> + <string name="openwnn_japanese_copyright">Ver.1.3.1\nオムロン ソフトウェア(株)</string> <!-- OpenWnn Chinese --> - <string name="openwnn_china_copyright">Ver.1.21-RC-20090403\nオムロン ソフトウェア(株)</string> + <string name="openwnn_china_copyright">Ver.1.3.1\nオムロン ソフトウェア(株)</string> <!-- Candidate Delete --> <string name="button_candidate_select">選 択</string> - <string name="button_candidate_delete">学習削除</string> + <string name="button_candidate_delete">学習削除</string> <string name="button_candidate_cancel">閉じる</string> + <!-- Tutorial --> + <string name="touch_to_continue">次へ >></string> + <string name="touch_to_try">下のボタンで試してみてください。</string> + <string name="touch_to_finish">実際に色々入力を試してみてください。</string> + <string name="tip_to_step1"><b>普通の携帯のキーボードのように、○キーを3回押すと「う」\nが入力できます。</b></string> + <string name="tip_to_step2_a"><b>例えば「寿司」と入力する場合…\n・○キーを3回押して「す」を入力し、</b></string> + <string name="tip_to_step2_b"><b>\n・→キーで右に進み、</b></string> + <string name="tip_to_step2_c"><b>\n・○キーを2回押して「し」を入力し、</b></string> + <string name="tip_to_step2_d"><b>\n・自動的に表示される候補の中から\n 「寿司」を選ぶか、■キーで変換して\n 表示される「寿司」を↓キーで確定\n します。</b></string> + <string name="tip_to_step3_a"><b>■キーで日本語、英語、数字モードに\n切り替わります。</b></string> + <string name="tip_to_step3_b"><b>日本語から英語にかわりました。\n次は数字です。</b></string> + <string name="tip_to_step3_c"><b>数字からまた日本語に戻りましょう。</b></string> + <string name="tip_to_step4"><b>ほかのモード(カタカナ・全角など)\nやPC風のキーボードが使いたい場合、\n■キーを3秒押すと入力メニューが\n表示されます。</b></string> + <string name="tip_to_step5"><b>入力が完了したら、携帯の\n「戻る」キー(←)を押して\nキーボードを閉じます。</b></string> + <string name="tip_to_step6"><b>これでチュートリアルは終わりです。</b></string> + </resources> diff --git a/res/values/colors.xml b/res/values/colors.xml index 3be30d9..66c1d9a 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -15,10 +15,8 @@ limitations under the License. --> <resources> - <color name="candidate_highlight">#BDFF8800</color> <color name="candidate_text">#ff404040</color> - <color name="candidate_background">#E0ffffc8</color> - <color name="candidate_shadow">#FF000000</color> + <color name="candidate_back">#FFEFEBEF</color> <color name="indicator_textcolor_default">#0032CD32</color> <color name="indicator_textcolor_caps_off">#0032CD32</color> <color name="indicator_textcolor_caps_on">#Cd32CD32</color> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 4d58752..2d87471 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -15,8 +15,10 @@ limitations under the License. --> <resources> - <dimen name="key_height">54px</dimen> - <dimen name="key_height_landscape">34px</dimen> - <dimen name="candidate_font_size">18sp</dimen> - <dimen name="candidate_delete_word_size">32px</dimen> + <dimen name="key_height">50dip</dimen> + <dimen name="key_height_landscape">34dip</dimen> + <dimen name="candidate_font_size">20sp</dimen> + <dimen name="candidate_delete_word_size">32dip</dimen> + <dimen name="candidate_delete_word_size_landscape">28dip</dimen> + <dimen name="bubble_pointer_offset">22dip</dimen> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 993dad8..59f22ce 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -33,7 +33,7 @@ <string name="preference_key_vibration_title"> Vibrate on Key Press </string> <string name="preference_key_vibration_summary"> Enable key click vibration. </string> - <string name="preference_preview_title"> Key preview </string> + <string name="preference_preview_title"> Key Preview </string> <string name="preference_preview_summary"> Enable key preview. </string> <string name="preference_auto_caps_title"> Auto Capitalization </string> @@ -42,14 +42,9 @@ <string name="preference_keyboard_skin_title">Keyboard Image</string> <string name="preference_keyboard_skin_summary">Change keyboard image.</string> - <string name="preference_keyboard_android_default">Default</string> + <string name="preference_keyboard_android_default">Standard</string> <string name="preference_keyboard_simple">Simple</string> <string name="preference_keyboard_metal">Metal</string> - <string name="preference_keyboard_light">Light</string> - <string name="preference_keyboard_ice">Ice</string> - <string name="preference_keyboard_classic">Classic</string> - <string name="preference_keyboard_wood">Wood</string> - <string name="preference_keyboard_kyoto">Kyoto</string> <string name="preference_conversion_menu">Conversion</string> @@ -110,25 +105,26 @@ <string name="user_dictionary_words_duplication_message">Already registered.</string> <string name="user_dictionary_over_max_text_size_message">Length of the string exceeds the limit.</string> <string name="user_dictionary_creating_wordlist">Loading</string> - <string name="user_dictionary_init">initialize?</string> - + <string name="user_dictionary_init">Initialize?</string> + <string name="user_dictionary_prev_button"> ≪ </string> + <string name="user_dictionary_next_button"> ≫ </string> <!-- IME dependency --> <!-- OpenWnn English --> - <string name="openwnn_english_copyright">Ver.1.21-RC-20090403\nOMRON SOFTWARE Co., Ltd.</string> + <string name="openwnn_english_copyright">Ver.1.3.1\nOMRON SOFTWARE Co., Ltd.</string> <string name="openwnn_english">OpenWnn English</string> <string name="openwnn_english_system_dictionary">/data/data/jp.co.omronsoft.openwnn/lib/libWnnEngDic.so</string> <string name="openwnn_english_writable_dictionary">/data/data/jp.co.omronsoft.openwnn/writableEN.dic</string> <string name="en_word_separators">.,;:!?</string> <!-- OpenWnn Japanese --> - <string name="openwnn_japanese_copyright">Ver.1.21-RC-20090403\nOMRON SOFTWARE Co., Ltd.</string> - <string name="openwnn_japanese">OpenWnn Japanese</string> + <string name="openwnn_japanese_copyright">Ver.1.3.1\nOMRON SOFTWARE Co., Ltd.</string> + <string name="openwnn_japanese">Japanese IME</string> <string name="openwnn_japanese_system_dictionary">/data/data/jp.co.omronsoft.openwnn/lib/libWnnJpnDic.so</string> <string name="openwnn_japanese_writable_dictionary">/data/data/jp.co.omronsoft.openwnn/writableJAJP.dic</string> <!-- OpenWnn Chinese --> - <string name="openwnn_china_copyright">Ver.1.21-RC-20090403\nOMRON SOFTWARE Co., Ltd.</string> + <string name="openwnn_china_copyright">Ver.1.3.1\nOMRON SOFTWARE Co., Ltd.</string> <string name="openwnn_china">OpenWnn Chinese</string> <string name="openwnn_china_system_dictionary">/data/data/jp.co.omronsoft.openwnn/lib/libWnnZHCNDic.so</string> <!-- After Config Change --> @@ -140,7 +136,6 @@ <string name="button_candidate_delete">Delete learning?</string> <string name="button_candidate_cancel">Close</string> - <string name="read_more">・・・▲</string> <!-- Key top --> <string name="key_left_arrow">↤</string> @@ -151,7 +146,6 @@ <string name="key_convert">変換</string> <string name="key_switch_keyboard">KBD</string> - <string name="key_12key_emoji_kigo">絵記顔</string> <string name="key_12key_A">゛゜ 大小</string> <string name="key_12key_kutoten">、。</string> <string name="key_12key_eisuu_kana">英数カナ</string> @@ -191,7 +185,6 @@ <string name="key_12key_0">わ 0 -</string> <string name="key_qwerty_tyouon">ー</string> - <string name="key_qwerty_emoji_kigo">絵記顔</string> <string name="key_qwerty_full_touten">、</string> <string name="key_qwerty_full_kuten">。</string> <string name="key_qwerty_full_question">?</string> @@ -228,6 +221,7 @@ <string name="key_qwerty_full_dollar_sign">$</string> <string name="key_qwerty_full_yen_sign">¥</string> <string name="key_qwerty_full_hat">^</string> + <string name="key_qwerty_full_slash">/</string> <string name="key_12key_switch_full_hiragana">あ</string> <string name="key_12key_switch_full_katakana">カ</string> @@ -247,5 +241,26 @@ <string name="indicator_caps">CAPS</string> <string name="indicator_alt">ALT</string> + + <!-- Tutorial --> + <string name="touch_to_continue">Next »</string> + <string name="touch_to_try">Try it on the button below.</string> + <string name="touch_to_finish">Try typing and using the keyboard yourself!</string> + <string name="tip_to_step1"><b>Like a normal mobile keyboard, tapping ○ three times will result\nin *C*.</b></string> + <string name="tip_to_step2_a"><b>For example, let\'s type \"hi.\"\n- Tap ○ twice to get \"h\"</b></string> + <string name="tip_to_step2_b"><b>\n- Tap → to advance to the right</b></string> + <string name="tip_to_step2_c"><b>\n- Tap ○ three times to get \"i\"</b></string> + <string name="tip_to_step2_d"><b>\n- Use touch or ↓ to set the word.</b></string> + <string name="tip_to_step3_a"><b>The ■ key switches between Japanese, English, and number input.</b></string> + <string name="tip_to_step3_b"><b>We\'ve switched from English to numbers. Next is Japanese.</b></string> + <string name="tip_to_step3_c"><b>Let\'s return to English now.</b></string> + <string name="tip_to_step4"><b>For other input modes (like full width)\nor a PC style keyboard, hold ■\nfor 3 seconds to show the input menu.</b></string> + <string name="tip_to_step5"><b>When you\'re done typing, hit the \"back\" key (←) to close the keyboard.</b></string> + <string name="tip_to_step6"><b>This is the end of the tutorial.</b></string> + + <string name="tip_en_to_open_keyboard"><b>The keyboard opens any time you touch a text field.</b></string> + <string name="tip_en_to_close_keyboard"><b>Press \"back\" (←) to close the keyboard.</b></string> + <string name="tip_en_end_of_tutorial"><b>This is the end of the tutorial.</b></string> + </resources> diff --git a/res/xml/default_cn_full_symbols.xml b/res/xml/default_cn_full_symbols.xml index 5d4dec8..7acb9d3 100644 --- a/res/xml/default_cn_full_symbols.xml +++ b/res/xml/default_cn_full_symbols.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_full_symbols_shift.xml b/res/xml/default_cn_full_symbols_shift.xml index ebe4bb5..31f0404 100644 --- a/res/xml/default_cn_full_symbols_shift.xml +++ b/res/xml/default_cn_full_symbols_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_half_symbols.xml b/res/xml/default_cn_half_symbols.xml index dd92e75..ca12eca 100644 --- a/res/xml/default_cn_half_symbols.xml +++ b/res/xml/default_cn_half_symbols.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_half_symbols_shift.xml b/res/xml/default_cn_half_symbols_shift.xml index 1660841..cc652d9 100644 --- a/res/xml/default_cn_half_symbols_shift.xml +++ b/res/xml/default_cn_half_symbols_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_qwerty.xml b/res/xml/default_cn_qwerty.xml index b6fd93b..c6498c9 100644 --- a/res/xml/default_cn_qwerty.xml +++ b/res/xml/default_cn_qwerty.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_qwerty_pinyin.xml b/res/xml/default_cn_qwerty_pinyin.xml index 72e76ef..7d59131 100644 --- a/res/xml/default_cn_qwerty_pinyin.xml +++ b/res/xml/default_cn_qwerty_pinyin.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_qwerty_pinyin_shift.xml b/res/xml/default_cn_qwerty_pinyin_shift.xml index 3bd917f..4ed5130 100644 --- a/res/xml/default_cn_qwerty_pinyin_shift.xml +++ b/res/xml/default_cn_qwerty_pinyin_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_cn_switch_key.xml b/res/xml/default_cn_switch_key.xml index b5d0495..e30e447 100644 --- a/res/xml/default_cn_switch_key.xml +++ b/res/xml/default_cn_switch_key.xml @@ -16,9 +16,9 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="15%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="50px" > + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="50dip" > <Row> <Key android:codes="-115" android:keyLabel="@string/key_12key_switch_pinyin" android:keyEdgeFlags="left"/> diff --git a/res/xml/default_en_qwerty.xml b/res/xml/default_en_qwerty.xml index 3a2f736..35068ee 100644 --- a/res/xml/default_en_qwerty.xml +++ b/res/xml/default_en_qwerty.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_en_switch_key.xml b/res/xml/default_en_switch_key.xml index 95f5a5e..319546b 100644 --- a/res/xml/default_en_switch_key.xml +++ b/res/xml/default_en_switch_key.xml @@ -16,9 +16,9 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="15%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="50px" > + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="50dip" > <Row> <Key android:codes="-113" android:keyLabel="@string/key_12key_switch_half_alphabet" android:keyEdgeFlags="left"/> diff --git a/res/xml/default_en_symbols.xml b/res/xml/default_en_symbols.xml index 2c0e1d8..16d5fe1 100644 --- a/res/xml/default_en_symbols.xml +++ b/res/xml/default_en_symbols.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/default_en_symbols_shift.xml b/res/xml/default_en_symbols_shift.xml index a8735be..c2eb67b 100644 --- a/res/xml/default_en_symbols_shift.xml +++ b/res/xml/default_en_symbols_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > diff --git a/res/xml/keyboard_12key_alphabet_input_landscape.xml b/res/xml/keyboard_12key_alphabet_input_landscape.xml deleted file mode 100644 index ee65750..0000000 --- a/res/xml/keyboard_12key_alphabet_input_landscape.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" - > - <Row> - <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_alphabet_1"/> - <Key android:codes="-202" android:keyLabel="@string/key_12key_alphabet_2"/> - <Key android:codes="-203" android:keyLabel="@string/key_12key_alphabet_3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_alphabet_4"/> - <Key android:codes="-205" android:keyLabel="@string/key_12key_alphabet_5"/> - <Key android:codes="-206" android:keyLabel="@string/key_12key_alphabet_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_alphabet_7"/> - <Key android:codes="-208" android:keyLabel="@string/key_12key_alphabet_8"/> - <Key android:codes="-209" android:keyLabel="@string/key_12key_alphabet_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_alphabet_A"/> - <Key android:codes="-210" android:keyLabel="@string/key_12key_alphabet_0"/> - <Key android:codes="-211" android:keyLabel=", ." /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_12key_alphabet.xml b/res/xml/keyboard_12key_full_alphabet.xml index 676322e..4637af2 100644 --- a/res/xml/keyboard_12key_alphabet.xml +++ b/res/xml/keyboard_12key_full_alphabet.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyIcon="@drawable/key_12key_alpha1" android:iconPreview="@drawable/key_12key_alpha1_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyIcon="@drawable/key_12key_alpha1" android:iconPreview="@drawable/key_12key_alpha1_b" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyIcon="@drawable/key_12key_alpha2" android:iconPreview="@drawable/key_12key_alpha2_b"/> <Key android:codes="-203" android:keyIcon="@drawable/key_12key_alpha3" android:iconPreview="@drawable/key_12key_alpha3_b"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyIcon="@drawable/key_12key_alpha4" android:iconPreview="@drawable/key_12key_alpha4_b"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyIcon="@drawable/key_12key_alpha4" android:iconPreview="@drawable/key_12key_alpha4_b" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyIcon="@drawable/key_12key_alpha5" android:iconPreview="@drawable/key_12key_alpha5_b"/> <Key android:codes="-206" android:keyIcon="@drawable/key_12key_alpha6" android:iconPreview="@drawable/key_12key_alpha6_b"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyIcon="@drawable/key_12key_alpha7" android:iconPreview="@drawable/key_12key_alpha7_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyIcon="@drawable/key_12key_alpha7" android:iconPreview="@drawable/key_12key_alpha7_b" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyIcon="@drawable/key_12key_alpha8" android:iconPreview="@drawable/key_12key_alpha8_b"/> <Key android:codes="-209" android:keyIcon="@drawable/key_12key_alpha9" android:iconPreview="@drawable/key_12key_alpha9_b"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_alphabet_A"/> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_full_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_caps" android:iconPreview="@drawable/key_12key_caps_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyIcon="@drawable/key_12key_alpha0" android:iconPreview="@drawable/key_12key_alpha0_b"/> - <Key android:codes="-211" android:keyLabel=", ." /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_period_comma" android:iconPreview="@drawable/key_12key_period_comma_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_alphabet_input.xml b/res/xml/keyboard_12key_full_alphabet_input.xml index 8737101..d34007d 100644 --- a/res/xml/keyboard_12key_alphabet_input.xml +++ b/res/xml/keyboard_12key_full_alphabet_input.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyIcon="@drawable/key_12key_alpha1" android:iconPreview="@drawable/key_12key_alpha1_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyIcon="@drawable/key_12key_alpha1" android:iconPreview="@drawable/key_12key_alpha1_b" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyIcon="@drawable/key_12key_alpha2" android:iconPreview="@drawable/key_12key_alpha2_b"/> <Key android:codes="-203" android:keyIcon="@drawable/key_12key_alpha3" android:iconPreview="@drawable/key_12key_alpha3_b"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyIcon="@drawable/key_12key_alpha4" android:iconPreview="@drawable/key_12key_alpha4_b"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyIcon="@drawable/key_12key_alpha4" android:iconPreview="@drawable/key_12key_alpha4_b" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyIcon="@drawable/key_12key_alpha5" android:iconPreview="@drawable/key_12key_alpha5_b"/> <Key android:codes="-206" android:keyIcon="@drawable/key_12key_alpha6" android:iconPreview="@drawable/key_12key_alpha6_b"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyIcon="@drawable/key_12key_alpha7" android:iconPreview="@drawable/key_12key_alpha7_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyIcon="@drawable/key_12key_alpha7" android:iconPreview="@drawable/key_12key_alpha7_b" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyIcon="@drawable/key_12key_alpha8" android:iconPreview="@drawable/key_12key_alpha8_b"/> <Key android:codes="-209" android:keyIcon="@drawable/key_12key_alpha9" android:iconPreview="@drawable/key_12key_alpha9_b"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_alphabet_A"/> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_full_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_caps" android:iconPreview="@drawable/key_12key_caps_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyIcon="@drawable/key_12key_alpha0" android:iconPreview="@drawable/key_12key_alpha0_b"/> - <Key android:codes="-211" android:keyLabel=", ." /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_period_comma" android:iconPreview="@drawable/key_12key_period_comma_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_katakana.xml b/res/xml/keyboard_12key_full_katakana.xml index 0123e29..aefc90f 100644 --- a/res/xml/keyboard_12key_katakana.xml +++ b/res/xml/keyboard_12key_full_katakana.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyLabel="@string/key_12key_katakana_2"/> <Key android:codes="-203" android:keyLabel="@string/key_12key_katakana_3"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyLabel="@string/key_12key_katakana_5"/> <Key android:codes="-206" android:keyLabel="@string/key_12key_katakana_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyLabel="@string/key_12key_katakana_8"/> <Key android:codes="-209" android:keyLabel="@string/key_12key_katakana_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" /> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_full_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyLabel="@string/key_12key_katakana_0" /> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_ten" android:iconPreview="@drawable/key_12key_ten_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_katakana_input.xml b/res/xml/keyboard_12key_full_katakana_input.xml index 25acc0b..f17bc81 100644 --- a/res/xml/keyboard_12key_katakana_input.xml +++ b/res/xml/keyboard_12key_full_katakana_input.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyLabel="@string/key_12key_katakana_2"/> <Key android:codes="-203" android:keyLabel="@string/key_12key_katakana_3"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyLabel="@string/key_12key_katakana_5"/> <Key android:codes="-206" android:keyLabel="@string/key_12key_katakana_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyLabel="@string/key_12key_katakana_8"/> <Key android:codes="-209" android:keyLabel="@string/key_12key_katakana_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" /> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_full_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyLabel="@string/key_12key_katakana_0" /> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_ten" android:iconPreview="@drawable/key_12key_ten_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_num.xml b/res/xml/keyboard_12key_full_num.xml index 60570f7..c17d031 100644 --- a/res/xml/keyboard_12key_num.xml +++ b/res/xml/keyboard_12key_full_num.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="1"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyLabel="1" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyLabel="2"/> <Key android:codes="-203" android:keyLabel="3"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="4"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyLabel="4" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyLabel="5"/> <Key android:codes="-206" android:keyLabel="6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="7"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyLabel="7" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyLabel="8"/> <Key android:codes="-209" android:keyLabel="9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="*" /> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_full_num" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyLabel="*" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyLabel="0" /> <Key android:codes="-211" android:keyLabel="#" /> <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_half_alphabet.xml b/res/xml/keyboard_12key_half_alphabet.xml new file mode 100644 index 0000000..2588c46 --- /dev/null +++ b/res/xml/keyboard_12key_half_alphabet.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + + 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="20%p" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" + > + + <Row> + <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyIcon="@drawable/key_12key_alpha1" android:iconPreview="@drawable/key_12key_alpha1_b" android:horizontalGap="2%"/> + <Key android:codes="-202" android:keyIcon="@drawable/key_12key_alpha2" android:iconPreview="@drawable/key_12key_alpha2_b"/> + <Key android:codes="-203" android:keyIcon="@drawable/key_12key_alpha3" android:iconPreview="@drawable/key_12key_alpha3_b"/> + <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> + + <Row> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyIcon="@drawable/key_12key_alpha4" android:iconPreview="@drawable/key_12key_alpha4_b" android:horizontalGap="2%"/> + <Key android:codes="-205" android:keyIcon="@drawable/key_12key_alpha5" android:iconPreview="@drawable/key_12key_alpha5_b"/> + <Key android:codes="-206" android:keyIcon="@drawable/key_12key_alpha6" android:iconPreview="@drawable/key_12key_alpha6_b"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> + + <Row> + <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyIcon="@drawable/key_12key_alpha7" android:iconPreview="@drawable/key_12key_alpha7_b" android:horizontalGap="2%"/> + <Key android:codes="-208" android:keyIcon="@drawable/key_12key_alpha8" android:iconPreview="@drawable/key_12key_alpha8_b"/> + <Key android:codes="-209" android:keyIcon="@drawable/key_12key_alpha9" android:iconPreview="@drawable/key_12key_alpha9_b"/> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> + + <Row android:rowEdgeFlags="bottom"> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_half_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_caps" android:iconPreview="@drawable/key_12key_caps_b" android:horizontalGap="2%"/> + <Key android:codes="-210" android:keyIcon="@drawable/key_12key_alpha0" android:iconPreview="@drawable/key_12key_alpha0_b"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_period_comma" android:iconPreview="@drawable/key_12key_period_comma_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> +</Keyboard> diff --git a/res/xml/keyboard_12key_half_alphabet_input.xml b/res/xml/keyboard_12key_half_alphabet_input.xml new file mode 100644 index 0000000..a7c6549 --- /dev/null +++ b/res/xml/keyboard_12key_half_alphabet_input.xml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + + 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="20%p" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" + > + + <Row> + <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyIcon="@drawable/key_12key_alpha1" android:iconPreview="@drawable/key_12key_alpha1_b" android:horizontalGap="2%"/> + <Key android:codes="-202" android:keyIcon="@drawable/key_12key_alpha2" android:iconPreview="@drawable/key_12key_alpha2_b"/> + <Key android:codes="-203" android:keyIcon="@drawable/key_12key_alpha3" android:iconPreview="@drawable/key_12key_alpha3_b"/> + <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> + + <Row> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyIcon="@drawable/key_12key_alpha4" android:iconPreview="@drawable/key_12key_alpha4_b" android:horizontalGap="2%"/> + <Key android:codes="-205" android:keyIcon="@drawable/key_12key_alpha5" android:iconPreview="@drawable/key_12key_alpha5_b"/> + <Key android:codes="-206" android:keyIcon="@drawable/key_12key_alpha6" android:iconPreview="@drawable/key_12key_alpha6_b"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> + + <Row> + <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyIcon="@drawable/key_12key_alpha7" android:iconPreview="@drawable/key_12key_alpha7_b" android:horizontalGap="2%"/> + <Key android:codes="-208" android:keyIcon="@drawable/key_12key_alpha8" android:iconPreview="@drawable/key_12key_alpha8_b"/> + <Key android:codes="-209" android:keyIcon="@drawable/key_12key_alpha9" android:iconPreview="@drawable/key_12key_alpha9_b"/> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> + + <Row android:rowEdgeFlags="bottom"> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_half_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_caps" android:iconPreview="@drawable/key_12key_caps_b" android:horizontalGap="2%"/> + <Key android:codes="-210" android:keyIcon="@drawable/key_12key_alpha0" android:iconPreview="@drawable/key_12key_alpha0_b"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_period_comma" android:iconPreview="@drawable/key_12key_period_comma_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> + </Row> +</Keyboard> diff --git a/res/xml/keyboard_12key_alphabet_landscape.xml b/res/xml/keyboard_12key_half_katakana.xml index d85cea5..6d52364 100644 --- a/res/xml/keyboard_12key_alphabet_landscape.xml +++ b/res/xml/keyboard_12key_half_katakana.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_alphabet_1"/> - <Key android:codes="-202" android:keyLabel="@string/key_12key_alphabet_2"/> - <Key android:codes="-203" android:keyLabel="@string/key_12key_alphabet_3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1" android:horizontalGap="2%"/> + <Key android:codes="-202" android:keyLabel="@string/key_12key_katakana_2"/> + <Key android:codes="-203" android:keyLabel="@string/key_12key_katakana_3"/> + <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_alphabet_4"/> - <Key android:codes="-205" android:keyLabel="@string/key_12key_alphabet_5"/> - <Key android:codes="-206" android:keyLabel="@string/key_12key_alphabet_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4" android:horizontalGap="2%"/> + <Key android:codes="-205" android:keyLabel="@string/key_12key_katakana_5"/> + <Key android:codes="-206" android:keyLabel="@string/key_12key_katakana_6"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_alphabet_7"/> - <Key android:codes="-208" android:keyLabel="@string/key_12key_alphabet_8"/> - <Key android:codes="-209" android:keyLabel="@string/key_12key_alphabet_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7" android:horizontalGap="2%"/> + <Key android:codes="-208" android:keyLabel="@string/key_12key_katakana_8"/> + <Key android:codes="-209" android:keyLabel="@string/key_12key_katakana_9"/> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_alphabet_A"/> - <Key android:codes="-210" android:keyLabel="@string/key_12key_alphabet_0"/> - <Key android:codes="-211" android:keyLabel=", ." /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_half_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" android:horizontalGap="2%"/> + <Key android:codes="-210" android:keyLabel="@string/key_12key_katakana_0" /> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_ten" android:iconPreview="@drawable/key_12key_ten_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_katakana_landscape.xml b/res/xml/keyboard_12key_half_katakana_input.xml index fe20b37..19cd68f 100644 --- a/res/xml/keyboard_12key_katakana_landscape.xml +++ b/res/xml/keyboard_12key_half_katakana_input.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > - <Row> + <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyLabel="@string/key_12key_katakana_2"/> <Key android:codes="-203" android:keyLabel="@string/key_12key_katakana_3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> + <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyLabel="@string/key_12key_katakana_5"/> <Key android:codes="-206" android:keyLabel="@string/key_12key_katakana_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyLabel="@string/key_12key_katakana_8"/> <Key android:codes="-209" android:keyLabel="@string/key_12key_katakana_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> - + <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_A"/> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_half_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyLabel="@string/key_12key_katakana_0" /> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_ten" android:iconPreview="@drawable/key_12key_ten_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_num_landscape.xml b/res/xml/keyboard_12key_half_num.xml index 70da21d..49a6562 100644 --- a/res/xml/keyboard_12key_num_landscape.xml +++ b/res/xml/keyboard_12key_half_num.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="1"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyLabel="1" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyLabel="2"/> <Key android:codes="-203" android:keyLabel="3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> + <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="4"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyLabel="4" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyLabel="5"/> <Key android:codes="-206" android:keyLabel="6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="7"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyLabel="7" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyLabel="8"/> <Key android:codes="-209" android:keyLabel="9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="*" /> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_half_num" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyLabel="*" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyLabel="0" /> <Key android:codes="-211" android:keyLabel="#" /> <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_katakana_input_landscape.xml b/res/xml/keyboard_12key_katakana_input_landscape.xml deleted file mode 100644 index c10d624..0000000 --- a/res/xml/keyboard_12key_katakana_input_landscape.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" - > - - <Row> - <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_katakana_1"/> - <Key android:codes="-202" android:keyLabel="@string/key_12key_katakana_2"/> - <Key android:codes="-203" android:keyLabel="@string/key_12key_katakana_3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_katakana_4"/> - <Key android:codes="-205" android:keyLabel="@string/key_12key_katakana_5"/> - <Key android:codes="-206" android:keyLabel="@string/key_12key_katakana_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_katakana_7"/> - <Key android:codes="-208" android:keyLabel="@string/key_12key_katakana_8"/> - <Key android:codes="-209" android:keyLabel="@string/key_12key_katakana_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_A"/> - <Key android:codes="-210" android:keyLabel="@string/key_12key_katakana_0" /> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_12key_phone.xml b/res/xml/keyboard_12key_phone.xml index 4ae5d4b..7637058 100644 --- a/res/xml/keyboard_12key_phone.xml +++ b/res/xml/keyboard_12key_phone.xml @@ -16,45 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-310" android:keyLabel="" - android:keyEdgeFlags="left"/> - <Key android:codes="49" android:keyLabel="1"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="49" android:keyLabel="1" android:horizontalGap="2%"/> <Key android:codes="50" android:keyLabel="2"/> <Key android:codes="51" android:keyLabel="3"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="52" android:keyLabel="4"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="52" android:keyLabel="4" android:horizontalGap="2%"/> <Key android:codes="53" android:keyLabel="5"/> <Key android:codes="54" android:keyLabel="6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="45" android:keyLabel="-"/> - <Key android:codes="55" android:keyLabel="7"/> + <Key android:codes="45" android:keyLabel="-" android:keyWidth="18%"/> + <Key android:codes="55" android:keyLabel="7" android:horizontalGap="2%"/> <Key android:codes="56" android:keyLabel="8"/> <Key android:codes="57" android:keyLabel="9"/> - <Key android:codes="43" android:keyLabel="+"/> + <Key android:codes="43" android:keyLabel="+" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-310" android:keyLabel="" android:keyEdgeFlags="left" /> - <Key android:codes="42" android:keyLabel="*" /> + <Key android:codes="-310" android:keyLabel="" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="42" android:keyLabel="*" android:horizontalGap="2%"/> <Key android:codes="48" android:keyLabel="0" /> <Key android:codes="35" android:keyLabel="#" /> <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12key_phone_landscape.xml b/res/xml/keyboard_12key_phone_landscape.xml deleted file mode 100644 index 159f752..0000000 --- a/res/xml/keyboard_12key_phone_landscape.xml +++ /dev/null @@ -1,78 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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. ---> -<!-- - /* - ** Copyright 2008, OMRON SOFTWARE Co., Ltd. All Rights Reserved. - ** - ** 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="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" - > - - <Row> - <Key android:codes="-310" android:keyLabel="" - android:keyEdgeFlags="left"/> - <Key android:codes="49" android:keyLabel="1"/> - <Key android:codes="50" android:keyLabel="2"/> - <Key android:codes="51" android:keyLabel="3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" - android:isRepeatable="true" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="52" android:keyLabel="4"/> - <Key android:codes="53" android:keyLabel="5"/> - <Key android:codes="54" android:keyLabel="6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="45" android:keyLabel="-"/> - <Key android:codes="55" android:keyLabel="7"/> - <Key android:codes="56" android:keyLabel="8"/> - <Key android:codes="57" android:keyLabel="9"/> - <Key android:codes="43" android:keyLabel="+"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-310" android:keyLabel="" android:keyEdgeFlags="left" /> - <Key android:codes="42" android:keyLabel="*" /> - <Key android:codes="48" android:keyLabel="0" /> - <Key android:codes="35" android:keyLabel="#" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" - android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> - diff --git a/res/xml/keyboard_12keyjp.xml b/res/xml/keyboard_12keyjp.xml index f05c953..b96fc4f 100644 --- a/res/xml/keyboard_12keyjp.xml +++ b/res/xml/keyboard_12keyjp.xml @@ -16,45 +16,46 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyIcon="@drawable/key_12key_hiragana1" android:iconPreview="@drawable/key_12key_hiragana1_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyIcon="@drawable/key_12key_hiragana1" android:iconPreview="@drawable/key_12key_hiragana1_b" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyIcon="@drawable/key_12key_hiragana2" android:iconPreview="@drawable/key_12key_hiragana2_b"/> <Key android:codes="-203" android:keyIcon="@drawable/key_12key_hiragana3" android:iconPreview="@drawable/key_12key_hiragana3_b"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyIcon="@drawable/key_12key_hiragana4" android:iconPreview="@drawable/key_12key_hiragana4_b"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyIcon="@drawable/key_12key_hiragana4" android:iconPreview="@drawable/key_12key_hiragana4_b" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyIcon="@drawable/key_12key_hiragana5" android:iconPreview="@drawable/key_12key_hiragana5_b"/> <Key android:codes="-206" android:keyIcon="@drawable/key_12key_hiragana6" android:iconPreview="@drawable/key_12key_hiragana6_b"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyIcon="@drawable/key_12key_hiragana7" android:iconPreview="@drawable/key_12key_hiragana7_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyIcon="@drawable/key_12key_hiragana7" android:iconPreview="@drawable/key_12key_hiragana7_b" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyIcon="@drawable/key_12key_hiragana8" android:iconPreview="@drawable/key_12key_hiragana8_b"/> <Key android:codes="-209" android:keyIcon="@drawable/key_12key_hiragana9" android:iconPreview="@drawable/key_12key_hiragana9_b"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space_jp" android:iconPreview="@drawable/key_12key_space_jp_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" android:popupKeyboard="@xml/keyboard_switch_key" - android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" /> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_hira" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyIcon="@drawable/key_12key_hiragana0" android:iconPreview="@drawable/key_12key_hiragana0_b"/> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_ten" android:iconPreview="@drawable/key_12key_ten_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12keyjp_input.xml b/res/xml/keyboard_12keyjp_input.xml index 1dc1202..fa86cd5 100644 --- a/res/xml/keyboard_12keyjp_input.xml +++ b/res/xml/keyboard_12keyjp_input.xml @@ -16,44 +16,45 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > <Row> <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyIcon="@drawable/key_12key_hiragana1" android:iconPreview="@drawable/key_12key_hiragana1_b"/> + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-201" android:keyIcon="@drawable/key_12key_hiragana1" android:iconPreview="@drawable/key_12key_hiragana1_b" android:horizontalGap="2%"/> <Key android:codes="-202" android:keyIcon="@drawable/key_12key_hiragana2" android:iconPreview="@drawable/key_12key_hiragana2_b"/> <Key android:codes="-203" android:keyIcon="@drawable/key_12key_hiragana3" android:iconPreview="@drawable/key_12key_hiragana3_b"/> <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del" android:iconPreview="@drawable/key_12key_del_b" - android:isRepeatable="true" android:keyEdgeFlags="right"/> + android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyIcon="@drawable/key_12key_hiragana4" android:iconPreview="@drawable/key_12key_hiragana4_b"/> + <Key android:codes="-218" android:keyIcon="@drawable/key_12key_left" android:iconPreview="@drawable/key_12key_left_b" android:isRepeatable="true" android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-204" android:keyIcon="@drawable/key_12key_hiragana4" android:iconPreview="@drawable/key_12key_hiragana4_b" android:horizontalGap="2%"/> <Key android:codes="-205" android:keyIcon="@drawable/key_12key_hiragana5" android:iconPreview="@drawable/key_12key_hiragana5_b"/> <Key android:codes="-206" android:keyIcon="@drawable/key_12key_hiragana6" android:iconPreview="@drawable/key_12key_hiragana6_b"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> + <Key android:codes="-217" android:keyIcon="@drawable/key_12key_right" android:iconPreview="@drawable/key_12key_right_b" android:isRepeatable="true" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row> - <Key android:codes="-305" android:keyIcon="@drawable/key_12key_eisukana" android:iconPreview="@drawable/key_12key_eisukana_b"/> - <Key android:codes="-207" android:keyIcon="@drawable/key_12key_hiragana7" android:iconPreview="@drawable/key_12key_hiragana7_b"/> + <Key android:codes="-305" android:keyIcon="@drawable/key_12key_eisukana" android:iconPreview="@drawable/key_12key_eisukana_b" android:keyWidth="18%"/> + <Key android:codes="-207" android:keyIcon="@drawable/key_12key_hiragana7" android:iconPreview="@drawable/key_12key_hiragana7_b" android:horizontalGap="2%"/> <Key android:codes="-208" android:keyIcon="@drawable/key_12key_hiragana8" android:iconPreview="@drawable/key_12key_hiragana8_b"/> <Key android:codes="-209" android:keyIcon="@drawable/key_12key_hiragana9" android:iconPreview="@drawable/key_12key_hiragana9_b"/> - <Key android:codes="-215" android:keyLabel="@string/key_convert" android:keyEdgeFlags="right"/> + <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space_jp" android:iconPreview="@drawable/key_12key_space_jp_b" android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" android:popupKeyboard="@xml/keyboard_switch_key" - android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" /> + <Key android:codes="-230" android:keyIcon="@drawable/key_12key_mode_hira" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_jp" + android:keyEdgeFlags="left" android:keyWidth="18%"/> + <Key android:codes="-213" android:keyIcon="@drawable/key_12key_dakuten" android:iconPreview="@drawable/key_12key_dakuten_b" android:horizontalGap="2%"/> <Key android:codes="-210" android:keyIcon="@drawable/key_12key_hiragana0" android:iconPreview="@drawable/key_12key_hiragana0_b"/> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> + <Key android:codes="-211" android:keyIcon="@drawable/key_12key_ten" android:iconPreview="@drawable/key_12key_ten_b" /> + <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter_jp" android:iconPreview="@drawable/key_12key_enter_jp_b" + android:keyEdgeFlags="right" android:horizontalGap="2%" android:keyWidth="18%"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_12keyjp_input_landscape.xml b/res/xml/keyboard_12keyjp_input_landscape.xml deleted file mode 100644 index 3d9e80f..0000000 --- a/res/xml/keyboard_12keyjp_input_landscape.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" - > - - <Row> - <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_1"/> - <Key android:codes="-202" android:keyLabel="@string/key_12key_2"/> - <Key android:codes="-203" android:keyLabel="@string/key_12key_3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_4"/> - <Key android:codes="-205" android:keyLabel="@string/key_12key_5"/> - <Key android:codes="-206" android:keyLabel="@string/key_12key_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-305" android:keyLabel="@string/key_12key_eisuu_kana" android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_7"/> - <Key android:codes="-208" android:keyLabel="@string/key_12key_8"/> - <Key android:codes="-209" android:keyLabel="@string/key_12key_9"/> - <Key android:codes="-215" android:keyLabel="@string/key_convert" android:keyEdgeFlags="right"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_A" /> - <Key android:codes="-210" android:keyLabel="@string/key_12key_0"/> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_12keyjp_landscape.xml b/res/xml/keyboard_12keyjp_landscape.xml deleted file mode 100644 index 816fc05..0000000 --- a/res/xml/keyboard_12keyjp_landscape.xml +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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="20%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="@dimen/key_height_landscape" - > - - <Row> - <Key android:codes="-219" android:keyIcon="@drawable/key_12key_reverse" android:iconPreview="@drawable/key_12key_reverse_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-201" android:keyLabel="@string/key_12key_1"/> - <Key android:codes="-202" android:keyLabel="@string/key_12key_2"/> - <Key android:codes="-203" android:keyLabel="@string/key_12key_3"/> - <Key android:codes="-214" android:keyIcon="@drawable/key_12key_del_landscape" android:iconPreview="@drawable/key_12key_del_b_landscape" android:isRepeatable="true" - android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-218" android:keyLabel="@string/key_left_arrow" android:isRepeatable="true" android:keyEdgeFlags="left"/> - <Key android:codes="-204" android:keyLabel="@string/key_12key_4"/> - <Key android:codes="-205" android:keyLabel="@string/key_12key_5"/> - <Key android:codes="-206" android:keyLabel="@string/key_12key_6"/> - <Key android:codes="-217" android:keyLabel="@string/key_right_arrow" android:isRepeatable="true" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-222" android:keyIcon="@drawable/key_12key_pict_sym" android:iconPreview="@drawable/key_12key_pict_sym_b" - android:keyEdgeFlags="left"/> - <Key android:codes="-207" android:keyLabel="@string/key_12key_7"/> - <Key android:codes="-208" android:keyLabel="@string/key_12key_8"/> - <Key android:codes="-209" android:keyLabel="@string/key_12key_9"/> - <Key android:codes="-215" android:keyIcon="@drawable/key_12key_space" android:iconPreview="@drawable/key_12key_space_b" android:isRepeatable="true" android:keyEdgeFlags="right" /> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key" android:keyEdgeFlags="left"/> - <Key android:codes="-213" android:keyLabel="@string/key_12key_A" /> - <Key android:codes="-210" android:keyLabel="@string/key_12key_0"/> - <Key android:codes="-211" android:keyLabel="@string/key_12key_kutoten" /> - <Key android:codes="-216" android:keyIcon="@drawable/key_12key_enter" android:iconPreview="@drawable/key_12key_enter_b" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty_full_alphabet_landscape.xml b/res/xml/keyboard_qwerty_full_alphabet_landscape.xml deleted file mode 100644 index 841b067..0000000 --- a/res/xml/keyboard_qwerty_full_alphabet_landscape.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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_landscape" - > - - <Row> - <Key android:codes="65361" android:keyLabel="q" android:keyEdgeFlags="left"/> - <Key android:codes="65367" android:keyLabel="w"/> - <Key android:codes="65349" android:keyLabel="e"/> - <Key android:codes="65362" android:keyLabel="r"/> - <Key android:codes="65364" android:keyLabel="t"/> - <Key android:codes="65369" android:keyLabel="y"/> - <Key android:codes="65365" android:keyLabel="u"/> - <Key android:codes="65353" android:keyLabel="i"/> - <Key android:codes="65359" android:keyLabel="o"/> - <Key android:codes="65360" android:keyLabel="p" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="65345" android:keyLabel="a" android:keyEdgeFlags="left"/> - <Key android:codes="65363" android:keyLabel="s"/> - <Key android:codes="65348" android:keyLabel="d"/> - <Key android:codes="65350" android:keyLabel="f"/> - <Key android:codes="65351" android:keyLabel="g"/> - <Key android:codes="65352" android:keyLabel="h"/> - <Key android:codes="65354" android:keyLabel="j"/> - <Key android:codes="65355" android:keyLabel="k"/> - <Key android:codes="65356" android:keyLabel="l"/> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" - android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" - android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="65370" android:keyLabel="z"/> - <Key android:codes="65368" android:keyLabel="x"/> - <Key android:codes="65347" android:keyLabel="c"/> - <Key android:codes="65366" android:keyLabel="v"/> - <Key android:codes="65346" android:keyLabel="b"/> - <Key android:codes="65358" android:keyLabel="n"/> - <Key android:codes="65357" android:keyLabel="m"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" - android:keyEdgeFlags="right" android:isRepeatable="true"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" - android:keyWidth="15%p" android:keyEdgeFlags="left"/> - <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" - android:keyWidth="15%p"/> - <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" - android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" - android:keyWidth="12.5%p"/> - <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" - android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" - android:keyWidth="15%p" android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty_full_alphabet_shift_landscape.xml b/res/xml/keyboard_qwerty_full_alphabet_shift_landscape.xml deleted file mode 100644 index f8178eb..0000000 --- a/res/xml/keyboard_qwerty_full_alphabet_shift_landscape.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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_landscape" - > - - <Row> - <Key android:codes="65329" android:keyLabel="Q" android:keyEdgeFlags="left"/> - <Key android:codes="65335" android:keyLabel="W"/> - <Key android:codes="65317" android:keyLabel="E"/> - <Key android:codes="65330" android:keyLabel="R"/> - <Key android:codes="65332" android:keyLabel="T"/> - <Key android:codes="65337" android:keyLabel="Y"/> - <Key android:codes="65333" android:keyLabel="U"/> - <Key android:codes="65321" android:keyLabel="I"/> - <Key android:codes="65327" android:keyLabel="O"/> - <Key android:codes="65328" android:keyLabel="P" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="65313" android:keyLabel="A" android:keyEdgeFlags="left"/> - <Key android:codes="65331" android:keyLabel="S"/> - <Key android:codes="65316" android:keyLabel="D"/> - <Key android:codes="65318" android:keyLabel="F"/> - <Key android:codes="65319" android:keyLabel="G"/> - <Key android:codes="65320" android:keyLabel="H"/> - <Key android:codes="65322" android:keyLabel="J"/> - <Key android:codes="65323" android:keyLabel="K"/> - <Key android:codes="65324" android:keyLabel="L"/> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" - android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" - android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="65338" android:keyLabel="Z"/> - <Key android:codes="65336" android:keyLabel="X"/> - <Key android:codes="65315" android:keyLabel="C"/> - <Key android:codes="65334" android:keyLabel="V"/> - <Key android:codes="65314" android:keyLabel="B"/> - <Key android:codes="65326" android:keyLabel="N"/> - <Key android:codes="65325" android:keyLabel="M"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" - android:keyEdgeFlags="right" android:isRepeatable="true"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" - android:keyWidth="15%p" android:keyEdgeFlags="left"/> - <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" - android:keyWidth="15%p"/> - <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" - android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" - android:keyWidth="12.5%p"/> - <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" - android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" - android:keyWidth="15%p" android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty_full_symbols_landscape.xml b/res/xml/keyboard_qwerty_full_symbols_landscape.xml deleted file mode 100644 index 0091d04..0000000 --- a/res/xml/keyboard_qwerty_full_symbols_landscape.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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_landscape" - > - - <Row> - <Key android:codes="65297" android:keyLabel="1" android:keyEdgeFlags="left"/> - <Key android:codes="65298" android:keyLabel="2"/> - <Key android:codes="65299" android:keyLabel="3"/> - <Key android:codes="65300" android:keyLabel="4"/> - <Key android:codes="65301" android:keyLabel="5"/> - <Key android:codes="65302" android:keyLabel="6"/> - <Key android:codes="65303" android:keyLabel="7"/> - <Key android:codes="65304" android:keyLabel="8"/> - <Key android:codes="65305" android:keyLabel="9"/> - <Key android:codes="65296" android:keyLabel="0" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="65312" android:keyLabel="@string/key_qwerty_full_at_sign" android:keyEdgeFlags="left"/> - <Key android:codes="65283" android:keyLabel="@string/key_qwerty_full_number_sign" /> - <Key android:codes="65285" android:keyLabel="@string/key_qwerty_full_percent_sign" /> - <Key android:codes="65286" android:keyLabel="@string/key_qwerty_full_ampersand" /> - <Key android:codes="65290" android:keyLabel="@string/key_qwerty_full_asterrisk" /> - <Key android:codes="65291" android:keyLabel="@string/key_qwerty_full_plus_sign" /> - <Key android:codes="65293" android:keyLabel="@string/key_qwerty_full_minus_sign" /> - <Key android:codes="65309" android:keyLabel="@string/key_qwerty_full_equal_sign" /> - <Key android:codes="12300" android:keyLabel="@string/key_qwerty_kagi_kakko_left" /> - <Key android:codes="12301" android:keyLabel="@string/key_qwerty_kagi_kakko_right" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" - android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" /> - <Key android:codes="65288" android:keyLabel="@string/key_qwerty_full_left_parenthesis" /> - <Key android:codes="65289" android:keyLabel="@string/key_qwerty_full_right_parenthesis" /> - <Key android:codes="65306" android:keyLabel="@string/key_qwerty_full_colon" /> - <Key android:codes="65307" android:keyLabel="@string/key_qwerty_full_semicolon" /> - <Key android:codes="12539" android:keyLabel="@string/key_qwerty_full_middot" /> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" /> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" - android:keyEdgeFlags="right" android:isRepeatable="true"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" - android:keyWidth="15%p" android:keyEdgeFlags="left" /> - <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" - android:keyWidth="15%p" /> - <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" - android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" android:keyWidth="12.5%p" /> - <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" android:keyWidth="12.5%p" /> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" - android:keyWidth="15%p" android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty_full_symbols_shift_landscape.xml b/res/xml/keyboard_qwerty_full_symbols_shift_landscape.xml deleted file mode 100644 index 4a7bed8..0000000 --- a/res/xml/keyboard_qwerty_full_symbols_shift_landscape.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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_landscape" - > - - <Row> - <Key android:codes="65297" android:keyLabel="1" android:keyEdgeFlags="left"/> - <Key android:codes="65298" android:keyLabel="2"/> - <Key android:codes="65299" android:keyLabel="3"/> - <Key android:codes="65300" android:keyLabel="4"/> - <Key android:codes="65301" android:keyLabel="5"/> - <Key android:codes="65302" android:keyLabel="6"/> - <Key android:codes="65303" android:keyLabel="7"/> - <Key android:codes="65304" android:keyLabel="8"/> - <Key android:codes="65305" android:keyLabel="9"/> - <Key android:codes="65296" android:keyLabel="0" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="65374" android:keyLabel="@string/key_qwerty_full_thilde" android:keyEdgeFlags="left"/> - <Key android:codes="65342" android:keyLabel="@string/key_qwerty_full_hat"/> - <Key android:codes="65509" android:keyLabel="@string/key_qwerty_full_yen_sign"/> - <Key android:codes="65284" android:keyLabel="@string/key_qwerty_full_dollar_sign"/> - <Key android:codes="8221" android:keyLabel="@string/key_qwerty_full_double_quotation_sign"/> - <Key android:codes="177" android:keyLabel="@string/key_qwerty_full_plus_minus_sign" /> - <Key android:codes="65343" android:keyLabel="@string/key_qwerty_full_underscore"/> - <Key android:codes="65309" android:keyLabel="@string/key_qwerty_full_equal_sign"/> - <Key android:codes="65371" android:keyLabel="@string/key_qwerty_full_left_curly_blacket"/> - <Key android:codes="65373" android:keyLabel="@string/key_qwerty_full_right_curly_blacket" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" - android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="65372" android:keyLabel="@string/key_qwerty_full_vertical_bar"/> - <Key android:codes="65308" android:keyLabel="@string/key_qwerty_full_less_than_sign"/> - <Key android:codes="65310" android:keyLabel="@string/key_qwerty_full_greater_than_sign"/> - <Key android:codes="8216" android:keyLabel="@string/key_qwerty_full_left_single_quote"/> - <Key android:codes="8217" android:keyLabel="@string/key_qwerty_full_right_single_quote"/> - <Key android:codes="65340" android:keyLabel="@string/key_qwerty_full_back_slash" /> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" - android:keyEdgeFlags="right" android:isRepeatable="true"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" - android:keyWidth="15%p" android:keyEdgeFlags="left" /> - <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" - android:keyWidth="15%p" /> - <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" - android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" - android:keyWidth="12.5%p" /> - <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" - android:keyWidth="12.5%p" /> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" - android:keyWidth="15%p" android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty_half_symbols_landscape.xml b/res/xml/keyboard_qwerty_half_symbols_landscape.xml deleted file mode 100644 index f02a85d..0000000 --- a/res/xml/keyboard_qwerty_half_symbols_landscape.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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_landscape" - > - - <Row> - <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/> - <Key android:codes="50" android:keyLabel="2"/> - <Key android:codes="51" android:keyLabel="3"/> - <Key android:codes="52" android:keyLabel="4"/> - <Key android:codes="53" android:keyLabel="5"/> - <Key android:codes="54" android:keyLabel="6"/> - <Key android:codes="55" android:keyLabel="7"/> - <Key android:codes="56" android:keyLabel="8"/> - <Key android:codes="57" android:keyLabel="9"/> - <Key android:codes="48" android:keyLabel="0" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="64" android:keyLabel="\@" android:keyEdgeFlags="left"/> - <Key android:codes="35" android:keyLabel="\#"/> - <Key android:codes="37" android:keyLabel="%"/> - <Key android:codes="38" android:keyLabel="&"/> - <Key android:codes="42" android:keyLabel="*"/> - <Key android:codes="43" android:keyLabel="+"/> - <Key android:codes="45" android:keyLabel="-"/> - <Key android:codes="61" android:keyLabel="="/> - <Key android:codes="91" android:keyLabel="["/> - <Key android:codes="93" android:keyLabel="]" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" - android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="33" android:keyLabel="!" /> - <Key android:codes="40" android:keyLabel="("/> - <Key android:codes="41" android:keyLabel=")"/> - <Key android:codes="58" android:keyLabel=":"/> - <Key android:codes="59" android:keyLabel=";"/> - <Key android:codes="47" android:keyLabel="/" /> - <Key android:codes="63" android:keyLabel="\?"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" - android:keyEdgeFlags="right" android:isRepeatable="true"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" - android:keyWidth="15%p" android:keyEdgeFlags="left" /> - <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" - android:keyWidth="15%p" /> - <Key android:codes="32" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" - android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="44" android:keyLabel="," android:keyWidth="12.5%p" /> - <Key android:codes="46" android:keyLabel="." android:keyWidth="12.5%p" /> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" - android:keyWidth="15%p" android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty_half_symbols_shift_landscape.xml b/res/xml/keyboard_qwerty_half_symbols_shift_landscape.xml deleted file mode 100644 index d9e1f36..0000000 --- a/res/xml/keyboard_qwerty_half_symbols_shift_landscape.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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_landscape" - > - - <Row> - <Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/> - <Key android:codes="50" android:keyLabel="2"/> - <Key android:codes="51" android:keyLabel="3"/> - <Key android:codes="52" android:keyLabel="4"/> - <Key android:codes="53" android:keyLabel="5"/> - <Key android:codes="54" android:keyLabel="6"/> - <Key android:codes="55" android:keyLabel="7"/> - <Key android:codes="56" android:keyLabel="8"/> - <Key android:codes="57" android:keyLabel="9"/> - <Key android:codes="48" android:keyLabel="0" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="126" android:keyLabel="~" android:keyEdgeFlags="left"/> - <Key android:codes="94" android:keyLabel="^"/> - <Key android:codes="165" android:keyLabel="¥"/> - <Key android:codes="36" android:keyLabel="$"/> - <Key android:codes="34" android:keyLabel="""/> - <Key android:codes="43" android:keyLabel="+" /> - <Key android:codes="95" android:keyLabel="_"/> - <Key android:codes="61" android:keyLabel="="/> - <Key android:codes="123" android:keyLabel="{"/> - <Key android:codes="125" android:keyLabel="}" android:keyEdgeFlags="right"/> - </Row> - - <Row> - <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" - android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="124" android:keyLabel="|"/> - <Key android:codes="60" android:keyLabel="<"/> - <Key android:codes="62" android:keyLabel=">"/> - <Key android:codes="96" android:keyLabel="`"/> - <Key android:codes="180" android:keyLabel="´"/> - <Key android:codes="92" android:keyLabel="\\" /> - <Key android:codes="63" android:keyLabel="\?"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" - android:keyEdgeFlags="right" android:isRepeatable="true"/> - </Row> - - <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" - android:keyWidth="15%p" android:keyEdgeFlags="left" /> - <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" - android:keyWidth="15%p" /> - <Key android:codes="32" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" - android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="44" android:keyLabel="," android:keyWidth="12.5%p" /> - <Key android:codes="46" android:keyLabel="." android:keyWidth="12.5%p" /> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" - android:keyWidth="15%p" android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_qwerty.xml b/res/xml/keyboard_qwerty_jp.xml index ed87f0e..ca87e72 100644 --- a/res/xml/keyboard_qwerty.xml +++ b/res/xml/keyboard_qwerty_jp.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -63,8 +63,8 @@ </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_hira" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> @@ -74,7 +74,7 @@ android:keyWidth="12.5%p"/> <Key android:codes="46" android:keyLabel="@string/key_qwerty_full_kuten" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_full_alphabet.xml b/res/xml/keyboard_qwerty_jp_full_alphabet.xml index ab1ecd6..ea7d72f 100644 --- a/res/xml/keyboard_qwerty_full_alphabet.xml +++ b/res/xml/keyboard_qwerty_jp_full_alphabet.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -44,7 +44,7 @@ <Key android:codes="65354" android:keyLabel="j"/> <Key android:codes="65355" android:keyLabel="k"/> <Key android:codes="65356" android:keyLabel="l"/> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" + <Key android:codes="65312" android:keyLabel="@string/key_qwerty_full_at_sign" android:keyEdgeFlags="right"/> </Row> @@ -63,8 +63,8 @@ </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_full_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> diff --git a/res/xml/keyboard_qwerty_full_alphabet_shift.xml b/res/xml/keyboard_qwerty_jp_full_alphabet_shift.xml index 623145a..38005c8 100644 --- a/res/xml/keyboard_qwerty_full_alphabet_shift.xml +++ b/res/xml/keyboard_qwerty_jp_full_alphabet_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -44,7 +44,7 @@ <Key android:codes="65322" android:keyLabel="J"/> <Key android:codes="65323" android:keyLabel="K"/> <Key android:codes="65324" android:keyLabel="L"/> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" + <Key android:codes="65295" android:keyLabel="@string/key_qwerty_full_slash" android:keyEdgeFlags="right"/> </Row> @@ -63,16 +63,16 @@ </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_full_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" + <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" android:keyWidth="12.5%p"/> - <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" + <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" android:keyWidth="12.5%p"/> <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> diff --git a/res/xml/keyboard_qwerty_full_katakana.xml b/res/xml/keyboard_qwerty_jp_full_katakana.xml index 776b5f8..5e2c0cd 100644 --- a/res/xml/keyboard_qwerty_full_katakana.xml +++ b/res/xml/keyboard_qwerty_jp_full_katakana.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -63,8 +63,8 @@ </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_full_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> @@ -74,7 +74,7 @@ android:keyWidth="12.5%p"/> <Key android:codes="12290" android:keyLabel="@string/key_qwerty_full_kuten" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_full_katakana_landscape.xml b/res/xml/keyboard_qwerty_jp_full_katakana_shift.xml index b68e747..dfee410 100644 --- a/res/xml/keyboard_qwerty_full_katakana_landscape.xml +++ b/res/xml/keyboard_qwerty_jp_full_katakana_shift.xml @@ -16,9 +16,9 @@ --> <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_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > <Row> @@ -58,23 +58,23 @@ <Key android:codes="98" android:keyLabel="b"/> <Key android:codes="110" android:keyLabel="n"/> <Key android:codes="109" android:keyLabel="m"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" + <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> - + <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_full_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="12289" android:keyLabel="@string/key_qwerty_full_touten" + <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" android:keyWidth="12.5%p"/> - <Key android:codes="12290" android:keyLabel="@string/key_qwerty_full_kuten" + <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_full_symbols.xml b/res/xml/keyboard_qwerty_jp_full_symbols.xml index cd75aea..1fcf7fa 100644 --- a/res/xml/keyboard_qwerty_full_symbols.xml +++ b/res/xml/keyboard_qwerty_jp_full_symbols.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -50,20 +50,20 @@ <Row> <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" /> + <Key android:codes="65295" android:keyLabel="@string/key_qwerty_full_slash" /> <Key android:codes="65288" android:keyLabel="@string/key_qwerty_full_left_parenthesis" /> <Key android:codes="65289" android:keyLabel="@string/key_qwerty_full_right_parenthesis" /> <Key android:codes="65306" android:keyLabel="@string/key_qwerty_full_colon" /> <Key android:codes="65307" android:keyLabel="@string/key_qwerty_full_semicolon" /> - <Key android:codes="12539" android:keyLabel="@string/key_qwerty_full_middot" /> + <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" /> <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" /> <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_full_num" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left" /> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p" /> diff --git a/res/xml/keyboard_qwerty_full_symbols_shift.xml b/res/xml/keyboard_qwerty_jp_full_symbols_shift.xml index e10565d..26e5cb3 100644 --- a/res/xml/keyboard_qwerty_full_symbols_shift.xml +++ b/res/xml/keyboard_qwerty_jp_full_symbols_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -42,7 +42,7 @@ <Key android:codes="8221" android:keyLabel="@string/key_qwerty_full_double_quotation_sign"/> <Key android:codes="177" android:keyLabel="@string/key_qwerty_full_plus_minus_sign" /> <Key android:codes="65343" android:keyLabel="@string/key_qwerty_full_underscore"/> - <Key android:codes="65309" android:keyLabel="@string/key_qwerty_full_equal_sign"/> + <Key android:codes="65340" android:keyLabel="@string/key_qwerty_full_back_slash"/> <Key android:codes="65371" android:keyLabel="@string/key_qwerty_full_left_curly_blacket"/> <Key android:codes="65373" android:keyLabel="@string/key_qwerty_full_right_curly_blacket" android:keyEdgeFlags="right"/> </Row> @@ -55,23 +55,23 @@ <Key android:codes="65310" android:keyLabel="@string/key_qwerty_full_greater_than_sign"/> <Key android:codes="8216" android:keyLabel="@string/key_qwerty_full_left_single_quote"/> <Key android:codes="8217" android:keyLabel="@string/key_qwerty_full_right_single_quote"/> - <Key android:codes="65340" android:keyLabel="@string/key_qwerty_full_back_slash" /> - <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question"/> + <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" /> + <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" /> <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_full_num" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left" /> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p" /> <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65292" android:keyLabel="@string/key_qwerty_full_comma" + <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" android:keyWidth="12.5%p" /> - <Key android:codes="65294" android:keyLabel="@string/key_qwerty_full_period" + <Key android:codes="12539" android:keyLabel="@string/key_qwerty_full_middot" android:keyWidth="12.5%p" /> <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> diff --git a/res/xml/keyboard_qwerty_half_alphabet.xml b/res/xml/keyboard_qwerty_jp_half_alphabet.xml index a83b50c..80b7934 100644 --- a/res/xml/keyboard_qwerty_half_alphabet.xml +++ b/res/xml/keyboard_qwerty_jp_half_alphabet.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -44,7 +44,7 @@ <Key android:codes="106" android:keyLabel="j"/> <Key android:codes="107" android:keyLabel="k"/> <Key android:codes="108" android:keyLabel="l"/> - <Key android:codes="63" android:keyLabel="\?" android:keyEdgeFlags="right"/> + <Key android:codes="64" android:keyLabel="\@" android:keyEdgeFlags="right"/> </Row> <Row> @@ -62,8 +62,8 @@ </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_half_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> @@ -73,7 +73,7 @@ android:keyWidth="12.5%p"/> <Key android:codes="46" android:keyLabel="." android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_half_alphabet_landscape.xml b/res/xml/keyboard_qwerty_jp_half_alphabet_shift.xml index c178bcc..7dc0869 100644 --- a/res/xml/keyboard_qwerty_half_alphabet_landscape.xml +++ b/res/xml/keyboard_qwerty_jp_half_alphabet_shift.xml @@ -16,9 +16,9 @@ --> <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_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > <Row> @@ -44,7 +44,7 @@ <Key android:codes="106" android:keyLabel="j"/> <Key android:codes="107" android:keyLabel="k"/> <Key android:codes="108" android:keyLabel="l"/> - <Key android:codes="63" android:keyLabel="\?" android:keyEdgeFlags="right"/> + <Key android:codes="47" android:keyLabel="/" android:keyEdgeFlags="right"/> </Row> <Row> @@ -57,23 +57,23 @@ <Key android:codes="98" android:keyLabel="b"/> <Key android:codes="110" android:keyLabel="n"/> <Key android:codes="109" android:keyLabel="m"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" + <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_half_alpha" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> <Key android:codes="32" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="44" android:keyLabel="," + <Key android:codes="33" android:keyLabel="!" android:keyWidth="12.5%p"/> - <Key android:codes="46" android:keyLabel="." + <Key android:codes="63" android:keyLabel="\?" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_half_katakana.xml b/res/xml/keyboard_qwerty_jp_half_katakana.xml index c5b2086..18d6c4c 100644 --- a/res/xml/keyboard_qwerty_half_katakana.xml +++ b/res/xml/keyboard_qwerty_jp_half_katakana.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -63,8 +63,8 @@ </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_half_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> @@ -74,7 +74,7 @@ android:keyWidth="12.5%p"/> <Key android:codes="65377" android:keyLabel="@string/key_qwerty_half_period" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_half_katakana_landscape.xml b/res/xml/keyboard_qwerty_jp_half_katakana_shift.xml index 8050c06..c250968 100644 --- a/res/xml/keyboard_qwerty_half_katakana_landscape.xml +++ b/res/xml/keyboard_qwerty_jp_half_katakana_shift.xml @@ -16,9 +16,9 @@ --> <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_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > <Row> @@ -58,23 +58,23 @@ <Key android:codes="98" android:keyLabel="b"/> <Key android:codes="110" android:keyLabel="n"/> <Key android:codes="109" android:keyLabel="m"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" + <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_half_kata" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> <Key android:codes="32" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="65380" android:keyLabel="@string/key_qwerty_half_comma" + <Key android:codes="33" android:keyLabel="!" android:keyWidth="12.5%p"/> - <Key android:codes="65377" android:keyLabel="@string/key_qwerty_half_period" + <Key android:codes="63" android:keyLabel="\?" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_qwerty_half_symbols.xml b/res/xml/keyboard_qwerty_jp_half_symbols.xml index 223d675..4621b9e 100644 --- a/res/xml/keyboard_qwerty_half_symbols.xml +++ b/res/xml/keyboard_qwerty_jp_half_symbols.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -50,20 +50,20 @@ <Row> <Key android:codes="-1" android:keyIcon="@drawable/key_qwerty_shift" android:iconPreview="@drawable/key_qwerty_shift_b" android:keyWidth="15%p" android:isModifier="true" android:isSticky="false" android:keyEdgeFlags="left"/> - <Key android:codes="33" android:keyLabel="!" /> + <Key android:codes="47" android:keyLabel="/" /> <Key android:codes="40" android:keyLabel="("/> <Key android:codes="41" android:keyLabel=")"/> <Key android:codes="58" android:keyLabel=":"/> <Key android:codes="59" android:keyLabel=";"/> - <Key android:codes="47" android:keyLabel="/" /> + <Key android:codes="33" android:keyLabel="!" /> <Key android:codes="63" android:keyLabel="\?"/> <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_half_num" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left" /> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p" /> diff --git a/res/xml/keyboard_qwerty_half_symbols_shift.xml b/res/xml/keyboard_qwerty_jp_half_symbols_shift.xml index edd776b..e7871f1 100644 --- a/res/xml/keyboard_qwerty_half_symbols_shift.xml +++ b/res/xml/keyboard_qwerty_jp_half_symbols_shift.xml @@ -16,8 +16,8 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" - android:horizontalGap="0px" - android:verticalGap="0px" + android:horizontalGap="0dip" + android:verticalGap="0dip" android:keyHeight="@dimen/key_height" > @@ -42,7 +42,7 @@ <Key android:codes="34" android:keyLabel="""/> <Key android:codes="43" android:keyLabel="+" /> <Key android:codes="95" android:keyLabel="_"/> - <Key android:codes="61" android:keyLabel="="/> + <Key android:codes="92" android:keyLabel="\\" /> <Key android:codes="123" android:keyLabel="{"/> <Key android:codes="125" android:keyLabel="}" android:keyEdgeFlags="right"/> </Row> @@ -54,23 +54,23 @@ <Key android:codes="60" android:keyLabel="<"/> <Key android:codes="62" android:keyLabel=">"/> <Key android:codes="96" android:keyLabel="`"/> - <Key android:codes="180" android:keyLabel="´"/> - <Key android:codes="92" android:keyLabel="\\" /> - <Key android:codes="63" android:keyLabel="\?"/> + <Key android:codes="39" android:keyLabel="'"/> + <Key android:codes="44" android:keyLabel="," /> + <Key android:codes="46" android:keyLabel="." /> <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_half_num" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left" /> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p" /> <Key android:codes="32" android:keyIcon="@drawable/key_qwerty_space" android:iconPreview="@drawable/key_qwerty_space_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="44" android:keyLabel="," android:keyWidth="12.5%p" /> - <Key android:codes="46" android:keyLabel="." android:keyWidth="12.5%p" /> + <Key android:codes="33" android:keyLabel="!" android:keyWidth="12.5%p" /> + <Key android:codes="63" android:keyLabel="\?" android:keyWidth="12.5%p" /> <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> diff --git a/res/xml/keyboard_qwerty_landscape.xml b/res/xml/keyboard_qwerty_jp_shift.xml index a782827..99b8ea8 100644 --- a/res/xml/keyboard_qwerty_landscape.xml +++ b/res/xml/keyboard_qwerty_jp_shift.xml @@ -16,9 +16,9 @@ --> <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_landscape" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="@dimen/key_height" > <Row> @@ -58,23 +58,23 @@ <Key android:codes="98" android:keyLabel="b"/> <Key android:codes="110" android:keyLabel="n"/> <Key android:codes="109" android:keyLabel="m"/> - <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del_landscape" android:iconPreview="@drawable/key_qwerty_del_b_landscape" android:keyWidth="15%p" + <Key android:codes="-100" android:keyIcon="@drawable/key_qwerty_del" android:iconPreview="@drawable/key_qwerty_del_b" android:keyWidth="15%p" android:keyEdgeFlags="right" android:isRepeatable="true"/> </Row> <Row android:rowEdgeFlags="bottom"> - <Key android:codes="-230" android:keyLabel="@string/key_change_mode" - android:popupKeyboard="@xml/keyboard_switch_key_qwerty" + <Key android:codes="-230" android:keyIcon="@drawable/key_qwerty_mode_hira" android:iconPreview="@drawable/key_mode_change_b" + android:popupKeyboard="@xml/keyboard_switch_key_qwerty_jp" android:keyWidth="15%p" android:keyEdgeFlags="left"/> <Key android:codes="-106" android:keyIcon="@drawable/key_qwerty_pict_sym" android:iconPreview="@drawable/key_qwerty_pict_sym_b" android:keyWidth="15%p"/> <Key android:codes="12288" android:keyIcon="@drawable/key_qwerty_space_conv" android:iconPreview="@drawable/key_qwerty_space_conv_b" android:keyWidth="30%p" android:isRepeatable="true"/> - <Key android:codes="44" android:keyLabel="@string/key_qwerty_full_touten" + <Key android:codes="65281" android:keyLabel="@string/key_qwerty_full_exclamation_mark" android:keyWidth="12.5%p"/> - <Key android:codes="46" android:keyLabel="@string/key_qwerty_full_kuten" + <Key android:codes="65311" android:keyLabel="@string/key_qwerty_full_question" android:keyWidth="12.5%p"/> - <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter" android:iconPreview="@drawable/key_qwerty_enter_b" + <Key android:codes="-101" android:keyIcon="@drawable/key_qwerty_enter_jp" android:iconPreview="@drawable/key_qwerty_enter_jp_b" android:keyWidth="15%p" android:keyEdgeFlags="right"/> </Row> </Keyboard> diff --git a/res/xml/keyboard_switch_key.xml b/res/xml/keyboard_switch_key_jp.xml index 4118f14..0ba7976 100644 --- a/res/xml/keyboard_switch_key.xml +++ b/res/xml/keyboard_switch_key_jp.xml @@ -16,9 +16,9 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="15%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="50px" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="50dip" > <Row> <Key android:codes="-301" android:keyLabel="@string/key_12key_switch_full_hiragana" diff --git a/res/xml/keyboard_switch_key_landscape.xml b/res/xml/keyboard_switch_key_landscape.xml deleted file mode 100644 index 933607d..0000000 --- a/res/xml/keyboard_switch_key_landscape.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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="15%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="50px" - > - <Row> - <Key android:codes="-301" android:keyLabel="@string/key_12key_switch_full_hiragana" - android:keyEdgeFlags="left"/> - <Key android:codes="-302" android:keyLabel="@string/key_12key_switch_full_katakana"/> - <Key android:codes="-303" android:keyLabel="@string/key_12key_switch_full_alphabet"/> - <Key android:codes="-304" android:keyLabel="@string/key_12key_switch_full_number" - android:keyEdgeFlags="right"/> - </Row> - <Row> - <Key android:codes="-221" android:keyLabel="@string/key_switch_keyboard" - android:keyEdgeFlags="left"/> - <Key android:codes="-306" android:keyLabel="@string/key_12key_switch_half_katakana"/> - <Key android:codes="-307" android:keyLabel="@string/key_12key_switch_half_alphabet"/> - <Key android:codes="-308" android:keyLabel="@string/key_12key_switch_half_number" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/keyboard_switch_key_qwerty.xml b/res/xml/keyboard_switch_key_qwerty_jp.xml index dbf08e9..3c09b96 100644 --- a/res/xml/keyboard_switch_key_qwerty.xml +++ b/res/xml/keyboard_switch_key_qwerty_jp.xml @@ -16,9 +16,9 @@ --> <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="15%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="50px" + android:horizontalGap="0dip" + android:verticalGap="0dip" + android:keyHeight="50dip" > <Row> <Key android:codes="-301" android:keyLabel="@string/key_12key_switch_full_hiragana" @@ -29,7 +29,7 @@ android:keyEdgeFlags="right"/> </Row> <Row> - <Key android:codes="-104" android:keyIcon="@drawable/key_mode_panel_kbd" android:iconPreview="@drawable/key_mode_panel_kbd_b" + <Key android:codes="-104" android:keyIcon="@drawable/key_mode_panel_kbd_12key" android:iconPreview="@drawable/key_mode_panel_kbd_12key_b" android:keyEdgeFlags="left"/> <Key android:codes="-306" android:keyLabel="@string/key_12key_switch_half_katakana"/> <Key android:codes="-307" android:keyLabel="@string/key_12key_switch_half_alphabet"/> diff --git a/res/xml/keyboard_switch_key_qwerty_landscape.xml b/res/xml/keyboard_switch_key_qwerty_landscape.xml deleted file mode 100644 index 4424a19..0000000 --- a/res/xml/keyboard_switch_key_qwerty_landscape.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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="15%p" - android:horizontalGap="0px" - android:verticalGap="0px" - android:keyHeight="50px" - > - <Row> - <Key android:codes="-301" android:keyLabel="@string/key_12key_switch_full_hiragana" - android:keyEdgeFlags="left"/> - <Key android:codes="-302" android:keyLabel="@string/key_12key_switch_full_katakana"/> - <Key android:codes="-303" android:keyLabel="@string/key_12key_switch_full_alphabet"/> - <Key android:codes="-304" android:keyLabel="@string/key_12key_switch_full_number" - android:keyEdgeFlags="right"/> - </Row> - <Row> - <Key android:codes="-104" android:keyLabel="@string/key_switch_keyboard" - android:keyEdgeFlags="left"/> - <Key android:codes="-306" android:keyLabel="@string/key_12key_switch_half_katakana"/> - <Key android:codes="-307" android:keyLabel="@string/key_12key_switch_half_alphabet"/> - <Key android:codes="-308" android:keyLabel="@string/key_12key_switch_half_number" - android:keyEdgeFlags="right"/> - </Row> -</Keyboard> diff --git a/res/xml/openwnn_pref_en.xml b/res/xml/openwnn_pref_en.xml index eea361c..90c4a4b 100644 --- a/res/xml/openwnn_pref_en.xml +++ b/res/xml/openwnn_pref_en.xml @@ -53,7 +53,9 @@ <CheckBoxPreference android:key="opt_en_spell_correction" android:title="@string/preference_correct_spell_title" android:summary="@string/preference_correct_spell_summary" - android:defaultValue="true" /> + android:defaultValue="true" + android:dependency="opt_en_prediction" /> + </PreferenceCategory> <PreferenceCategory android:title="@string/preference_dictionary_menu"> diff --git a/res/xml/openwnn_pref_zhcn.xml b/res/xml/openwnn_pref_zhcn.xml index f65291b..048e393 100644 --- a/res/xml/openwnn_pref_zhcn.xml +++ b/res/xml/openwnn_pref_zhcn.xml @@ -57,7 +57,8 @@ <CheckBoxPreference android:key="opt_zhcn_spell_correction" android:title="@string/preference_correct_spell_title" android:summary="@string/preference_correct_spell_summary" - android:defaultValue="true" /> + android:defaultValue="true" + android:dependency="opt_zhcn_prediction" /> </PreferenceCategory> <PreferenceCategory android:title="@string/preference_dictionary_menu"> diff --git a/res/xml/symbols_china_list.xml b/res/xml/symbols_china_list.xml index 2741930..a9fc71b 100644 --- a/res/xml/symbols_china_list.xml +++ b/res/xml/symbols_china_list.xml @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. --> -<!--symbols shuāngzìjiéyīqū --> +<!--symbols --> <keystring> <string value="、"/> <string value="。"/> @@ -205,6 +205,7 @@ <string value="-"/> <string value="."/> <string value="/"/> +<!-- <string value="0"/> <string value="1"/> <string value="2"/> @@ -215,6 +216,7 @@ <string value="7"/> <string value="8"/> <string value="9"/> +--> <string value=":"/> <string value=";"/> <string value="<"/> @@ -222,6 +224,7 @@ <string value=">"/> <string value="?"/> <string value="@"/> +<!-- <string value="A"/> <string value="B"/> <string value="C"/> @@ -248,12 +251,14 @@ <string value="X"/> <string value="Y"/> <string value="Z"/> +--> <string value="["/> <string value="\"/> <string value="]"/> <string value="^"/> <string value="_"/> <string value="`"/> +<!-- <string value="a"/> <string value="b"/> <string value="c"/> @@ -280,10 +285,12 @@ <string value="x"/> <string value="y"/> <string value="z"/> +--> <string value="{"/> <string value="|"/> <string value="}"/> <string value=" ̄"/> +<!-- <string value="А"/> <string value="Б"/> <string value="В"/> @@ -375,11 +382,14 @@ <string value="ǜ"/> <string value="ü"/> <string value="ê"/> +--> <!-- <string value="ɑ"/> --> +<!-- no glyph in Droid font <string value="\u1e3f"/> <string value="ń"/> <string value="ň"/> -<!-- <string value="\u01f9"/> --> +--> +<!-- no glyph in Droid font <string value="\u01f9"/> --> <!-- <string value="ɡ"/> --> <string value="ㄅ"/> <string value="ㄆ"/> @@ -418,6 +428,7 @@ <string value="ㄧ"/> <string value="ㄨ"/> <string value="ㄩ"/> +<!-- <string value="─"/> <string value="━"/> <string value="│"/> @@ -711,7 +722,8 @@ <string value="χ"/> <string value="ψ"/> <string value="ω"/> -<!-- +--> +<!-- no glyph in Droid font <string value="\ue78d"/> <string value="\ue78e"/> <string value="\ue78f"/> @@ -720,6 +732,7 @@ <string value="\ue792"/> <string value="\ue793"/> --> +<!-- <string value="︵"/> <string value="︶"/> <string value="︹"/> @@ -732,18 +745,23 @@ <string value="﹂"/> <string value="﹃"/> <string value="﹄"/> -<!-- +--> +<!-- no glyph in Droid font <string value="\ue794"/> <string value="\ue795"/> --> +<!-- <string value="︻"/> <string value="︼"/> <string value="︷"/> <string value="︸"/> <string value="︱"/> -<!-- +--> +<!-- no glyph in Droid font <string value="\ue796"/> --> +<!-- <string value="︳"/> <string value="︴"/> -</keystring>
\ No newline at end of file +--> +</keystring> diff --git a/res/xml/symbols_japan_emoji_list.xml b/res/xml/symbols_japan_emoji_list.xml deleted file mode 100644 index ce32546..0000000 --- a/res/xml/symbols_japan_emoji_list.xml +++ /dev/null @@ -1,825 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. - - 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. ---> -<!--symbols --> -<keystring> - -<string value="\udbb8\udc00"/> -<string value="\udbb8\udc01"/> -<string value="\udbb8\udc02"/> -<string value="\udbb8\udc03"/> -<string value="\udbb8\udc04"/> -<string value="\udbb8\udc05"/> -<string value="\udbb8\udc06"/> -<string value="\udbb8\udc07"/> -<string value="\udbb8\udc08"/> -<string value="\udbb8\udc09"/> -<string value="\udbb8\udc0a"/> -<string value="\udbb8\udc0b"/> -<string value="\udbb8\udc0c"/> -<string value="\udbb8\udc0d"/> -<string value="\udbb8\udc0e"/> -<string value="\udbb8\udc0f"/> -<string value="\udbb8\udc10"/> -<string value="\udbb8\udc11"/> -<string value="\udbb8\udc12"/> -<string value="\udbb8\udc13"/> -<string value="\udbb8\udc14"/> -<string value="\udbb8\udc15"/> -<string value="\udbb8\udc16"/> -<string value="\udbb8\udc17"/> -<string value="\udbb8\udc18"/> -<string value="\udbb8\udc19"/> -<string value="\udbb8\udc1a"/> -<string value="\udbb8\udc1b"/> -<string value="\udbb8\udc1c"/> -<string value="\udbb8\udc1d"/> -<string value="\udbb8\udc1e"/> -<string value="\udbb8\udc1f"/> -<string value="\udbb8\udc20"/> -<string value="\udbb8\udc21"/> -<string value="\udbb8\udc22"/> -<string value="\udbb8\udc23"/> -<string value="\udbb8\udc24"/> -<string value="\udbb8\udc25"/> -<string value="\udbb8\udc26"/> -<string value="\udbb8\udc27"/> -<string value="\udbb8\udc28"/> -<string value="\udbb8\udc29"/> -<string value="\udbb8\udc2a"/> -<string value="\udbb8\udc2b"/> -<string value="\udbb8\udc2c"/> -<string value="\udbb8\udc2d"/> -<string value="\udbb8\udc2e"/> -<string value="\udbb8\udc2f"/> -<string value="\udbb8\udc30"/> -<string value="\udbb8\udc31"/> -<string value="\udbb8\udc32"/> -<string value="\udbb8\udc33"/> -<string value="\udbb8\udc34"/> -<string value="\udbb8\udc35"/> -<string value="\udbb8\udc36"/> -<string value="\udbb8\udc37"/> -<string value="\udbb8\udc38"/> -<string value="\udbb8\udc39"/> -<string value="\udbb8\udc3a"/> -<string value="\udbb8\udc3b"/> -<string value="\udbb8\udc3c"/> -<string value="\udbb8\udc3d"/> -<string value="\udbb8\udc3e"/> -<string value="\udbb8\udc3f"/> -<string value="\udbb8\udc40"/> -<string value="\udbb8\udc41"/> -<string value="\udbb8\udc42"/> -<string value="\udbb8\udc43"/> -<string value="\udbb8\udc44"/> -<string value="\udbb8\udc45"/> -<string value="\udbb8\udc46"/> -<string value="\udbb8\udc47"/> -<string value="\udbb8\udc48"/> -<string value="\udbb8\udc49"/> -<string value="\udbb8\udc4a"/> -<string value="\udbb8\udc4b"/> -<string value="\udbb8\udc4c"/> -<string value="\udbb8\udc4d"/> -<string value="\udbb8\udc4e"/> -<string value="\udbb8\udc4f"/> -<string value="\udbb8\udc50"/> -<string value="\udbb8\udc51"/> -<string value="\udbb8\udc52"/> -<string value="\udbb8\udc53"/> -<string value="\udbb8\udc54"/> -<string value="\udbb8\udc55"/> -<string value="\udbb8\udc56"/> -<string value="\udbb8\udc57"/> -<string value="\udbb8\udc58"/> -<string value="\udbb8\udc59"/> -<string value="\udbb8\udc5a"/> -<string value="\udbb8\udc5b"/> -<string value="\udbb8\udd90"/> -<string value="\udbb8\udd91"/> -<string value="\udbb8\udd92"/> -<string value="\udbb8\udd93"/> -<string value="\udbb8\udd94"/> -<string value="\udbb8\udd95"/> -<string value="\udbb8\udd96"/> -<string value="\udbb8\udd97"/> -<string value="\udbb8\udd98"/> -<string value="\udbb8\udd99"/> -<string value="\udbb8\udd9a"/> -<string value="\udbb8\udd9b"/> -<string value="\udbb8\udd9c"/> -<string value="\udbb8\udd9d"/> -<string value="\udbb8\udd9e"/> -<string value="\udbb8\udd9f"/> -<string value="\udbb8\udda0"/> -<string value="\udbb8\udda1"/> -<string value="\udbb8\udda2"/> -<string value="\udbb8\udda3"/> -<string value="\udbb8\udda4"/> -<string value="\udbb8\udda5"/> -<string value="\udbb8\udda6"/> -<string value="\udbb8\udda7"/> -<string value="\udbb8\udda8"/> -<string value="\udbb8\udda9"/> -<string value="\udbb8\uddaa"/> -<string value="\udbb8\uddab"/> -<string value="\udbb8\uddac"/> -<string value="\udbb8\uddad"/> -<string value="\udbb8\uddae"/> -<string value="\udbb8\uddaf"/> -<string value="\udbb8\uddb0"/> -<string value="\udbb8\uddb1"/> -<string value="\udbb8\uddb2"/> -<string value="\udbb8\uddb3"/> -<string value="\udbb8\uddb4"/> -<string value="\udbb8\uddb5"/> -<string value="\udbb8\uddb6"/> -<string value="\udbb8\uddb7"/> -<string value="\udbb8\uddb8"/> -<string value="\udbb8\uddb9"/> -<string value="\udbb8\uddba"/> -<string value="\udbb8\uddbb"/> -<string value="\udbb8\uddbc"/> -<string value="\udbb8\uddbd"/> -<string value="\udbb8\uddbe"/> -<string value="\udbb8\uddbf"/> -<string value="\udbb8\uddc0"/> -<string value="\udbb8\uddc1"/> -<string value="\udbb8\uddc2"/> -<string value="\udbb8\uddc3"/> -<string value="\udbb8\uddc4"/> -<string value="\udbb8\uddc5"/> -<string value="\udbb8\uddc6"/> -<string value="\udbb8\uddc7"/> -<string value="\udbb8\uddc8"/> -<string value="\udbb8\uddc9"/> -<string value="\udbb8\uddca"/> -<string value="\udbb8\uddcb"/> -<string value="\udbb8\uddcc"/> -<string value="\udbb8\uddcd"/> -<string value="\udbb8\uddce"/> -<string value="\udbb8\uddcf"/> -<string value="\udbb8\uddd0"/> -<string value="\udbb8\uddd1"/> -<string value="\udbb8\uddd2"/> -<string value="\udbb8\uddd3"/> -<string value="\udbb8\uddd4"/> -<string value="\udbb8\uddd5"/> -<string value="\udbb8\uddd6"/> -<string value="\udbb8\uddd7"/> -<string value="\udbb8\uddd8"/> -<string value="\udbb8\uddd9"/> -<string value="\udbb8\uddda"/> -<string value="\udbb8\udddb"/> -<string value="\udbb8\udddc"/> -<string value="\udbb8\udddd"/> -<string value="\udbb8\uddde"/> -<string value="\udbb8\udddf"/> -<string value="\udbb8\udde0"/> -<string value="\udbb8\udde1"/> -<string value="\udbb8\udde2"/> -<string value="\udbb8\udde3"/> -<string value="\udbb8\udf20"/> -<string value="\udbb8\udf21"/> -<string value="\udbb8\udf22"/> -<string value="\udbb8\udf23"/> -<string value="\udbb8\udf24"/> -<string value="\udbb8\udf25"/> -<string value="\udbb8\udf26"/> -<string value="\udbb8\udf27"/> -<string value="\udbb8\udf28"/> -<string value="\udbb8\udf29"/> -<string value="\udbb8\udf2a"/> -<string value="\udbb8\udf2b"/> -<string value="\udbb8\udf2c"/> -<string value="\udbb8\udf2d"/> -<string value="\udbb8\udf2e"/> -<string value="\udbb8\udf2f"/> -<string value="\udbb8\udf30"/> -<string value="\udbb8\udf31"/> -<string value="\udbb8\udf32"/> -<string value="\udbb8\udf33"/> -<string value="\udbb8\udf34"/> -<string value="\udbb8\udf35"/> -<string value="\udbb8\udf36"/> -<string value="\udbb8\udf37"/> -<string value="\udbb8\udf38"/> -<string value="\udbb8\udf39"/> -<string value="\udbb8\udf3a"/> -<string value="\udbb8\udf3b"/> -<string value="\udbb8\udf3c"/> -<string value="\udbb8\udf3d"/> -<string value="\udbb8\udf3e"/> -<string value="\udbb8\udf3f"/> -<string value="\udbb8\udf40"/> -<string value="\udbb8\udf41"/> -<string value="\udbb8\udf42"/> -<string value="\udbb8\udf43"/> -<string value="\udbb8\udf44"/> -<string value="\udbb8\udf45"/> -<string value="\udbb8\udf46"/> -<string value="\udbb8\udf47"/> -<string value="\udbb8\udf48"/> -<string value="\udbb8\udf49"/> -<string value="\udbb8\udf4a"/> -<string value="\udbb8\udf4b"/> -<string value="\udbb8\udf4c"/> -<string value="\udbb8\udf4d"/> -<string value="\udbb8\udf4e"/> -<string value="\udbb8\udf4f"/> -<string value="\udbb8\udf50"/> -<string value="\udbb8\udf51"/> -<string value="\udbb8\udf52"/> -<string value="\udbb8\udf53"/> -<string value="\udbb8\udf54"/> -<string value="\udbb8\udf55"/> -<string value="\udbb8\udf56"/> -<string value="\udbb8\udf57"/> -<string value="\udbb8\udf58"/> -<string value="\udbb8\udf59"/> -<string value="\udbb8\udf5a"/> -<string value="\udbb8\udf5b"/> -<string value="\udbb8\udf5c"/> -<string value="\udbb8\udf5d"/> -<string value="\udbb8\udf5e"/> -<string value="\udbb8\udf5f"/> -<string value="\udbb8\udf60"/> -<string value="\udbb8\udf61"/> -<string value="\udbb8\udf62"/> -<string value="\udbb8\udf63"/> -<string value="\udbb8\udf64"/> -<string value="\udbb8\udf65"/> -<string value="\udbb8\udf66"/> -<string value="\udbb8\udf67"/> -<string value="\udbb8\udf68"/> -<string value="\udbb8\udf69"/> -<string value="\udbb9\udcb0"/> -<string value="\udbb9\udcb1"/> -<string value="\udbb9\udcb2"/> -<string value="\udbb9\udcb3"/> -<string value="\udbb9\udcb4"/> -<string value="\udbb9\udcb5"/> -<string value="\udbb9\udcb6"/> -<string value="\udbb9\udcb7"/> -<string value="\udbb9\udcb8"/> -<string value="\udbb9\udcb9"/> -<string value="\udbb9\udcba"/> -<string value="\udbb9\udcbb"/> -<string value="\udbb9\udcbc"/> -<string value="\udbb9\udcbd"/> -<string value="\udbb9\udcbe"/> -<string value="\udbb9\udcbf"/> -<string value="\udbb9\udcc0"/> -<string value="\udbb9\udcc1"/> -<string value="\udbb9\udcc2"/> -<string value="\udbb9\udcc3"/> -<string value="\udbb9\udcc4"/> -<string value="\udbb9\udcc5"/> -<string value="\udbb9\udcc6"/> -<string value="\udbb9\udcc7"/> -<string value="\udbb9\udcc8"/> -<string value="\udbb9\udcc9"/> -<string value="\udbb9\udcca"/> -<string value="\udbb9\udccb"/> -<string value="\udbb9\udccc"/> -<string value="\udbb9\udccd"/> -<string value="\udbb9\udcce"/> -<string value="\udbb9\udccf"/> -<string value="\udbb9\udcd0"/> -<string value="\udbb9\udcd1"/> -<string value="\udbb9\udcd2"/> -<string value="\udbb9\udcd3"/> -<string value="\udbb9\udcd4"/> -<string value="\udbb9\udcd5"/> -<string value="\udbb9\udcd6"/> -<string value="\udbb9\udcd7"/> -<string value="\udbb9\udcd8"/> -<string value="\udbb9\udcd9"/> -<string value="\udbb9\udcda"/> -<string value="\udbb9\udcdb"/> -<string value="\udbb9\udcdc"/> -<string value="\udbb9\udcdd"/> -<string value="\udbb9\udcde"/> -<string value="\udbb9\udcdf"/> -<string value="\udbb9\udce0"/> -<string value="\udbb9\udce1"/> -<string value="\udbb9\udce2"/> -<string value="\udbb9\udce3"/> -<string value="\udbb9\udce4"/> -<string value="\udbb9\udce5"/> -<string value="\udbb9\udce6"/> -<string value="\udbb9\udce7"/> -<string value="\udbb9\udce8"/> -<string value="\udbb9\udce9"/> -<string value="\udbb9\udcea"/> -<string value="\udbb9\udceb"/> -<string value="\udbb9\udcec"/> -<string value="\udbb9\udced"/> -<string value="\udbb9\udcee"/> -<string value="\udbb9\udcef"/> -<string value="\udbb9\udcf0"/> -<string value="\udbb9\udcf1"/> -<string value="\udbb9\udcf2"/> -<string value="\udbb9\udcf3"/> -<string value="\udbb9\udcf4"/> -<string value="\udbb9\udcf5"/> -<string value="\udbb9\udcf6"/> -<string value="\udbb9\udcf7"/> -<string value="\udbb9\udcf8"/> -<string value="\udbb9\udcf9"/> -<string value="\udbb9\udcfa"/> -<string value="\udbb9\udcfb"/> -<string value="\udbb9\udcfc"/> -<string value="\udbb9\udcfd"/> -<string value="\udbb9\udcfe"/> -<string value="\udbb9\udcff"/> -<string value="\udbb9\udd00"/> -<string value="\udbb9\udd01"/> -<string value="\udbb9\udd02"/> -<string value="\udbb9\udd03"/> -<string value="\udbb9\udd04"/> -<string value="\udbb9\udd05"/> -<string value="\udbb9\udd06"/> -<string value="\udbb9\udd07"/> -<string value="\udbb9\udd08"/> -<string value="\udbb9\udd09"/> -<string value="\udbb9\udd0a"/> -<string value="\udbb9\udd0b"/> -<string value="\udbb9\udd0c"/> -<string value="\udbb9\udd0d"/> -<string value="\udbb9\udd0e"/> -<string value="\udbb9\udd0f"/> -<string value="\udbb9\udd10"/> -<string value="\udbb9\udd11"/> -<string value="\udbb9\udd12"/> -<string value="\udbb9\udd13"/> -<string value="\udbb9\udd14"/> -<string value="\udbb9\udd15"/> -<string value="\udbb9\udd16"/> -<string value="\udbb9\udd17"/> -<string value="\udbb9\udd18"/> -<string value="\udbb9\udd19"/> -<string value="\udbb9\udd1a"/> -<string value="\udbb9\udd1b"/> -<string value="\udbb9\udd1c"/> -<string value="\udbb9\udd1d"/> -<string value="\udbb9\udd1e"/> -<string value="\udbb9\udd1f"/> -<string value="\udbb9\udd20"/> -<string value="\udbb9\udd21"/> -<string value="\udbb9\udd22"/> -<string value="\udbb9\udd23"/> -<string value="\udbb9\udd24"/> -<string value="\udbb9\udd25"/> -<string value="\udbb9\udd26"/> -<string value="\udbb9\udd27"/> -<string value="\udbb9\udd28"/> -<string value="\udbb9\udd29"/> -<string value="\udbb9\udd2a"/> -<string value="\udbb9\udd2b"/> -<string value="\udbb9\udd2c"/> -<string value="\udbb9\udd2d"/> -<string value="\udbb9\udd2e"/> -<string value="\udbb9\udd2f"/> -<string value="\udbb9\udd30"/> -<string value="\udbb9\udd31"/> -<string value="\udbb9\udd32"/> -<string value="\udbb9\udd33"/> -<string value="\udbb9\udd34"/> -<string value="\udbb9\udd35"/> -<string value="\udbb9\udd36"/> -<string value="\udbb9\udd37"/> -<string value="\udbb9\udd38"/> -<string value="\udbb9\udd39"/> -<string value="\udbb9\udd3a"/> -<string value="\udbb9\udd3b"/> -<string value="\udbb9\udd3c"/> -<string value="\udbb9\udd3d"/> -<string value="\udbb9\udd3e"/> -<string value="\udbb9\udd3f"/> -<string value="\udbb9\udd40"/> -<string value="\udbb9\udd41"/> -<string value="\udbb9\udd42"/> -<string value="\udbb9\udd43"/> -<string value="\udbb9\udd44"/> -<string value="\udbb9\udd45"/> -<string value="\udbb9\udd46"/> -<string value="\udbb9\udd47"/> -<string value="\udbb9\udd48"/> -<string value="\udbb9\udd49"/> -<string value="\udbb9\udd4a"/> -<string value="\udbb9\udd4b"/> -<string value="\udbb9\udd4c"/> -<string value="\udbb9\udd4d"/> -<string value="\udbb9\udd4e"/> -<string value="\udbb9\udd4f"/> -<string value="\udbb9\udd50"/> -<string value="\udbb9\udd51"/> -<string value="\udbb9\udd52"/> -<string value="\udbb9\udd53"/> -<string value="\udbb9\udfd0"/> -<string value="\udbb9\udfd1"/> -<string value="\udbb9\udfd2"/> -<string value="\udbb9\udfd3"/> -<string value="\udbb9\udfd4"/> -<string value="\udbb9\udfd5"/> -<string value="\udbb9\udfd6"/> -<string value="\udbb9\udfd7"/> -<string value="\udbb9\udfd8"/> -<string value="\udbb9\udfd9"/> -<string value="\udbb9\udfda"/> -<string value="\udbb9\udfdb"/> -<string value="\udbb9\udfdc"/> -<string value="\udbb9\udfdd"/> -<string value="\udbb9\udfde"/> -<string value="\udbb9\udfdf"/> -<string value="\udbb9\udfe0"/> -<string value="\udbb9\udfe1"/> -<string value="\udbb9\udfe2"/> -<string value="\udbb9\udfe3"/> -<string value="\udbb9\udfe4"/> -<string value="\udbb9\udfe5"/> -<string value="\udbb9\udfe6"/> -<string value="\udbb9\udfe7"/> -<string value="\udbb9\udfe8"/> -<string value="\udbb9\udfe9"/> -<string value="\udbb9\udfea"/> -<string value="\udbb9\udfeb"/> -<string value="\udbb9\udfec"/> -<string value="\udbb9\udfed"/> -<string value="\udbb9\udfee"/> -<string value="\udbb9\udfef"/> -<string value="\udbb9\udff0"/> -<string value="\udbb9\udff1"/> -<string value="\udbb9\udff2"/> -<string value="\udbb9\udff3"/> -<string value="\udbb9\udff4"/> -<string value="\udbb9\udff5"/> -<string value="\udbb9\udff6"/> -<string value="\udbb9\udff7"/> -<string value="\udbb9\udff8"/> -<string value="\udbb9\udff9"/> -<string value="\udbb9\udffa"/> -<string value="\udbb9\udffb"/> -<string value="\udbb9\udffc"/> -<string value="\udbb9\udffd"/> -<string value="\udbb9\udffe"/> -<string value="\udbb9\udfff"/> -<string value="\udbba\udc00"/> -<string value="\udbba\udc01"/> -<string value="\udbba\udc02"/> -<string value="\udbba\udc03"/> -<string value="\udbba\udc04"/> -<string value="\udbba\udc05"/> -<string value="\udbba\udc06"/> -<string value="\udbba\udc07"/> -<string value="\udbba\udc08"/> -<string value="\udbba\udc09"/> -<string value="\udbba\udc0a"/> -<string value="\udbba\udc0b"/> -<string value="\udbba\udc0c"/> -<string value="\udbba\udc0d"/> -<string value="\udbba\udc0e"/> -<string value="\udbba\udc0f"/> -<string value="\udbba\udc10"/> -<string value="\udbba\udc11"/> -<string value="\udbba\udc12"/> -<string value="\udbba\udc13"/> -<string value="\udbba\udc14"/> -<string value="\udbba\udc15"/> -<string value="\udbba\udc16"/> -<string value="\udbba\udc17"/> -<string value="\udbba\udc18"/> -<string value="\udbba\udc19"/> -<string value="\udbba\udc1a"/> -<string value="\udbba\udc1b"/> -<string value="\udbba\udc1c"/> -<string value="\udbba\udc1d"/> -<string value="\udbba\udc1e"/> -<string value="\udbba\udc1f"/> -<string value="\udbba\udc20"/> -<string value="\udbba\udc21"/> -<string value="\udbba\udc22"/> -<string value="\udbba\udc23"/> -<string value="\udbba\udc24"/> -<string value="\udbba\udc25"/> -<string value="\udbba\udc26"/> -<string value="\udbba\udc27"/> -<string value="\udbba\udc28"/> -<string value="\udbba\udc29"/> -<string value="\udbba\udc2a"/> -<string value="\udbba\udc2b"/> -<string value="\udbba\udc2c"/> -<string value="\udbba\udc2d"/> -<string value="\udbba\udc2e"/> -<string value="\udbba\udc2f"/> -<string value="\udbba\udc30"/> -<string value="\udbba\udc31"/> -<string value="\udbba\udc32"/> -<string value="\udbba\udc33"/> -<string value="\udbba\udc34"/> -<string value="\udbba\udc35"/> -<string value="\udbba\udc36"/> -<string value="\udbba\udc37"/> -<string value="\udbba\udc38"/> -<string value="\udbba\udc39"/> -<string value="\udbba\udc3a"/> -<string value="\udbba\udc3b"/> -<string value="\udbba\udc3c"/> -<string value="\udbba\udd60"/> -<string value="\udbba\udd61"/> -<string value="\udbba\udd62"/> -<string value="\udbba\udd63"/> -<string value="\udbba\udd64"/> -<string value="\udbba\udd65"/> -<string value="\udbba\udd66"/> -<string value="\udbba\udd67"/> -<string value="\udbba\udd68"/> -<string value="\udbba\udd69"/> -<string value="\udbba\udd6a"/> -<string value="\udbba\udd6b"/> -<string value="\udbba\udd6c"/> -<string value="\udbba\udd6d"/> -<string value="\udbba\udd6e"/> -<string value="\udbba\udd6f"/> -<string value="\udbba\udd70"/> -<string value="\udbba\udd71"/> -<string value="\udbba\udd72"/> -<string value="\udbba\udd73"/> -<string value="\udbba\udd74"/> -<string value="\udbba\udd75"/> -<string value="\udbba\udd76"/> -<string value="\udbba\udd77"/> -<string value="\udbba\udd78"/> -<string value="\udbba\udd79"/> -<string value="\udbba\udd7a"/> -<string value="\udbba\udd7b"/> -<string value="\udbba\udd7c"/> -<string value="\udbba\udd7d"/> -<string value="\udbba\udd7e"/> -<string value="\udbba\udd7f"/> -<string value="\udbba\udd80"/> -<string value="\udbba\udd81"/> -<string value="\udbba\udd82"/> -<string value="\udbba\udd83"/> -<string value="\udbba\udd84"/> -<string value="\udbba\udd85"/> -<string value="\udbba\udd86"/> -<string value="\udbba\udd87"/> -<string value="\udbba\udd88"/> -<string value="\udbba\udef0"/> -<string value="\udbba\udef1"/> -<string value="\udbba\udef2"/> -<string value="\udbba\udef3"/> -<string value="\udbba\udef4"/> -<string value="\udbba\udef5"/> -<string value="\udbba\udef6"/> -<string value="\udbba\udef7"/> -<string value="\udbba\udef8"/> -<string value="\udbba\udef9"/> -<string value="\udbba\udefa"/> -<string value="\udbba\udefb"/> -<string value="\udbba\udefc"/> -<string value="\udbba\udefd"/> -<string value="\udbba\udefe"/> -<string value="\udbba\udeff"/> -<string value="\udbba\udf00"/> -<string value="\udbba\udf01"/> -<string value="\udbba\udf02"/> -<string value="\udbba\udf03"/> -<string value="\udbba\udf04"/> -<string value="\udbba\udf05"/> -<string value="\udbba\udf06"/> -<string value="\udbba\udf07"/> -<string value="\udbba\udf08"/> -<string value="\udbba\udf09"/> -<string value="\udbba\udf0a"/> -<string value="\udbba\udf0b"/> -<string value="\udbba\udf0c"/> -<string value="\udbba\udf0d"/> -<string value="\udbba\udf0e"/> -<string value="\udbba\udf0f"/> -<string value="\udbba\udf10"/> -<string value="\udbba\udf11"/> -<string value="\udbba\udf12"/> -<string value="\udbba\udf13"/> -<string value="\udbba\udf14"/> -<string value="\udbba\udf15"/> -<string value="\udbba\udf16"/> -<string value="\udbba\udf17"/> -<string value="\udbba\udf18"/> -<string value="\udbba\udf19"/> -<string value="\udbba\udf1a"/> -<string value="\udbba\udf1b"/> -<string value="\udbba\udf1c"/> -<string value="\udbba\udf1d"/> -<string value="\udbba\udf1e"/> -<string value="\udbba\udf1f"/> -<string value="\udbba\udf20"/> -<string value="\udbba\udf21"/> -<string value="\udbba\udf22"/> -<string value="\udbba\udf23"/> -<string value="\udbba\udf24"/> -<string value="\udbba\udf25"/> -<string value="\udbba\udf26"/> -<string value="\udbba\udf27"/> -<string value="\udbba\udf28"/> -<string value="\udbba\udf29"/> -<string value="\udbba\udf2a"/> -<string value="\udbba\udf2b"/> -<string value="\udbba\udf2c"/> -<string value="\udbba\udf2d"/> -<string value="\udbba\udf2e"/> -<string value="\udbba\udf2f"/> -<string value="\udbba\udf30"/> -<string value="\udbba\udf31"/> -<string value="\udbba\udf32"/> -<string value="\udbba\udf33"/> -<string value="\udbba\udf34"/> -<string value="\udbba\udf35"/> -<string value="\udbba\udf36"/> -<string value="\udbba\udf37"/> -<string value="\udbba\udf38"/> -<string value="\udbba\udf39"/> -<string value="\udbba\udf3a"/> -<string value="\udbba\udf3b"/> -<string value="\udbba\udf3c"/> -<string value="\udbba\udf3d"/> -<string value="\udbba\udf3e"/> -<string value="\udbba\udf3f"/> -<string value="\udbba\udf40"/> -<string value="\udbba\udf41"/> -<string value="\udbba\udf42"/> -<string value="\udbba\udf43"/> -<string value="\udbba\udf44"/> -<string value="\udbba\udf45"/> -<string value="\udbba\udf46"/> -<string value="\udbba\udf47"/> -<string value="\udbba\udf48"/> -<string value="\udbba\udf49"/> -<string value="\udbba\udf4a"/> -<string value="\udbba\udf4b"/> -<string value="\udbba\udf4c"/> -<string value="\udbba\udf4d"/> -<string value="\udbba\udf4e"/> -<string value="\udbba\udf4f"/> -<string value="\udbba\udf50"/> -<string value="\udbba\udf51"/> -<string value="\udbba\udf52"/> -<string value="\udbba\udf53"/> -<string value="\udbba\udf54"/> -<string value="\udbba\udf55"/> -<string value="\udbba\udf56"/> -<string value="\udbba\udf57"/> -<string value="\udbba\udf58"/> -<string value="\udbba\udf59"/> -<string value="\udbba\udf5a"/> -<string value="\udbba\udf5b"/> -<string value="\udbba\udf5c"/> -<string value="\udbba\udf5d"/> -<string value="\udbba\udf5e"/> -<string value="\udbba\udf5f"/> -<string value="\udbba\udf60"/> -<string value="\udbba\udf61"/> -<string value="\udbba\udf62"/> -<string value="\udbba\udf63"/> -<string value="\udbba\udf64"/> -<string value="\udbba\udf65"/> -<string value="\udbba\udf66"/> -<string value="\udbba\udf67"/> -<string value="\udbba\udf68"/> -<string value="\udbba\udf69"/> -<string value="\udbba\udf6a"/> -<string value="\udbba\udf6b"/> -<string value="\udbba\udf6c"/> -<string value="\udbba\udf6d"/> -<string value="\udbba\udf6e"/> -<string value="\udbba\udf6f"/> -<string value="\udbba\udf70"/> -<string value="\udbba\udf71"/> -<string value="\udbba\udf72"/> -<string value="\udbba\udf73"/> -<string value="\udbba\udf74"/> -<string value="\udbba\udf75"/> -<string value="\udbba\udf76"/> -<string value="\udbba\udf77"/> -<string value="\udbba\udf78"/> -<string value="\udbba\udf79"/> -<string value="\udbba\udf7a"/> -<string value="\udbba\udf7b"/> -<string value="\udbba\udf7c"/> -<string value="\udbba\udf7d"/> -<string value="\udbba\udf7e"/> -<string value="\udbba\udf7f"/> -<string value="\udbba\udf80"/> -<string value="\udbba\udf81"/> -<string value="\udbba\udf82"/> -<string value="\udbba\udf83"/> -<string value="\udbba\udf84"/> -<string value="\udbba\udf85"/> -<string value="\udbba\udf86"/> -<string value="\udbba\udf87"/> -<string value="\udbba\udf88"/> -<string value="\udbba\udf89"/> -<string value="\udbba\udf8a"/> -<string value="\udbba\udf8b"/> -<string value="\udbba\udf8c"/> -<string value="\udbba\udf8d"/> -<string value="\udbba\udf8e"/> -<string value="\udbba\udf8f"/> -<string value="\udbba\udf90"/> -<string value="\udbba\udf91"/> -<string value="\udbba\udf92"/> -<string value="\udbba\udf93"/> -<string value="\udbba\udf94"/> -<string value="\udbba\udf95"/> -<string value="\udbba\udf96"/> -<string value="\udbba\udf97"/> -<string value="\udbba\udf98"/> -<string value="\udbba\udf99"/> -<string value="\udbba\udf9a"/> -<string value="\udbba\udf9b"/> -<string value="\udbba\udf9c"/> -<string value="\udbba\udf9d"/> -<string value="\udbba\udf9e"/> -<string value="\udbba\udf9f"/> -<string value="\udbba\udfa0"/> -<string value="\udbba\udfa1"/> -<string value="\udbba\udfa2"/> -<string value="\udbbb\ude10"/> -<string value="\udbbb\ude11"/> -<string value="\udbbb\ude12"/> -<string value="\udbbb\ude13"/> -<string value="\udbbb\ude14"/> -<string value="\udbbb\ude15"/> -<string value="\udbbb\ude16"/> -<string value="\udbbb\ude17"/> -<string value="\udbbb\ude18"/> -<string value="\udbbb\ude19"/> -<string value="\udbbb\ude1a"/> -<string value="\udbbb\ude1b"/> -<string value="\udbbb\ude1c"/> -<string value="\udbbb\ude1d"/> -<string value="\udbbb\ude1e"/> -<string value="\udbbb\ude1f"/> -<string value="\udbbb\ude20"/> -<string value="\udbbb\ude21"/> -<string value="\udbbb\ude22"/> -<string value="\udbbb\ude23"/> -<string value="\udbbb\ude24"/> -<string value="\udbbb\ude25"/> -<string value="\udbbb\ude26"/> -<string value="\udbbb\ude27"/> -<string value="\udbbb\ude28"/> -<string value="\udbbb\ude29"/> -<string value="\udbbb\ude2a"/> -<string value="\udbbb\ude2b"/> -<string value="\udbbb\ude2c"/> -<string value="\udbbb\ude2d"/> -<string value="\udbbb\ude2e"/> -<string value="\udbbb\ude2f"/> -<string value="\udbbb\ude30"/> -<string value="\udbbb\ude31"/> -<string value="\udbbb\ude32"/> -<string value="\udbbb\ude33"/> -<string value="\udbbb\ude40"/> -<string value="\udbbb\ude41"/> -<string value="\udbbb\ude42"/> -<string value="\udbbb\ude43"/> -<string value="\udbbb\ude44"/> -<string value="\udbbb\ude45"/> -<string value="\udbbb\ude46"/> -<string value="\udbbb\ude47"/> -<string value="\udbbb\ude48"/> -<string value="\udbbb\ude49"/> -<string value="\udbbb\ude4a"/> -<string value="\udbbb\ude70"/> -<string value="\udbbb\ude71"/> -<string value="\udbbb\ude72"/> -<string value="\udbbb\ude73"/> -<string value="\udbbb\ude74"/> -<string value="\udbbb\ude75"/> -<string value="\udbbb\ude76"/> -<string value="\udbbb\ude77"/> -<string value="\udbbb\ude78"/> -<string value="\udbbb\ude79"/> -<string value="\udbbb\ude7a"/> -<string value="\udbbb\ude7b"/> -<string value="\udbbb\ude7c"/> -<string value="\udbbb\ude7d"/> -<string value="\udbbb\udea0"/> -</keystring> diff --git a/src/jp/co/omronsoft/openwnn/CandidateFilter.java b/src/jp/co/omronsoft/openwnn/CandidateFilter.java index f3dd55a..993aef1 100644 --- a/src/jp/co/omronsoft/openwnn/CandidateFilter.java +++ b/src/jp/co/omronsoft/openwnn/CandidateFilter.java @@ -16,9 +16,6 @@ package jp.co.omronsoft.openwnn; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** * The filter class for candidates. * This class is used for filtering candidates by {link WnnEngine}. @@ -29,42 +26,30 @@ import java.util.regex.Pattern; public class CandidateFilter { /** Filtering pattern (No filter) */ public static final int FILTER_NONE = 0x0; - /** Filtering pattern (Emoji filter) */ - public static final int FILTER_EMOJI = 0x1; - - /** Regular expression pattern for emoji */ - private static final Pattern PATTERN_EMOJI = Pattern.compile("[\uDBB8\uDBB9\uDBBA\uDBBB]"); + /** Filtering pattern (Non ASCII) */ + public static final int FILTER_NON_ASCII = 0x2; /** Current filter type */ - private int mFilter = 0; + public int filter = 0; /** - * Set specified filter type. - * - * @param filter The filter type - * @see jp.co.omronsoft.openwnn.CandidateFilter#FILTER_NONE - * @see jp.co.omronsoft.openwnn.CandidateFilter#FILTER_EMOJI - */ - public void setFilter(int filter) { - mFilter = filter; - } - - /** * Checking whether a specified word is filtered. * * @param word A word * @return {@code true} if the word is allowed; {@code false} if the word is denied. */ public boolean isAllowed(WnnWord word) { - if (mFilter == 0) { + if (filter == 0) { return true; } - if ((mFilter & FILTER_EMOJI) != 0) { - Matcher m = PATTERN_EMOJI.matcher(word.candidate); - if (m.matches()) { - return false; + if ((filter & FILTER_NON_ASCII) != 0) { + String str = word.candidate; + for (int i = 0; i < str.length(); i++) { + if (str.charAt(i) < 0x20 || 0x7E < str.charAt(i)) { + return false; + } } - } + } return true; } } diff --git a/src/jp/co/omronsoft/openwnn/CandidateViewButton.java b/src/jp/co/omronsoft/openwnn/CandidateViewButton.java new file mode 100644 index 0000000..7ede44f --- /dev/null +++ b/src/jp/co/omronsoft/openwnn/CandidateViewButton.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + * + * 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 jp.co.omronsoft.openwnn; + +import android.widget.Button; +import android.view.MotionEvent; +import android.view.View; +import android.graphics.drawable.Drawable; +import android.util.AttributeSet; +import android.content.Context; + +/** + * The button for the candidate-view + * @author Copyright (C) 2009, OMRON SOFTWARE CO., LTD. All Rights Reserved. + */ +public class CandidateViewButton extends Button { + + /** The state of up */ + private int[] mUpState; + + /** Constructor */ + public CandidateViewButton(Context context) { + super(context); + } + + /** Constructor */ + public CandidateViewButton(Context context, AttributeSet attrs) { + super(context, attrs); + } + + /** @see android.view.View#onTouchEvent */ + public boolean onTouchEvent(MotionEvent me) { + /* for changing the button on CandidateView when it is pressed. */ + + boolean ret = super.onTouchEvent(me); + Drawable d = getBackground(); + + switch (me.getAction()) { + case MotionEvent.ACTION_DOWN: + mUpState = d.getState(); + d.setState(View.PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET); + break; + case MotionEvent.ACTION_UP: + default: + d.setState(mUpState); + break; + } + + return ret; + } +} diff --git a/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java b/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java index 9b72074..0fa7e31 100644 --- a/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java +++ b/src/jp/co/omronsoft/openwnn/DefaultSoftKeyboard.java @@ -20,7 +20,6 @@ import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.TextView; -import android.graphics.Typeface; import android.inputmethodservice.Keyboard; import android.inputmethodservice.KeyboardView; import android.content.SharedPreferences; @@ -517,7 +516,9 @@ public class DefaultSoftKeyboard implements InputViewManager, KeyboardView.OnKey /** @see jp.co.omronsoft.openwnn.InputViewManager#initView */ public View initView(OpenWnn parent, int width, int height) { mWnn = parent; - mDisplayMode = (width == 320)? PORTRAIT : LANDSCAPE; + mDisplayMode = + (parent.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) + ? LANDSCAPE : PORTRAIT; /* * create keyboards & the view. @@ -756,4 +757,20 @@ public class DefaultSoftKeyboard implements InputViewManager, KeyboardView.OnKey mHardKeyboardHidden = hidden; } + /** + * Get current keyboard view. + */ + public View getKeyboardView() { + return mKeyboardView; + } + + /** + * Reset the current keyboard + */ + public void resetCurrentKeyboard() { + closing(); + Keyboard keyboard = mCurrentKeyboard; + mCurrentKeyboard = null; + changeKeyboard(keyboard); + } } diff --git a/src/jp/co/omronsoft/openwnn/EN/DefaultSoftKeyboardEN.java b/src/jp/co/omronsoft/openwnn/EN/DefaultSoftKeyboardEN.java index fd8667d..4cdcc9a 100644 --- a/src/jp/co/omronsoft/openwnn/EN/DefaultSoftKeyboardEN.java +++ b/src/jp/co/omronsoft/openwnn/EN/DefaultSoftKeyboardEN.java @@ -22,6 +22,7 @@ import android.inputmethodservice.Keyboard; import android.view.KeyEvent; import android.view.View; import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; import android.util.Log; @@ -95,8 +96,13 @@ public class DefaultSoftKeyboardEN extends DefaultSoftKeyboard { * @return state ID of the shift key (0:off, 1:on) */ private int getShiftKeyState(EditorInfo editor) { - int caps = mWnn.getCurrentInputConnection().getCursorCapsMode(editor.inputType); - return (caps == 0) ? 0 : 1; + InputConnection connection = mWnn.getCurrentInputConnection(); + if (connection != null) { + int caps = connection.getCursorCapsMode(editor.inputType); + return (caps == 0) ? 0 : 1; + } else { + return 0; + } } /** @@ -124,7 +130,6 @@ public class DefaultSoftKeyboardEN extends DefaultSoftKeyboard { mCurrentKeyboardType = KEYBOARD_QWERTY; mShiftOn = KEYBOARD_SHIFT_OFF; mCurrentKeyMode = KEYMODE_EN_ALPHABET; - mDisplayMode = (width == 320)? PORTRAIT : LANDSCAPE; Keyboard kbd = mKeyboard[mCurrentLanguage][mDisplayMode][mCurrentKeyboardType][mShiftOn][mCurrentKeyMode][0]; if (kbd == null) { diff --git a/src/jp/co/omronsoft/openwnn/EN/KeyboardListPreferenceEN.java b/src/jp/co/omronsoft/openwnn/EN/KeyboardListPreferenceEN.java index 35fa70f..4bcadaf 100644 --- a/src/jp/co/omronsoft/openwnn/EN/KeyboardListPreferenceEN.java +++ b/src/jp/co/omronsoft/openwnn/EN/KeyboardListPreferenceEN.java @@ -36,7 +36,7 @@ public class KeyboardListPreferenceEN extends ListPreference{ this(context, null); } - /** see android.preference.DialogPreference#onDialogClosed */ + /** @see android.preference.DialogPreference#onDialogClosed */ @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); diff --git a/src/jp/co/omronsoft/openwnn/EN/OpenWnnEngineEN.java b/src/jp/co/omronsoft/openwnn/EN/OpenWnnEngineEN.java index 17d6886..4a71690 100644 --- a/src/jp/co/omronsoft/openwnn/EN/OpenWnnEngineEN.java +++ b/src/jp/co/omronsoft/openwnn/EN/OpenWnnEngineEN.java @@ -21,7 +21,6 @@ import java.util.ArrayList; import jp.co.omronsoft.openwnn.*; import android.content.SharedPreferences; -import android.util.Log; /** * The OpenWnn engine class for English IME. diff --git a/src/jp/co/omronsoft/openwnn/EN/TutorialEN.java b/src/jp/co/omronsoft/openwnn/EN/TutorialEN.java new file mode 100644 index 0000000..cb2f1d8 --- /dev/null +++ b/src/jp/co/omronsoft/openwnn/EN/TutorialEN.java @@ -0,0 +1,304 @@ +/* + * Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + * + * 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. + */ + +/* + * Copyright (C) 2008-2009 Google Inc. + * + * 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 jp.co.omronsoft.openwnn.EN; + +import jp.co.omronsoft.openwnn.*; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.os.Message; +import android.text.Layout; +import android.text.SpannableStringBuilder; +import android.text.StaticLayout; +import android.text.Spanned; +import android.text.style.ImageSpan; +import android.text.style.DynamicDrawableSpan; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnTouchListener; +import android.widget.PopupWindow; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +public class TutorialEN implements OnTouchListener { + + private List<Bubble> mBubbles = new ArrayList<Bubble>(); + private View mInputView; + private OpenWnnEN mIme; + private int[] mLocation = new int[2]; + private static final int MSG_SHOW_BUBBLE = 0; + + private int mBubbleIndex; + private boolean mEnableKeyTouch = false; + + Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SHOW_BUBBLE: + Bubble bubba = (Bubble) msg.obj; + bubba.show(mLocation[0], mLocation[1]); + break; + } + } + }; + + class Bubble { + Drawable bubbleBackground; + int x; + int y; + int width; + int gravity; + CharSequence text; + boolean dismissOnTouch; + boolean dismissOnClose; + PopupWindow window; + TextView textView; + View inputView; + + Bubble(Context context, View inputView, + int backgroundResource, int bx, int by, int description, int guide) { + + CharSequence text = context.getResources().getText(description); + init(context, inputView, backgroundResource, bx, by, text, guide, false); + } + + Bubble(Context context, View inputView, int backgroundResource, int bx, int by, + CharSequence description, int guide, boolean leftAlign) { + init(context, inputView, backgroundResource, bx, by, description, guide, leftAlign); + } + + void init(Context context, View inputView, int backgroundResource, + int bx, int by, CharSequence description, int guide, boolean leftAlign) { + bubbleBackground = context.getResources().getDrawable(backgroundResource); + x = bx; + y = by; + width = (int) (inputView.getWidth() * 0.9); + this.gravity = Gravity.TOP | Gravity.LEFT; + text = new SpannableStringBuilder() + .append(description) + .append("\n") + .append(context.getResources().getText(guide)); + this.dismissOnTouch = true; + this.dismissOnClose = false; + this.inputView = inputView; + window = new PopupWindow(context); + window.setBackgroundDrawable(null); + LayoutInflater inflate = + (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + textView = (TextView) inflate.inflate(R.layout.bubble_text, null); + textView.setBackgroundDrawable(bubbleBackground); + textView.setText(text); + if (leftAlign) { + textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); + } + window.setContentView(textView); + window.setFocusable(false); + window.setTouchable(true); + window.setOutsideTouchable(false); + } + + private int chooseSize(PopupWindow pop, View parentView, CharSequence text, TextView tv) { + int wid = tv.getPaddingLeft() + tv.getPaddingRight(); + int ht = tv.getPaddingTop() + tv.getPaddingBottom(); + + /* + * Figure out how big the text would be if we laid it out to the + * full width of this view minus the border. + */ + int cap = width - wid; + + Layout l = new StaticLayout(text, tv.getPaint(), cap, + Layout.Alignment.ALIGN_NORMAL, 1, 0, true); + float max = 0; + for (int i = 0; i < l.getLineCount(); i++) { + max = Math.max(max, l.getLineWidth(i)); + } + + /* + * Now set the popup size to be big enough for the text plus the border. + */ + pop.setWidth(width); + pop.setHeight(ht + l.getHeight()); + return l.getHeight(); + } + + void show(int offx, int offy) { + int textHeight = chooseSize(window, inputView, text, textView); + offy -= textView.getPaddingTop() + textHeight; + if (inputView.getVisibility() == View.VISIBLE + && inputView.getWindowVisibility() == View.VISIBLE) { + try { + if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) offy -= window.getHeight(); + if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) offx -= window.getWidth(); + textView.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View view, MotionEvent me) { + boolean ret = !mEnableKeyTouch; + switch (me.getAction()) { + case MotionEvent.ACTION_UP: + if (mBubbleIndex >= mBubbles.size()) { + mInputView.setOnTouchListener(null); + } else { + TutorialEN.this.next(); + } + break; + default: + break; + } + return ret; + } + }); + window.showAtLocation(inputView, Gravity.NO_GRAVITY, x + offx, y + offy); + } catch (Exception e) { + } + } + } + + void hide() { + if (window.isShowing()) { + textView.setOnTouchListener(null); + window.dismiss(); + } + } + + boolean isShowing() { + return window.isShowing(); + } + } + + /** Constructor */ + public TutorialEN(OpenWnnEN ime, View inputView, DefaultSoftKeyboardEN inputManager) { + mInputView = inputView; + mIme = ime; + + Context context = inputView.getContext(); + int inputWidth = inputView.getWidth(); + Resources r = inputView.getContext().getResources(); + final int x = inputWidth / 20; + r.getDimensionPixelOffset(R.dimen.bubble_pointer_offset); + + SpannableStringBuilder spannable = new SpannableStringBuilder(); + Bubble button; + + spannable.clear(); + spannable.append(r.getText(R.string.tip_en_to_open_keyboard)); + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + spannable.clear(); + spannable.append(r.getText(R.string.tip_en_to_close_keyboard)); + + setSpan(spannable, "\u2190", R.drawable.tutorial_back); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + R.string.tip_en_end_of_tutorial, R.string.touch_to_finish); + mBubbles.add(button); + } + + private void setSpan(SpannableStringBuilder spannable, String marker, int imageResourceId) { + String text = spannable.toString(); + int target = text.indexOf(marker); + while (0 <= target) { + ImageSpan span = new ImageSpan(mIme, imageResourceId, + DynamicDrawableSpan.ALIGN_BOTTOM); + spannable.setSpan(span, target, target + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + target = text.indexOf(marker, target + 1); + } + } + + public void start() { + mInputView.getLocationInWindow(mLocation); + mBubbleIndex = -1; + mInputView.setOnTouchListener(this); + next(); + } + + boolean next() { + if (mBubbleIndex >= 0) { + if (!mBubbles.get(mBubbleIndex).isShowing()) { + return true; + } + for (int i = 0; i <= mBubbleIndex; i++) { + mBubbles.get(i).hide(); + } + } + mBubbleIndex++; + if (mBubbleIndex >= mBubbles.size()) { + mEnableKeyTouch = true; + mIme.sendDownUpKeyEvents(-1); + mIme.tutorialDone(); + return false; + } + + mHandler.sendMessageDelayed( + mHandler.obtainMessage(MSG_SHOW_BUBBLE, mBubbles.get(mBubbleIndex)), 500); + return true; + } + + void hide() { + for (int i = 0; i < mBubbles.size(); i++) { + mBubbles.get(i).hide(); + } + mInputView.setOnTouchListener(null); + } + + public boolean close() { + mHandler.removeMessages(MSG_SHOW_BUBBLE); + hide(); + return true; + } + + public boolean onTouch(View v, MotionEvent event) { + boolean ret = !mEnableKeyTouch; + if (event.getAction() == MotionEvent.ACTION_UP) { + if (mBubbleIndex >= mBubbles.size()) { + mInputView.setOnTouchListener(null); + } + } + return ret; + } +} diff --git a/src/jp/co/omronsoft/openwnn/EN/UserDictionaryToolsListEN.java b/src/jp/co/omronsoft/openwnn/EN/UserDictionaryToolsListEN.java index bbcb972..483b25a 100644 --- a/src/jp/co/omronsoft/openwnn/EN/UserDictionaryToolsListEN.java +++ b/src/jp/co/omronsoft/openwnn/EN/UserDictionaryToolsListEN.java @@ -17,10 +17,9 @@ package jp.co.omronsoft.openwnn.EN; import jp.co.omronsoft.openwnn.*; -import jp.co.omronsoft.openwnn.UserDictionaryToolsEdit; -import jp.co.omronsoft.openwnn.UserDictionaryToolsList; import android.view.View; import android.view.Window; +import java.util.Comparator; /** * The user dictionary tool class for English IME. @@ -60,4 +59,16 @@ public class UserDictionaryToolsListEN extends UserDictionaryToolsList { } return false; } + + /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#getComparator */ + @Override protected Comparator<WnnWord> getComparator() { + return new ListComparatorEN(); + } + + /** Comparator class for sorting the list of English user dictionary */ + protected class ListComparatorEN implements Comparator<WnnWord>{ + public int compare(WnnWord word1, WnnWord word2) { + return word1.stroke.compareTo(word2.stroke); + }; + } } diff --git a/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java b/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java index 6941fda..de9f431 100644 --- a/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java +++ b/src/jp/co/omronsoft/openwnn/JAJP/DefaultSoftKeyboardJAJP.java @@ -19,19 +19,14 @@ package jp.co.omronsoft.openwnn.JAJP; import jp.co.omronsoft.openwnn.*; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; import android.inputmethodservice.Keyboard; -import android.inputmethodservice.Keyboard.Key; -import android.inputmethodservice.KeyboardView; -import android.widget.Toast; -import android.provider.Settings; import android.util.Log; import android.view.View; -import android.content.Context; import android.content.SharedPreferences; - import java.util.HashMap; -import java.util.List; import java.util.Locale; +import java.util.List; /** * The default Software Keyboard class for Japanese IME. @@ -84,6 +79,9 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** Definition for {@code mInputType} (commit instantly) */ private static final int INPUT_TYPE_INSTANT = 2; + /** Max key number of the 12 key keyboard (depends on the definition of keyboards) */ + private static final int KEY_NUMBER_12KEY = 20; + /** Toggle cycle table for full-width HIRAGANA */ private static final String[][] JP_FULL_HIRAGANA_CYCLE_TABLE = { {"\u3042", "\u3044", "\u3046", "\u3048", "\u304a", "\u3041", "\u3043", "\u3045", "\u3047", "\u3049"}, @@ -264,6 +262,12 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** The constant for mFixedKeyMode. It means that input mode is not fixed. */ private static final int INVALID_KEYMODE = -1; + /** KeyIndex of "Moji" key on 12 keyboard (depends on the definition of keyboards) */ + private static final int KEY_INDEX_CHANGE_MODE_12KEY = 15; + + /** KeyIndex of "Moji" key on QWERTY keyboard (depends on the definition of keyboards) */ + private static final int KEY_INDEX_CHANGE_MODE_QWERTY = 29; + /** Type of input mode */ private int mInputType = INPUT_TYPE_TOGGLE; @@ -277,7 +281,7 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { private char[] mCurrentInstantTable = null; /** Input mode that is not able to be changed. If ENABLE_CHANGE_KEYMODE is set, input mode can change. */ - private int mFixedKeyMode = INVALID_KEYMODE; + private int[] mLimitedKeyMode = null; /** Input mode that is given the first priority. If ENABLE_CHANGE_KEYMODE is set, input mode can change. */ private int mPreferenceKeyMode = INVALID_KEYMODE; @@ -288,6 +292,18 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** Auto caps mode */ private boolean mEnableAutoCaps = true; + /** PopupResId of "Moji" key (this is used for canceling long-press) */ + private int mPopupResId = 0; + + /** Whether the InputType is null */ + private boolean mIsInputTypeNull = false; + + /** {@code SharedPreferences} for save the keyboard type */ + private SharedPreferences.Editor mPrefEditor = null; + + /** "Moji" key (this is used for canceling long-press) */ + private Keyboard.Key mChangeModeKey = null; + /** Default constructor */ public DefaultSoftKeyboardJAJP() { @@ -304,7 +320,7 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { mKeyboard = new Keyboard[3][2][4][2][8][2]; if (mHardKeyboardHidden) { - /* Create the suitable keyboard object */ + /* Create the suitable keyboard object */ if (mDisplayMode == DefaultSoftKeyboard.PORTRAIT) { createKeyboardsPortrait(parent); } else { @@ -325,7 +341,8 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { } /** - * Commit the pre-edit string for committing operation that is not explicit (ex. when a candidate is selected) + * Commit the pre-edit string for committing operation that is not explicit + * (ex. when a candidate is selected) */ private void commitText() { if (!mNoInput) { @@ -339,41 +356,20 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { * @param keyMode The type of input mode */ public void changeKeyMode(int keyMode) { - int targetMode = keyMode; + int targetMode = filterKeyMode(keyMode); + if (targetMode == INVALID_KEYMODE) { + return; + } + commitText(); if (mCapsLock) { - mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.INPUT_SOFT_KEY, + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.INPUT_SOFT_KEY, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT))); mCapsLock = false; } mShiftOn = KEYBOARD_SHIFT_OFF; - - if (mFixedKeyMode != INVALID_KEYMODE) { - targetMode = mFixedKeyMode; - } - - if (!mHardKeyboardHidden) { - if ((targetMode != KEYMODE_JA_FULL_HIRAGANA) - && (targetMode != KEYMODE_JA_HALF_ALPHABET)) { - - Locale locale = Locale.getDefault(); - int keymode = KEYMODE_JA_HALF_ALPHABET; - if (locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) { - switch (targetMode) { - case KEYMODE_JA_FULL_HIRAGANA: - case KEYMODE_JA_FULL_KATAKANA: - case KEYMODE_JA_HALF_KATAKANA: - keymode = KEYMODE_JA_FULL_HIRAGANA; - break; - default: - break; - } - } - targetMode = keymode; - } - } Keyboard kbd = getModeChangeKeyboard(targetMode); mCurrentKeyMode = targetMode; mPrevInputKeyCode = 0; @@ -441,12 +437,35 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { return view; } + /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#changeKeyboard */ + @Override protected boolean changeKeyboard(Keyboard keyboard) { + if (keyboard != null) { + if (mIsInputTypeNull) { + mChangeModeKey.popupResId = mPopupResId; + } + + List<Keyboard.Key> keys = keyboard.getKeys(); + int keyIndex = (KEY_NUMBER_12KEY < keys.size()) + ? KEY_INDEX_CHANGE_MODE_QWERTY : KEY_INDEX_CHANGE_MODE_12KEY; + mChangeModeKey = keys.get(keyIndex); + + if (mIsInputTypeNull) { + mPopupResId = mChangeModeKey.popupResId; + mChangeModeKey.popupResId = 0; + } + } + + return super.changeKeyboard(keyboard); + } + /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#changeKeyboardType */ @Override public void changeKeyboardType(int type) { commitText(); Keyboard kbd = getTypeChangeKeyboard(type); if (kbd != null) { mCurrentKeyboardType = type; + mPrefEditor.putBoolean("opt_enable_qwerty", type == KEYBOARD_QWERTY); + mPrefEditor.commit(); changeKeyboard(kbd); } if (type == KEYBOARD_12KEY) { @@ -466,7 +485,9 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { switch (primaryCode) { case KEYCODE_JP12_TOGGLE_MODE: case KEYCODE_QWERTY_TOGGLE_MODE: - nextKeyMode(); + if (!mIsInputTypeNull) { + nextKeyMode(); + } break; case DefaultSoftKeyboard.KEYCODE_QWERTY_BACKSPACE: @@ -520,18 +541,19 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { case KEYCODE_JP12_9: case KEYCODE_JP12_0: case KEYCODE_JP12_SHARP: - /* Processing to input by ten key */ - if (mInputType == INPUT_TYPE_INSTANT) { - /* Send a input character directly if instant input type is selected */ + /* Processing to input by ten key */ + if (mInputType == INPUT_TYPE_INSTANT) { + /* Send a input character directly if instant input type is selected */ commitText(); mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.INPUT_CHAR, mCurrentInstantTable[getTableIndex(primaryCode)])); } else { if ((mPrevInputKeyCode != primaryCode)) { + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.TOUCH_OTHER_KEY)); if ((mCurrentKeyMode == KEYMODE_JA_HALF_ALPHABET) && (primaryCode == KEYCODE_JP12_SHARP)) { - /* Commit text by symbol character (',' '.') when alphabet input mode is selected */ - commitText(); + /* Commit text by symbol character (',' '.') when alphabet input mode is selected */ + commitText(); } } @@ -554,9 +576,9 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.INPUT_CHAR, mCurrentInstantTable[getTableIndex(primaryCode)])); } else { - if (!mNoInput) { - /* Processing to toggle Dakuten, Handakuten, and capital */ - HashMap replaceTable = getReplaceTable(); + if (!mNoInput) { + /* Processing to toggle Dakuten, Handakuten, and capital */ + HashMap replaceTable = getReplaceTable(); if (replaceTable == null) { Log.e("OpenWnn", "not founds replace table"); } else { @@ -568,38 +590,38 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { break; case KEYCODE_SWITCH_FULL_HIRAGANA: - /* Change mode to Full width hiragana */ - changeKeyMode(KEYMODE_JA_FULL_HIRAGANA); + /* Change mode to Full width hiragana */ + changeKeyMode(KEYMODE_JA_FULL_HIRAGANA); break; case KEYCODE_SWITCH_FULL_KATAKANA: - /* Change mode to Full width katakana */ - changeKeyMode(KEYMODE_JA_FULL_KATAKANA); + /* Change mode to Full width katakana */ + changeKeyMode(KEYMODE_JA_FULL_KATAKANA); break; case KEYCODE_SWITCH_FULL_ALPHABET: - /* Change mode to Full width alphabet */ - changeKeyMode(KEYMODE_JA_FULL_ALPHABET); + /* Change mode to Full width alphabet */ + changeKeyMode(KEYMODE_JA_FULL_ALPHABET); break; case KEYCODE_SWITCH_FULL_NUMBER: - /* Change mode to Full width numeric */ - changeKeyMode(KEYMODE_JA_FULL_NUMBER); + /* Change mode to Full width numeric */ + changeKeyMode(KEYMODE_JA_FULL_NUMBER); break; case KEYCODE_SWITCH_HALF_KATAKANA: - /* Change mode to Half width katakana */ - changeKeyMode(KEYMODE_JA_HALF_KATAKANA); + /* Change mode to Half width katakana */ + changeKeyMode(KEYMODE_JA_HALF_KATAKANA); break; case KEYCODE_SWITCH_HALF_ALPHABET: - /* Change mode to Half width alphabet */ - changeKeyMode(KEYMODE_JA_HALF_ALPHABET); + /* Change mode to Half width alphabet */ + changeKeyMode(KEYMODE_JA_HALF_ALPHABET); break; case KEYCODE_SWITCH_HALF_NUMBER: - /* Change mode to Half width numeric */ - changeKeyMode(KEYMODE_JA_HALF_NUMBER); + /* Change mode to Half width numeric */ + changeKeyMode(KEYMODE_JA_HALF_NUMBER); break; @@ -661,18 +683,37 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#setPreferences */ @Override public void setPreferences(SharedPreferences pref, EditorInfo editor) { + mPrefEditor = pref.edit(); + boolean isQwerty = pref.getBoolean("opt_enable_qwerty", false); + if (isQwerty && (mCurrentKeyboardType == KEYBOARD_12KEY)) { + changeKeyboardType(KEYBOARD_QWERTY); + } + super.setPreferences(pref, editor); int inputType = editor.inputType; - if (inputType == EditorInfo.TYPE_NULL) { - return; + if (mHardKeyboardHidden) { + if (inputType == EditorInfo.TYPE_NULL) { + if (!mIsInputTypeNull) { + mIsInputTypeNull = true; + mPopupResId = mChangeModeKey.popupResId; + mChangeModeKey.popupResId = 0; + } + return; + } + + if (mIsInputTypeNull) { + mIsInputTypeNull = false; + mChangeModeKey.popupResId = mPopupResId; + } } mEnableAutoCaps = pref.getBoolean("auto_caps", true); - mFixedKeyMode = INVALID_KEYMODE; + mLimitedKeyMode = null; mPreferenceKeyMode = INVALID_KEYMODE; mNoInput = true; mDisableKeyInput = false; + mCapsLock = false; switch (inputType & EditorInfo.TYPE_MASK_CLASS) { @@ -682,17 +723,23 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { break; case EditorInfo.TYPE_CLASS_PHONE: - mFixedKeyMode = KEYMODE_JA_HALF_PHONE; + if (mHardKeyboardHidden) { + mLimitedKeyMode = new int[] {KEYMODE_JA_HALF_PHONE}; + } else { + mLimitedKeyMode = new int[] {KEYMODE_JA_HALF_ALPHABET}; + } break; case EditorInfo.TYPE_CLASS_TEXT: switch (inputType & EditorInfo.TYPE_MASK_VARIATION) { case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD: - mPreferenceKeyMode = KEYMODE_JA_HALF_ALPHABET; + mLimitedKeyMode = new int[] {KEYMODE_JA_HALF_ALPHABET, KEYMODE_JA_HALF_NUMBER}; break; case EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS: + mLimitedKeyMode = new int[] {KEYMODE_JA_HALF_ALPHABET, KEYMODE_JA_HALF_NUMBER}; + break; case EditorInfo.TYPE_TEXT_VARIATION_URI: mPreferenceKeyMode = KEYMODE_JA_HALF_ALPHABET; break; @@ -711,6 +758,7 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { mLastInputType = inputType; } + setStatusIcon(); setShiftByEditorInfo(); } @@ -731,6 +779,8 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { if (mPreferenceKeyMode != INVALID_KEYMODE) { keymode = mPreferenceKeyMode; + } else if (mLimitedKeyMode != null) { + keymode = mLimitedKeyMode[0]; } else { if (!locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) { keymode = KEYMODE_JA_HALF_ALPHABET; @@ -743,9 +793,9 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** * Change to the next input mode */ - private void nextKeyMode() { - /* Search the current mode in the toggle table */ - boolean found = false; + public void nextKeyMode() { + /* Search the current mode in the toggle table */ + boolean found = false; int index; for (index = 0; index < JP_MODE_CYCLE_TABLE.length; index++) { if (JP_MODE_CYCLE_TABLE[index] == mCurrentKeyMode) { @@ -755,15 +805,24 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { } if (!found) { - /* If the current mode not exists, set the default mode */ - setDefaultKeyboard(); + /* If the current mode not exists, set the default mode */ + setDefaultKeyboard(); } else { - /* If the current mode exists, set the next input mode */ - index++; - if (JP_MODE_CYCLE_TABLE.length <= index) { - index = 0; + /* If the current mode exists, set the next input mode */ + int size = JP_MODE_CYCLE_TABLE.length; + int keyMode = INVALID_KEYMODE; + for (int i = 0; i < size; i++) { + index = (++index) % size; + + keyMode = filterKeyMode(JP_MODE_CYCLE_TABLE[index]); + if (keyMode != INVALID_KEYMODE) { + break; + } + } + + if (keyMode != INVALID_KEYMODE) { + changeKeyMode(keyMode); } - changeKeyMode(JP_MODE_CYCLE_TABLE[index]); } } @@ -776,28 +835,24 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { Keyboard[][] keyList; /* qwerty shift_off (portrait) */ keyList = mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF]; - keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty); - keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_alphabet); - keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_symbols); - keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_katakana); - keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_alphabet); - keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_symbols); - keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_katakana); + keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp); + keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_alphabet); + keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_symbols); + keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_katakana); + keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_alphabet); + keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_symbols); + keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_katakana); keyList[KEYMODE_JA_HALF_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone); /* qwerty shift_on (portrait) */ keyList = mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_ON]; - keyList[KEYMODE_JA_FULL_HIRAGANA][0] = - mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_HIRAGANA][0]; - keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_alphabet_shift); - keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_symbols_shift); - keyList[KEYMODE_JA_FULL_KATAKANA][0] = - mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_KATAKANA][0]; - keyList[KEYMODE_JA_HALF_ALPHABET][0] = - mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_ALPHABET][0]; - keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_symbols_shift); - keyList[KEYMODE_JA_HALF_KATAKANA][0] = - mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_KATAKANA][0]; + keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_shift); + keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_alphabet_shift); + keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_symbols_shift); + keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_katakana_shift); + keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_alphabet_shift); + keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_symbols_shift); + keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_katakana_shift); keyList[KEYMODE_JA_HALF_PHONE][0] = mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_PHONE][0]; @@ -806,16 +861,16 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { keyList = mKeyboard[LANG_JA][PORTRAIT][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF]; keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_12keyjp); keyList[KEYMODE_JA_FULL_HIRAGANA][1] = new Keyboard(parent, R.xml.keyboard_12keyjp_input); - keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_alphabet); - keyList[KEYMODE_JA_FULL_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_input); - keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_num); - keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_katakana); - keyList[KEYMODE_JA_FULL_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_katakana_input); - keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_alphabet); - keyList[KEYMODE_JA_HALF_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_input); - keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_num); - keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_katakana); - keyList[KEYMODE_JA_HALF_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_katakana_input); + keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_full_alphabet); + keyList[KEYMODE_JA_FULL_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_full_alphabet_input); + keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_full_num); + keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_full_katakana); + keyList[KEYMODE_JA_FULL_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_full_katakana_input); + keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_half_alphabet); + keyList[KEYMODE_JA_HALF_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_half_alphabet_input); + keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_half_num); + keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_half_katakana); + keyList[KEYMODE_JA_HALF_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_half_katakana_input); keyList[KEYMODE_JA_HALF_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone); /* 12-keys shift_on (portrait) */ @@ -845,52 +900,54 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { * @param parent The context */ private void createKeyboardsLandscape(OpenWnn parent) { + /* Keyboard[][] keyList; + */ /* qwerty shift_off (landscape) */ -/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF]; - keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_landscape); - keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_alphabet_landscape); - keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_symbols_landscape); - keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_katakana_landscape); - keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_alphabet_landscape); - keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_symbols_landscape); - keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_katakana_landscape); + /* + keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF]; + keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_landscape); + keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_alphabet_landscape); + keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_symbols_landscape); + keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_katakana_landscape); + keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_alphabet_landscape); + keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_symbols_landscape); + keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_katakana_landscape); keyList[KEYMODE_JA_HALF_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone_landscape); -*/ + */ /* qwerty shift_on (landscape) */ -/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_ON]; - keyList[KEYMODE_JA_FULL_HIRAGANA][0] = - mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_HIRAGANA][0]; - keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_alphabet_shift_landscape); - keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_full_symbols_shift_landscape); - keyList[KEYMODE_JA_FULL_KATAKANA][0] = - mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_KATAKANA][0]; - keyList[KEYMODE_JA_HALF_ALPHABET][0] = - mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_ALPHABET][0]; - keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_half_symbols_shift_landscape); - keyList[KEYMODE_JA_HALF_KATAKANA][0] = - mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_KATAKANA][0]; + /* + keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_ON]; + keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_shift_landscape); + keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_alphabet_shift_landscape); + keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_symbols_shift_landscape); + keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_full_katakana_shift_landscape); + keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_alphabet_shift_landscape); + keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_symbols_shift_landscape); + keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_qwerty_jp_half_katakana_shift_landscape); keyList[KEYMODE_JA_HALF_PHONE][0] = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_PHONE][0]; -*/ + */ /* 12-keys shift_off (landscape) */ -/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF]; + /* + keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF]; keyList[KEYMODE_JA_FULL_HIRAGANA][0] = new Keyboard(parent, R.xml.keyboard_12keyjp_landscape); keyList[KEYMODE_JA_FULL_HIRAGANA][1] = new Keyboard(parent, R.xml.keyboard_12keyjp_input_landscape); - keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_landscape); - keyList[KEYMODE_JA_FULL_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_input_landscape); - keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_num_landscape); - keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_katakana_landscape); - keyList[KEYMODE_JA_FULL_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_katakana_input_landscape); - keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_landscape); - keyList[KEYMODE_JA_HALF_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_alphabet_input_landscape); - keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_num_landscape); - keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_katakana_landscape); - keyList[KEYMODE_JA_HALF_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_katakana_input_landscape); + keyList[KEYMODE_JA_FULL_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_full_alphabet_landscape); + keyList[KEYMODE_JA_FULL_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_full_alphabet_input_landscape); + keyList[KEYMODE_JA_FULL_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_full_num_landscape); + keyList[KEYMODE_JA_FULL_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_full_katakana_landscape); + keyList[KEYMODE_JA_FULL_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_full_katakana_input_landscape); + keyList[KEYMODE_JA_HALF_ALPHABET][0] = new Keyboard(parent, R.xml.keyboard_12key_half_alphabet_landscape); + keyList[KEYMODE_JA_HALF_ALPHABET][1] = new Keyboard(parent, R.xml.keyboard_12key_half_alphabet_input_landscape); + keyList[KEYMODE_JA_HALF_NUMBER][0] = new Keyboard(parent, R.xml.keyboard_12key_half_num_landscape); + keyList[KEYMODE_JA_HALF_KATAKANA][0] = new Keyboard(parent, R.xml.keyboard_12key_half_katakana_landscape); + keyList[KEYMODE_JA_HALF_KATAKANA][1] = new Keyboard(parent, R.xml.keyboard_12key_half_katakana_input_landscape); keyList[KEYMODE_JA_HALF_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone_landscape); -*/ + */ /* 12-keys shift_on (landscape) */ -/* keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_ON]; + /* + keyList = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_ON]; keyList[KEYMODE_JA_FULL_HIRAGANA] = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_FULL_HIRAGANA]; keyList[KEYMODE_JA_FULL_ALPHABET] @@ -907,7 +964,7 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_KATAKANA]; keyList[KEYMODE_JA_HALF_PHONE] = mKeyboard[LANG_JA][LANDSCAPE][KEYBOARD_12KEY][KEYBOARD_SHIFT_OFF][KEYMODE_JA_HALF_PHONE]; -*/ + */ } /** @@ -957,7 +1014,7 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { case KEYMODE_JA_FULL_NUMBER: case KEYMODE_JA_HALF_NUMBER: - /* Because these modes belong to direct input group, No toggle table exists */ + /* Because these modes belong to direct input group, No toggle table exists */ break; case KEYMODE_JA_HALF_ALPHABET: @@ -995,7 +1052,7 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { case KEYMODE_JA_FULL_NUMBER: case KEYMODE_JA_HALF_NUMBER: - /* Because these modes belong to direct input group, No replacing table exists */ + /* Because these modes belong to direct input group, No replacing table exists */ break; case KEYMODE_JA_HALF_ALPHABET: @@ -1051,12 +1108,17 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** * Get the shift key state from the editor. * <br> - * @param editor The editor information - * @return state ID of the shift key (0:off, 1:on) + * @param editor The editor information + * @return The state id of the shift key (0:off, 1:on) */ protected int getShiftKeyState(EditorInfo editor) { - int caps = mWnn.getCurrentInputConnection().getCursorCapsMode(editor.inputType); - return (caps == 0) ? 0 : 1; + InputConnection connection = mWnn.getCurrentInputConnection(); + if (connection != null) { + int caps = connection.getCursorCapsMode(editor.inputType); + return (caps == 0) ? 0 : 1; + } else { + return 0; + } } /** @@ -1073,13 +1135,85 @@ public class DefaultSoftKeyboardJAJP extends DefaultSoftKeyboard { /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#setHardKeyboardHidden */ @Override public void setHardKeyboardHidden(boolean hidden) { - if ((mWnn != null) && !mHardKeyboardHidden) { - mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CHANGE_MODE, - OpenWnnJAJP.ENGINE_MODE_OPT_TYPE_QWERTY)); + if (mWnn != null) { + if (!hidden) { + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CHANGE_MODE, + OpenWnnJAJP.ENGINE_MODE_OPT_TYPE_QWERTY)); + } + + if (mHardKeyboardHidden != hidden) { + if ((mLimitedKeyMode != null) + || ((mCurrentKeyMode != KEYMODE_JA_FULL_HIRAGANA) + && (mCurrentKeyMode != KEYMODE_JA_HALF_ALPHABET))) { + + mLastInputType = EditorInfo.TYPE_NULL; + if (mWnn.isInputViewShown()) { + setDefaultKeyboard(); + } + } + } } super.setHardKeyboardHidden(hidden); } -} + /** + * Change the key-mode to the allowed one which is restricted + * by the text input field or the type of the keyboard. + * @param keyMode The key-mode + * @return the key-mode allowed + */ + private int filterKeyMode(int keyMode) { + int targetMode = keyMode; + int[] limits = mLimitedKeyMode; + + if (!mHardKeyboardHidden) { /* for hardware keyboard */ + if ((targetMode != KEYMODE_JA_FULL_HIRAGANA) + && (targetMode != KEYMODE_JA_HALF_ALPHABET)) { + Locale locale = Locale.getDefault(); + int keymode = KEYMODE_JA_HALF_ALPHABET; + if (locale.getLanguage().equals(Locale.JAPANESE.getLanguage())) { + switch (targetMode) { + case KEYMODE_JA_FULL_HIRAGANA: + case KEYMODE_JA_FULL_KATAKANA: + case KEYMODE_JA_HALF_KATAKANA: + keymode = KEYMODE_JA_FULL_HIRAGANA; + break; + default: + /* half-alphabet */ + break; + } + } + targetMode = keymode; + } + } + + /* restrict by the type of the text field */ + if (limits != null) { + boolean hasAccepted = false; + boolean hasRequiredChange = true; + int size = limits.length; + int nowMode = mCurrentKeyMode; + + for (int i = 0; i < size; i++) { + if (targetMode == limits[i]) { + hasAccepted = true; + break; + } + if (nowMode == limits[i]) { + hasRequiredChange = false; + } + } + if (!hasAccepted) { + if (hasRequiredChange) { + targetMode = mLimitedKeyMode[0]; + } else { + targetMode = INVALID_KEYMODE; + } + } + } + + return targetMode; + } +} diff --git a/src/jp/co/omronsoft/openwnn/JAJP/KanaConverter.java b/src/jp/co/omronsoft/openwnn/JAJP/KanaConverter.java index 60e0989..05d1199 100644 --- a/src/jp/co/omronsoft/openwnn/JAJP/KanaConverter.java +++ b/src/jp/co/omronsoft/openwnn/JAJP/KanaConverter.java @@ -32,7 +32,8 @@ import jp.co.omronsoft.openwnn.WnnWord; */ public class KanaConverter { - private static final HashMap<String,String> mHanSuujiMap = new HashMap<String,String>() {{ + /** Conversion rule for half-width numeric */ + private static final HashMap<String,String> mHalfNumericMap = new HashMap<String,String>() {{ put( "\u3042", "1"); put( "\u3044", "11"); put( "\u3046", "111"); @@ -92,7 +93,8 @@ public class KanaConverter { put( "\u30fc", "00000"); }}; - private static final HashMap<String,String> mZenSuujiMap = new HashMap<String,String>() {{ + /** Conversion rule for full-width numeric */ + private static final HashMap<String,String> mFullNumericMap = new HashMap<String,String>() {{ put( "\u3042", "\uff11"); put( "\u3044", "\uff11\uff11"); put( "\u3046", "\uff11\uff11\uff11"); @@ -152,7 +154,8 @@ public class KanaConverter { put( "\u30fc", "\uff10\uff10\uff10\uff10\uff10"); }}; - private static final HashMap<String,String> mHanKataMap = new HashMap<String,String>() {{ + /** Conversion rule for half-width Katakana */ + private static final HashMap<String,String> mHalfKatakanaMap = new HashMap<String,String>() {{ put( "\u3042", "\uff71"); put( "\u3044", "\uff72"); put( "\u3046", "\uff73"); @@ -242,7 +245,8 @@ public class KanaConverter { put( "\u30fc", "\uff70"); }}; - private static final HashMap<String,String> mZenKataMap = new HashMap<String,String>() {{ + /** Conversion rule for full-width Katakana */ + private static final HashMap<String,String> mFullKatakanaMap = new HashMap<String,String>() {{ put( "\u3042", "\u30a2"); put( "\u3044", "\u30a4"); put( "\u3046", "\u30a6"); @@ -332,7 +336,8 @@ public class KanaConverter { put( "\u30fc", "\u30fc"); }}; - private static final HashMap<String,String> mHanEijiMap = new HashMap<String,String>() {{ + /** Conversion rule for half-width alphabet */ + private static final HashMap<String,String> mHalfAlphabetMap = new HashMap<String,String>() {{ put( "\u3042", "."); put( "\u3044", "@"); put( "\u3046", "-"); @@ -369,7 +374,8 @@ public class KanaConverter { put( "\u308f", "-"); }}; - private static final HashMap<String,String> mZenEijiMap = new HashMap<String,String>() {{ + /** Conversion rule for full-width alphabet */ + private static final HashMap<String,String> mFullAlphabetMap = new HashMap<String,String>() {{ put( "\u3042", "\uff0e"); put( "\u3044", "\uff20"); put( "\u3046", "\u30fc"); @@ -406,7 +412,8 @@ public class KanaConverter { put( "\u308f", "\u30fc" ); }}; - private static final HashMap<String,String> mZenEijiMapQwety = new HashMap<String,String>() {{ + /** Conversion rule for full-width alphabet (QWERTY mode) */ + private static final HashMap<String,String> mFullAlphabetMapQwety = new HashMap<String,String>() {{ put( "a", "\uff41"); put( "b", "\uff42"); put( "c", "\uff43"); @@ -462,9 +469,12 @@ public class KanaConverter { put( "Z", "\uff3a"); }}; + /** Decimal format using comma */ private static final DecimalFormat mFormat = new DecimalFormat("###,###"); + /** List of the generated candidates */ private List<WnnWord> mAddCandidateList; + /** Work area for generating string */ private StringBuffer mStringBuff; /** part of speech (default) */ @@ -515,10 +525,10 @@ public class KanaConverter { /* Create pseudo candidates for all keyboard type */ /* Hiragana(reading) / Full width katakana / Half width katakana */ list.add(new WnnWord(inputHiragana, inputHiragana)); - if (createCandidateString(inputHiragana, mZenKataMap, mStringBuff)) { + if (createCandidateString(inputHiragana, mFullKatakanaMap, mStringBuff)) { list.add(new WnnWord(mStringBuff.toString(), inputHiragana, mPosDefault)); } - if (createCandidateString(inputHiragana, mHanKataMap, mStringBuff)) { + if (createCandidateString(inputHiragana, mHalfKatakanaMap, mStringBuff)) { list.add(new WnnWord(mStringBuff.toString(), inputHiragana, mPosDefault)); } @@ -529,7 +539,7 @@ public class KanaConverter { /* Create pseudo candidates for 12key */ /* Create pseudo candidates for half width numeric */ - if (createCandidateString(inputHiragana, mHanSuujiMap, mStringBuff)) { + if (createCandidateString(inputHiragana, mHalfNumericMap, mStringBuff)) { String convHanSuuji = mStringBuff.toString(); String convNumComma = convertNumber(convHanSuuji); list.add(new WnnWord(convHanSuuji, inputHiragana, mPosNumber)); @@ -539,12 +549,12 @@ public class KanaConverter { } /* Create pseudo candidates for full width numeric */ - if (createCandidateString(inputHiragana, mZenSuujiMap, mStringBuff)) { + if (createCandidateString(inputHiragana, mFullNumericMap, mStringBuff)) { list.add(new WnnWord(mStringBuff.toString(), inputHiragana, mPosNumber)); } /* Create pseudo candidates for half width alphabet */ - if (createCandidateString(inputHiragana, mHanEijiMap, mStringBuff)) { + if (createCandidateString(inputHiragana, mHalfAlphabetMap, mStringBuff)) { String convHanEiji = mStringBuff.toString(); String convHanEijiLower = convHanEiji.toLowerCase(); list.add(new WnnWord(convHanEijiLower, inputHiragana, mPosSymbol)); @@ -553,7 +563,7 @@ public class KanaConverter { } /* Create pseudo candidates for full width alphabet */ - if (createCandidateString(inputHiragana, mZenEijiMap, mStringBuff)) { + if (createCandidateString(inputHiragana, mFullAlphabetMap, mStringBuff)) { String convZenEiji = mStringBuff.toString(); String convZenEijiLower = convZenEiji.toLowerCase(Locale.JAPAN); list.add(new WnnWord(convZenEijiLower, inputHiragana, mPosSymbol)); @@ -581,7 +591,7 @@ public class KanaConverter { list.add(new WnnWord(inputRomaji.toUpperCase(), inputHiragana, mPosSymbol)); /* Create pseudo candidates for the full width alphabet */ - if (createCandidateString(inputRomaji, mZenEijiMapQwety, mStringBuff)) { + if (createCandidateString(inputRomaji, mFullAlphabetMapQwety, mStringBuff)) { String convZenEiji = mStringBuff.toString(); String convZenEijiLower = convZenEiji.toLowerCase(Locale.JAPAN); list.add(new WnnWord(convZenEiji, inputHiragana, mPosSymbol)); diff --git a/src/jp/co/omronsoft/openwnn/JAJP/OpenWnnClauseConverterJAJP.java b/src/jp/co/omronsoft/openwnn/JAJP/OpenWnnClauseConverterJAJP.java index ce87f97..7114e52 100644 --- a/src/jp/co/omronsoft/openwnn/JAJP/OpenWnnClauseConverterJAJP.java +++ b/src/jp/co/omronsoft/openwnn/JAJP/OpenWnnClauseConverterJAJP.java @@ -17,11 +17,8 @@ package jp.co.omronsoft.openwnn.JAJP; import jp.co.omronsoft.openwnn.*; - import java.util.*; -import android.util.Log; - /** * The penWnn Clause Converter class for Japanese IME. * @@ -537,7 +534,7 @@ public class OpenWnnClauseConverterJAJP { * and the default part-of-speech tag. * * @param input Input string - * @return Default cluase + * @return Default clause */ private WnnClause defaultClause(String input) { return (new WnnClause(input, input, mPosDefault, (CLAUSE_COST - 1) * input.length())); diff --git a/src/jp/co/omronsoft/openwnn/JAJP/RomkanFullKatakana.java b/src/jp/co/omronsoft/openwnn/JAJP/RomkanFullKatakana.java index 7ecd3ef..d42a3c3 100644 --- a/src/jp/co/omronsoft/openwnn/JAJP/RomkanFullKatakana.java +++ b/src/jp/co/omronsoft/openwnn/JAJP/RomkanFullKatakana.java @@ -25,7 +25,7 @@ import java.util.regex.Pattern; import java.util.regex.Matcher; /** - * The Romaji to Full Katakana converter class for Japanese IME. + * The Romaji to full-width Katakana converter class for Japanese IME. * * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD. All Rights Reserved. */ diff --git a/src/jp/co/omronsoft/openwnn/JAJP/TutorialJAJP.java b/src/jp/co/omronsoft/openwnn/JAJP/TutorialJAJP.java new file mode 100644 index 0000000..edf5ddd --- /dev/null +++ b/src/jp/co/omronsoft/openwnn/JAJP/TutorialJAJP.java @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + * + * 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. + */ + +/* + * Copyright (C) 2008-2009 Google Inc. + * + * 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 jp.co.omronsoft.openwnn.JAJP; + +import jp.co.omronsoft.openwnn.*; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.os.Message; +import android.text.Layout; +import android.text.SpannableStringBuilder; +import android.text.StaticLayout; +import android.text.Spanned; +import android.text.style.ImageSpan; +import android.text.style.DynamicDrawableSpan; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnTouchListener; +import android.widget.PopupWindow; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +public class TutorialJAJP implements OnTouchListener { + + private List<Bubble> mBubbles = new ArrayList<Bubble>(); + private static final int LONG_PRESS_INDEX = 8; + private View mInputView; + private OpenWnnJAJP mIme; + private int[] mLocation = new int[2]; + private static final int MSG_SHOW_BUBBLE = 0; + + private int mBubbleIndex; + private DefaultSoftKeyboardJAJP mInputManager; + private boolean mEnableKeyTouch = false; + + Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SHOW_BUBBLE: + Bubble bubba = (Bubble) msg.obj; + bubba.show(mLocation[0], mLocation[1]); + break; + } + } + }; + + class Bubble { + Drawable bubbleBackground; + int x; + int y; + int width; + int gravity; + CharSequence text; + boolean dismissOnTouch; + boolean dismissOnClose; + PopupWindow window; + TextView textView; + View inputView; + + Bubble(Context context, View inputView, + int backgroundResource, int bx, int by, int description, int guide) { + + CharSequence text = context.getResources().getText(description); + init(context, inputView, backgroundResource, bx, by, text, guide, false); + } + + Bubble(Context context, View inputView, int backgroundResource, int bx, int by, + CharSequence description, int guide, boolean leftAlign) { + init(context, inputView, backgroundResource, bx, by, description, guide, leftAlign); + } + + void init(Context context, View inputView, int backgroundResource, + int bx, int by, CharSequence description, int guide, boolean leftAlign) { + bubbleBackground = context.getResources().getDrawable(backgroundResource); + x = bx; + y = by; + width = (int) (inputView.getWidth() * 0.9); + this.gravity = Gravity.TOP | Gravity.LEFT; + text = new SpannableStringBuilder() + .append(description) + .append("\n") + .append(context.getResources().getText(guide)); + this.dismissOnTouch = true; + this.dismissOnClose = false; + this.inputView = inputView; + window = new PopupWindow(context); + window.setBackgroundDrawable(null); + LayoutInflater inflate = + (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + textView = (TextView) inflate.inflate(R.layout.bubble_text, null); + textView.setBackgroundDrawable(bubbleBackground); + textView.setText(text); + if (leftAlign) { + textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); + } + window.setContentView(textView); + window.setFocusable(false); + window.setTouchable(true); + window.setOutsideTouchable(false); + } + + private int chooseSize(PopupWindow pop, View parentView, CharSequence text, TextView tv) { + int wid = tv.getPaddingLeft() + tv.getPaddingRight(); + int ht = tv.getPaddingTop() + tv.getPaddingBottom(); + + /* + * Figure out how big the text would be if we laid it out to the + * full width of this view minus the border. + */ + int cap = width - wid; + + Layout l = new StaticLayout(text, tv.getPaint(), cap, + Layout.Alignment.ALIGN_NORMAL, 1, 0, true); + float max = 0; + for (int i = 0; i < l.getLineCount(); i++) { + max = Math.max(max, l.getLineWidth(i)); + } + + /* + * Now set the popup size to be big enough for the text plus the border. + */ + pop.setWidth(width); + pop.setHeight(ht + l.getHeight()); + return l.getHeight(); + } + + void show(int offx, int offy) { + int textHeight = chooseSize(window, inputView, text, textView); + offy -= textView.getPaddingTop() + textHeight; + if (inputView.getVisibility() == View.VISIBLE + && inputView.getWindowVisibility() == View.VISIBLE) { + try { + if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) offy -= window.getHeight(); + if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) offx -= window.getWidth(); + textView.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View view, MotionEvent me) { + + boolean ret = !mEnableKeyTouch; + switch (me.getAction()) { + case MotionEvent.ACTION_UP: + if (mBubbleIndex >= mBubbles.size()) { + mInputView.setOnTouchListener(null); + } else { + TutorialJAJP.this.next(); + } + break; + default: + break; + } + return ret; + } + }); + window.showAtLocation(inputView, Gravity.NO_GRAVITY, x + offx, y + offy); + } catch (Exception e) { + } + } + } + + void hide() { + if (window.isShowing()) { + textView.setOnTouchListener(null); + window.dismiss(); + } + } + + boolean isShowing() { + return window.isShowing(); + } + } + + /** Constructor */ + public TutorialJAJP(OpenWnnJAJP ime, View inputView, DefaultSoftKeyboardJAJP inputManager) { + mInputManager = inputManager; + mInputView = inputView; + mIme = ime; + + Context context = inputView.getContext(); + int inputWidth = inputView.getWidth(); + Resources r = inputView.getContext().getResources(); + final int x = inputWidth / 20; + r.getDimensionPixelOffset(R.dimen.bubble_pointer_offset); + + SpannableStringBuilder spannable = new SpannableStringBuilder(); + Bubble button; + + spannable.clear(); + spannable.append(r.getText(R.string.tip_to_step1)); + + setSpan(spannable, "\u25cb", R.drawable.tutorial_12key_key); + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + spannable.clear(); + spannable.append(r.getText(R.string.tip_to_step2_a)); + + setSpan(spannable, "\u25cb", R.drawable.tutorial_12key_toggle); + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, true); + mBubbles.add(button); + + spannable.append(r.getText(R.string.tip_to_step2_b)); + + setSpan(spannable, "\u2192", R.drawable.tutorial_12key_right); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, true); + mBubbles.add(button); + + spannable.append(r.getText(R.string.tip_to_step2_c)); + + setSpan(spannable, "\u25cb", R.drawable.tutorial_12key_toggle); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, true); + mBubbles.add(button); + + spannable.append(r.getText(R.string.tip_to_step2_d)); + + setSpan(spannable, "\u25a0", R.drawable.tutorial_12key_space_jp); + + setSpan(spannable, "\u2193", R.drawable.tutorial_12key_enter); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, true); + mBubbles.add(button); + + spannable.clear(); + spannable.append(r.getText(R.string.tip_to_step3_a)); + + setSpan(spannable, "\u25a0", R.drawable.tutorial_12key_mode); + button = new Bubble(context, inputView, + R.drawable.dialog_bubble_moji, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble_moji, x, 0, + R.string.tip_to_step3_b, R.string.touch_to_continue); + mBubbles.add(button); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble_moji, x, 0, + R.string.tip_to_step3_c, R.string.touch_to_continue); + mBubbles.add(button); + + spannable.clear(); + spannable.append(r.getText(R.string.tip_to_step4)); + + setSpan(spannable, "\u25a0", R.drawable.tutorial_12key_mode); + button = new Bubble(context, inputView, + R.drawable.dialog_bubble_moji, x, 0, + spannable, R.string.touch_to_try, false); + mBubbles.add(button); + + spannable.clear(); + spannable.append(r.getText(R.string.tip_to_step5)); + + setSpan(spannable, "\u2190", R.drawable.tutorial_back); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + R.string.tip_to_step6, R.string.touch_to_finish); + mBubbles.add(button); + } + + private void setSpan(SpannableStringBuilder spannable, String marker, int imageResourceId) { + String text = spannable.toString(); + int target = text.indexOf(marker); + while (0 <= target) { + ImageSpan span = new ImageSpan(mIme, imageResourceId, + DynamicDrawableSpan.ALIGN_BOTTOM); + spannable.setSpan(span, target, target + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + target = text.indexOf(marker, target + 1); + } + } + + public void start() { + mInputView.getLocationInWindow(mLocation); + mBubbleIndex = -1; + mInputView.setOnTouchListener(this); + next(); + } + + boolean next() { + if (mBubbleIndex >= 0) { + if (!mBubbles.get(mBubbleIndex).isShowing()) { + return true; + } + for (int i = 0; i <= mBubbleIndex; i++) { + mBubbles.get(i).hide(); + } + } + mBubbleIndex++; + if (mBubbleIndex >= mBubbles.size()) { + mEnableKeyTouch = true; + mIme.sendDownUpKeyEvents(-1); + mIme.tutorialDone(); + return false; + } + + if ((6 <= mBubbleIndex) && (mBubbleIndex <= 8)) { + mInputManager.nextKeyMode(); + } + + if (mBubbleIndex == LONG_PRESS_INDEX) { + mEnableKeyTouch = true; + } else if (LONG_PRESS_INDEX < mBubbleIndex) { + mEnableKeyTouch = false; + } + + mHandler.sendMessageDelayed( + mHandler.obtainMessage(MSG_SHOW_BUBBLE, mBubbles.get(mBubbleIndex)), 500); + return true; + } + + void hide() { + for (int i = 0; i < mBubbles.size(); i++) { + mBubbles.get(i).hide(); + } + mInputView.setOnTouchListener(null); + } + + public boolean close() { + mHandler.removeMessages(MSG_SHOW_BUBBLE); + hide(); + return true; + } + + public boolean onTouch(View v, MotionEvent event) { + boolean ret = !mEnableKeyTouch; + if (event.getAction() == MotionEvent.ACTION_UP) { + if (mBubbleIndex >= mBubbles.size()) { + mInputView.setOnTouchListener(null); + } else { + if (mBubbleIndex != LONG_PRESS_INDEX) { + next(); + } + } + } + return ret; + } +} diff --git a/src/jp/co/omronsoft/openwnn/JAJP/UserDictionaryToolsListJAJP.java b/src/jp/co/omronsoft/openwnn/JAJP/UserDictionaryToolsListJAJP.java index a9357fe..87d1e4d 100644 --- a/src/jp/co/omronsoft/openwnn/JAJP/UserDictionaryToolsListJAJP.java +++ b/src/jp/co/omronsoft/openwnn/JAJP/UserDictionaryToolsListJAJP.java @@ -19,6 +19,8 @@ package jp.co.omronsoft.openwnn.JAJP; import jp.co.omronsoft.openwnn.*; import android.view.View; import android.view.Window; +import java.util.Comparator; + /** * The user dictionary tool class for Japanese IME. * @@ -55,4 +57,15 @@ public class UserDictionaryToolsListJAJP extends UserDictionaryToolsList { return false; } + /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#getComparator */ + @Override protected Comparator<WnnWord> getComparator() { + return new ListComparatorJAJP(); + } + + /** Comparator class for sorting the list of Japanese user dictionary */ + protected class ListComparatorJAJP implements Comparator<WnnWord>{ + public int compare(WnnWord word1, WnnWord word2) { + return word1.stroke.compareTo(word2.stroke); + }; + } } diff --git a/src/jp/co/omronsoft/openwnn/OpenWnn.java b/src/jp/co/omronsoft/openwnn/OpenWnn.java index 41795f6..a68ef74 100644 --- a/src/jp/co/omronsoft/openwnn/OpenWnn.java +++ b/src/jp/co/omronsoft/openwnn/OpenWnn.java @@ -21,7 +21,6 @@ import android.view.WindowManager; import android.content.Context; import android.view.View; import android.view.KeyEvent; -import android.view.MotionEvent; import android.content.SharedPreferences; import android.preference.PreferenceManager; @@ -31,6 +30,7 @@ import android.view.inputmethod.*; import android.content.res.Configuration; import android.graphics.*; import android.graphics.drawable.*; +import android.view.MotionEvent; /** * The OpenWnn IME's base class. @@ -113,7 +113,7 @@ public class OpenWnn extends InputMethodService { @Override public void onDestroy() { super.onDestroy(); - if (mConverter != null) { mConverter.close(); } + close(); } /** @see android.inputmethodservice.InputMethodService#onKeyDown */ @@ -190,6 +190,11 @@ public class OpenWnn extends InputMethodService { mDirectInputMode = true; hideStatusIcon(); } + /** @see android.inputmethodservice.InputMethodService#onComputeInsets */ + @Override public void onComputeInsets(InputMethodService.Insets outInsets) { + super.onComputeInsets(outInsets); + outInsets.contentTopInsets = outInsets.visibleTopInsets; + } /********************************************************************** @@ -235,4 +240,11 @@ public class OpenWnn extends InputMethodService { } return null; } + + /** + * Processing of resource open when IME ends. + */ + protected void close() { + if (mConverter != null) { mConverter.close(); } + } } diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java b/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java index 6c8a464..e5b7fe0 100644 --- a/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java +++ b/src/jp/co/omronsoft/openwnn/OpenWnnDictionaryImpl.java @@ -998,7 +998,6 @@ public class OpenWnnDictionaryImpl implements WnnDictionary { if( mDbDic != null ) { StringBuilder previousStrokeSQL = new StringBuilder(); StringBuilder previousCandidateSQL = new StringBuilder(); - boolean isConnectLearn = false; if( previousWord != null && previousWord.stroke.length() > 0 && previousWord.stroke.length() <= MAX_STROKE_LENGTH && @@ -1006,7 +1005,6 @@ public class OpenWnnDictionaryImpl implements WnnDictionary { DatabaseUtils.appendEscapedSQLString( previousStrokeSQL, previousWord.stroke ); DatabaseUtils.appendEscapedSQLString( previousCandidateSQL, previousWord.candidate ); /* If the information of previous word is set, perform the link learning */ - isConnectLearn = true; } if( word.stroke.length() > 0 && word.stroke.length() <= MAX_STROKE_LENGTH && @@ -1018,86 +1016,6 @@ public class OpenWnnDictionaryImpl implements WnnDictionary { SQLiteCursor cursor; - /* If the words which have same stroke and same candidate is already learned, move to the tail */ - cursor = ( SQLiteCursor )mDbDic.query( - TABLE_NAME_DIC, - new String[] { COLUMN_NAME_ID, - COLUMN_NAME_STROKE, - COLUMN_NAME_CANDIDATE, - COLUMN_NAME_POS_LEFT, - COLUMN_NAME_POS_RIGHT, - COLUMN_NAME_PREVIOUS_STROKE, - COLUMN_NAME_PREVIOUS_CANDIDATE, - COLUMN_NAME_PREVIOUS_POS_LEFT, - COLUMN_NAME_PREVIOUS_POS_RIGHT }, - String.format( "%s=%d and %s=%s and %s=%s", - COLUMN_NAME_TYPE, TYPE_NAME_LEARN, - COLUMN_NAME_STROKE, strokeSQL.toString(), - COLUMN_NAME_CANDIDATE, candidateSQL.toString() ), - null, null, null, - String.format( "%s ASC", COLUMN_NAME_ID ) ); - - if( cursor.getCount() > 0 ) { - /* The results are arranged ascending by the ID. In other words, The results are arranged in an old turn. */ - cursor.moveToFirst( ); - - ContentValues content = new ContentValues(); - int[] idArray = new int[ cursor.getCount() ]; - int idIndex = 0; - - boolean isExistConnectLearnData = false; - - mDbDic.beginTransaction(); - try { - do { - /* Record the ID that is removed later */ - idArray[ idIndex++ ] = cursor.getInt( 0 ); - - /* Add the word to tail */ - content.clear(); - content.put( COLUMN_NAME_TYPE, TYPE_NAME_LEARN ); - content.put( COLUMN_NAME_STROKE, cursor.getString( 1 ) ); - content.put( COLUMN_NAME_CANDIDATE, cursor.getString( 2 ) ); - content.put( COLUMN_NAME_POS_LEFT, cursor.getInt( 3 ) ); - content.put( COLUMN_NAME_POS_RIGHT, cursor.getInt( 4 ) ); - content.put( COLUMN_NAME_PREVIOUS_STROKE, cursor.getString( 5 ) ); - content.put( COLUMN_NAME_PREVIOUS_CANDIDATE, cursor.getString( 6 ) ); - content.put( COLUMN_NAME_PREVIOUS_POS_LEFT, cursor.getInt( 7 ) ); - content.put( COLUMN_NAME_PREVIOUS_POS_RIGHT, cursor.getInt( 8 ) ); - mDbDic.insert( TABLE_NAME_DIC, null, content ); - - /* If the word that contain same link information exist, need NOT to add link information. */ - if( isConnectLearn && - previousWord.stroke.equals( cursor.getString( 5 ) ) && - previousWord.candidate.equals( cursor.getString( 6 ) ) ) { - isExistConnectLearnData = true; - } - } while( cursor.moveToNext( ) ); - - /* Delete the recorded words */ - while( --idIndex >= 0 ) { - mDbDic.delete( TABLE_NAME_DIC, - String.format( "%s=%d", COLUMN_NAME_ID, idArray[ idIndex ] ), - null ); - } - - mDbDic.setTransactionSuccessful(); - - /* If the link information is not specified or the word that contain same link information exist, */ - /* need NOT to add link information. Otherwise, go to next section for adding link information. */ - if( !isConnectLearn || isExistConnectLearnData ) { - return 0; - } - } catch( SQLException e ) { - return -1; - } finally { - mDbDic.endTransaction(); - cursor.close(); - } - } else { - cursor.close(); - } - /* Count the number of registered words and retrieve that words ascending by the ID */ cursor = ( SQLiteCursor )mDbDic.query( TABLE_NAME_DIC, diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnEN.java b/src/jp/co/omronsoft/openwnn/OpenWnnEN.java index ab0754d..9801849 100644 --- a/src/jp/co/omronsoft/openwnn/OpenWnnEN.java +++ b/src/jp/co/omronsoft/openwnn/OpenWnnEN.java @@ -20,8 +20,7 @@ import jp.co.omronsoft.openwnn.EN.*; import android.content.SharedPreferences; import android.content.Context; import android.content.res.Configuration; -import android.inputmethodservice.InputMethodService; -import android.os.Bundle; +import android.os.Message; import android.os.Handler; import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; @@ -29,10 +28,12 @@ import android.text.Spanned; import android.text.method.MetaKeyKeyListener; import android.text.style.BackgroundColorSpan; import android.text.style.CharacterStyle; +import android.text.style.ForegroundColorSpan; import android.text.style.UnderlineSpan; import android.util.Log; import android.view.KeyCharacterMap; import android.view.KeyEvent; +import android.view.MotionEvent; import android.view.View; import android.view.inputmethod.EditorInfo; @@ -51,20 +52,17 @@ public class OpenWnnEN extends OpenWnn { private static final CharacterStyle SPAN_EXACT_BGCOLOR_HL = new BackgroundColorSpan(0xFF66CDAA); /** Highlight color style for the composing text */ private static final CharacterStyle SPAN_REMAIN_BGCOLOR_HL = new BackgroundColorSpan(0xFFF0FFFF); + /** Highlight text color */ + private static final CharacterStyle SPAN_TEXTCOLOR = new ForegroundColorSpan(0xFF000000); /** A private area code(ALT+SHIFT+X) to be ignore (G1 specific). */ private static final int PRIVATE_AREA_CODE = 61184; /** Never move cursor in to the composing text (adapting to IMF's specification change) */ private static final boolean FIX_CURSOR_TEXT_END = true; - /** Whether using Emoji or not */ - private static final boolean ENABLE_EMOJI_LIMITATION = true; - /** Spannable string for the composing text */ protected SpannableStringBuilder mDisplayText; - /** Handler for drawing the candidates view */ - private Handler mDelayUpdateHandler; /** Characters treated as a separator */ private String mWordSeparators; /** Previous event's code */ @@ -100,12 +98,63 @@ public class OpenWnnEN extends OpenWnn { /** Shift lock toggle definition */ private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED}; - /** Alt lock toggle definition */ + /** ALT lock toggle definition */ private static final int[] mAltKeyToggle = {0, MetaKeyKeyListener.META_ALT_ON, MetaKeyKeyListener.META_ALT_LOCKED}; /** Auto caps mode */ private boolean mAutoCaps = false; - private CandidateFilter mFilter; + /** Whether dismissing the keyboard when the enter key is pressed */ + private boolean mEnableAutoHideKeyboard = true; + + /** Tutorial */ + private TutorialEN mTutorial; + + /** Whether tutorial mode or not */ + private boolean mEnableTutorial; + + /** Message for {@code mHandler} (execute prediction) */ + private static final int MSG_PREDICTION = 0; + + /** Message for {@code mHandler} (execute tutorial) */ + private static final int MSG_START_TUTORIAL = 1; + + /** Message for {@code mHandler} (close) */ + private static final int MSG_CLOSE = 2; + + /** Delay time(msec.) to start prediction after key input when the candidates view is not shown. */ + private static final int PREDICTION_DELAY_MS_1ST = 200; + + /** Delay time(msec.) to start prediction after key input when the candidates view is shown. */ + private static final int PREDICTION_DELAY_MS_SHOWING_CANDIDATE = 200; + + /** {@code Handler} for drawing candidates/displaying tutorial */ + Handler mHandler = new Handler() { + @Override public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_PREDICTION: + updatePrediction(); + break; + case MSG_START_TUTORIAL: + if (mTutorial == null) { + if (isInputViewShown()) { + DefaultSoftKeyboardEN inputManager = ((DefaultSoftKeyboardEN) mInputViewManager); + View v = inputManager.getKeyboardView(); + mTutorial = new TutorialEN(OpenWnnEN.this, v, inputManager); + + mTutorial.start(); + } else { + /* Try again soon if the view is not yet showing */ + sendMessageDelayed(obtainMessage(MSG_START_TUTORIAL), 100); + } + } + break; + case MSG_CLOSE: + if (mConverterEN != null) mConverterEN.close(); + if (mSymbolList != null) mSymbolList.close(); + break; + } + } + }; /** * Constructor @@ -120,13 +169,11 @@ public class OpenWnnEN extends OpenWnn { mInputViewManager = new DefaultSoftKeyboardEN(); mConverterEN = new OpenWnnEngineEN("/data/data/jp.co.omronsoft.openwnn/writableEN.dic"); mConverter = mConverterEN; - mFilter = new CandidateFilter(); mSymbolList = null; /* etc */ mDisplayText = new SpannableStringBuilder(); mAutoHideMode = false; - mDelayUpdateHandler = new Handler(); mSymbolMode = false; mOptPrediction = true; mOptSpellCorrection = true; @@ -212,7 +259,7 @@ public class OpenWnnEN extends OpenWnn { */ private void setSymbolMode(String mode) { if (mode != null) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); mSymbolMode = true; mSymbolList.setDictionary(mode); mConverter = mSymbolList; @@ -220,7 +267,7 @@ public class OpenWnnEN extends OpenWnn { if (!mSymbolMode) { return; } - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); mSymbolMode = false; mConverter = mConverterEN; } @@ -244,8 +291,7 @@ public class OpenWnnEN extends OpenWnn { int hiddenState = getResources().getConfiguration().hardKeyboardHidden; boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES); ((DefaultSoftKeyboardEN) mInputViewManager).setHardKeyboardHidden(hidden); - ((TextCandidatesViewManager) - mCandidatesViewManager).setHardKeyboardHidden(hidden); + mEnableTutorial = hidden; return super.onCreateInputView(); } @@ -274,76 +320,42 @@ public class OpenWnnEN extends OpenWnn { /* display status icon */ showStatusIcon(R.drawable.immodeic_half_alphabet); - /* set prediction & spell correction mode */ - mOptPrediction = pref.getBoolean("opt_en_prediction", true); - mOptSpellCorrection = pref.getBoolean("opt_en_spell_correction", true); - mOptLearning = pref.getBoolean("opt_en_enable_learning", true); - - /* prediction on/off */ - switch (attribute.inputType & EditorInfo.TYPE_MASK_CLASS) { - case EditorInfo.TYPE_CLASS_NUMBER: - case EditorInfo.TYPE_CLASS_DATETIME: - case EditorInfo.TYPE_CLASS_PHONE: - mOptPrediction = false; - mOptLearning = false; - break; - - case EditorInfo.TYPE_CLASS_TEXT: - switch (attribute.inputType & EditorInfo.TYPE_MASK_VARIATION) { - case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD: - case EditorInfo.TYPE_TEXT_VARIATION_PHONETIC: - mOptLearning = false; - mOptPrediction = false; - break; - default: - break; - } - } - - /* set engine's mode */ - if (mOptSpellCorrection) { - mConverterEN.setDictionary(OpenWnnEngineEN.DICT_FOR_CORRECT_MISTYPE); - } else { - mConverterEN.setDictionary(OpenWnnEngineEN.DICT_DEFAULT); - } - /* emoji */ - if (ENABLE_EMOJI_LIMITATION) { - Bundle bundle = attribute.extras; - if (bundle != null && bundle.getBoolean("allowEmoji")) { - mConverterEN.setFilter(null); - } else { - mFilter.setFilter(CandidateFilter.FILTER_EMOJI); - mConverterEN.setFilter(mFilter); - } - } else { - mConverterEN.setFilter(null); - } - - /* doesn't learn any word if it is not prediction mode */ - if (!mOptPrediction) { - mOptLearning = false; - } - if (mComposingText != null) { mComposingText.clear(); } /* initialize the engine's state */ fitInputType(pref, attribute); + + ((DefaultSoftKeyboard) mInputViewManager).resetCurrentKeyboard(); } - /** @see jp.co.omronsoft.openwnn.OpenWnn#onComputeInsets */ - @Override public void onComputeInsets(InputMethodService.Insets outInsets) { - /* use default value. means; - * outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_VISIBLE; - */ + /** @see jp.co.omronsoft.openwnn.OpenWnn#hideWindow */ + @Override public void hideWindow() { + mComposingText.clear(); + mInputViewManager.onUpdateState(this); + mHandler.removeMessages(MSG_START_TUTORIAL); + mInputViewManager.closing(); + if (mTutorial != null) { + mTutorial.close(); + mTutorial = null; + } + + super.hideWindow(); } /** @see jp.co.omronsoft.openwnn.OpenWnn#onUpdateSelection */ @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) { - if (mComposingText.size(1) != 0) { + + boolean isNotComposing = ((candidatesStart < 0) && (candidatesEnd < 0)); + if (isNotComposing) { + mComposingText.clear(); updateComposingText(1); + } else { + if (mComposingText.size(1) != 0) { + updateComposingText(1); + } } } @@ -354,6 +366,10 @@ public class OpenWnnEN extends OpenWnn { if (mInputConnection != null) { updateComposingText(1); } + /* Hardware keyboard */ + int hiddenState = newConfig.hardKeyboardHidden; + boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES); + mEnableTutorial = hidden; } catch (Exception ex) { } } @@ -415,6 +431,10 @@ public class OpenWnnEN extends OpenWnn { case OpenWnnEvent.CHANGE_MODE: return false; + case OpenWnnEvent.UPDATE_CANDIDATE: + updateComposingText(ComposingText.LAYER1); + return true; + case OpenWnnEvent.CHANGE_INPUT_VIEW: setInputView(onCreateInputView()); return true; @@ -446,6 +466,9 @@ public class OpenWnnEN extends OpenWnn { if (ev.code == OpenWnnEvent.LIST_CANDIDATES_FULL) { mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_FULL); return true; + } else if (ev.code == OpenWnnEvent.LIST_CANDIDATES_NORMAL) { + mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); + return true; } boolean ret = false; @@ -531,7 +554,7 @@ public class OpenWnnEN extends OpenWnn { } if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) { - mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); + mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); } return ret; @@ -680,34 +703,72 @@ public class OpenWnnEN extends OpenWnn { case KeyEvent.KEYCODE_DPAD_CENTER: commitText(1); mComposingText.clear(); + if (mEnableAutoHideKeyboard) { + mInputViewManager.closing(); + requestHideSelf(0); + } return true; default: break; } + } else { + /* if there is no composing string. */ + if (mCandidatesViewManager.getCurrentView().isShown()) { + if (key == KeyEvent.KEYCODE_BACK) { + if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) { + mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); + } else { + mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_CLOSE); + } + return true; + } + } else { + switch (key) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + if (mEnableAutoHideKeyboard) { + mInputViewManager.closing(); + requestHideSelf(0); + return true; + } + break; + case KeyEvent.KEYCODE_BACK: + /* + * If 'BACK' key is pressed when the SW-keyboard is shown + * and the candidates view is not shown, dismiss the SW-keyboard. + */ + if (isInputViewShown()) { + mInputViewManager.closing(); + requestHideSelf(0); + return true; + } + break; + default: + break; + } + } } return false; } /** - * Runnable for a thread getting and displaying candidates. + * Thread for updating the candidates view */ - private final Runnable updatePredictionRunnable = new Runnable() { - public void run() { - int candidates = 0; - if (mConverter != null) { - /* normal prediction */ - candidates = mConverter.predict(mComposingText, 0, -1); - } - /* update the candidates view */ - if (candidates > 0) { - mCandidatesViewManager.displayCandidates(mConverter); - } else { - mCandidatesViewManager.clearCandidates(); - } + private void updatePrediction() { + int candidates = 0; + if (mConverter != null) { + /* normal prediction */ + candidates = mConverter.predict(mComposingText, 0, -1); } - }; + /* update the candidates view */ + if (candidates > 0) { + mCandidatesViewManager.displayCandidates(mConverter); + } else { + mCandidatesViewManager.clearCandidates(); + } + } /** * Update the composing text. @@ -720,25 +781,27 @@ public class OpenWnnEN extends OpenWnn { commitText(1); mComposingText.clear(); if (mSymbolMode) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 0); + mHandler.removeMessages(MSG_PREDICTION); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), 0); } } else { if (mComposingText.size(1) != 0) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 250); + mHandler.removeMessages(MSG_PREDICTION); + if (mCandidatesViewManager.getCurrentView().isShown()) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), + PREDICTION_DELAY_MS_SHOWING_CANDIDATE); + } else { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), + PREDICTION_DELAY_MS_1ST); + } } else { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 0); + mHandler.removeMessages(MSG_PREDICTION); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), 0); } /* notice to the input view */ this.mInputViewManager.onUpdateState(this); - /* set the candidates view to the normal size */ - if (mCandidatesViewManager.getViewType() != CandidatesViewManager.VIEW_TYPE_NORMAL) { - mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); - } /* set the text for displaying as the composing text */ SpannableStringBuilder disp = mDisplayText; disp.clear(); @@ -754,6 +817,8 @@ public class OpenWnnEN extends OpenWnn { if (cursor < disp.length()) { mDisplayText.setSpan(SPAN_REMAIN_BGCOLOR_HL, cursor, disp.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + mDisplayText.setSpan(SPAN_TEXTCOLOR, 0, disp.length(), + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } disp.setSpan(SPAN_UNDERLINE, 0, disp.length(), @@ -892,5 +957,94 @@ public class OpenWnnEN extends OpenWnn { mDirectInputMode = true; return; } + + mEnableAutoHideKeyboard = false; + + /* set prediction & spell correction mode */ + mOptPrediction = preference.getBoolean("opt_en_prediction", true); + mOptSpellCorrection = preference.getBoolean("opt_en_spell_correction", true); + mOptLearning = preference.getBoolean("opt_en_enable_learning", true); + + /* prediction on/off */ + switch (info.inputType & EditorInfo.TYPE_MASK_CLASS) { + case EditorInfo.TYPE_CLASS_NUMBER: + case EditorInfo.TYPE_CLASS_DATETIME: + case EditorInfo.TYPE_CLASS_PHONE: + mOptPrediction = false; + mOptLearning = false; + break; + + case EditorInfo.TYPE_CLASS_TEXT: + switch (info.inputType & EditorInfo.TYPE_MASK_VARIATION) { + case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD: + mEnableAutoHideKeyboard = true; + mOptLearning = false; + mOptPrediction = false; + break; + + case EditorInfo.TYPE_TEXT_VARIATION_PHONETIC: + mOptLearning = false; + mOptPrediction = false; + break; + default: + break; + } + } + + /* doesn't learn any word if it is not prediction mode */ + if (!mOptPrediction) { + mOptLearning = false; + } + + /* set engine's mode */ + if (mOptSpellCorrection) { + mConverterEN.setDictionary(OpenWnnEngineEN.DICT_FOR_CORRECT_MISTYPE); + } else { + mConverterEN.setDictionary(OpenWnnEngineEN.DICT_DEFAULT); + } + checkTutorial(info.privateImeOptions); + } + + /** + * Check and start the tutorial if it is the tutorial mode. + * + * @param privateImeOptions IME's options + */ + private void checkTutorial(String privateImeOptions) { + if (privateImeOptions == null) return; + if (privateImeOptions.equals("com.android.setupwizard:ShowTutorial")) { + if ((mTutorial == null) && mEnableTutorial) startTutorial(); + } else if (privateImeOptions.equals("com.android.setupwizard:HideTutorial")) { + if (mTutorial != null) { + if (mTutorial.close()) { + mTutorial = null; + } + } + } + } + + /** + * Start the tutorial + */ + private void startTutorial() { + DefaultSoftKeyboardEN inputManager = ((DefaultSoftKeyboardEN) mInputViewManager); + View v = inputManager.getKeyboardView(); + v.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + return true; + }}); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_START_TUTORIAL), 500); + } + + /** + * Close the tutorial + */ + public void tutorialDone() { + mTutorial = null; + } + + /** @see OpenWnn#close */ + @Override protected void close() { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLOSE), 0); } } diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnEvent.java b/src/jp/co/omronsoft/openwnn/OpenWnnEvent.java index 18b0041..06260e1 100644 --- a/src/jp/co/omronsoft/openwnn/OpenWnnEvent.java +++ b/src/jp/co/omronsoft/openwnn/OpenWnnEvent.java @@ -219,6 +219,11 @@ public class OpenWnnEvent { */ public static final int KEYUP = 0xF000001F; + /** + * Touch the other key. + */ + public static final int TOUCH_OTHER_KEY = 0xF0000020; + /** Event code */ public int code = UNDEFINED; /** Detail mode of the event */ diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java b/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java index 6db1817..91fff14 100644 --- a/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java +++ b/src/jp/co/omronsoft/openwnn/OpenWnnJAJP.java @@ -18,27 +18,23 @@ package jp.co.omronsoft.openwnn; import jp.co.omronsoft.openwnn.EN.OpenWnnEngineEN; -import jp.co.omronsoft.openwnn.JAJP.DefaultSoftKeyboardJAJP; -import jp.co.omronsoft.openwnn.JAJP.OpenWnnEngineJAJP; -import jp.co.omronsoft.openwnn.JAJP.Romkan; -import jp.co.omronsoft.openwnn.JAJP.RomkanFullKatakana; -import jp.co.omronsoft.openwnn.JAJP.RomkanHalfKatakana; -import jp.co.omronsoft.openwnn.StrSegmentClause; +import jp.co.omronsoft.openwnn.JAJP.*; import android.content.SharedPreferences; import android.content.Context; import android.content.res.Configuration; -import android.inputmethodservice.InputMethodService; import android.os.Handler; -import android.os.Bundle; +import android.os.Message; import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.BackgroundColorSpan; import android.text.style.CharacterStyle; +import android.text.style.ForegroundColorSpan; import android.text.style.UnderlineSpan; import android.util.Log; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; +import android.view.MotionEvent; import android.view.View; import android.view.KeyCharacterMap; import android.text.method.MetaKeyKeyListener; @@ -91,9 +87,6 @@ public class OpenWnnJAJP extends OpenWnn { /** Never move cursor in to the composing text (adapting to IMF's specification change) */ private static final boolean FIX_CURSOR_TEXT_END = true; - /** Whether using Emoji or not */ - private static final boolean ENABLE_EMOJI_LIMITATION = true; - /** Highlight color style for the converted clause */ private static final CharacterStyle SPAN_CONVERT_BGCOLOR_HL = new BackgroundColorSpan(0xFF8888FF); /** Highlight color style for the selected string */ @@ -102,6 +95,8 @@ public class OpenWnnJAJP extends OpenWnn { private static final CharacterStyle SPAN_EISUKANA_BGCOLOR_HL = new BackgroundColorSpan(0xFF9FB6CD); /** Highlight color style for the composing text */ private static final CharacterStyle SPAN_REMAIN_BGCOLOR_HL = new BackgroundColorSpan(0xFFF0FFFF); + /** Highlight text color */ + private static final CharacterStyle SPAN_TEXTCOLOR = new ForegroundColorSpan(0xFF000000); /** Underline style for the composing text */ private static final CharacterStyle SPAN_UNDERLINE = new UnderlineSpan(); @@ -114,8 +109,8 @@ public class OpenWnnJAJP extends OpenWnn { /** IME's status for {@code mStatus}(all candidates are displayed). */ private static final int STATUS_CANDIDATE_FULL = 0x0010; - /** Alphabet pattern */ - private static final Pattern ENGLISH_CHARACTER = Pattern.compile(".*[a-zA-Z]$"); + /** Alphabet-last pattern */ + private static final Pattern ENGLISH_CHARACTER_LAST = Pattern.compile(".*[a-zA-Z]$"); /** * Private area character code got by {@link KeyEvent#getUnicodeChar()}. @@ -133,6 +128,21 @@ public class OpenWnnJAJP extends OpenWnn { /** Bit flag for English auto commit mode (symbol list) */ private static final int AUTO_COMMIT_ENGLISH_SYMBOL = 0x0010; + /** Message for {@code mHandler} (execute prediction) */ + private static final int MSG_PREDICTION = 0; + + /** Message for {@code mHandler} (execute tutorial) */ + private static final int MSG_START_TUTORIAL = 1; + + /** Message for {@code mHandler} (close) */ + private static final int MSG_CLOSE = 2; + + /** Delay time(msec.) to start prediction after key input when the candidates view is not shown. */ + private static final int PREDICTION_DELAY_MS_1ST = 200; + + /** Delay time(msec.) to start prediction after key input when the candidates view is shown. */ + private static final int PREDICTION_DELAY_MS_SHOWING_CANDIDATE = 200; + /** Convert engine's state */ private class EngineState { @@ -257,9 +267,6 @@ public class OpenWnnJAJP extends OpenWnn { /** Instance of this service */ private static OpenWnnJAJP mSelf = null; - /** Handler for drawing the candidates view */ - private Handler mDelayUpdateHandler; - /** Backup for switching the converter */ private WnnEngine mConverterBack; @@ -277,7 +284,7 @@ public class OpenWnnJAJP extends OpenWnn { /** Symbol lists to display when the symbol key is pressed */ private static final String[] SYMBOL_LISTS = { - SymbolList.SYMBOL_JAPANESE_EMOJI, SymbolList.SYMBOL_JAPANESE, SymbolList.SYMBOL_ENGLISH, SymbolList.SYMBOL_JAPANESE_FACE + SymbolList.SYMBOL_JAPANESE_FACE, SymbolList.SYMBOL_JAPANESE, SymbolList.SYMBOL_ENGLISH }; /** Current symbol list */ @@ -307,8 +314,8 @@ public class OpenWnnJAJP extends OpenWnn { /** Whether displaying the symbol list */ private boolean mEnableSymbolList = true; - /** Whether being able to use Emoji */ - private boolean mEnableEmoji = false; + /** Whether non ASCII code is enabled */ + private boolean mEnableSymbolListNonHalf = true; /** Enable mistyping spell correction or not */ private boolean mEnableSpellCorrection = true; @@ -319,14 +326,17 @@ public class OpenWnnJAJP extends OpenWnn { /** Whether removing a space before a separator or not. (in English mode) */ private boolean mEnableAutoDeleteSpace = false; - /** Whether appending a space to a selected word or not (in English mode) */ + /** Whether auto-spacing is enabled or not. */ private boolean mEnableAutoInsertSpace = true; + /** Whether dismissing the keyboard when the enter key is pressed */ + private boolean mEnableAutoHideKeyboard = true; + /** Number of committed clauses on consecutive clause conversion */ private int mCommitCount = 0; /** Target layer of the {@link ComposingText} */ - private int mTargetLayer = 0; + private int mTargetLayer = 1; /** Current orientation of the display */ private int mOrientation = Configuration.ORIENTATION_UNDEFINED; @@ -337,11 +347,8 @@ public class OpenWnnJAJP extends OpenWnn { /** Regular expression pattern for English separators */ private Pattern mEnglishAutoCommitDelimiter = null; - /** Lenght of committed text */ - private int mCommitLength = 0; - - /** Last cursor position */ - private int mLastSelectionEnd = 0; + /** Cursor position in the composing text */ + private int mComposingStartCursor = 0; /** Cursor position before committing text */ private int mCommitStartCursor = 0; @@ -349,8 +356,8 @@ public class OpenWnnJAJP extends OpenWnn { /** Previous committed text */ private StringBuffer mPrevCommitText = null; - /** List of words in the user dictionary */ - private WnnWord[] mUserDictionaryWords = null; + /** Call count of {@code commitText} */ + private int mPrevCommitCount = 0; /** Shift lock status of the Hardware keyboard */ private int mHardShift; @@ -358,7 +365,7 @@ public class OpenWnnJAJP extends OpenWnn { /** SHIFT key state (pressing) */ private boolean mShiftPressing; - /** Alt lock status of the Hardware keyboard */ + /** ALT lock status of the Hardware keyboard */ private int mHardAlt; /** ALT key state (pressing) */ @@ -367,12 +374,55 @@ public class OpenWnnJAJP extends OpenWnn { /** Shift lock toggle definition */ private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED}; - /** Alt lock toggle definition */ + /** ALT lock toggle definition */ private static final int[] mAltKeyToggle = {0, MetaKeyKeyListener.META_ALT_ON, MetaKeyKeyListener.META_ALT_LOCKED}; /** Auto caps mode */ private boolean mAutoCaps = false; + + /** List of words in the user dictionary */ + private WnnWord[] mUserDictionaryWords = null; + /** Tutorial */ + private TutorialJAJP mTutorial; + + /** Whether tutorial mode or not */ + private boolean mEnableTutorial; + + /** Whether there is a continued predicted candidate */ + private boolean mHasContinuedPrediction = false; + + /** {@code Handler} for drawing candidates/displaying tutorial */ + Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_PREDICTION: + updatePrediction(); + break; + case MSG_START_TUTORIAL: + if (mTutorial == null) { + if (isInputViewShown()) { + DefaultSoftKeyboardJAJP inputManager = ((DefaultSoftKeyboardJAJP) mInputViewManager); + View v = inputManager.getKeyboardView(); + mTutorial = new TutorialJAJP(OpenWnnJAJP.this, v, inputManager); + + mTutorial.start(); + } else { + /* Try again soon if the view is not yet showing */ + sendMessageDelayed(obtainMessage(MSG_START_TUTORIAL), 100); + } + } + break; + case MSG_CLOSE: + if (mConverterJAJP != null) mConverterJAJP.close(); + if (mConverterEN != null) mConverterEN.close(); + if (mConverterSymbolEngineBack != null) mConverterSymbolEngineBack.close(); + break; + } + } + }; + /** The candidate filter */ private CandidateFilter mFilter; @@ -395,7 +445,6 @@ public class OpenWnnJAJP extends OpenWnn { mDisplayText = new SpannableStringBuilder(); mAutoHideMode = false; - mDelayUpdateHandler = new Handler(); mPrevCommitText = new StringBuffer(); } @@ -425,9 +474,7 @@ public class OpenWnnJAJP extends OpenWnn { int hiddenState = getResources().getConfiguration().hardKeyboardHidden; boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES); ((DefaultSoftKeyboardJAJP) mInputViewManager).setHardKeyboardHidden(hidden); - ((TextCandidatesViewManager) - mCandidatesViewManager).setHardKeyboardHidden(hidden); - + mEnableTutorial = hidden; return super.onCreateInputView(); } @@ -438,16 +485,13 @@ public class OpenWnnJAJP extends OpenWnn { state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; updateEngineState(state); + mPrevCommitCount = 0; clearCommitInfo(); - if (mDirectInputMode) { - DefaultSoftKeyboardJAJP inputManager = ((DefaultSoftKeyboardJAJP)mInputViewManager); - inputManager.setDefaultKeyboard(); - } + ((DefaultSoftKeyboard) mInputViewManager).resetCurrentKeyboard(); super.onStartInputView(attribute, restarting); - mEnableAutoDeleteSpace = false; /* initialize views */ mCandidatesViewManager.clearCandidates(); /* initialize status */ @@ -467,8 +511,7 @@ public class OpenWnnJAJP extends OpenWnn { ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(true); if (isEnableL2Converter()) { - mEnableAutoDeleteSpace = false; - mConverter.breakSequence(); + breakSequence(); } } @@ -477,37 +520,55 @@ public class OpenWnnJAJP extends OpenWnn { mComposingText.clear(); mInputViewManager.onUpdateState(this); clearCommitInfo(); + mHandler.removeMessages(MSG_START_TUTORIAL); mInputViewManager.closing(); - super.hideWindow(); - } + if (mTutorial != null) { + mTutorial.close(); + mTutorial = null; + } - /** @see jp.co.omronsoft.openwnn.OpenWnn#onComputeInsets */ - @Override public void onComputeInsets(InputMethodService.Insets outInsets) { - /* use default value. means; - * outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_VISIBLE; - */ + super.hideWindow(); } /** @see jp.co.omronsoft.openwnn.OpenWnn#onUpdateSelection */ @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) { - mLastSelectionEnd = newSelEnd; + mComposingStartCursor = (candidatesStart < 0) ? newSelEnd : candidatesStart; + + if (newSelStart != newSelEnd) { + clearCommitInfo(); + } + + if (mHasContinuedPrediction) { + mHasContinuedPrediction = false; + if (0 < mPrevCommitCount) { + mPrevCommitCount--; + } + return; + } - if (mComposingText.size(ComposingText.LAYER1) != 0) { + boolean isNotComposing = ((candidatesStart < 0) && (candidatesEnd < 0)); + if ((mComposingText.size(ComposingText.LAYER1) != 0) + && !isNotComposing) { updateViewStatus(mTargetLayer, false, true); } else { - int commitEnd = mCommitStartCursor + mCommitLength; - if ((mCommitLength != 0) - && (commitEnd != newSelEnd) - && ((newSelEnd < oldSelEnd) || (commitEnd < newSelEnd))) { - - if (isEnableL2Converter()) { - mEnableAutoDeleteSpace = false; - mConverter.breakSequence(); - } + if (0 < mPrevCommitCount) { + mPrevCommitCount--; + } else { + int commitEnd = mCommitStartCursor + mPrevCommitText.length(); + if ((((newSelEnd < oldSelEnd) || (commitEnd < newSelEnd)) && clearCommitInfo()) + || isNotComposing) { + if (isEnableL2Converter()) { + breakSequence(); + } - clearCommitInfo(); - initializeScreen(); + if (mInputConnection != null) { + if (isNotComposing && (mComposingText.size(ComposingText.LAYER1) != 0)) { + mInputConnection.finishComposingText(); + } + } + initializeScreen(); + } } } } @@ -533,8 +594,7 @@ public class OpenWnnJAJP extends OpenWnn { int hiddenState = newConfig.hardKeyboardHidden; boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES); ((DefaultSoftKeyboardJAJP) mInputViewManager).setHardKeyboardHidden(hidden); - ((TextCandidatesViewManager) - mCandidatesViewManager).setHardKeyboardHidden(hidden); + mEnableTutorial = hidden; } } catch (Exception ex) { /* do nothing if an error occurs. */ @@ -592,12 +652,6 @@ public class OpenWnnJAJP extends OpenWnn { if (!(ev.mode == ENGINE_MODE_SYMBOL || ev.mode == ENGINE_MODE_EISU_KANA)) { initializeScreen(); } - - if (ev.mode != ENGINE_MODE_SYMBOL) { - state = new EngineState(); - state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; - updateEngineState(state); - } return true; case OpenWnnEvent.UPDATE_CANDIDATE: @@ -620,6 +674,10 @@ public class OpenWnnJAJP extends OpenWnn { ret = ((TextCandidatesViewManager)mCandidatesViewManager).onTouchSync(); return ret; + case OpenWnnEvent.TOUCH_OTHER_KEY: + mStatus |= STATUS_INPUT_EDIT; + return true; + default: break; } @@ -661,6 +719,7 @@ public class OpenWnnJAJP extends OpenWnn { ||(keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) ||(keyCode == KeyEvent.KEYCODE_ALT_LEFT) ||(keyCode == KeyEvent.KEYCODE_ALT_RIGHT) + ||(keyCode == KeyEvent.KEYCODE_BACK && mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) ||(keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) { state = new EngineState(); @@ -739,6 +798,15 @@ public class OpenWnnJAJP extends OpenWnn { case OpenWnnEvent.INPUT_KEY: /* update shift/alt state */ switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_DOWN: + case KeyEvent.KEYCODE_DPAD_LEFT: + case KeyEvent.KEYCODE_DPAD_RIGHT: + case KeyEvent.KEYCODE_DPAD_UP: + if (mTutorial != null) { + return true; + } + break; + case KeyEvent.KEYCODE_ALT_LEFT: case KeyEvent.KEYCODE_ALT_RIGHT: if (keyEvent.getRepeatCount() == 0) { @@ -772,18 +840,15 @@ public class OpenWnnJAJP extends OpenWnn { break; case OpenWnnEvent.SELECT_CANDIDATE: - boolean hasSetInfo = false; - if (isEnableL2Converter()) { - setCommitInfo(ev.word.candidate.length()); - hasSetInfo = true; - } + initCommitInfoForWatchCursor(); if (isEnglishPrediction()) { mComposingText.clear(); } mStatus = commitText(ev.word); - if (hasSetInfo) { - checkCommitInfo(); + if (isEnglishPrediction() && !mEngineState.isSymbolList() && mEnableAutoInsertSpace) { + commitSpaceJustOne(); } + checkCommitInfo(); if (mEngineState.isSymbolList()) { mEnableAutoDeleteSpace = false; @@ -925,9 +990,7 @@ public class OpenWnnJAJP extends OpenWnn { processHardwareKeyboardInputChar(str); return true; } else { - mEnableAutoInsertSpace = false; commitText(true); - mEnableAutoInsertSpace = true; commitText(str.string); initializeScreen(); return true; @@ -940,7 +1003,9 @@ public class OpenWnnJAJP extends OpenWnn { } else if (key == KeyEvent.KEYCODE_SYM) { /* display the symbol list */ + initCommitInfoForWatchCursor(); mStatus = commitText(true); + checkCommitInfo(); changeEngineMode(ENGINE_MODE_SYMBOL); mHardAlt = 0; updateMetaKeyStateDisplay(); @@ -957,10 +1022,11 @@ public class OpenWnnJAJP extends OpenWnn { mComposingText.toString(ComposingText.LAYER1).length()); mExactMatchMode = false; } else { - mComposingText.delete(ComposingText.LAYER1, false); - if (mComposingText.size(ComposingText.LAYER1) == 0) { + if (mComposingText.size(ComposingText.LAYER1) == 1) { initializeScreen(); return true; + } else { + mComposingText.delete(ComposingText.LAYER1, false); } } updateViewStatusForPrediction(true, true); @@ -998,32 +1064,33 @@ public class OpenWnnJAJP extends OpenWnn { case KeyEvent.KEYCODE_DPAD_RIGHT: if (!isEnableL2Converter()) { - commitText(false); - return false; + if (mEngineState.keyboard == EngineState.KEYBOARD_12KEY) { + commitText(false); + } } else { processRightKeyEvent(); - return true; } + return true; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: - boolean hasSetInfo = false; - if (isEnableL2Converter()) { - if (isEnglishPrediction()) { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); - } else { - int layer = mTargetLayer; - int cursor = mComposingText.getCursor(layer); - if (0 < cursor) { - String tmp = mComposingText.toString(layer, 0, cursor - 1); - setCommitInfo(tmp.length()); - } + if (!isEnglishPrediction()) { + int cursor = mComposingText.getCursor(ComposingText.LAYER1); + if (cursor < 1) { + return true; } - hasSetInfo = true; } + initCommitInfoForWatchCursor(); mStatus = commitText(true); - if (hasSetInfo) { - checkCommitInfo(); + checkCommitInfo(); + + if (isEnglishPrediction()) { + initializeScreen(); + } + + if (mEnableAutoHideKeyboard) { + mInputViewManager.closing(); + requestHideSelf(0); } return true; @@ -1059,14 +1126,30 @@ public class OpenWnnJAJP extends OpenWnn { default: return processKeyEventNoInputCandidateShown(ev); } - } else if (key == KeyEvent.KEYCODE_BACK && isInputViewShown()) { - /* - * If 'BACK' key is pressed when the SW-keyboard is shown - * and the candidates view is not shown, dismiss the SW-keyboard. - */ - mInputViewManager.closing(); - requestHideSelf(0); - return true; + } else { + switch (key) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + if (mEnableAutoHideKeyboard) { + mInputViewManager.closing(); + requestHideSelf(0); + return true; + } + break; + case KeyEvent.KEYCODE_BACK: + /* + * If 'BACK' key is pressed when the SW-keyboard is shown + * and the candidates view is not shown, dismiss the SW-keyboard. + */ + if (isInputViewShown()) { + mInputViewManager.closing(); + requestHideSelf(0); + return true; + } + break; + default: + break; + } } } @@ -1086,9 +1169,11 @@ public class OpenWnnJAJP extends OpenWnn { mHardShift = 0; updateMetaKeyStateDisplay(); if (mEngineState.isEnglish()) { + /* English mode to Japanese mode */ ((DefaultSoftKeyboardJAJP) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_JA_FULL_HIRAGANA); mConverter = mConverterJAJP; } else { + /* Japanese mode to English mode */ ((DefaultSoftKeyboardJAJP) mInputViewManager).changeKeyMode(DefaultSoftKeyboard.KEYMODE_JA_HALF_ALPHABET); mConverter = mConverterEN; } @@ -1096,8 +1181,9 @@ public class OpenWnnJAJP extends OpenWnn { } else if(ev.isAltPressed()){ /* display the symbol list (G1 specific. same as KEYCODE_SYM) */ - commitAllText(); - + if (!mEngineState.isSymbolList()) { + commitAllText(); + } changeEngineMode(ENGINE_MODE_SYMBOL); mHardAlt = 0; updateMetaKeyStateDisplay(); @@ -1107,8 +1193,9 @@ public class OpenWnnJAJP extends OpenWnn { if (mComposingText.size(0) == 0) { commitText(" "); mCandidatesViewManager.clearCandidates(); + breakSequence(); } else { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); + initCommitInfoForWatchCursor(); commitText(true); commitSpaceJustOne(); checkCommitInfo(); @@ -1120,6 +1207,7 @@ public class OpenWnnJAJP extends OpenWnn { if (mComposingText.size(0) == 0) { commitText(" "); mCandidatesViewManager.clearCandidates(); + breakSequence(); } else { startConvert(EngineState.CONVERT_TYPE_RENBUN); } @@ -1137,9 +1225,7 @@ public class OpenWnnJAJP extends OpenWnn { if (mPreConverter == null) { Matcher m = mEnglishAutoCommitDelimiter.matcher(str.string); if (m.matches()) { - mEnableAutoInsertSpace = false; commitText(true); - mEnableAutoInsertSpace = true; commit = true; } @@ -1171,28 +1257,28 @@ public class OpenWnnJAJP extends OpenWnn { } /** Thread for updating the candidates view */ - private final Runnable updatePredictionRunnable = new Runnable() { - public void run() { - int candidates = 0; - int cursor = mComposingText.getCursor(ComposingText.LAYER1); - if (isEnableL2Converter() || mEngineState.isSymbolList()) { - if (mExactMatchMode) { - /* exact matching */ - candidates = mConverter.predict(mComposingText, 0, cursor); - } else { - /* normal prediction */ - candidates = mConverter.predict(mComposingText, 0, -1); - } - } - - /* update the candidates view */ - if (candidates > 0) { - mCandidatesViewManager.displayCandidates(mConverter); - } else { - mCandidatesViewManager.clearCandidates(); - } + private void updatePrediction() { + int candidates = 0; + int cursor = mComposingText.getCursor(ComposingText.LAYER1); + if (isEnableL2Converter() || mEngineState.isSymbolList()) { + if (mExactMatchMode) { + /* exact matching */ + candidates = mConverter.predict(mComposingText, 0, cursor); + } else { + /* normal prediction */ + candidates = mConverter.predict(mComposingText, 0, -1); } - }; + } + + /* update the candidates view */ + if (candidates > 0) { + mHasContinuedPrediction = ((mComposingText.size(ComposingText.LAYER1) == 0) + && !mEngineState.isSymbolList()); + mCandidatesViewManager.displayCandidates(mConverter); + } else { + mCandidatesViewManager.clearCandidates(); + } + } /** * Handle a left key event. @@ -1216,7 +1302,7 @@ public class OpenWnnJAJP extends OpenWnn { } } - mCommitCount = 0; + mCommitCount = 0; /* retry consecutive clause conversion if necessary. */ mStatus = STATUS_INPUT_EDIT; updateViewStatus(mTargetLayer, true, true); } @@ -1226,11 +1312,12 @@ public class OpenWnnJAJP extends OpenWnn { */ private void processRightKeyEvent() { int layer = mTargetLayer; + ComposingText composingText = mComposingText; if (mExactMatchMode || (mEngineState.isConvertState())) { - int textSize = mComposingText.size(ComposingText.LAYER1); - if (mComposingText.getCursor(ComposingText.LAYER1) == textSize) { + int textSize = composingText.size(ComposingText.LAYER1); + if (composingText.getCursor(ComposingText.LAYER1) == textSize) { mExactMatchMode = false; - layer = ComposingText.LAYER1; + layer = ComposingText.LAYER1; /* convert -> prediction */ EngineState state = new EngineState(); state.convertType = EngineState.CONVERT_TYPE_NONE; updateEngineState(state); @@ -1238,16 +1325,16 @@ public class OpenWnnJAJP extends OpenWnn { if (mEngineState.isEisuKana()) { mExactMatchMode = true; } - mComposingText.moveCursor(ComposingText.LAYER1, 1); + composingText.moveCursor(ComposingText.LAYER1, 1); } } else { - if (mComposingText.getCursor(ComposingText.LAYER1) - < mComposingText.size(ComposingText.LAYER1)) { - mComposingText.moveCursor(ComposingText.LAYER1, 1); + if (composingText.getCursor(ComposingText.LAYER1) + < composingText.size(ComposingText.LAYER1)) { + composingText.moveCursor(ComposingText.LAYER1, 1); } } - mCommitCount = 0; + mCommitCount = 0; /* retry consecutive clause conversion if necessary. */ mStatus = STATUS_INPUT_EDIT; updateViewStatus(layer, true, true); @@ -1278,15 +1365,25 @@ public class OpenWnnJAJP extends OpenWnn { return false; case KeyEvent.KEYCODE_DPAD_CENTER: - case KeyEvent.KEYCODE_BACK: ret = true; break; + + case KeyEvent.KEYCODE_BACK: + if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) { + mStatus &= ~STATUS_CANDIDATE_FULL; + mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); + return true; + } else { + ret = true; + } + break; default: return true; } if (mConverter != null) { + /* initialize the converter */ mConverter.init(); } updateViewStatusForPrediction(true, true); @@ -1349,15 +1446,22 @@ public class OpenWnnJAJP extends OpenWnn { } else if (layer == ComposingText.LAYER2) { highlightEnd = mComposingText.toString(layer, 0, 0).length(); + /* highlights the first segment */ mDisplayText.setSpan(SPAN_CONVERT_BGCOLOR_HL, 0, highlightEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } if (FIX_CURSOR_TEXT_END && (highlightEnd != 0)) { + /* highlights remaining text */ mDisplayText.setSpan(SPAN_REMAIN_BGCOLOR_HL, highlightEnd, mComposingText.toString(layer).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + + /* text color in the highlight */ + mDisplayText.setSpan(SPAN_TEXTCOLOR, 0, + mComposingText.toString(layer).length(), + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } @@ -1379,25 +1483,32 @@ public class OpenWnnJAJP extends OpenWnn { private void updateCandidateView() { switch (mTargetLayer) { case ComposingText.LAYER0: - case ComposingText.LAYER1: + case ComposingText.LAYER1: /* prediction */ if (mEnablePrediction || mEngineState.isSymbolList() || mEngineState.isEisuKana()) { /* update the candidates view */ if ((mComposingText.size(ComposingText.LAYER1) != 0) && !mEngineState.isConvertState()) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 250); + + mHandler.removeMessages(MSG_PREDICTION); + if (mCandidatesViewManager.getCurrentView().isShown()) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), + PREDICTION_DELAY_MS_SHOWING_CANDIDATE); + } else { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), + PREDICTION_DELAY_MS_1ST); + } } else { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - updatePredictionRunnable.run(); + mHandler.removeMessages(MSG_PREDICTION); + updatePrediction(); } } else { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); mCandidatesViewManager.clearCandidates(); } break; - case ComposingText.LAYER2: + case ComposingText.LAYER2: /* convert */ if (mCommitCount == 0) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); mConverter.convert(mComposingText); } @@ -1439,7 +1550,7 @@ public class OpenWnnJAJP extends OpenWnn { if (mConverter != null) { if (learn) { if (mEngineState.isRenbun()) { - learnWord(0); + learnWord(0); /* select the top of the clauses */ } else { if (mComposingText.size(ComposingText.LAYER1) != 0) { String stroke = mComposingText.toString(ComposingText.LAYER1, 0, mComposingText.getCursor(layer) - 1); @@ -1449,7 +1560,7 @@ public class OpenWnnJAJP extends OpenWnn { } } } else { - mConverter.breakSequence(); + breakSequence(); } } return commitTextThroughInputConnection(tmp); @@ -1459,11 +1570,7 @@ public class OpenWnnJAJP extends OpenWnn { * Commit all uncommitted words. */ private void commitAllText() { - boolean hasSetInfo = false; - if (isEnableL2Converter()) { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); - hasSetInfo = true; - } + initCommitInfoForWatchCursor(); if (mEngineState.isConvertState()) { commitConvertingText(); } else { @@ -1471,9 +1578,7 @@ public class OpenWnnJAJP extends OpenWnn { mComposingText.size(ComposingText.LAYER1)); mStatus = commitText(true); } - if (hasSetInfo) { - checkCommitInfo(); - } + checkCommitInfo(); } /** @@ -1497,7 +1602,7 @@ public class OpenWnnJAJP extends OpenWnn { private void commitText(String str) { mInputConnection.commitText(str, (FIX_CURSOR_TEXT_END ? 1 : str.length())); mPrevCommitText.append(str); - mCommitLength += str.length(); + mPrevCommitCount++; mEnableAutoDeleteSpace = true; updateViewStatusForPrediction(false, false); } @@ -1513,6 +1618,7 @@ public class OpenWnnJAJP extends OpenWnn { mInputConnection.commitText(string, (FIX_CURSOR_TEXT_END ? 1 : string.length())); mPrevCommitText.append(string); + mPrevCommitCount++; int cursor = mComposingText.getCursor(layer); if (cursor > 0) { @@ -1523,7 +1629,7 @@ public class OpenWnnJAJP extends OpenWnn { mCommitCount++; if ((layer == ComposingText.LAYER2) && (mComposingText.size(layer) == 0)) { - layer = 1; + layer = 1; /* for connected prediction */ } boolean commited = autoCommitEnglish(); @@ -1581,7 +1687,7 @@ public class OpenWnnJAJP extends OpenWnn { if (mEngineState.isEisuKana()) { state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; updateEngineState(state); - updateViewStatusForPrediction(true, true); + updateViewStatusForPrediction(true, true); /* prediction only */ } else { startConvert(EngineState.CONVERT_TYPE_EISU_KANA); } @@ -1670,6 +1776,7 @@ public class OpenWnnJAJP extends OpenWnn { break; } myState.dictionarySet = state.dictionarySet; + breakSequence(); /* update keyboard setting */ if (state.keyboard == EngineState.INVALID) { @@ -1716,16 +1823,14 @@ public class OpenWnnJAJP extends OpenWnn { if (++mCurrentSymbol >= SYMBOL_LISTS.length) { mCurrentSymbol = 0; } - if (!mEnableEmoji) { - if (SYMBOL_LISTS[mCurrentSymbol] == SymbolList.SYMBOL_JAPANESE_EMOJI) { - if (++mCurrentSymbol >= SYMBOL_LISTS.length) { - mCurrentSymbol = 0; - } - } + if (mEnableSymbolListNonHalf) { + mConverterSymbolEngineBack.setDictionary(SYMBOL_LISTS[mCurrentSymbol]); + } else { + mConverterSymbolEngineBack.setDictionary(SymbolList.SYMBOL_ENGLISH); } - mConverterSymbolEngineBack.setDictionary(SYMBOL_LISTS[mCurrentSymbol]); mConverter = mConverterSymbolEngineBack; mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_SYMBOL; + breakSequence(); break; default: @@ -1878,7 +1983,7 @@ public class OpenWnnJAJP extends OpenWnn { } ComposingText text = mComposingText; - text.insertStrSegment(0, ComposingText.LAYER1, new StrSegment(chars)); + appendStrSegment(new StrSegment(chars)); if (!isAlphabetLast(text.toString(ComposingText.LAYER1))) { /* commit if the input character is not alphabet */ @@ -1908,9 +2013,10 @@ public class OpenWnnJAJP extends OpenWnn { if (mComposingText.size(0) == 0) { mCandidatesViewManager.clearCandidates(); commitText(new String(chars)); + breakSequence(); } else { if (isEnglishPrediction()) { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); + initCommitInfoForWatchCursor(); commitText(true); commitSpaceJustOne(); checkCommitInfo(); @@ -1934,9 +2040,7 @@ public class OpenWnnJAJP extends OpenWnn { } if (commit) { - mEnableAutoInsertSpace = false; commitText(true); - mEnableAutoInsertSpace = true; appendStrSegment(new StrSegment(chars)); commitText(true); @@ -2016,16 +2120,12 @@ public class OpenWnnJAJP extends OpenWnn { CharSequence str = seq.subSequence(1, 2); mInputConnection.commitText(str, 1); mPrevCommitText.append(str); + mPrevCommitCount++; } - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - + mHandler.removeMessages(MSG_PREDICTION); mCandidatesViewManager.clearCandidates(); return true; - } else { - if (mEnableAutoInsertSpace) { - commitSpaceJustOne(); - } } } return false; @@ -2121,6 +2221,7 @@ public class OpenWnnJAJP extends OpenWnn { mDirectInputMode = true; return; } + mEnableLearning = preference.getBoolean("opt_enable_learning", true); mEnablePrediction = preference.getBoolean("opt_prediction", true); mEnableSpellCorrection = preference.getBoolean("opt_spell_correction", true); @@ -2128,13 +2229,20 @@ public class OpenWnnJAJP extends OpenWnn { int preferenceDictionary = EngineState.PREFERENCE_DICTIONARY_NONE; mEnableConverter = true; mEnableSymbolList = true; - mEnableEmoji = false; + mEnableSymbolListNonHalf = true; mAutoCaps = preference.getBoolean("auto_caps", true); + mFilter.filter = 0; + mEnableAutoInsertSpace = true; + mEnableAutoHideKeyboard = false; switch (info.inputType & EditorInfo.TYPE_MASK_CLASS) { case EditorInfo.TYPE_CLASS_NUMBER: case EditorInfo.TYPE_CLASS_DATETIME: + mEnableConverter = false; + break; + case EditorInfo.TYPE_CLASS_PHONE: + mEnableSymbolList = false; mEnableConverter = false; break; @@ -2148,11 +2256,22 @@ public class OpenWnnJAJP extends OpenWnn { case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD: mEnableLearning = false; mEnableConverter = false; + mEnableSymbolListNonHalf = false; + mFilter.filter = CandidateFilter.FILTER_NON_ASCII; mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_OFF; + mEnableAutoHideKeyboard = true; break; case EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS: + mFilter.filter = CandidateFilter.FILTER_NON_ASCII; + mEnableSymbolListNonHalf = false; + mEnableAutoInsertSpace = false; + mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_OFF; + preferenceDictionary = EngineState.PREFERENCE_DICTIONARY_EMAIL_ADDRESS_URI; + break; + case EditorInfo.TYPE_TEXT_VARIATION_URI: + mEnableAutoInsertSpace = false; mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_OFF; preferenceDictionary = EngineState.PREFERENCE_DICTIONARY_EMAIL_ADDRESS_URI; break; @@ -2176,19 +2295,10 @@ public class OpenWnnJAJP extends OpenWnn { break; } - if (ENABLE_EMOJI_LIMITATION) { - Bundle bundle = info.extras; - if (bundle != null) { - mEnableEmoji = bundle.getBoolean("allowEmoji"); - } - } else { - mEnableEmoji = true; - } - if (mEnableEmoji) { + if (mFilter.filter == 0) { mConverterEN.setFilter(null); mConverterJAJP.setFilter(null); } else { - mFilter.setFilter(CandidateFilter.FILTER_EMOJI); mConverterEN.setFilter(mFilter); mConverterJAJP.setFilter(mFilter); } @@ -2199,6 +2309,8 @@ public class OpenWnnJAJP extends OpenWnn { state.keyboard = mEngineState.keyboard; updateEngineState(state); updateMetaKeyStateDisplay(); + + checkTutorial(info.privateImeOptions); } /** @@ -2213,7 +2325,7 @@ public class OpenWnnJAJP extends OpenWnn { ComposingText composingText = mComposingText; if (composingText.size(ComposingText.LAYER1) >= LIMIT_INPUT_NUMBER) { - return; + return; /* do nothing */ } composingText.insertStrSegment(ComposingText.LAYER0, ComposingText.LAYER1, str); return; @@ -2231,6 +2343,8 @@ public class OpenWnnJAJP extends OpenWnn { String text = mComposingText.toString(ComposingText.LAYER2); mInputConnection.commitText(text, (FIX_CURSOR_TEXT_END ? 1 : text.length())); + mPrevCommitText.append(text); + mPrevCommitCount++; initializeScreen(); } } @@ -2239,16 +2353,22 @@ public class OpenWnnJAJP extends OpenWnn { * Initialize the screen displayed by IME */ private void initializeScreen() { + if (mComposingText.size(ComposingText.LAYER0) != 0) { + mInputConnection.setComposingText("", 0); + } mComposingText.clear(); - mInputConnection.setComposingText("", 0); mExactMatchMode = false; mStatus = STATUS_INIT; - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); View candidateView = mCandidatesViewManager.getCurrentView(); if ((candidateView != null) && candidateView.isShown()) { mCandidatesViewManager.clearCandidates(); } mInputViewManager.onUpdateState(this); + + EngineState state = new EngineState(); + state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; + updateEngineState(state); } /** @@ -2258,7 +2378,7 @@ public class OpenWnnJAJP extends OpenWnn { * @return {@code true} if the tail is alphabet; {@code false} if otherwise. */ private boolean isAlphabetLast(String str) { - Matcher m = ENGLISH_CHARACTER.matcher(str); + Matcher m = ENGLISH_CHARACTER_LAST.matcher(str); return m.matches(); } @@ -2313,42 +2433,102 @@ public class OpenWnnJAJP extends OpenWnn { } /** - * Remember the commit test's info. - * @param length length of commit text + * Initialize the committed text's information. */ - private void setCommitInfo(int length) { - if (length == 0) { + private void initCommitInfoForWatchCursor() { + if (!isEnableL2Converter()) { return; } - mCommitLength = length; - mCommitStartCursor = mLastSelectionEnd - mComposingText.size(mTargetLayer); + + mCommitStartCursor = mComposingStartCursor; mPrevCommitText.delete(0, mPrevCommitText.length()); } /** * Clear the commit text's info. + * @return {@code true}:cleared, {@code false}:has already cleared. */ - private void clearCommitInfo() { - mCommitLength = 0; - mCommitStartCursor = 0; + private boolean clearCommitInfo() { + if (mCommitStartCursor < 0) { + return false; + } + + mCommitStartCursor = -1; + return true; } /** * Verify the commit text. */ private void checkCommitInfo() { - if (mCommitLength == 0) { + if (mCommitStartCursor < 0) { return; } int composingLength = mComposingText.toString(mTargetLayer).length(); - CharSequence seq = mInputConnection.getTextBeforeCursor(mCommitLength + composingLength, 0); + CharSequence seq = mInputConnection.getTextBeforeCursor(mPrevCommitText.length() + composingLength, 0); seq = seq.subSequence(0, seq.length() - composingLength); if (!seq.equals(mPrevCommitText.toString())) { + mPrevCommitCount = 0; clearCommitInfo(); - } + } + } + + /** + * Check and start the tutorial if it is the tutorial mode. + * + * @param privateImeOptions IME's options + */ + private void checkTutorial(String privateImeOptions) { + if (privateImeOptions == null) return; + if (privateImeOptions.equals("com.android.setupwizard:ShowTutorial")) { + if ((mTutorial == null) && mEnableTutorial) startTutorial(); + } else if (privateImeOptions.equals("com.android.setupwizard:HideTutorial")) { + if (mTutorial != null) { + if (mTutorial.close()) { + mTutorial = null; + } + } + } + } + + /** + * Start the tutorial + */ + private void startTutorial() { + DefaultSoftKeyboardJAJP manager = (DefaultSoftKeyboardJAJP) mInputViewManager; + manager.setDefaultKeyboard(); + if (mEngineState.keyboard == EngineState.KEYBOARD_QWERTY) { + manager.changeKeyboardType(DefaultSoftKeyboard.KEYBOARD_12KEY); + } + + DefaultSoftKeyboardJAJP inputManager = ((DefaultSoftKeyboardJAJP) mInputViewManager); + View v = inputManager.getKeyboardView(); + v.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + return true; + }}); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_START_TUTORIAL), 500); } -} + /** + * Close the tutorial + */ + public void tutorialDone() { + mTutorial = null; + } + /** @see OpenWnn#close */ + @Override protected void close() { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLOSE), 0); + } + /** + * Break the sequence of words. + */ + private void breakSequence() { + mEnableAutoDeleteSpace = false; + mConverterJAJP.breakSequence(); + mConverterEN.breakSequence(); + } +} diff --git a/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java b/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java index 043730c..b9f4eac 100644 --- a/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java +++ b/src/jp/co/omronsoft/openwnn/OpenWnnZHCN.java @@ -18,25 +18,25 @@ package jp.co.omronsoft.openwnn; import jp.co.omronsoft.openwnn.EN.OpenWnnEngineEN; -import jp.co.omronsoft.openwnn.ZH.DefaultSoftKeyboardZH; -import jp.co.omronsoft.openwnn.ZH.LetterConverterZH; -import jp.co.omronsoft.openwnn.ZH.CN.OpenWnnEngineZHCN; +import jp.co.omronsoft.openwnn.ZH.*; +import jp.co.omronsoft.openwnn.ZH.CN.*; import jp.co.omronsoft.openwnn.StrSegmentClause; import android.content.SharedPreferences; import android.content.Context; import android.content.res.Configuration; -import android.inputmethodservice.InputMethodService; import android.os.Handler; -import android.os.Bundle; +import android.os.Message; import android.preference.PreferenceManager; import android.text.SpannableStringBuilder; import android.text.Spanned; import android.text.style.BackgroundColorSpan; import android.text.style.CharacterStyle; +import android.text.style.ForegroundColorSpan; import android.text.style.UnderlineSpan; import android.util.Log; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; +import android.view.MotionEvent; import android.view.View; import android.view.KeyCharacterMap; import android.text.method.MetaKeyKeyListener; @@ -71,15 +71,14 @@ public class OpenWnnZHCN extends OpenWnn { /** Never move cursor in to the composing text (adapting to IMF's specification change) */ private static final boolean FIX_CURSOR_TEXT_END = true; - /** Whether using Emoji or not */ - private static final boolean ENABLE_EMOJI_LIMITATION = true; - /** Highlight color style for the converted clause */ private static final CharacterStyle SPAN_CONVERT_BGCOLOR_HL = new BackgroundColorSpan(0xFF8888FF); /** Highlight color style for the selected string */ private static final CharacterStyle SPAN_EXACT_BGCOLOR_HL = new BackgroundColorSpan(0xFF66CDAA); /** Highlight color style for the composing text */ private static final CharacterStyle SPAN_REMAIN_BGCOLOR_HL = new BackgroundColorSpan(0xFFF0FFFF); + /** Highlight text color */ + private static final CharacterStyle SPAN_TEXTCOLOR = new ForegroundColorSpan(0xFF000000); /** Underline style for the composing text */ private static final CharacterStyle SPAN_UNDERLINE = new UnderlineSpan(); @@ -92,8 +91,8 @@ public class OpenWnnZHCN extends OpenWnn { /** IME's status for {@code mStatus}(all candidates are displayed). */ private static final int STATUS_CANDIDATE_FULL = 0x0010; - /** Alphabet pattern */ - private static final Pattern ENGLISH_CHARACTER = Pattern.compile(".*[a-zA-Z]$"); + /** Alphabet-last pattern */ + private static final Pattern ENGLISH_CHARACTER_LAST = Pattern.compile(".*[a-zA-Z]$"); /** * Private area character code got by {@link KeyEvent#getUnicodeChar()}. @@ -111,6 +110,21 @@ public class OpenWnnZHCN extends OpenWnn { /** Bit flag for English auto commit mode (symbol list) */ private static final int AUTO_COMMIT_ENGLISH_SYMBOL = 0x0010; + /** Message for {@code mHandler} (execute prediction) */ + private static final int MSG_PREDICTION = 0; + + /** Message for {@code mHandler} (execute tutorial) */ + private static final int MSG_START_TUTORIAL = 1; + + /** Message for {@code mHandler} (close) */ + private static final int MSG_CLOSE = 2; + + /** Delay time(msec.) to start prediction after key input when the candidates view is not shown. */ + private static final int PREDICTION_DELAY_MS_1ST = 200; + + /** Delay time(msec.) to start prediction after key input when the candidates view is shown. */ + private static final int PREDICTION_DELAY_MS_SHOWING_CANDIDATE = 200; + /** Convert engine's state */ private class EngineState { @@ -223,9 +237,6 @@ public class OpenWnnZHCN extends OpenWnn { /** Instance of this service */ private static OpenWnnZHCN mSelf = null; - /** Handler for drawing the candidates view */ - private Handler mDelayUpdateHandler; - /** Backup for switching the converter */ private WnnEngine mConverterBack; @@ -267,8 +278,8 @@ public class OpenWnnZHCN extends OpenWnn { /** Whether displaying the symbol list */ private boolean mEnableSymbolList = true; - /** Whether being able to use Emoji */ - private boolean mEnableEmoji = false; + /** Whether non ASCII code is enabled */ + private boolean mEnableSymbolListNonHalf = true; /** Enable mistyping spell correction or not */ private boolean mEnableSpellCorrection = true; @@ -279,14 +290,17 @@ public class OpenWnnZHCN extends OpenWnn { /** Whether removing a space before a separator or not. (in English mode) */ private boolean mEnableAutoDeleteSpace = false; - /** Whether appending a space to a selected word or not (in English mode) */ + /** Whether auto-spacing is enabled or not. */ private boolean mEnableAutoInsertSpace = true; + /** Whether dismissing the keyboard when the enter key is pressed */ + private boolean mEnableAutoHideKeyboard = true; + /** Number of committed clauses on consecutive clause conversion */ private int mCommitCount = 0; /** Target layer of the {@link ComposingText} */ - private int mTargetLayer = 0; + private int mTargetLayer = 1; /** Current orientation of the display */ private int mOrientation = Configuration.ORIENTATION_UNDEFINED; @@ -297,11 +311,8 @@ public class OpenWnnZHCN extends OpenWnn { /** Regular expression pattern for English separators */ private Pattern mEnglishAutoCommitDelimiter = null; - /** Lenght of committed text */ - private int mCommitLength = 0; - - /** Last cursor position */ - private int mLastSelectionEnd = 0; + /** Cursor position in the composing text */ + private int mComposingStartCursor = 0; /** Cursor position before committing text */ private int mCommitStartCursor = 0; @@ -309,8 +320,8 @@ public class OpenWnnZHCN extends OpenWnn { /** Previous committed text */ private StringBuffer mPrevCommitText = null; - /** List of words in the user dictionary */ - private WnnWord[] mUserDictionaryWords = null; + /** Call count of {@code commitText} */ + private int mPrevCommitCount = 0; /** Shift lock status of the Hardware keyboard */ private int mHardShift; @@ -318,21 +329,64 @@ public class OpenWnnZHCN extends OpenWnn { /** SHIFT key state (pressing) */ private boolean mShiftPressing; - /** Alt lock status of the Hardware keyboard */ + /** ALT lock status of the Hardware keyboard */ private int mHardAlt; /** ALT key state (pressing) */ private boolean mAltPressing; - + /** Shift lock toggle definition */ private static final int[] mShiftKeyToggle = {0, MetaKeyKeyListener.META_SHIFT_ON, MetaKeyKeyListener.META_CAP_LOCKED}; - /** Alt lock toggle definition */ + /** ALT lock toggle definition */ private static final int[] mAltKeyToggle = {0, MetaKeyKeyListener.META_ALT_ON, MetaKeyKeyListener.META_ALT_LOCKED}; /** Auto caps mode */ private boolean mAutoCaps = false; + + /** List of words in the user dictionary */ + private WnnWord[] mUserDictionaryWords = null; + /** Tutorial */ + private TutorialZHCN mTutorial; + + /** Whether tutorial mode or not */ + private boolean mEnableTutorial; + + /** Whether there is a continued predicted candidate */ + private boolean mHasContinuedPrediction = false; + + /** {@code Handler} for drawing candidates/displaying tutorial */ + Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_PREDICTION: + updatePrediction(); + break; + case MSG_START_TUTORIAL: + if (mTutorial == null) { + if (isInputViewShown()) { + DefaultSoftKeyboardZH inputManager = ((DefaultSoftKeyboardZH) mInputViewManager); + View v = inputManager.getKeyboardView(); + mTutorial = new TutorialZHCN(OpenWnnZHCN.this, v, inputManager); + + mTutorial.start(); + } else { + /* Try again soon if the view is not yet showing */ + sendMessageDelayed(obtainMessage(MSG_START_TUTORIAL), 100); + } + } + break; + case MSG_CLOSE: + if (mConverterZHCN != null) mConverterZHCN.close(); + if (mConverterEN != null) mConverterEN.close(); + if (mConverterSymbolEngineBack != null) mConverterSymbolEngineBack.close(); + break; + } + } + }; + /** The candidate filter */ private CandidateFilter mFilter; @@ -345,9 +399,7 @@ public class OpenWnnZHCN extends OpenWnn { mComposingText = new ComposingText(); mCandidatesViewManager = new TextCandidatesViewManager(-1); mInputViewManager = new DefaultSoftKeyboardZH(); - - mConverter = mConverterZHCN = new OpenWnnEngineZHCN( - "libWnnZHCNDic.so", + mConverter = mConverterZHCN = new OpenWnnEngineZHCN("libWnnZHCNDic.so", "/data/data/jp.co.omronsoft.openwnn/writableZHCN.dic"); mConverterEN = new OpenWnnEngineEN("/data/data/jp.co.omronsoft.openwnn/writableEN.dic"); @@ -357,7 +409,6 @@ public class OpenWnnZHCN extends OpenWnn { mDisplayText = new SpannableStringBuilder(); mAutoHideMode = false; - mDelayUpdateHandler = new Handler(); mPrevCommitText = new StringBuffer(); } @@ -387,9 +438,7 @@ public class OpenWnnZHCN extends OpenWnn { int hiddenState = getResources().getConfiguration().hardKeyboardHidden; boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES); ((DefaultSoftKeyboardZH) mInputViewManager).setHardKeyboardHidden(hidden); - ((TextCandidatesViewManager) - mCandidatesViewManager).setHardKeyboardHidden(hidden); - + mEnableTutorial = hidden; return super.onCreateInputView(); } @@ -400,16 +449,13 @@ public class OpenWnnZHCN extends OpenWnn { state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; updateEngineState(state); + mPrevCommitCount = 0; clearCommitInfo(); - if (mDirectInputMode) { - DefaultSoftKeyboardZH inputManager = ((DefaultSoftKeyboardZH)mInputViewManager); - inputManager.setDefaultKeyboard(); - } + ((DefaultSoftKeyboard) mInputViewManager).resetCurrentKeyboard(); super.onStartInputView(attribute, restarting); - mEnableAutoDeleteSpace = false; /* initialize views */ mCandidatesViewManager.clearCandidates(); /* initialize status */ @@ -429,8 +475,7 @@ public class OpenWnnZHCN extends OpenWnn { ((TextCandidatesViewManager)mCandidatesViewManager).setAutoHide(true); if (isEnableL2Converter()) { - mEnableAutoDeleteSpace = false; - mConverter.breakSequence(); + breakSequence(); } } @@ -439,37 +484,55 @@ public class OpenWnnZHCN extends OpenWnn { mComposingText.clear(); mInputViewManager.onUpdateState(this); clearCommitInfo(); + mHandler.removeMessages(MSG_START_TUTORIAL); mInputViewManager.closing(); - super.hideWindow(); - } + if (mTutorial != null) { + mTutorial.close(); + mTutorial = null; + } - /** @see jp.co.omronsoft.openwnn.OpenWnn#onComputeInsets */ - @Override public void onComputeInsets(InputMethodService.Insets outInsets) { - /* use default value. means; - * outInsets.touchableInsets = InputMethodService.Insets.TOUCHABLE_INSETS_VISIBLE; - */ + super.hideWindow(); } /** @see jp.co.omronsoft.openwnn.OpenWnn#onUpdateSelection */ @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) { - mLastSelectionEnd = newSelEnd; + mComposingStartCursor = (candidatesStart < 0) ? newSelEnd : candidatesStart; - if (mComposingText.size(ComposingText.LAYER1) != 0) { + if (newSelStart != newSelEnd) { + clearCommitInfo(); + } + + if (mHasContinuedPrediction) { + mHasContinuedPrediction = false; + if (0 < mPrevCommitCount) { + mPrevCommitCount--; + } + return; + } + + boolean isNotComposing = ((candidatesStart < 0) && (candidatesEnd < 0)); + if ((mComposingText.size(ComposingText.LAYER1) != 0) + && !isNotComposing) { updateViewStatus(mTargetLayer, false, true); } else { - int commitEnd = mCommitStartCursor + mCommitLength; - if ((mCommitLength != 0) - && (commitEnd != newSelEnd) - && ((newSelEnd < oldSelEnd) || (commitEnd < newSelEnd))) { - - if (isEnableL2Converter()) { - mEnableAutoDeleteSpace = false; - mConverter.breakSequence(); - } + if (0 < mPrevCommitCount) { + mPrevCommitCount--; + } else { + int commitEnd = mCommitStartCursor + mPrevCommitText.length(); + if ((((newSelEnd < oldSelEnd) || (commitEnd < newSelEnd)) && clearCommitInfo()) + || isNotComposing) { + if (isEnableL2Converter()) { + breakSequence(); + } - clearCommitInfo(); - initializeScreen(); + if (mInputConnection != null) { + if (isNotComposing && (mComposingText.size(ComposingText.LAYER1) != 0)) { + mInputConnection.finishComposingText(); + } + } + initializeScreen(); + } } } } @@ -495,8 +558,7 @@ public class OpenWnnZHCN extends OpenWnn { int hiddenState = newConfig.hardKeyboardHidden; boolean hidden = (hiddenState == Configuration.HARDKEYBOARDHIDDEN_YES); ((DefaultSoftKeyboardZH) mInputViewManager).setHardKeyboardHidden(hidden); - ((TextCandidatesViewManager) - mCandidatesViewManager).setHardKeyboardHidden(hidden); + mEnableTutorial = hidden; } } catch (Exception ex) { /* do nothing if an error occurs. */ @@ -553,9 +615,6 @@ public class OpenWnnZHCN extends OpenWnn { changeEngineMode(ev.mode); if (ev.mode != ENGINE_MODE_SYMBOL) { initializeScreen(); - state = new EngineState(); - state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; - updateEngineState(state); } return true; @@ -579,6 +638,10 @@ public class OpenWnnZHCN extends OpenWnn { ret = ((TextCandidatesViewManager)mCandidatesViewManager).onTouchSync(); return ret; + case OpenWnnEvent.TOUCH_OTHER_KEY: + mStatus |= STATUS_INPUT_EDIT; + return true; + default: break; } @@ -620,6 +683,7 @@ public class OpenWnnZHCN extends OpenWnn { ||(keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) ||(keyCode == KeyEvent.KEYCODE_ALT_LEFT) ||(keyCode == KeyEvent.KEYCODE_ALT_RIGHT) + ||(keyCode == KeyEvent.KEYCODE_BACK && mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) ||(keyEvent.isAltPressed() && (keyCode == KeyEvent.KEYCODE_SPACE)))))) { state = new EngineState(); @@ -698,6 +762,15 @@ public class OpenWnnZHCN extends OpenWnn { case OpenWnnEvent.INPUT_KEY: /* update shift/alt state */ switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_DOWN: + case KeyEvent.KEYCODE_DPAD_LEFT: + case KeyEvent.KEYCODE_DPAD_RIGHT: + case KeyEvent.KEYCODE_DPAD_UP: + if (mTutorial != null) { + return true; + } + break; + case KeyEvent.KEYCODE_ALT_LEFT: case KeyEvent.KEYCODE_ALT_RIGHT: if (keyEvent.getRepeatCount() == 0) { @@ -731,18 +804,15 @@ public class OpenWnnZHCN extends OpenWnn { break; case OpenWnnEvent.SELECT_CANDIDATE: - boolean hasSetInfo = false; - if (isEnableL2Converter()) { - setCommitInfo(ev.word.candidate.length()); - hasSetInfo = true; - } + initCommitInfoForWatchCursor(); if (isEnglishPrediction()) { mComposingText.clear(); } mStatus = commitText(ev.word); - if (hasSetInfo) { - checkCommitInfo(); + if (isEnglishPrediction() && !mEngineState.isSymbolList() && mEnableAutoInsertSpace) { + commitSpaceJustOne(); } + checkCommitInfo(); if (mEngineState.isSymbolList()) { mEnableAutoDeleteSpace = false; @@ -888,9 +958,7 @@ public class OpenWnnZHCN extends OpenWnn { processHardwareKeyboardInputChar(str, caps); return true; } else { - mEnableAutoInsertSpace = false; commitText(true); - mEnableAutoInsertSpace = true; commitText(str.string); initializeScreen(); return true; @@ -903,7 +971,9 @@ public class OpenWnnZHCN extends OpenWnn { } else if (key == KeyEvent.KEYCODE_SYM) { /* display the symbol list */ + initCommitInfoForWatchCursor(); mStatus = commitText(true); + checkCommitInfo(); changeEngineMode(ENGINE_MODE_SYMBOL); mHardAlt = 0; updateMetaKeyStateDisplay(); @@ -920,10 +990,11 @@ public class OpenWnnZHCN extends OpenWnn { mComposingText.toString(ComposingText.LAYER1).length()); mExactMatchMode = false; } else { - mComposingText.delete(ComposingText.LAYER1, false); - if (mComposingText.size(ComposingText.LAYER1) == 0) { + if (mComposingText.size(ComposingText.LAYER1) == 1) { initializeScreen(); return true; + } else { + mComposingText.delete(ComposingText.LAYER1, false); } } updateViewStatusForPrediction(true, true); @@ -962,31 +1033,30 @@ public class OpenWnnZHCN extends OpenWnn { case KeyEvent.KEYCODE_DPAD_RIGHT: if (!isEnableL2Converter()) { commitText(false); - return false; } else { processRightKeyEvent(); - return true; } + return true; case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: - boolean hasSetInfo = false; - if (isEnableL2Converter()) { - if (isEnglishPrediction()) { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); - } else { - int layer = mTargetLayer; - int cursor = mComposingText.getCursor(layer); - if (0 < cursor) { - String tmp = mComposingText.toString(layer, 0, cursor - 1); - setCommitInfo(tmp.length()); - } + if (!isEnglishPrediction()) { + int cursor = mComposingText.getCursor(ComposingText.LAYER1); + if (cursor < 1) { + return true; } - hasSetInfo = true; } + initCommitInfoForWatchCursor(); mStatus = commitText(true); - if (hasSetInfo) { - checkCommitInfo(); + checkCommitInfo(); + + if (isEnglishPrediction()) { + initializeScreen(); + } + + if (mEnableAutoHideKeyboard) { + mInputViewManager.closing(); + requestHideSelf(0); } return true; @@ -1022,14 +1092,30 @@ public class OpenWnnZHCN extends OpenWnn { default: return processKeyEventNoInputCandidateShown(ev); } - } else if (key == KeyEvent.KEYCODE_BACK && isInputViewShown()) { - /* - * If 'BACK' key is pressed when the SW-keyboard is shown - * and the candidates view is not shown, dismiss the SW-keyboard. - */ - mInputViewManager.closing(); - requestHideSelf(0); - return true; + } else { + switch (key) { + case KeyEvent.KEYCODE_DPAD_CENTER: + case KeyEvent.KEYCODE_ENTER: + if (mEnableAutoHideKeyboard) { + mInputViewManager.closing(); + requestHideSelf(0); + return true; + } + break; + case KeyEvent.KEYCODE_BACK: + /* + * If 'BACK' key is pressed when the SW-keyboard is shown + * and the candidates view is not shown, dismiss the SW-keyboard. + */ + if (isInputViewShown()) { + mInputViewManager.closing(); + requestHideSelf(0); + return true; + } + break; + default: + break; + } } } @@ -1059,8 +1145,9 @@ public class OpenWnnZHCN extends OpenWnn { } else if(ev.isAltPressed()){ /* display the symbol list (G1 specific. same as KEYCODE_SYM) */ - commitAllText(); - + if (!mEngineState.isSymbolList()) { + commitAllText(); + } changeEngineMode(ENGINE_MODE_SYMBOL); mHardAlt = 0; updateMetaKeyStateDisplay(); @@ -1070,8 +1157,9 @@ public class OpenWnnZHCN extends OpenWnn { if (mComposingText.size(0) == 0) { commitText(" "); mCandidatesViewManager.clearCandidates(); + breakSequence(); } else { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); + initCommitInfoForWatchCursor(); commitText(true); commitSpaceJustOne(); checkCommitInfo(); @@ -1083,6 +1171,7 @@ public class OpenWnnZHCN extends OpenWnn { if (mComposingText.size(0) == 0) { commitText(" "); mCandidatesViewManager.clearCandidates(); + breakSequence(); } else { startConvert(EngineState.CONVERT_TYPE_RENBUN); } @@ -1101,9 +1190,7 @@ public class OpenWnnZHCN extends OpenWnn { if (mPreConverter == null) { Matcher m = mEnglishAutoCommitDelimiter.matcher(str.string); if (m.matches()) { - mEnableAutoInsertSpace = false; commitText(true); - mEnableAutoInsertSpace = true; commit = true; } @@ -1135,28 +1222,28 @@ public class OpenWnnZHCN extends OpenWnn { } /** Thread for updating the candidates view */ - private final Runnable updatePredictionRunnable = new Runnable() { - public void run() { - int candidates = 0; - int cursor = mComposingText.getCursor(ComposingText.LAYER1); - if (isEnableL2Converter() || mEngineState.isSymbolList()) { - if (mExactMatchMode) { - /* exact matching */ - candidates = mConverter.predict(mComposingText, 0, cursor); - } else { - /* normal prediction */ - candidates = mConverter.predict(mComposingText, 0, -1); - } - } - - /* update the candidates view */ - if (candidates > 0) { - mCandidatesViewManager.displayCandidates(mConverter); - } else { - mCandidatesViewManager.clearCandidates(); - } + private void updatePrediction() { + int candidates = 0; + int cursor = mComposingText.getCursor(ComposingText.LAYER1); + if (isEnableL2Converter() || mEngineState.isSymbolList()) { + if (mExactMatchMode) { + /* exact matching */ + candidates = mConverter.predict(mComposingText, 0, cursor); + } else { + /* normal prediction */ + candidates = mConverter.predict(mComposingText, 0, -1); } - }; + } + + /* update the candidates view */ + if (candidates > 0) { + mHasContinuedPrediction = ((mComposingText.size(ComposingText.LAYER1) == 0) + && !mEngineState.isSymbolList()); + mCandidatesViewManager.displayCandidates(mConverter); + } else { + mCandidatesViewManager.clearCandidates(); + } + } /** * Handle a left key event. @@ -1176,7 +1263,7 @@ public class OpenWnnZHCN extends OpenWnn { } } - mCommitCount = 0; + mCommitCount = 0; /* retry consecutive clause conversion if necessary. */ mStatus = STATUS_INPUT_EDIT; updateViewStatus(mTargetLayer, true, true); } @@ -1186,25 +1273,26 @@ public class OpenWnnZHCN extends OpenWnn { */ private void processRightKeyEvent() { int layer = mTargetLayer; + ComposingText composingText = mComposingText; if (mExactMatchMode || (mEngineState.isConvertState())) { - int textSize = mComposingText.size(ComposingText.LAYER1); - if (mComposingText.getCursor(ComposingText.LAYER1) == textSize) { + int textSize = composingText.size(ComposingText.LAYER1); + if (composingText.getCursor(ComposingText.LAYER1) == textSize) { mExactMatchMode = false; - layer = ComposingText.LAYER1; + layer = ComposingText.LAYER1; /* convert -> prediction */ EngineState state = new EngineState(); state.convertType = EngineState.CONVERT_TYPE_NONE; updateEngineState(state); } else { - mComposingText.moveCursor(ComposingText.LAYER1, 1); + composingText.moveCursor(ComposingText.LAYER1, 1); } } else { - if (mComposingText.getCursor(ComposingText.LAYER1) - < mComposingText.size(ComposingText.LAYER1)) { - mComposingText.moveCursor(ComposingText.LAYER1, 1); + if (composingText.getCursor(ComposingText.LAYER1) + < composingText.size(ComposingText.LAYER1)) { + composingText.moveCursor(ComposingText.LAYER1, 1); } } - mCommitCount = 0; + mCommitCount = 0; /* retry consecutive clause conversion if necessary. */ mStatus = STATUS_INPUT_EDIT; updateViewStatus(layer, true, true); @@ -1235,15 +1323,25 @@ public class OpenWnnZHCN extends OpenWnn { return false; case KeyEvent.KEYCODE_DPAD_CENTER: - case KeyEvent.KEYCODE_BACK: ret = true; break; + + case KeyEvent.KEYCODE_BACK: + if (mCandidatesViewManager.getViewType() == CandidatesViewManager.VIEW_TYPE_FULL) { + mStatus &= ~STATUS_CANDIDATE_FULL; + mCandidatesViewManager.setViewType(CandidatesViewManager.VIEW_TYPE_NORMAL); + return true; + } else { + ret = true; + } + break; default: return true; } if (mConverter != null) { + /* initialize the converter */ mConverter.init(); } updateViewStatusForPrediction(true, true); @@ -1301,15 +1399,22 @@ public class OpenWnnZHCN extends OpenWnn { } else if (layer == ComposingText.LAYER2) { highlightEnd = mComposingText.toString(layer, 0, 0).length(); + /* highlights the first segment */ mDisplayText.setSpan(SPAN_CONVERT_BGCOLOR_HL, 0, highlightEnd, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } if (FIX_CURSOR_TEXT_END && (highlightEnd != 0)) { + /* highlights remaining text */ mDisplayText.setSpan(SPAN_REMAIN_BGCOLOR_HL, highlightEnd, mComposingText.toString(layer).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + + /* text color in the highlight */ + mDisplayText.setSpan(SPAN_TEXTCOLOR, 0, + mComposingText.toString(layer).length(), + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } } @@ -1331,25 +1436,32 @@ public class OpenWnnZHCN extends OpenWnn { private void updateCandidateView() { switch (mTargetLayer) { case ComposingText.LAYER0: - case ComposingText.LAYER1: + case ComposingText.LAYER1: /* prediction */ if (mEnablePrediction || mEngineState.isSymbolList()) { /* update the candidates view */ if ((mComposingText.size(ComposingText.LAYER1) != 0) && !mEngineState.isConvertState()) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - mDelayUpdateHandler.postDelayed(updatePredictionRunnable, 250); + + mHandler.removeMessages(MSG_PREDICTION); + if (mCandidatesViewManager.getCurrentView().isShown()) { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), + PREDICTION_DELAY_MS_SHOWING_CANDIDATE); + } else { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_PREDICTION), + PREDICTION_DELAY_MS_1ST); + } } else { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - updatePredictionRunnable.run(); + mHandler.removeMessages(MSG_PREDICTION); + updatePrediction(); } } else { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); mCandidatesViewManager.clearCandidates(); } break; - case ComposingText.LAYER2: + case ComposingText.LAYER2: /* convert */ if (mCommitCount == 0) { - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); mConverter.convert(mComposingText); } @@ -1391,7 +1503,7 @@ public class OpenWnnZHCN extends OpenWnn { if (mConverter != null) { if (learn) { if (mEngineState.isRenbun()) { - learnWord(0); + learnWord(0); /* select the top of the clauses */ } else { if (mComposingText.size(ComposingText.LAYER1) != 0) { String stroke = mComposingText.toString(ComposingText.LAYER1, 0, mComposingText.getCursor(layer) - 1); @@ -1401,7 +1513,7 @@ public class OpenWnnZHCN extends OpenWnn { } } } else { - mConverter.breakSequence(); + breakSequence(); } } return commitTextThroughInputConnection(tmp); @@ -1411,11 +1523,7 @@ public class OpenWnnZHCN extends OpenWnn { * Commit all uncommitted words. */ private void commitAllText() { - boolean hasSetInfo = false; - if (isEnableL2Converter()) { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); - hasSetInfo = true; - } + initCommitInfoForWatchCursor(); if (mEngineState.isConvertState()) { commitConvertingText(); } else { @@ -1423,9 +1531,7 @@ public class OpenWnnZHCN extends OpenWnn { mComposingText.size(ComposingText.LAYER1)); mStatus = commitText(true); } - if (hasSetInfo) { - checkCommitInfo(); - } + checkCommitInfo(); } /** @@ -1449,7 +1555,7 @@ public class OpenWnnZHCN extends OpenWnn { private void commitText(String str) { mInputConnection.commitText(str, (FIX_CURSOR_TEXT_END ? 1 : str.length())); mPrevCommitText.append(str); - mCommitLength += str.length(); + mPrevCommitCount++; mEnableAutoDeleteSpace = true; updateViewStatusForPrediction(false, false); } @@ -1457,7 +1563,7 @@ public class OpenWnnZHCN extends OpenWnn { /** * Commit a string through {@link InputConnection}. * - * @param string A string to commit + * @param string A string to commit * @return IME's status after commit */ private int commitTextThroughInputConnection(String string) { @@ -1465,6 +1571,7 @@ public class OpenWnnZHCN extends OpenWnn { mInputConnection.commitText(string, (FIX_CURSOR_TEXT_END ? 1 : string.length())); mPrevCommitText.append(string); + mPrevCommitCount++; int cursor = mComposingText.getCursor(layer); if (cursor > 0) { @@ -1475,7 +1582,7 @@ public class OpenWnnZHCN extends OpenWnn { mCommitCount++; if ((layer == ComposingText.LAYER2) && (mComposingText.size(layer) == 0)) { - layer = 1; + layer = 1; /* for connected prediction */ } boolean commited = autoCommitEnglish(); @@ -1508,6 +1615,7 @@ public class OpenWnnZHCN extends OpenWnn { int layer = mTargetLayer; mInputConnection.commitText(string, (FIX_CURSOR_TEXT_END ? 1 : string.length())); mPrevCommitText.append(string); + mPrevCommitCount++; int cursor = word.stroke.length(); int position = mComposingText.getCursor(layer); @@ -1652,6 +1760,7 @@ public class OpenWnnZHCN extends OpenWnn { break; } myState.dictionarySet = state.dictionarySet; + breakSequence(); /* update keyboard setting */ if (state.keyboard == EngineState.INVALID) { @@ -1694,16 +1803,14 @@ public class OpenWnnZHCN extends OpenWnn { if (++mCurrentSymbol >= SYMBOL_LISTS.length) { mCurrentSymbol = 0; } - if (!mEnableEmoji) { - if (SYMBOL_LISTS[mCurrentSymbol] == SymbolList.SYMBOL_JAPANESE_EMOJI) { - if (++mCurrentSymbol >= SYMBOL_LISTS.length) { - mCurrentSymbol = 0; - } - } + if (mEnableSymbolListNonHalf) { + mConverterSymbolEngineBack.setDictionary(SYMBOL_LISTS[mCurrentSymbol]); + } else { + mConverterSymbolEngineBack.setDictionary(SymbolList.SYMBOL_ENGLISH); } - mConverterSymbolEngineBack.setDictionary(SYMBOL_LISTS[mCurrentSymbol]); mConverter = mConverterSymbolEngineBack; mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_SYMBOL; + breakSequence(); break; default: @@ -1856,7 +1963,7 @@ public class OpenWnnZHCN extends OpenWnn { } ComposingText text = mComposingText; - text.insertStrSegment(0, ComposingText.LAYER1, new StrSegment(chars)); + appendStrSegment(new StrSegment(chars)); if (!isAlphabetLast(text.toString(ComposingText.LAYER1))) { /* commit if the input character is not alphabet */ @@ -1878,9 +1985,10 @@ public class OpenWnnZHCN extends OpenWnn { if (mComposingText.size(0) == 0) { mCandidatesViewManager.clearCandidates(); commitText(new String(chars)); + breakSequence(); } else { if (isEnglishPrediction()) { - setCommitInfo(mComposingText.toString(mTargetLayer).length()); + initCommitInfoForWatchCursor(); commitText(true); commitSpaceJustOne(); checkCommitInfo(); @@ -1904,9 +2012,7 @@ public class OpenWnnZHCN extends OpenWnn { } if (commit) { - mEnableAutoInsertSpace = false; commitText(true); - mEnableAutoInsertSpace = true; appendStrSegment(new StrSegment(chars)); commitText(true); @@ -1979,16 +2085,12 @@ public class OpenWnnZHCN extends OpenWnn { CharSequence str = seq.subSequence(1, 2); mInputConnection.commitText(str, 1); mPrevCommitText.append(str); + mPrevCommitCount++; } - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); - + mHandler.removeMessages(MSG_PREDICTION); mCandidatesViewManager.clearCandidates(); return true; - } else { - if (mEnableAutoInsertSpace) { - commitSpaceJustOne(); - } } } return false; @@ -2084,6 +2186,7 @@ public class OpenWnnZHCN extends OpenWnn { mDirectInputMode = true; return; } + mEnableLearning = preference.getBoolean("opt_zhcn_enable_learning", true); mEnablePrediction = preference.getBoolean("opt_zhcn_prediction", true); mEnableSpellCorrection = preference.getBoolean("opt_zhcn_spell_correction", true); @@ -2091,13 +2194,20 @@ public class OpenWnnZHCN extends OpenWnn { int preferenceDictionary = EngineState.PREFERENCE_DICTIONARY_NONE; mEnableConverter = true; mEnableSymbolList = true; - mEnableEmoji = false; + mEnableSymbolListNonHalf = true; mAutoCaps = preference.getBoolean("auto_caps", true); + mFilter.filter = 0; + mEnableAutoInsertSpace = true; + mEnableAutoHideKeyboard = false; switch (info.inputType & EditorInfo.TYPE_MASK_CLASS) { case EditorInfo.TYPE_CLASS_NUMBER: case EditorInfo.TYPE_CLASS_DATETIME: + mEnableConverter = false; + break; + case EditorInfo.TYPE_CLASS_PHONE: + mEnableSymbolList = false; mEnableConverter = false; break; @@ -2111,11 +2221,22 @@ public class OpenWnnZHCN extends OpenWnn { case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD: mEnableLearning = false; mEnableConverter = false; + mEnableSymbolListNonHalf = false; + mFilter.filter = CandidateFilter.FILTER_NON_ASCII; mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_OFF; + mEnableAutoHideKeyboard = true; break; case EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS: + mFilter.filter = CandidateFilter.FILTER_NON_ASCII; + mEnableSymbolListNonHalf = false; + mEnableAutoInsertSpace = false; + mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_OFF; + preferenceDictionary = EngineState.PREFERENCE_DICTIONARY_EMAIL_ADDRESS_URI; + break; + case EditorInfo.TYPE_TEXT_VARIATION_URI: + mEnableAutoInsertSpace = false; mDisableAutoCommitEnglishMask |= AUTO_COMMIT_ENGLISH_OFF; preferenceDictionary = EngineState.PREFERENCE_DICTIONARY_EMAIL_ADDRESS_URI; break; @@ -2139,19 +2260,10 @@ public class OpenWnnZHCN extends OpenWnn { break; } - if (ENABLE_EMOJI_LIMITATION) { - Bundle bundle = info.extras; - if (bundle != null) { - mEnableEmoji = bundle.getBoolean("allowEmoji"); - } - } else { - mEnableEmoji = true; - } - if (mEnableEmoji) { + if (mFilter.filter == 0) { mConverterEN.setFilter(null); mConverterZHCN.setFilter(null); } else { - mFilter.setFilter(CandidateFilter.FILTER_EMOJI); mConverterEN.setFilter(mFilter); mConverterZHCN.setFilter(mFilter); } @@ -2162,6 +2274,8 @@ public class OpenWnnZHCN extends OpenWnn { state.keyboard = mEngineState.keyboard; updateEngineState(state); updateMetaKeyStateDisplay(); + + checkTutorial(info.privateImeOptions); } /** @@ -2176,7 +2290,7 @@ public class OpenWnnZHCN extends OpenWnn { ComposingText composingText = mComposingText; if (composingText.size(ComposingText.LAYER1) >= LIMIT_INPUT_NUMBER) { - return; + return; /* do nothing */ } composingText.insertStrSegment(ComposingText.LAYER0, ComposingText.LAYER1, str); return; @@ -2194,6 +2308,8 @@ public class OpenWnnZHCN extends OpenWnn { String text = mComposingText.toString(ComposingText.LAYER2); mInputConnection.commitText(text, (FIX_CURSOR_TEXT_END ? 1 : text.length())); + mPrevCommitText.append(text); + mPrevCommitCount++; initializeScreen(); } } @@ -2202,16 +2318,22 @@ public class OpenWnnZHCN extends OpenWnn { * Initialize the screen displayed by IME */ private void initializeScreen() { + if (mComposingText.size(ComposingText.LAYER0) != 0) { + mInputConnection.setComposingText("", 0); + } mComposingText.clear(); - mInputConnection.setComposingText("", 0); mExactMatchMode = false; mStatus = STATUS_INIT; - mDelayUpdateHandler.removeCallbacks(updatePredictionRunnable); + mHandler.removeMessages(MSG_PREDICTION); View candidateView = mCandidatesViewManager.getCurrentView(); if ((candidateView != null) && candidateView.isShown()) { mCandidatesViewManager.clearCandidates(); } mInputViewManager.onUpdateState(this); + + EngineState state = new EngineState(); + state.temporaryMode = EngineState.TEMPORARY_DICTIONARY_MODE_NONE; + updateEngineState(state); } /** @@ -2221,7 +2343,7 @@ public class OpenWnnZHCN extends OpenWnn { * @return {@code true} if the tail is alphabet; {@code false} if otherwise. */ private boolean isAlphabetLast(String str) { - Matcher m = ENGLISH_CHARACTER.matcher(str); + Matcher m = ENGLISH_CHARACTER_LAST.matcher(str); return m.matches(); } @@ -2276,40 +2398,99 @@ public class OpenWnnZHCN extends OpenWnn { } /** - * Remember the commit test's info. - * @param length length of commit text + * Initialize the committed text's information. */ - private void setCommitInfo(int length) { - if (length == 0) { + private void initCommitInfoForWatchCursor() { + if (!isEnableL2Converter()) { return; } - mCommitLength = length; - mCommitStartCursor = mLastSelectionEnd - mComposingText.size(mTargetLayer); + + mCommitStartCursor = mComposingStartCursor; + mPrevCommitText.delete(0, mPrevCommitText.length()); } /** * Clear the commit text's info. + * @return {@code true}:cleared, {@code false}:has already cleared. */ - private void clearCommitInfo() { - mCommitLength = 0; - mCommitStartCursor = 0; + private boolean clearCommitInfo() { + if (mCommitStartCursor < 0) { + return false; + } + + mCommitStartCursor = -1; + return true; } /** * Verify the commit text. */ private void checkCommitInfo() { - if (mCommitLength == 0) { + if (mCommitStartCursor < 0) { return; } int composingLength = mComposingText.toString(mTargetLayer).length(); - CharSequence seq = mInputConnection.getTextBeforeCursor(mCommitLength + composingLength, 0); + CharSequence seq = mInputConnection.getTextBeforeCursor(mPrevCommitText.length() + composingLength, 0); seq = seq.subSequence(0, seq.length() - composingLength); if (!seq.equals(mPrevCommitText.toString())) { + mPrevCommitCount = 0; clearCommitInfo(); - } + } + } + + /** + * Check and start the tutorial if it is the tutorial mode. + * + * @param privateImeOptions IME's options + */ + private void checkTutorial(String privateImeOptions) { + if (privateImeOptions == null) return; + if (privateImeOptions.equals("com.android.setupwizard:ShowTutorial")) { + if ((mTutorial == null) && mEnableTutorial) startTutorial(); + } else if (privateImeOptions.equals("com.android.setupwizard:HideTutorial")) { + if (mTutorial != null) { + if (mTutorial.close()) { + mTutorial = null; + } + } + } } -} + /** + * Start the tutorial + */ + private void startTutorial() { + DefaultSoftKeyboardZH manager = (DefaultSoftKeyboardZH) mInputViewManager; + manager.setDefaultKeyboard(); + + DefaultSoftKeyboardZH inputManager = ((DefaultSoftKeyboardZH) mInputViewManager); + View v = inputManager.getKeyboardView(); + v.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + return true; + }}); + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_START_TUTORIAL), 500); + } + /** + * Close the tutorial + */ + public void tutorialDone() { + mTutorial = null; + } + + /** @see OpenWnn#close */ + @Override protected void close() { + mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_CLOSE), 0); + } + + /** + * Break the sequence of words. + */ + private void breakSequence() { + mEnableAutoDeleteSpace = false; + mConverterZHCN.breakSequence(); + mConverterEN.breakSequence(); + } +} diff --git a/src/jp/co/omronsoft/openwnn/SymbolList.java b/src/jp/co/omronsoft/openwnn/SymbolList.java index 7eb6a6f..e41bc4d 100644 --- a/src/jp/co/omronsoft/openwnn/SymbolList.java +++ b/src/jp/co/omronsoft/openwnn/SymbolList.java @@ -55,8 +55,6 @@ public class SymbolList implements WnnEngine { /** Key string to get normal symbol list for Chinese */ public static final String SYMBOL_CHINESE = "c1"; - /** Key string to get EMOJI symbol list for Japanese */ - public static final String SYMBOL_JAPANESE_EMOJI = "j_emoji"; /** Key string to get face mark list for Japanese */ public static final String SYMBOL_JAPANESE_FACE = "j_face"; @@ -103,9 +101,9 @@ public class SymbolList implements WnnEngine { mSymbols.put(SYMBOL_ENGLISH, getXmlfile(R.xml.symbols_latin1_list)); mSymbols.put(SYMBOL_JAPANESE, getXmlfile(R.xml.symbols_japan_list)); mSymbols.put(SYMBOL_JAPANESE_FACE, getXmlfile(R.xml.symbols_japan_face_list)); - mSymbols.put(SYMBOL_JAPANESE_EMOJI, getXmlfile(R.xml.symbols_japan_emoji_list)); mCurrentList = mSymbols.get(SYMBOL_ENGLISH); break; + case LANG_ZHCN: /* symbols for Chinese IME */ mSymbols.put(SYMBOL_CHINESE, getXmlfile(R.xml.symbols_china_list)); diff --git a/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java b/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java index 83bec26..c8291f1 100644 --- a/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java +++ b/src/jp/co/omronsoft/openwnn/TextCandidatesViewManager.java @@ -19,66 +19,74 @@ package jp.co.omronsoft.openwnn; import java.util.ArrayList; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Paint; -import android.graphics.drawable.Drawable; import android.media.MediaPlayer; import android.os.Vibrator; -import android.text.Layout; -import android.text.Styled; +import android.text.TextUtils; +import android.text.TextPaint; +import android.text.SpannableString; +import android.text.Spanned; +import android.text.style.ImageSpan; +import android.text.style.DynamicDrawableSpan; import android.util.Log; +import android.util.DisplayMetrics; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; -import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.View.OnClickListener; +import android.view.View.OnLongClickListener; import android.view.View.OnTouchListener; -import android.view.ViewGroup.LayoutParams; import android.view.GestureDetector; +import android.view.LayoutInflater; import android.widget.Button; -import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.TextView; import android.widget.EditText; -import android.text.TextPaint; +import android.widget.RelativeLayout; +import android.widget.ImageView; +import android.graphics.drawable.Drawable; /** * The default candidates view manager class using {@link EditText}. * * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD. All Rights Reserved. */ -public class TextCandidatesViewManager implements CandidatesViewManager, OnTouchListener, - GestureDetector.OnGestureListener { +public class TextCandidatesViewManager implements CandidatesViewManager, GestureDetector.OnGestureListener { /** Height of a line */ - public static final int LINE_HEIGHT = 48; + public static final int LINE_HEIGHT = 34; /** Number of lines to display (Portrait) */ public static final int LINE_NUM_PORTRAIT = 2; - /** Number of lines to full-display (Portrait) */ - public static final int LINE_NUM_PORTRAIT_FULL = 5; /** Number of lines to display (Landscape) */ public static final int LINE_NUM_LANDSCAPE = 1; - /** Number of lines to full-display (Landscape) */ - public static final int LINE_NUM_LANDSCAPE_FULL = 3; - /** Separator */ - public static final String CANDIDATE_SEPARATOR = "\u3000 "; - /** Maximum lines */ private static final int DISPLAY_LINE_MAX_COUNT = 1000; - - /** Adjusted value for detecting the selected candidate */ - private static final int TOUCH_ADJUSTED_VALUE = 1; + /** Width of the view */ + private static final int CANDIDATE_MINIMUM_WIDTH = 48; + /** Height of the view */ + private static final int CANDIDATE_MINIMUM_HEIGHT = 35; + /** Align the candidate left if the width of the string exceeds this threshold */ + private static final int CANDIDATE_LEFT_ALIGN_THRESHOLD = 120; + /** Maximum number of displaying candidates par one line (full view mode) */ + private static final int FULL_VIEW_DIV = 4; /** Body view of the candidates list */ private ViewGroup mViewBody; /** Scroller of {@code mViewBodyText} */ private ScrollView mViewBodyScroll; - /** Body of the list view */ - private EditText mViewBodyText; - /** Text displayed bottom of the view when there are more candidates. */ - private TextView mReadMoreText; - + /** Base of {@code mViewCandidateList1st}, {@code mViewCandidateList2nd} */ + private ViewGroup mViewCandidateBase; + /** Button displayed bottom of the view when there are more candidates. */ + private ImageView mReadMoreButton; + /** The view of the scaling up candidate */ + private View mViewScaleUp; + /** Layout for the candidates list on normal view */ + private LinearLayout mViewCandidateList1st; + /** Layout for the candidates list on full view */ + private RelativeLayout mViewCandidateList2nd; /** {@link OpenWnn} instance using this manager */ private OpenWnn mWnn; /** View type (VIEW_TYPE_NORMAL or VIEW_TYPE_FULL or VIEW_TYPE_CLOSE) */ @@ -96,8 +104,6 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch private WnnEngine mConverter; /** Limitation of displaying candidates */ private int mDisplayLimit; - /** The last displaying word */ - private WnnWord mLastWord; /** Vibrator for touch vibration */ private Vibrator mVibrator = null; @@ -106,15 +112,6 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch /** Number of candidates displaying */ private int mWordCount; - private int mWordCountInNormalView; - /** List of word's index to convert from the position of the cursor */ - private ArrayList<Integer> mPositionToWordIndexArray; - /** The string to display candidates */ - private StringBuffer mCandidates; - /** List of the start position of each candidate */ - private ArrayList<Integer> mStartPositionArray; - /** List of the end position of each candidate */ - private ArrayList<Integer> mEndPositionArray; /** List of candidates */ private ArrayList<WnnWord> mWnnWordArray; @@ -122,31 +119,17 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch private GestureDetector mGestureDetector; /** The word pressed */ private WnnWord mWord; - /** Text on the select button */ - private String mSelectBottonText = null; - /** Text on the cancel button */ - private String mCancelBottonText = null; - /** Character width of the candidate area */ private int mLineLength = 0; - /** Word count on a single line in the candidate area */ - private int mLineWordCount = -1; - - /** {@code true} if the hardware keyboard is shown */ - private boolean mHardKeyboardHidden = true; + /** Number of lines displayed */ + private int mLineCount = 1; /** {@code true} if the candidate delete state is selected */ - private boolean mCandidateDeleteState = false; + private boolean mIsScaleUp = false; /** {@code true} if the full screen mode is selected */ private boolean mIsFullView = false; - /** {@code true} if the selection state is started */ - private boolean mHasStartedSelect = false; - - /** {@code true} if the candidate list is created */ - private boolean mHasCreatedCandidateList = false; - /** The event object for "touch" */ private MotionEvent mMotionEvent = null; @@ -154,7 +137,96 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch private int mDisplayEndOffset = 0; /** {@code true} if there are more candidates to display. */ private boolean mCanReadMore = false; + /** Width of {@code mReadMoreButton} */ + private int mReadMoreButtonWidth = 0; + /** Color of the candidates */ + private int mTextColor = 0; + /** Template object for each candidate and normal/full view change button */ + private TextView mViewCandidateTemplate; + /** Number of candidates in full view */ + private int mFullViewWordCount; + /** Number of candidates in the current line (in full view) */ + private int mFullViewOccupyCount; + /** View of the previous candidate (in full view) */ + private TextView mFullViewPrevView; + /** Id of the top line view (in full view) */ + private int mFullViewPrevLineTopId; + /** Layout of the previous candidate (in full view) */ + private RelativeLayout.LayoutParams mFullViewPrevParams; + /** Whether all candidates is displayed */ + private boolean mCreateCandidateDone; + /** Number of lines in normal view */ + private int mNormalViewWordCountOfLine; + /** general infomation about a display */ + private final DisplayMetrics mMetrics = new DisplayMetrics(); + + /** Event listener for touching a candidate */ + private OnTouchListener mCandidateOnTouch = new OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + if (mMotionEvent != null) { + return true; + } + + if ((event.getAction() == MotionEvent.ACTION_UP) + && (v instanceof TextView)) { + Drawable d = v.getBackground(); + if (d != null) { + d.setState(new int[] {}); + } + } + + mMotionEvent = event; + boolean ret = mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CANDIDATE_VIEW_TOUCH)); + mMotionEvent = null; + return ret; + } + }; + + /** Event listener for clicking a candidate */ + private OnClickListener mCandidateOnClick = new OnClickListener() { + public void onClick(View v) { + if (!v.isShown()) { + return; + } + + if (v instanceof TextView) { + TextView text = (TextView)v; + int wordcount = text.getId(); + WnnWord word = null; + word = mWnnWordArray.get(wordcount); + selectCandidate(word); + } + } + }; + + /** Event listener for long-clicking a candidate */ + private OnLongClickListener mCandidateOnLongClick = new OnLongClickListener() { + public boolean onLongClick(View v) { + if (mViewScaleUp == null) { + return false; + } + + if (!v.isShown()) { + return true; + } + + Drawable d = v.getBackground(); + if (d != null) { + if(d.getState().length == 0){ + return true; + } + } + + int wordcount = ((TextView)v).getId(); + mWord = mWnnWordArray.get(wordcount); + setViewScaleUp(true, mWord); + + return true; + } + }; + + /** * Constructor */ @@ -169,12 +241,9 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch */ public TextCandidatesViewManager(int displayLimit) { this.mDisplayLimit = displayLimit; - this.mCandidates = new StringBuffer(); - this.mStartPositionArray = new ArrayList<Integer>(); - this.mEndPositionArray = new ArrayList<Integer>(); - this.mPositionToWordIndexArray = new ArrayList<Integer>(); this.mWnnWordArray = new ArrayList<WnnWord>(); this.mAutoHideMode = true; + mMetrics.setToDefaults(); } /** @@ -190,35 +259,131 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch public View initView(OpenWnn parent, int width, int height) { mWnn = parent; mViewWidth = width; + mViewHeight = height; + mPortrait = + (parent.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE); - mSelectBottonText = mWnn.getResources().getString(R.string.button_candidate_select); - mCancelBottonText = mWnn.getResources().getString(R.string.button_candidate_cancel); + Resources r = mWnn.getResources(); - mViewBody = (ViewGroup)parent.getLayoutInflater().inflate(R.layout.candidates, null); + LayoutInflater inflater = parent.getLayoutInflater(); + mViewBody = (ViewGroup)inflater.inflate(R.layout.candidates, null); mViewBodyScroll = (ScrollView)mViewBody.findViewById(R.id.candview_scroll); - mViewBodyScroll.setOnTouchListener(this); - - mViewBodyText = (EditText)mViewBody.findViewById(R.id.text_candidates_view); - mViewBodyText.setOnTouchListener(this); - mViewBodyText.setTextSize(18.0f); - mViewBodyText.setLineSpacing(6.0f, 1.5f); - mViewBodyText.setIncludeFontPadding(false); - mViewBodyText.setFocusable(true); - mViewBodyText.setCursorVisible(false); - mViewBodyText.setGravity(Gravity.TOP); + mViewBodyScroll.setOnTouchListener(mCandidateOnTouch); + + mViewCandidateBase = (ViewGroup)mViewBody.findViewById(R.id.candview_base); + + createNormalCandidateView(); + mViewCandidateList2nd = (RelativeLayout)mViewBody.findViewById(R.id.candidates_2nd_view); + + mReadMoreButtonWidth = r.getDrawable(R.drawable.cand_up).getMinimumWidth(); + + mTextColor = r.getColor(R.color.candidate_text); - mReadMoreText = (TextView)mViewBody.findViewById(R.id.read_more_text); - mReadMoreText.setText(mWnn.getResources().getString(R.string.read_more)); - mReadMoreText.setTextSize(24.0f); + mReadMoreButton = (ImageView)mViewBody.findViewById(R.id.read_more_text); + mReadMoreButton.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View v, MotionEvent event) { + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: + if (mIsFullView) { + mReadMoreButton.setImageResource(R.drawable.cand_down_press); + } else { + mReadMoreButton.setImageResource(R.drawable.cand_up_press); + } + break; + case MotionEvent.ACTION_UP: + if (mIsFullView) { + mReadMoreButton.setImageResource(R.drawable.cand_down); + } else { + mReadMoreButton.setImageResource(R.drawable.cand_up); + } + break; + default: + break; + } + return false; + } + }); + mReadMoreButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + if (!v.isShown()) { + return; + } + + if (mIsFullView) { + mIsFullView = false; + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.LIST_CANDIDATES_NORMAL)); + } else { + mIsFullView = true; + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.LIST_CANDIDATES_FULL)); + } + } + }); - mPortrait = (height > 450)? true : false; setViewType(CandidatesViewManager.VIEW_TYPE_CLOSE); mGestureDetector = new GestureDetector(this); + + View scaleUp = (View)inflater.inflate(R.layout.candidate_scale_up, null); + mViewScaleUp = scaleUp; + + /* select button */ + Button b = (Button)scaleUp.findViewById(R.id.candidate_select); + b.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + selectCandidate(mWord); + } + }); + + /* cancel button */ + b = (Button)scaleUp.findViewById(R.id.candidate_cancel); + b.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.UPDATE_CANDIDATE)); + } + }); + return mViewBody; } + /** + * Create the normal candidate view + */ + private void createNormalCandidateView() { + mViewCandidateList1st = (LinearLayout)mViewBody.findViewById(R.id.candidates_1st_view); + mViewCandidateList1st.setOnTouchListener(mCandidateOnTouch); + mViewCandidateList1st.setOnClickListener(mCandidateOnClick); + + int line = getMaxLine(); + int width = mViewWidth; + for (int i = 0; i < line; i++) { + LinearLayout lineView = new LinearLayout(mViewBodyScroll.getContext()); + lineView.setOrientation(LinearLayout.HORIZONTAL); + LinearLayout.LayoutParams layoutParams = + new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, + ViewGroup.LayoutParams.WRAP_CONTENT); + lineView.setLayoutParams(layoutParams); + for (int j = 0; j < (width / getCandidateMinimumWidth()); j++) { + TextView tv = createCandidateView(); + lineView.addView(tv); + } + + if (i == 0) { + TextView tv = createCandidateView(); + layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT); + layoutParams.weight = 0; + layoutParams.gravity = Gravity.RIGHT; + tv.setLayoutParams(layoutParams); + + lineView.addView(tv); + mViewCandidateTemplate = tv; + } + mViewCandidateList1st.addView(lineView); + } + } + /** @see CandidatesViewManager#getCurrentView */ public View getCurrentView() { return mViewBody; @@ -227,7 +392,6 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch /** @see CandidatesViewManager#setViewType */ public void setViewType(int type) { boolean readMore = setViewLayout(type); - addNewlineIfNecessary(); if (readMore) { displayCandidates(this.mConverter, false, -1); @@ -242,7 +406,7 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch } } else { if (mViewBody.isShown()) { - mWnn.setCandidatesViewShown(false); + mWnn.setCandidatesViewShown(false); } } } @@ -256,62 +420,28 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch */ private boolean setViewLayout(int type) { mViewType = type; - boolean readMore = false; - int height; - if (type == CandidatesViewManager.VIEW_TYPE_CLOSE) { - mViewBody.setVisibility(View.GONE); - return false; - } - - mViewBody.setVisibility(View.VISIBLE); + setViewScaleUp(false, null); - if (mPortrait) { - if (type == CandidatesViewManager.VIEW_TYPE_NORMAL) { - mViewBodyScroll.scrollTo(0, 0); - height = LINE_HEIGHT * LINE_NUM_PORTRAIT; - mViewBodyText.setMaxLines(LINE_NUM_PORTRAIT); - mViewBodyText.setLines(LINE_NUM_PORTRAIT); - if (mWordCount > 1) { - int displayEndCount = (mWordCountInNormalView != -1) ? mWordCountInNormalView : mWordCount; - int endPosition = mEndPositionArray.get(displayEndCount - 1); - mViewBodyText.setText(mCandidates.subSequence(0, endPosition)); - mViewBodyText.setSelection(0, 0); - mViewBodyText.setCursorVisible(false); - } - mViewBodyText.setMinimumHeight(height); - } else { - height = LINE_HEIGHT * LINE_NUM_PORTRAIT_FULL; - mViewBodyText.setMaxLines(DISPLAY_LINE_MAX_COUNT); - readMore = true; - mViewBodyText.setMinimumHeight(height); - } - } else { - if (type == CandidatesViewManager.VIEW_TYPE_NORMAL) { - mViewBodyScroll.scrollTo(0, 0); - height = LINE_HEIGHT * LINE_NUM_LANDSCAPE; - mViewBodyText.setMaxLines(LINE_NUM_LANDSCAPE); - mViewBodyText.setLines(LINE_NUM_LANDSCAPE); - if (mWordCount > 1) { - int displayEndCount = (mWordCountInNormalView != -1) ? mWordCountInNormalView : mWordCount; - int endPosition = mEndPositionArray.get(displayEndCount - 1); - mViewBodyText.setText(mCandidates.subSequence(0, endPosition)); - mViewBodyText.setSelection(0, 0); - mViewBodyText.setCursorVisible(false); - } - mViewBodyText.setMinimumHeight(height); - } else { - height = LINE_HEIGHT * LINE_NUM_LANDSCAPE_FULL * ((!mHardKeyboardHidden) ? 2 : 1); - mViewBodyText.setMaxLines(DISPLAY_LINE_MAX_COUNT); - readMore = true; - mViewBodyText.setMinimumHeight(height); - } - } + switch (type) { + case CandidatesViewManager.VIEW_TYPE_CLOSE: + mViewCandidateBase.setMinimumHeight(-1); + return false; - mViewBody.updateViewLayout(mViewBodyScroll, - new FrameLayout.LayoutParams(mViewWidth, height)); + case CandidatesViewManager.VIEW_TYPE_NORMAL: + mViewBodyScroll.scrollTo(0, 0); + mViewCandidateList1st.setVisibility(View.VISIBLE); + mViewCandidateList2nd.setVisibility(View.GONE); + mViewCandidateBase.setMinimumHeight(-1); + int line = (mPortrait) ? LINE_NUM_PORTRAIT : LINE_NUM_LANDSCAPE; + mViewCandidateList1st.setMinimumHeight(getCandidateMinimumHeight() * line); + return false; - mViewHeight = height; - return readMore; + case CandidatesViewManager.VIEW_TYPE_FULL: + default: + mViewCandidateList2nd.setVisibility(View.VISIBLE); + mViewCandidateBase.setMinimumHeight(mViewHeight); + return true; + } } /** @see CandidatesViewManager#getViewType */ @@ -321,11 +451,24 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch /** @see CandidatesViewManager#displayCandidates */ public void displayCandidates(WnnEngine converter) { + mCanReadMore = false; mDisplayEndOffset = 0; mIsFullView = false; - int maxLine = getMaxLine(); - displayCandidates(converter, true, maxLine); + mFullViewWordCount = 0; + mFullViewOccupyCount = 0; + mFullViewPrevLineTopId = 0; + mCreateCandidateDone = false; + mNormalViewWordCountOfLine = 0; + + clearCandidates(); + mConverter = converter; + setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); + + mViewCandidateTemplate.setVisibility(View.VISIBLE); + mViewCandidateTemplate.setBackgroundResource(R.drawable.cand_back); + + displayCandidates(converter, true, getMaxLine()); } /** @see CandidatesViewManager#getMaxLine */ @@ -335,59 +478,6 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch } /** - * Add a new line if necessary. - */ - private void addNewlineIfNecessary() { - int maxLine = getMaxLine(); - int lineNum = mViewBodyText.getLineCount(); - if (lineNum == 0) { - lineNum = countLineUsingMeasureText(mViewBodyText.getText()); - } - int textLength = mViewBodyText.length(); - for (int i = 0; i < 3; i++) { - mPositionToWordIndexArray.add(textLength + i,-1); - } - for (int i = 0; i < maxLine - lineNum; i++) { - mViewBodyText.append("\n"); - } - if (mPortrait && maxLine == -1 && lineNum == 1) { - mViewBodyText.append("\n"); - } - return; - } - - /** - * Count lines using {@link Paint#measureText}. - * - * @param text The text to display - * @return Number of lines - */ - private int countLineUsingMeasureText(CharSequence text) { - StringBuffer tmpText = new StringBuffer(text); - mStartPositionArray.add(mWordCount,tmpText.length()); - int padding = - ViewConfiguration.getScrollBarSize() + - mViewBodyText.getPaddingLeft() + - mViewBodyText.getPaddingRight(); - TextPaint p = mViewBodyText.getPaint(); - int lineCount = 1; - int start = 0; - for (int i = 0; i < mWordCount; i++) { - if (tmpText.length() < start || - tmpText.length() < mStartPositionArray.get(i + 1)) { - return 1; - } - float lineLength = measureText(p, tmpText, start, mStartPositionArray.get(i + 1)); - if (lineLength > (mViewWidth - padding)) { - lineCount++; - start = mStartPositionArray.get(i); - i--; - } - } - return lineCount; - } - - /** * Display the candidates. * * @param converter {@link WnnEngine} which holds candidates. @@ -399,302 +489,284 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch return; } - mHasStartedSelect = false; + /* Concatenate the candidates already got and the last one in dispFirst mode */ + int displayLimit = mDisplayLimit; - /* Clear for the first time */ - if (dispFirst) { - clearCandidates(); - this.mConverter = converter; - mLastWord = null; - mHasCreatedCandidateList = true; - } + boolean isHistorySequence = false; + boolean isBreak = false; - /* Concatenate the candidates already got and the last one in dispFirst mode */ - boolean category = false; - StringBuffer tmp = new StringBuffer(); - tmp.append(mCandidates); - if ((!dispFirst) && (mLastWord != null) && (mLastWord.candidate.length() != 0)) { - mLineWordCount = -1; + /* Get candidates */ + WnnWord result = null; + while ((displayLimit == -1 || mWordCount < displayLimit)) { + result = converter.getNextCandidate(); - StringBuffer displayText = createDisplayText(mLastWord, maxLine); + if (result == null) { + break; + } + + setCandidate(false, result); + + if (dispFirst && (maxLine < mLineCount)) { + mCanReadMore = true; + isBreak = true; + break; + } + } - if (category) { - tmp.append(displayText); - category = false; + if (!isBreak && !mCreateCandidateDone) { + /* align left if necessary */ + createNextLine(); + mCreateCandidateDone = true; + } + + if (mWordCount < 1) { /* no candidates */ + if (mAutoHideMode) { + mWnn.setCandidatesViewShown(false); + return; } else { - mWnnWordArray.add(mWordCount, mLastWord); - int i = 0; - for (i = 0 ; i < tmp.length(); i++) { - if (!displayText.subSequence(i, i + 1).equals("\n")) { - break; - } - } - mStartPositionArray.add(mWordCount, tmp.length() + i); - tmp.append(displayText); - mEndPositionArray.add(mWordCount, tmp.length()); - tmp.append(CANDIDATE_SEPARATOR); - mWordCount++; + mCanReadMore = false; + mIsFullView = false; + setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); } - mLastWord = null; } - int displayLimit = mDisplayLimit; - StringBuffer displayText; - /* Get candidates */ - WnnWord result; - while ((result = converter.getNextCandidate()) != null && (displayLimit == -1 || mWordCount < displayLimit)) { + setReadMore(); - displayText = createDisplayText(result, maxLine); - if (displayText == null) { - continue; + if (!(mViewBody.isShown())) { + mWnn.setCandidatesViewShown(true); + } + return; + } + + /** + * Add a candidate into the list. + * @param isCategory {@code true}:caption of category, {@code false}:normal word + * @param word A candidate word + */ + private void setCandidate(boolean isCategory, WnnWord word) { + int textLength = measureText(word.candidate, 0, word.candidate.length()); + TextView template = mViewCandidateTemplate; + textLength += template.getPaddingLeft() + template.getPaddingRight(); + int maxWidth = mViewWidth; + + TextView textView; + if (mIsFullView || getMaxLine() < mLineCount) { + /* Full view */ + int indentWidth = mViewWidth / FULL_VIEW_DIV; + int occupyCount = Math.min((textLength + indentWidth) / indentWidth, FULL_VIEW_DIV); + if (isCategory) { + occupyCount = FULL_VIEW_DIV; } - - mWnnWordArray.add(mWordCount, result); - int i = 0; - for (i = 0 ; i < tmp.length(); i++) { - if (!displayText.subSequence(i, i + 1).equals("\n")) { - break; + + if (FULL_VIEW_DIV < (mFullViewOccupyCount + occupyCount)) { + if (FULL_VIEW_DIV != mFullViewOccupyCount) { + mFullViewPrevParams.width += (FULL_VIEW_DIV - mFullViewOccupyCount) * indentWidth; + mViewCandidateList2nd.updateViewLayout(mFullViewPrevView, mFullViewPrevParams); } + mFullViewOccupyCount = 0; + mFullViewPrevLineTopId = mFullViewPrevView.getId(); + mLineCount++; } - mStartPositionArray.add(mWordCount, tmp.length() + i); - tmp.append(displayText); - mEndPositionArray.add(mWordCount,tmp.length()); - tmp.append(CANDIDATE_SEPARATOR); - mWordCount++; - - if (mIsFullView) { - continue; + + RelativeLayout layout = mViewCandidateList2nd; + + int width = indentWidth * occupyCount; + int height = getCandidateMinimumHeight(); + RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height); + + if (mFullViewPrevLineTopId == 0) { + params.addRule(RelativeLayout.ALIGN_PARENT_TOP); + } else { + params.addRule(RelativeLayout.BELOW, mFullViewPrevLineTopId); } - - mViewBodyText.setText(tmp); - int lineNum = mViewBodyText.getLineCount(); - if (lineNum == 0) { - lineNum = countLineUsingMeasureText(mViewBodyText.getText()); - if (lineNum == -1) { - return; - } + + if (mFullViewOccupyCount == 0) { + params.addRule(RelativeLayout.ALIGN_PARENT_LEFT); + } else { + params.addRule(RelativeLayout.RIGHT_OF, (mWordCount - 1)); } - if (dispFirst && lineNum > maxLine) { - if (mWordCount == 1) { - setViewLayout(CandidatesViewManager.VIEW_TYPE_FULL); - maxLine = -1; - mIsFullView = true; - continue; - } - - mCanReadMore = true; - mLastWord = result; - if (mWordCount > 1) { - tmp.delete(mStartPositionArray.get(mWordCount - 1), tmp.length()); - mWnnWordArray.remove(mWordCount -1); - mStartPositionArray.remove(mWordCount -1); - mEndPositionArray.remove(mWordCount -1); - } else { + textView = (TextView) layout.getChildAt(mFullViewWordCount); + if (textView == null) { + textView = createCandidateView(); + textView.setLayoutParams(params); + + mViewCandidateList2nd.addView(textView); + } else { + mViewCandidateList2nd.updateViewLayout(textView, params); + } + + mFullViewOccupyCount += occupyCount; + mFullViewWordCount++; + mFullViewPrevView = textView; + mFullViewPrevParams = params; + + } else { + textLength = Math.max(textLength, getCandidateMinimumWidth()); + + /* Normal view */ + int nextEnd = mLineLength + textLength; + if (mLineCount == 1) { + maxWidth -= getCandidateMinimumWidth(); + } + + if ((maxWidth < nextEnd) && (mWordCount != 0)) { + createNextLine(); + if (getMaxLine() < mLineCount) { + mLineLength = 0; + /* Call this method again to add the candidate in the full view */ + setCandidate(isCategory, word); return; } - mWordCount--; - mWordCountInNormalView = mWordCount; - break; + + mLineLength = textLength; } else { - if (mWordCount == 1) { - setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); - } + mLineLength = nextEnd; } - } - - /* save the candidate string */ - mCandidates.delete(0, mCandidates.length()); - mCandidates.append(tmp); - int j = 0; - for (int i = 0; i < mWordCount; i++) { - while (j <= mEndPositionArray.get(i)) { - if (j < mStartPositionArray.get(i)) { - mPositionToWordIndexArray.add(j,-1); - } else { - mPositionToWordIndexArray.add(j,i); + + LinearLayout lineView = (LinearLayout) mViewCandidateList1st.getChildAt(mLineCount - 1); + textView = (TextView) lineView.getChildAt(mNormalViewWordCountOfLine); + + if (isCategory) { + if (mLineCount == 1) { + mViewCandidateTemplate.setBackgroundDrawable(null); } - j++; + mLineLength += CANDIDATE_LEFT_ALIGN_THRESHOLD; } - mPositionToWordIndexArray.add(j,-1); - mPositionToWordIndexArray.add(j + 1,-1); - } - if (mAutoHideMode && mWordCount < 1) { - mWnn.setCandidatesViewShown(false); - return; + mNormalViewWordCountOfLine++; } - int displayEndCount = - ((mViewType == CandidatesViewManager.VIEW_TYPE_NORMAL) && - (mWordCountInNormalView != -1)) - ? mWordCountInNormalView : mWordCount; - int endPosition = mEndPositionArray.get(displayEndCount - 1); - endPosition += CANDIDATE_SEPARATOR.length(); - - if (mDisplayEndOffset > 0 && maxLine != -1) { - mCanReadMore = true; - String str = mCandidates.substring(0, mDisplayEndOffset); - StringBuffer sub = new StringBuffer(str); - sub.append(CANDIDATE_SEPARATOR); - mViewBodyText.setText(sub.subSequence(0, mDisplayEndOffset + CANDIDATE_SEPARATOR.length())); + textView.setText(word.candidate); + textView.setTextColor(mTextColor); + textView.setId(mWordCount); + textView.setVisibility(View.VISIBLE); + textView.setPressed(false); + + if (isCategory) { + textView.setOnClickListener(null); + textView.setOnLongClickListener(null); + textView.setBackgroundDrawable(null); } else { - mViewBodyText.setText(mCandidates.subSequence(0, endPosition)); - addNewlineIfNecessary(); + textView.setOnClickListener(mCandidateOnClick); + textView.setOnLongClickListener(mCandidateOnLongClick); + textView.setBackgroundResource(R.drawable.cand_back); } + textView.setOnTouchListener(mCandidateOnTouch); - /* Set EditText */ - mViewBodyText.setSelection(0, 0); - mViewBodyText.setCursorVisible(false); - mViewBodyText.requestFocus(); + if (maxWidth < textLength) { + textView.setEllipsize(TextUtils.TruncateAt.END); + } else { + textView.setEllipsize(null); + } - setReadMore(); + ImageSpan span = null; + if (word.candidate.equals(" ")) { + span = new ImageSpan(mWnn, R.drawable.word_half_space, + DynamicDrawableSpan.ALIGN_BASELINE); + } else if (word.candidate.equals("\u3000" /* full-width space */)) { + span = new ImageSpan(mWnn, R.drawable.word_full_space, + DynamicDrawableSpan.ALIGN_BASELINE); + } - if (!(mViewBody.isShown())) { - mWnn.setCandidatesViewShown(true); + if (span != null) { + SpannableString spannable = new SpannableString(" "); + spannable.setSpan(span, 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + textView.setText(spannable); } - return; + + mWnnWordArray.add(mWordCount, word); + mWordCount++; } /** - * Display {@code mReadMoreText} if there are more candidates. - * + * Create a view for a candidate. + * @return the view */ - private void setReadMore() { - if (mCanReadMore && !mIsFullView && !mCandidateDeleteState) { - mReadMoreText.setHeight(mViewHeight); - mReadMoreText.setVisibility(View.VISIBLE); - } else { - mReadMoreText.setVisibility(View.GONE); - } + private TextView createCandidateView() { + TextView text = new TextView(mViewBodyScroll.getContext()); + text.setTextSize(20); + text.setBackgroundResource(R.drawable.cand_back); + text.setGravity(Gravity.CENTER); + text.setSingleLine(); + text.setPadding(4, 4, 4, 4); + text.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT, + 1.0f)); + text.setMinHeight(getCandidateMinimumHeight()); + text.setMinimumWidth(getCandidateMinimumWidth()); + return text; } - + /** - * Create the string to show in the candidate window. - * - * @param word A candidate word - * @param maxLine The maximum number of line in the candidate window - * @return The string to show + * Display {@code mReadMoreText} if there are more candidates. */ - private StringBuffer createDisplayText(WnnWord word, int maxLine) { - StringBuffer tmp = new StringBuffer(); - int padding = ViewConfiguration.getScrollBarSize() + - mViewBodyText.getPaddingLeft() + - mViewBodyText.getPaddingRight(); - int width = mViewWidth - padding; - TextPaint p = mViewBodyText.getPaint(); - float newLineLength = measureText(p, word.candidate, 0, word.candidate.length()); - float separatorLength = measureText(p, CANDIDATE_SEPARATOR, 0, CANDIDATE_SEPARATOR.length()); - boolean isFirstWordOfLine = (mLineLength == 0); - - int maxWidth = 0; - int lineLength = 0; - lineLength += newLineLength; - maxWidth += width - separatorLength; - - mLineLength += newLineLength; - mLineLength += separatorLength; - mLineWordCount++; - - if (mLineWordCount == 0) { - mLineLength = lineLength; - mLineLength += separatorLength; + private void setReadMore() { + if (mIsScaleUp) { + mReadMoreButton.setVisibility(View.GONE); + mViewCandidateTemplate.setVisibility(View.GONE); + return; } - - if (!isFirstWordOfLine && (width < mLineLength) && mLineWordCount != 0) { - tmp.append("\n"); - mLineLength = lineLength; - mLineLength += separatorLength; - mLineWordCount = 0; + + if (mIsFullView) { + mReadMoreButton.setVisibility(View.VISIBLE); + mReadMoreButton.setImageResource(R.drawable.cand_down); + } else { + if (mCanReadMore) { + mReadMoreButton.setVisibility(View.VISIBLE); + mReadMoreButton.setImageResource(R.drawable.cand_up); + } else { + mReadMoreButton.setVisibility(View.GONE); + mViewCandidateTemplate.setVisibility(View.GONE); + } } - return adjustDisplaySize(word, tmp, lineLength, maxWidth, maxLine); } - /** - * Adjust the width of specified string - * - * @param word A candidate word - * @param tmp A work area - * @param newLineLength The line length to show - * @param maxwidth The maximum number of width that can be displayed in the candidate window - * @param maxLine The maximum number of line in the candidate window - * @return The string to show + * Clear the list of the normal candidate view. */ - private StringBuffer adjustDisplaySize(WnnWord word, StringBuffer tmp, int newLineLength, int maxWidth, int maxLine) { - StringBuffer string = new StringBuffer(tmp); - if (newLineLength > maxWidth) { - TextPaint p = mViewBodyText.getPaint(); - float separatorLength = measureText(p, CANDIDATE_SEPARATOR, 0, CANDIDATE_SEPARATOR.length()); - int length = word.candidate.length(); - int size = 0; - int count = 0; - int line = 0; - float LineLength = 0; - for (int i = 0 ; i < length;i++) { - string.append(word.candidate.charAt(i)); - LineLength = measureText(p, string, count, count + 1); - size += LineLength; - if (size > maxWidth) { - line++; - string.delete(string.length() - 1, string.length()); - if (mDisplayEndOffset == 0 && line == maxLine && mWordCount == 0) { - mDisplayEndOffset = count; - } - string.append("\n"); - string.append(word.candidate.charAt(i)); - size = 0; - count++; - LineLength = measureText(p, string, count, count + 1); - size += LineLength; - } - count++; + private void clearNormalViewCandidate() { + LinearLayout candidateList = mViewCandidateList1st; + int lineNum = candidateList.getChildCount(); + for (int i = 0; i < lineNum; i++) { + + LinearLayout lineView = (LinearLayout)candidateList.getChildAt(i); + int size = lineView.getChildCount(); + for (int j = 0; j < size; j++) { + View v = lineView.getChildAt(j); + v.setVisibility(View.GONE); } - - mLineWordCount = 0; - mLineLength = newLineLength; - mLineLength += separatorLength; - } else { - string.append(word.candidate); } - return string; } - /** @see CandidatesViewManager#clearCandidates */ public void clearCandidates() { - mViewBodyText.setText(""); + clearNormalViewCandidate(); + + RelativeLayout layout = mViewCandidateList2nd; + int size = layout.getChildCount(); + for (int i = 0; i < size; i++) { + View v = layout.getChildAt(i); + v.setVisibility(View.GONE); + } - mCandidates.delete(0, mCandidates.length()); + mLineCount = 1; mWordCount = 0; - mWordCountInNormalView = -1; - mStartPositionArray.clear(); - mEndPositionArray.clear(); - mPositionToWordIndexArray.clear(); mWnnWordArray.clear(); mLineLength = 0; - mLineWordCount = -1; + mIsFullView = false; + setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); if (mAutoHideMode) { setViewLayout(CandidatesViewManager.VIEW_TYPE_CLOSE); } - if (mCandidateDeleteState) { - mViewBodyScroll.removeAllViews(); - mViewBodyScroll.addView(mViewBodyText); - } - mCandidateDeleteState = false; - - mHasCreatedCandidateList = false; - if (mAutoHideMode && mViewBody.isShown()) { mWnn.setCandidatesViewShown(false); } - if (!mAutoHideMode) { - mCanReadMore = false; - setReadMore(); - } + mCanReadMore = false; + setReadMore(); } /** @see CandidatesViewManager#setPreferences */ @@ -716,30 +788,11 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch } /** - * @see OnTouchListener#onTouch - */ - public boolean onTouch(View v, MotionEvent event) { - if (mMotionEvent != null) { - return true; - } - - mMotionEvent = event; - boolean ret = mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CANDIDATE_VIEW_TOUCH)); - mMotionEvent = null; - return ret; - } - - /** - * Process CANDIDATE_VIEW_TOUCH event. + * Process {@code OpenWnnEvent.CANDIDATE_VIEW_TOUCH} event. * * @return {@code true} if event is processed; {@code false} if otherwise */ public boolean onTouchSync() { - if (!mHasCreatedCandidateList) { - return false; - } - - mViewBodyText.setCursorVisible(false); return mGestureDetector.onTouchEvent(mMotionEvent); } @@ -761,61 +814,20 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.SELECT_CANDIDATE, word)); } - /** - * Convert a coordinate into the offset of character - * - * @param x The horizontal position - * @param y The vertical position - * @return The offset of character - */ - public int getOffset(int x,int y){ - Layout layout = mViewBodyText.getLayout(); - int line = layout.getLineForVertical(y); - - if( y >= layout.getLineTop(line+1) ){ - return layout.getText().length(); - } - - int offset = layout.getOffsetForHorizontal(line,x); - offset -= TOUCH_ADJUSTED_VALUE; - if (offset < 0) { - offset = 0; - } - return offset; - } - - /** from GestureDetector.OnGestureListener class */ + /** @see android.view.GestureDetector.OnGestureListener#onDown */ public boolean onDown(MotionEvent arg0) { - if (!mCandidateDeleteState) { - int position = getOffset((int)arg0.getX(),(int)arg0.getY()); - int wordIndex = mPositionToWordIndexArray.get(position); - if (wordIndex != -1) { - int startPosition = mStartPositionArray.get(wordIndex); - int endPosition = 0; - if (mDisplayEndOffset > 0 && getViewType() == CandidatesViewManager.VIEW_TYPE_NORMAL) { - endPosition = mDisplayEndOffset + CANDIDATE_SEPARATOR.length(); - } else { - endPosition = mEndPositionArray.get(wordIndex); - } - mViewBodyText.setSelection(startPosition, endPosition); - mViewBodyText.setCursorVisible(true); - mViewBodyText.invalidate(); - mHasStartedSelect = true; - } - } - return true; + return false; } - /** from GestureDetector.OnGestureListener class */ + /** @see android.view.GestureDetector.OnGestureListener#onFling */ public boolean onFling(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) { - - if (mCandidateDeleteState) { + if (mIsScaleUp) { return false; } boolean consumed = false; - if (arg1.getY() < arg0.getY()) { - if (mViewType == CandidatesViewManager.VIEW_TYPE_NORMAL) { + if (arg1 != null && arg0 != null && arg1.getY() < arg0.getY()) { + if ((mViewType == CandidatesViewManager.VIEW_TYPE_NORMAL) && mCanReadMore) { if (mVibrator != null) { try { mVibrator.vibrate(30); } catch (Exception ex) { } } @@ -837,176 +849,120 @@ public class TextCandidatesViewManager implements CandidatesViewManager, OnTouch return consumed; } - /** from GestureDetector.OnGestureListener class */ + /** @see android.view.GestureDetector.OnGestureListener#onLongPress */ public void onLongPress(MotionEvent arg0) { - if (!mHasStartedSelect) { - return; - } - - mWord = null; - int position = getOffset((int)arg0.getX(),(int)arg0.getY()); - if (position < mPositionToWordIndexArray.size()) { - int wordIndex = mPositionToWordIndexArray.get(position); - if (wordIndex != -1) { - mCandidateDeleteState = true; - mViewBodyScroll.removeAllViews(); - mViewBody.updateViewLayout(mViewBodyScroll, - new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, - LayoutParams.WRAP_CONTENT)); - setReadMore(); - mWord = mWnnWordArray.get(wordIndex); - LinearLayout mLinerLayout; - mLinerLayout = new LinearLayout(mViewBodyScroll.getContext()); - mLinerLayout.setOrientation(LinearLayout.VERTICAL); - Resources r = mViewBodyScroll.getContext().getResources(); - int color = r.getColor(R.color.candidate_background); - mLinerLayout.setBackgroundColor(color); - TextView text = new TextView(mViewBodyScroll.getContext()); - text.setText(mWord.candidate); - text.setTextColor(mWnn.getResources().getColor(R.color.candidate_text)); - text.setTextSize(mWnn.getResources().getDimension(R.dimen.candidate_delete_word_size)); - text.setGravity(Gravity.CENTER); - mLinerLayout.addView(text); - - LinearLayout linearLayout = new LinearLayout(mViewBodyScroll.getContext()); - linearLayout.setOrientation(LinearLayout.HORIZONTAL); - - linearLayout.addView(createSelectButton()); - - linearLayout.addView(createCancelButton()); - linearLayout.setGravity(Gravity.CENTER); - mLinerLayout.addView(linearLayout); - mViewBodyScroll.addView(mLinerLayout); - } - } + return; } - /** from GestureDetector.OnGestureListener class */ - public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, - float arg3) { + /** @see android.view.GestureDetector.OnGestureListener#onScroll */ + public boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3) { return false; } - /** from GestureDetector.OnGestureListener class */ + /** @see android.view.GestureDetector.OnGestureListener#onShowPress */ public void onShowPress(MotionEvent arg0) { } - /** from GestureDetector.OnGestureListener class */ + /** @see android.view.GestureDetector.OnGestureListener#onSingleTapUp */ public boolean onSingleTapUp(MotionEvent arg0) { - if (!mHasStartedSelect) { - return true; - } - - WnnWord word = null; - - if (!mCandidateDeleteState) { - int position = getOffset((int)arg0.getX(),(int)arg0.getY()); - if (position < mPositionToWordIndexArray.size()) { - int wordIndex = mPositionToWordIndexArray.get(position); - if (wordIndex != -1) { - word = mWnnWordArray.get(wordIndex); - } - - if (word != null) { - selectCandidate(word); - return true; - } else { - return false; - } - } - } return false; } /** - * Create the select button. - * - * @return Button The button object + * Retrieve the width of string to draw. + * + * @param text The string + * @param start The start position (specified by the number of character) + * @param end The end position (specified by the number of character) + * @return The width of string to draw + */ + public int measureText(CharSequence text, int start, int end) { + TextPaint paint = mViewCandidateTemplate.getPaint(); + return (int)paint.measureText(text, start, end); + } + + /** + * Switch list/enlarge view mode. + * @param up {@code true}:enlarge, {@code false}:list + * @param word The candidate word to be enlarged. */ - private Button createSelectButton(){ - final Button selectB; - selectB= new Button(mViewBodyScroll.getContext()) { - public boolean onTouchEvent(MotionEvent me) { - boolean ret = super.onTouchEvent(me); - Drawable d = getBackground(); - switch (me.getAction()) { - case MotionEvent.ACTION_DOWN: - d.setState(View.PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET); - break; - case MotionEvent.ACTION_UP: - default: - d.clearColorFilter(); - break; - } - return ret; - } - }; - selectB.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - selectCandidate(mWord); + private void setViewScaleUp(boolean up, WnnWord word) { + if (up == mIsScaleUp || (mViewScaleUp == null)) { + return; + } + + if (up) { + setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); + mViewCandidateList1st.setVisibility(View.GONE); + mViewCandidateBase.setMinimumHeight(-1); + mViewCandidateBase.addView(mViewScaleUp); + TextView text = (TextView)mViewScaleUp.findViewById(R.id.candidate_scale_up_text); + text.setText(word.candidate); + if (!mPortrait) { + Resources r = mViewBodyScroll.getContext().getResources(); + text.setTextSize(r.getDimensionPixelSize(R.dimen.candidate_delete_word_size_landscape)); } - }); - selectB.setText(mSelectBottonText); - return selectB; + + mIsScaleUp = true; + setReadMore(); + } else { + mIsScaleUp = false; + mViewCandidateBase.removeView(mViewScaleUp); + } } /** - * Create the cancel button - * - * @return Button the button object + * Create a layout for the next line. */ - private Button createCancelButton(){ - final Button cancelB; - cancelB= new Button(mViewBodyScroll.getContext()) { - public boolean onTouchEvent(MotionEvent me) { - boolean ret = super.onTouchEvent(me); - Drawable d = getBackground(); - switch (me.getAction()) { - case MotionEvent.ACTION_DOWN: - d.setState(View.PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET); - break; - case MotionEvent.ACTION_UP: - default: - d.clearColorFilter(); - break; + private void createNextLine() { + int lineCount = mLineCount; + if (mIsFullView || getMaxLine() < lineCount) { + /* Full view */ + mFullViewOccupyCount = 0; + mFullViewPrevLineTopId = mFullViewPrevView.getId(); + } else { + /* Normal view */ + LinearLayout lineView = (LinearLayout) mViewCandidateList1st.getChildAt(lineCount - 1); + float weight = 0; + if (mLineLength < CANDIDATE_LEFT_ALIGN_THRESHOLD) { + if (lineCount == 1) { + mViewCandidateTemplate.setVisibility(View.GONE); } - return ret; + } else { + weight = 1.0f; } - }; - cancelB.setOnClickListener(new View.OnClickListener() { - public void onClick(View v) { - setViewLayout(CandidatesViewManager.VIEW_TYPE_NORMAL); - mViewBodyScroll.removeAllViews(); - mCandidateDeleteState = false; - mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.UPDATE_CANDIDATE)); - mViewBodyScroll.addView(mViewBodyText); + + LinearLayout.LayoutParams params + = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.WRAP_CONTENT, + weight); + + int child = lineView.getChildCount(); + for (int i = 0; i < child; i++) { + View view = lineView.getChildAt(i); + + if (view != mViewCandidateTemplate) { + view.setLayoutParams(params); + } } - }); - cancelB.setText(mCancelBottonText); - return cancelB; - } + mLineLength = 0; + mNormalViewWordCountOfLine = 0; + } + mLineCount++; + } /** - * Set the show state of hardware keyboard - * - * @param hidden {@code true} if the hardware keyboard is not shown + * @return the minimum width of a candidate view. */ - public void setHardKeyboardHidden(boolean hidden) { - mHardKeyboardHidden = hidden; + private int getCandidateMinimumWidth() { + return (int)(CANDIDATE_MINIMUM_WIDTH * mMetrics.density); } /** - * Retrieve the width of string to draw - * (Emoji is supported by this method) - * - * @param paint The information to draw - * @param text The string - * @param start The start position (specified by the number of character) - * @param end The end position (specified by the number of character) - * @return The width of string to draw - */ - public int measureText(TextPaint paint, CharSequence text, int start, int end) { - return (int)Styled.measureText(paint, new TextPaint(), text, start, end, null); + * @return the minimum height of a candidate view. + */ + private int getCandidateMinimumHeight() { + return (int)(CANDIDATE_MINIMUM_HEIGHT * mMetrics.density); } } diff --git a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java index 40e780f..a12496a 100644 --- a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java +++ b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsEdit.java @@ -23,7 +23,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.Editable; -import android.text.SpannableStringBuilder; import android.text.TextWatcher; import android.util.Log; import android.view.KeyEvent; @@ -57,8 +56,6 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O /** The error code (Already registered the same word) */ private static final int RETURN_SAME_WORD = -11; - /** The error code (Insufficient the free space of the user dictionary) */ - private static final int RETURN_USER_DICTIONARY_FULL = -12; /** The focus view and pair view */ private static View sFocusingView = null; @@ -181,12 +178,14 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O */ public void setAddButtonControl() { + /* Text changed listener for the reading text */ mReadEditText.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { + /* Enable/disable the "Add" button */ if ((mReadEditText.getText().toString().length() != 0) && (mCandidateEditText.getText().toString().length() != 0)) { mEntryButton.setEnabled(true); @@ -195,12 +194,14 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O } } }); + /* Text changed listener for the candidate text */ mCandidateEditText.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void onTextChanged(CharSequence s, int start, int before, int count) { + /* Enable/disable the "Add" button */ if ((mReadEditText.getText().toString().length() != 0) && (mCandidateEditText.getText().toString().length() != 0)) { mEntryButton.setEnabled(true); @@ -301,6 +302,12 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O } }) .setCancelable(true) + .setOnCancelListener(new DialogInterface.OnCancelListener() { + public void onCancel(DialogInterface dialog) { + mEntryButton.setEnabled(true); + mCancelButton.setEnabled(true); + } + }) .create(); case DIALOG_CONTROL_OVER_MAX_TEXT_SIZE: @@ -328,22 +335,26 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O * @return {@code true} if success; {@code false} if fail. */ private boolean addDictionary(String stroke, String candidate) { - boolean ret; + /* create WnnWord from the strings */ WnnWord wnnWordAdd = new WnnWord(); wnnWordAdd.stroke = stroke; wnnWordAdd.candidate = candidate; + /* add word event */ OpenWnnEvent event = new OpenWnnEvent(OpenWnnEvent.ADD_WORD, WnnEngine.DICTIONARY_TYPE_USER, wnnWordAdd); + /* notify the event to IME */ ret = sendEventToIME(event); if (ret == false) { + /* get error code if the process in IME is failed */ int ret_code = event.errorCode; if (ret_code == RETURN_SAME_WORD) { showDialog(DIALOG_CONTROL_WORDS_DUPLICATE); } } else { + /* update the dictionary */ mListInstance = createUserDictionaryToolsList(); } return ret; @@ -355,7 +366,7 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O * @param word The information of word */ private void deleteDictionary(WnnWord word) { - + /* delete the word from the dictionary */ mListInstance = createUserDictionaryToolsList(); boolean deleted = mListInstance.deleteWord(word); if (!deleted) { @@ -363,7 +374,6 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O R.string.user_dictionary_delete_fail, Toast.LENGTH_LONG).show(); } - } /** @@ -379,6 +389,7 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O */ private boolean inputDataCheck(View v) { + /* return false if the length of the string exceeds the limit. */ if ((((TextView)v).getTextSize()) > MAX_TEXT_SIZE) { showDialog(DIALOG_CONTROL_OVER_MAX_TEXT_SIZE); Log.e("OpenWnn", "inputDataCheck() : over max string length."); @@ -394,10 +405,11 @@ public abstract class UserDictionaryToolsEdit extends Activity implements View.O private void screenTransition() { finish(); + /* change to the word listing window */ Intent intent = new Intent(); intent.setClassName(mPackageName, mListViewName); startActivity(intent); - + } } diff --git a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java index e0182bf..0b9a2cd 100644 --- a/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java +++ b/src/jp/co/omronsoft/openwnn/UserDictionaryToolsList.java @@ -23,7 +23,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; -import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.view.Display; @@ -41,6 +40,12 @@ import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; import android.widget.Toast; +import android.widget.Button; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; + /** * The abstract class for user dictionary tool. @@ -74,8 +79,9 @@ public abstract class UserDictionaryToolsList extends Activity /** The size of font*/ private final int WORD_TEXT_SIZE = 16; - /** The color of background */ + /** The color of background (unfocused item) */ private final int UNFOCUS_BACKGROUND_COLOR = 0xFF242424; + /** The color of background (focused item) */ private final int FOCUS_BACKGROUND_COLOR = 0xFFFF8500; /** The minimum count of registered words */ @@ -83,31 +89,33 @@ public abstract class UserDictionaryToolsList extends Activity /** The maximum count of registered words */ private final int MAX_WORD_COUNT = 100; /** Maximum word count to display */ - private final int MAX_LIST_WORD_COUNT = 50; - /** Maximum word count to display (at the first step) */ - private final int MAX_LIST_WORD_DELAY_COUNT = 50; + private final int MAX_LIST_WORD_COUNT = 100; /** The threshold time of the double tapping */ private final int DOUBLE_TAP_TIME = 300; /** Widgets which constitute this screen of activity */ private Menu mMenu; + /** Table layout for the lists */ private TableLayout mTableLayout; + /** Focusing view */ private static View sFocusingView = null; + /** Focusing pair view */ private static View sFocusingPairView = null; /** Objects which control state transitions */ private Intent mIntent; - private OpenWnnEvent mEvent; - private Handler mDelayUpdateHandler; /** The number of the registered words */ - private int mWordCount = -1; + private int mWordCount = 0; - /** The state of menu items */ + /** The state of "Add" menu item */ private boolean mAddMenuEnabled; + /** The state of "Edit" menu item */ private boolean mEditMenuEnabled; + /** The state of "Delete" menu item */ private boolean mDeleteMenuEnabled; + /** The state of "Initialize" menu item */ private boolean mInitMenuEnabled; /** {@code true} if the menu option is initialized */ @@ -121,7 +129,20 @@ public abstract class UserDictionaryToolsList extends Activity /** The time of previous action */ private static long sJustBeforeActionTime = -1; - private boolean mHasCreatedList = false; + /** List of the words in the user dictionary */ + private ArrayList<WnnWord> mWordList = null; + + /** Work area for sorting the word list */ + private WnnWord[] mSortData; + + /** Whether the view is initialized */ + private boolean mInit = false; + + /** Page left button */ + private Button mLeftButton = null; + + /** Page right button */ + private Button mRightButton = null; /** * Send the specified event to IME @@ -130,6 +151,8 @@ public abstract class UserDictionaryToolsList extends Activity * @return {@code true} if this event is processed */ protected abstract boolean sendEventToIME(OpenWnnEvent ev); + /** Get the comparator for sorting the list */ + protected abstract Comparator<WnnWord> getComparator(); /** * Create the header @@ -142,10 +165,36 @@ public abstract class UserDictionaryToolsList extends Activity super.onCreate(savedInstanceState); - mDelayUpdateHandler = new Handler(); /* create XML layout */ requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.user_dictionary_tools_list); + mTableLayout = (TableLayout)findViewById(R.id.user_dictionary_tools_table); + + Button b = (Button)findViewById(R.id.user_dictionary_left_button); + b.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + int pos = mWordCount - MAX_LIST_WORD_COUNT; + if (0 <= pos) { + mWordCount = pos; + updateWordList(); + mTableLayout.findViewById(1).requestFocus(); + } + } + }); + mLeftButton = b; + + b = (Button)findViewById(R.id.user_dictionary_right_button); + b.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + int pos = mWordCount + MAX_LIST_WORD_COUNT; + if (pos < mWordList.size()) { + mWordCount = pos; + updateWordList(); + mTableLayout.findViewById(1).requestFocus(); + } + } + }); + mRightButton = b; } @@ -154,13 +203,13 @@ public abstract class UserDictionaryToolsList extends Activity super.onStart(); sBeforeSelectedViewID = -1; sJustBeforeActionTime = -1; - updateWordList(); - } + mWordList = getWords(); + + headerCreate(); + final TextView leftText = (TextView) findViewById(R.id.user_dictionary_tools_list_title_words_count); + leftText.setText(mWordList.size() + "/" + MAX_WORD_COUNT); - /** @see android.app.Activity#onStop */ - @Override protected void onStop() { - super.onStop(); - mDelayUpdateHandler.removeCallbacks(updateWordListRunnable); + updateWordList(); } /** @@ -213,7 +262,7 @@ public abstract class UserDictionaryToolsList extends Activity /* [menu] add a word */ - if ((mWordCount >= MAX_WORD_COUNT) || !mHasCreatedList) { + if (mWordList.size() >= MAX_WORD_COUNT) { /* disable if the number of registered word exceeds MAX_WORD_COUNT */ mAddMenuEnabled = false; } else { @@ -221,13 +270,17 @@ public abstract class UserDictionaryToolsList extends Activity } /* [menu] edit a word/delete a word */ - if (mWordCount <= MIN_WORD_COUNT) { + if (mWordList.size() <= MIN_WORD_COUNT) { /* disable if no word is registered or no word is selected */ mEditMenuEnabled = false; mDeleteMenuEnabled = false; } else { mEditMenuEnabled = true; - mDeleteMenuEnabled = true; + if (mSelectedWords) { + mDeleteMenuEnabled = true; + } else { + mDeleteMenuEnabled = false; + } } /* [menu] clear the dictionary (always enabled) */ @@ -323,7 +376,7 @@ public abstract class UserDictionaryToolsList extends Activity CharSequence focusPairString = ((TextView)sFocusingPairView).getText(); WnnWord wnnWordSearch = new WnnWord(); - if (mSelectedViewID > MAX_WORD_COUNT) { + if (mSelectedViewID > MAX_WORD_COUNT) { wnnWordSearch.stroke = focusPairString.toString(); wnnWordSearch.candidate = focusString.toString(); } else { @@ -339,38 +392,19 @@ public abstract class UserDictionaryToolsList extends Activity Toast.makeText(getApplicationContext(), R.string.user_dictionary_delete_fail, Toast.LENGTH_LONG).show(); - return; + return; } - - int id = mSelectedViewID; - id = (MAX_WORD_COUNT < id) ? id - MAX_WORD_COUNT : id; - View v = null; - - mTableLayout.removeView((View)sFocusingView.getParent()); - for (int i = id; i < MAX_WORD_COUNT; i++) { - v = mTableLayout.findViewById(i); - if (v != null) { - break; - } - } - - if (v == null) { - for (int i = id; 0 <= i; i--) { - v = mTableLayout.findViewById(i); - if (v != null) { - break; - } - } - } - - if (v != null) { - ((View)v.getParent()).requestFocus(); + mWordList = getWords(); + int size = mWordList.size(); + if (size <= mWordCount) { + int newPos = (mWordCount - MAX_LIST_WORD_COUNT); + mWordCount = (0 <= newPos) ? newPos : 0; } - mWordCount--; + updateWordList(); TextView leftText = (TextView) findViewById(R.id.user_dictionary_tools_list_title_words_count); - leftText.setText(mWordCount + "/" + MAX_WORD_COUNT); + leftText.setText(size + "/" + MAX_WORD_COUNT); if (mInitializedMenu) { onCreateOptionsMenu(mMenu); @@ -395,10 +429,15 @@ public abstract class UserDictionaryToolsList extends Activity /* show the message */ Toast.makeText(getApplicationContext(), R.string.dialog_clear_user_dictionary_done, Toast.LENGTH_LONG).show(); + mWordList = new ArrayList<WnnWord>(); + mWordCount = 0; updateWordList(); - if (mInitializedMenu) { - onCreateOptionsMenu(mMenu); - } + TextView leftText = (TextView) findViewById(R.id.user_dictionary_tools_list_title_words_count); + leftText.setText(mWordList.size() + "/" + MAX_WORD_COUNT); + + if (mInitializedMenu) { + onCreateOptionsMenu(mMenu); + } } }; @@ -447,9 +486,7 @@ public abstract class UserDictionaryToolsList extends Activity sFocusingPairView.setBackgroundColor(FOCUS_BACKGROUND_COLOR); mSelectedWords = true; } else { - if (mSelectedViewID == 0) { - mSelectedWords = false; - } + mSelectedWords = false; ((TextView)v).setTextColor(Color.LTGRAY); v.setBackgroundColor(UNFOCUS_BACKGROUND_COLOR); ((TextView)sFocusingPairView).setTextColor(Color.LTGRAY); @@ -464,6 +501,7 @@ public abstract class UserDictionaryToolsList extends Activity * Add the word */ public void wordAdd() { + /** change to the edit window */ screenTransition(Intent.ACTION_INSERT, mEditViewName); } @@ -551,149 +589,141 @@ public abstract class UserDictionaryToolsList extends Activity finish(); } - /** - * Update the word list. + * Get the list of words in the user dictionary. + * @return The list of words */ - private void updateWordList() { - mWordCount = 0; - WnnWord wnnWordSearch = new WnnWord(); - mEvent = new OpenWnnEvent(OpenWnnEvent.LIST_WORDS_IN_USER_DICTIONARY, - WnnEngine.DICTIONARY_TYPE_USER, - wnnWordSearch); - sendEventToIME(mEvent); + private ArrayList<WnnWord> getWords() { + WnnWord word = new WnnWord(); + OpenWnnEvent event = new OpenWnnEvent(OpenWnnEvent.LIST_WORDS_IN_USER_DICTIONARY, + WnnEngine.DICTIONARY_TYPE_USER, + word); + sendEventToIME(event); - mTableLayout = (TableLayout)findViewById(R.id.user_dictionary_tools_table); - mTableLayout.removeAllViews(); - - if (createWordList(mWordCount,MAX_LIST_WORD_COUNT, this)) { - headerCreate(); - final TextView leftText = (TextView) findViewById(R.id.user_dictionary_tools_list_title_words_count); - leftText.setText(R.string.user_dictionary_creating_wordlist); - mDelayUpdateHandler.removeCallbacks(updateWordListRunnable); - mDelayUpdateHandler.postDelayed(updateWordListRunnable, 0); - } else { - if (mSelectedViewID >= 0) { - View v; - v = mTableLayout.findViewById(mSelectedViewID); - if (v != null) { - ((View)v.getParent()).requestFocus(); - } else { - mSelectedViewID--; - if (mSelectedViewID < 0) { - mSelectedViewID = 0; - } - v = mTableLayout.findViewById(mSelectedViewID); - if (v != null) { - ((View)v.getParent()).requestFocus(); - } - } + ArrayList<WnnWord> list = new ArrayList<WnnWord>(); + for (int i = 0; i < MAX_WORD_COUNT; i++) { + event = new OpenWnnEvent(OpenWnnEvent.GET_WORD, word); + if (!sendEventToIME(event)) { + break; } - headerCreate(); - final TextView leftText = (TextView) findViewById(R.id.user_dictionary_tools_list_title_words_count); - leftText.setText(mWordCount + "/" + MAX_WORD_COUNT); - mHasCreatedList = true; + list.add(event.word); } + + compareTo(list); + + return list; } /** - * Handler for updating the word list. + * Sort the list of words + * @param array The array list of the words */ - private final Runnable updateWordListRunnable = new Runnable() { - public void run() { - UserDictionaryToolsList self = UserDictionaryToolsList.this; - if (createWordList(mWordCount,mWordCount+MAX_LIST_WORD_DELAY_COUNT, self)) { - mDelayUpdateHandler.removeCallbacks(updateWordListRunnable); - mDelayUpdateHandler.postDelayed(updateWordListRunnable, 0); - } else { - mDelayUpdateHandler.removeCallbacks(updateWordListRunnable); - final TextView leftText = (TextView) findViewById(R.id.user_dictionary_tools_list_title_words_count); - leftText.setText(mWordCount + "/" + MAX_WORD_COUNT); - mHasCreatedList = true; - if (mInitializedMenu) { - onCreateOptionsMenu(mMenu); - } - } - } - }; - + protected void compareTo(ArrayList<WnnWord> array) { + mSortData = new WnnWord[array.size()]; + array.toArray(mSortData); + Arrays.sort(mSortData, getComparator()); + } + + /** - * Create the list of words. - * - * @param position Start position to create the list - * @param max Maximum number of words to display - * @param self UserDictionaryToolsList - * @return {@code true} if more words undisplayed; {@code false} if no more. + * Update the word list. */ - private boolean createWordList(int position ,int max, UserDictionaryToolsList self) { - boolean ret = true; - - if (position >= MAX_WORD_COUNT) { - return false; + private void updateWordList() { + if (!mInit) { + mInit = true; + mSelectedViewID = 1; + + Window window = getWindow(); + WindowManager windowManager = window.getWindowManager(); + Display display = windowManager.getDefaultDisplay(); + int system_width = display.getWidth(); + + for (int i = 1; i <= MAX_LIST_WORD_COUNT; i++) { + TableRow row = new TableRow(this); + UserDictionaryToolsListFocus stroke = new UserDictionaryToolsListFocus(this); + stroke.setId(i); + stroke.setWidth(system_width/2); + stroke.setTextSize(WORD_TEXT_SIZE); + stroke.setTextColor(Color.LTGRAY); + stroke.setBackgroundColor(UNFOCUS_BACKGROUND_COLOR); + stroke.setSingleLine(); + stroke.setPadding(1,0,1,1); + stroke.setEllipsize(TextUtils.TruncateAt.END); + stroke.setClickable(true); + stroke.setFocusable(true); + stroke.setFocusableInTouchMode(true); + stroke.setOnTouchListener(this); + stroke.setOnFocusChangeListener(this); + + UserDictionaryToolsListFocus candidate = new UserDictionaryToolsListFocus(this); + candidate.setId(i+MAX_WORD_COUNT); + candidate.setWidth(system_width/2); + candidate.setTextSize(WORD_TEXT_SIZE); + candidate.setTextColor(Color.LTGRAY); + candidate.setBackgroundColor(UNFOCUS_BACKGROUND_COLOR); + candidate.setSingleLine(); + candidate.setPadding(1,0,1,1); + candidate.setEllipsize(TextUtils.TruncateAt.END); + candidate.setClickable(true); + candidate.setFocusable(true); + candidate.setFocusableInTouchMode(true); + candidate.setOnTouchListener(this); + candidate.setOnFocusChangeListener(this); + + stroke.setPairView(candidate); + candidate.setPairView(stroke); + + row.addView(stroke); + row.addView(candidate); + mTableLayout.addView(row, tableCreateParam(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + } + } + + int size = mWordList.size(); + int start = mWordCount; + + TextView t = (TextView)findViewById(R.id.user_dictionary_position_indicator); + if (size <= MAX_LIST_WORD_COUNT) { + ((View)mLeftButton.getParent()).setVisibility(View.GONE); + } else { + ((View)mLeftButton.getParent()).setVisibility(View.VISIBLE); + int last = (start + MAX_LIST_WORD_COUNT); + t.setText((start + 1) + " - " + Math.min(last, size)); + + mLeftButton.setEnabled(start != 0); + mRightButton.setEnabled(last < size); } - Window window = getWindow(); - WindowManager windowManager = window.getWindowManager(); - Display display = windowManager.getDefaultDisplay(); - int system_width = display.getWidth(); - WnnWord wnnWordGet = new WnnWord(); - mEvent = new OpenWnnEvent(OpenWnnEvent.GET_WORD, wnnWordGet); + + int selectedId = mSelectedViewID - ((MAX_WORD_COUNT < mSelectedViewID) ? MAX_WORD_COUNT : 0); - int i; - for (i = position; i < max; i++) { - if (!sendEventToIME(mEvent)) { - ret = false; - break; + for (int i = 0; i < MAX_LIST_WORD_COUNT; i++) { + if ((size - 1) < (start + i)) { + if ((0 < i) && (selectedId == (i + 1))) { + mTableLayout.findViewById(i).requestFocus(); + } + + ((View)(mTableLayout.findViewById(i + 1)).getParent()).setVisibility(View.GONE); + continue; } - wnnWordGet = mEvent.word; + + WnnWord wnnWordGet; + wnnWordGet = mSortData[start + i]; int len_stroke = wnnWordGet.stroke.length(); int len_candidate = wnnWordGet.candidate.length(); if (len_stroke == 0 || len_candidate == 0) { - ret = false; break; } - mWordCount++; - TableRow row = new TableRow(self); - UserDictionaryToolsListFocus stroke = new UserDictionaryToolsListFocus(self); - stroke.setId(mWordCount); - stroke.setText(wnnWordGet.stroke); - stroke.setWidth(system_width/2); - stroke.setTextSize(WORD_TEXT_SIZE); - stroke.setTextColor(Color.LTGRAY); - stroke.setBackgroundColor(UNFOCUS_BACKGROUND_COLOR); - stroke.setSingleLine(); - stroke.setPadding(1,0,1,1); - stroke.setEllipsize(TextUtils.TruncateAt.END); - stroke.setClickable(true); - stroke.setFocusable(true); - stroke.setFocusableInTouchMode(true); - stroke.setOnTouchListener(self); - stroke.setOnFocusChangeListener(self); - - UserDictionaryToolsListFocus candidate = new UserDictionaryToolsListFocus(self); - candidate.setId(mWordCount+MAX_WORD_COUNT); - candidate.setText(wnnWordGet.candidate); - candidate.setWidth(system_width/2); - candidate.setTextSize(WORD_TEXT_SIZE); - candidate.setTextColor(Color.LTGRAY); - candidate.setBackgroundColor(UNFOCUS_BACKGROUND_COLOR); - candidate.setSingleLine(); - candidate.setPadding(1,0,1,1); - candidate.setEllipsize(TextUtils.TruncateAt.END); - candidate.setClickable(true); - candidate.setFocusable(true); - candidate.setFocusableInTouchMode(true); - candidate.setOnTouchListener(self); - candidate.setOnFocusChangeListener(self); - - stroke.setPairView(candidate); - candidate.setPairView(stroke); - - row.addView(stroke); - row.addView(candidate); - mTableLayout.addView(row, tableCreateParam(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + if (selectedId == i + 1) { + mTableLayout.findViewById(i + 1).requestFocus(); + } + + TextView text = (TextView)mTableLayout.findViewById(i + 1); + text.setText(wnnWordGet.stroke); + text = (TextView)mTableLayout.findViewById(i + 1 + MAX_WORD_COUNT); + text.setText(wnnWordGet.candidate); + ((View)text.getParent()).setVisibility(View.VISIBLE); } mTableLayout.requestLayout(); - return ret; } } diff --git a/src/jp/co/omronsoft/openwnn/WnnDictionary.java b/src/jp/co/omronsoft/openwnn/WnnDictionary.java index c83d140..c4b2aa5 100644 --- a/src/jp/co/omronsoft/openwnn/WnnDictionary.java +++ b/src/jp/co/omronsoft/openwnn/WnnDictionary.java @@ -84,7 +84,7 @@ public interface WnnDictionary { public static final int POS_TYPE_V3 = 2; /** Type of a part of speech (Top of sentence) */ public static final int POS_TYPE_BUNTOU = 3; - /** Type of a part of speech (Single chinese character) */ + /** Type of a part of speech (Single Chinese character) */ public static final int POS_TYPE_TANKANJI = 4; /** Type of a part of speech (Numeric) */ public static final int POS_TYPE_SUUJI = 5; diff --git a/src/jp/co/omronsoft/openwnn/ZH/CN/KeyboardListPreferenceZHCN.java b/src/jp/co/omronsoft/openwnn/ZH/CN/KeyboardListPreferenceZHCN.java index 21f569b..e0a7e98 100644 --- a/src/jp/co/omronsoft/openwnn/ZH/CN/KeyboardListPreferenceZHCN.java +++ b/src/jp/co/omronsoft/openwnn/ZH/CN/KeyboardListPreferenceZHCN.java @@ -36,7 +36,7 @@ public class KeyboardListPreferenceZHCN extends ListPreference { this(context, null); } - /** see android.preference.DialogPreference#onDialogClosed */ + /** @see android.preference.DialogPreference#onDialogClosed */ @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); diff --git a/src/jp/co/omronsoft/openwnn/ZH/CN/TutorialZHCN.java b/src/jp/co/omronsoft/openwnn/ZH/CN/TutorialZHCN.java new file mode 100644 index 0000000..7bbc87e --- /dev/null +++ b/src/jp/co/omronsoft/openwnn/ZH/CN/TutorialZHCN.java @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2008,2009 OMRON SOFTWARE Co., Ltd. + * + * 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. + */ + +/* + * Copyright (C) 2008-2009 Google Inc. + * + * 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 jp.co.omronsoft.openwnn.ZH.CN; + +import jp.co.omronsoft.openwnn.*; +import jp.co.omronsoft.openwnn.ZH.*; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.drawable.Drawable; +import android.os.Handler; +import android.os.Message; +import android.text.Layout; +import android.text.SpannableStringBuilder; +import android.text.StaticLayout; +import android.text.Spanned; +import android.text.style.ImageSpan; +import android.text.style.DynamicDrawableSpan; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MotionEvent; +import android.view.View; +import android.view.View.OnTouchListener; +import android.widget.PopupWindow; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +public class TutorialZHCN implements OnTouchListener { + + private List<Bubble> mBubbles = new ArrayList<Bubble>(); + private View mInputView; + private OpenWnnZHCN mIme; + private int[] mLocation = new int[2]; + private static final int MSG_SHOW_BUBBLE = 0; + + private int mBubbleIndex; + private boolean mEnableKeyTouch = false; + + Handler mHandler = new Handler() { + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case MSG_SHOW_BUBBLE: + Bubble bubba = (Bubble) msg.obj; + bubba.show(mLocation[0], mLocation[1]); + break; + } + } + }; + + class Bubble { + Drawable bubbleBackground; + int x; + int y; + int width; + int gravity; + CharSequence text; + boolean dismissOnTouch; + boolean dismissOnClose; + PopupWindow window; + TextView textView; + View inputView; + + Bubble(Context context, View inputView, + int backgroundResource, int bx, int by, int description, int guide) { + + CharSequence text = context.getResources().getText(description); + init(context, inputView, backgroundResource, bx, by, text, guide, false); + } + + Bubble(Context context, View inputView, int backgroundResource, int bx, int by, + CharSequence description, int guide, boolean leftAlign) { + init(context, inputView, backgroundResource, bx, by, description, guide, leftAlign); + } + + void init(Context context, View inputView, int backgroundResource, + int bx, int by, CharSequence description, int guide, boolean leftAlign) { + bubbleBackground = context.getResources().getDrawable(backgroundResource); + x = bx; + y = by; + width = (int) (inputView.getWidth() * 0.9); + this.gravity = Gravity.TOP | Gravity.LEFT; + text = new SpannableStringBuilder() + .append(description) + .append("\n") + .append(context.getResources().getText(guide)); + this.dismissOnTouch = true; + this.dismissOnClose = false; + this.inputView = inputView; + window = new PopupWindow(context); + window.setBackgroundDrawable(null); + LayoutInflater inflate = + (LayoutInflater) context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + textView = (TextView) inflate.inflate(R.layout.bubble_text, null); + textView.setBackgroundDrawable(bubbleBackground); + textView.setText(text); + if (leftAlign) { + textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); + } + window.setContentView(textView); + window.setFocusable(false); + window.setTouchable(true); + window.setOutsideTouchable(false); + } + + private int chooseSize(PopupWindow pop, View parentView, CharSequence text, TextView tv) { + int wid = tv.getPaddingLeft() + tv.getPaddingRight(); + int ht = tv.getPaddingTop() + tv.getPaddingBottom(); + + /* + * Figure out how big the text would be if we laid it out to the + * full width of this view minus the border. + */ + int cap = width - wid; + + Layout l = new StaticLayout(text, tv.getPaint(), cap, + Layout.Alignment.ALIGN_NORMAL, 1, 0, true); + float max = 0; + for (int i = 0; i < l.getLineCount(); i++) { + max = Math.max(max, l.getLineWidth(i)); + } + + /* + * Now set the popup size to be big enough for the text plus the border. + */ + pop.setWidth(width); + pop.setHeight(ht + l.getHeight()); + return l.getHeight(); + } + + void show(int offx, int offy) { + int textHeight = chooseSize(window, inputView, text, textView); + offy -= textView.getPaddingTop() + textHeight; + if (inputView.getVisibility() == View.VISIBLE + && inputView.getWindowVisibility() == View.VISIBLE) { + try { + if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) offy -= window.getHeight(); + if ((gravity & Gravity.RIGHT) == Gravity.RIGHT) offx -= window.getWidth(); + textView.setOnTouchListener(new View.OnTouchListener() { + public boolean onTouch(View view, MotionEvent me) { + boolean ret = !mEnableKeyTouch; + switch (me.getAction()) { + case MotionEvent.ACTION_UP: + if (mBubbleIndex >= mBubbles.size()) { + mInputView.setOnTouchListener(null); + } else { + TutorialZHCN.this.next(); + } + break; + default: + break; + } + return ret; + } + }); + window.showAtLocation(inputView, Gravity.NO_GRAVITY, x + offx, y + offy); + } catch (Exception e) { + } + } + } + + void hide() { + if (window.isShowing()) { + textView.setOnTouchListener(null); + window.dismiss(); + } + } + + boolean isShowing() { + return window.isShowing(); + } + } + + /** Constructor */ + public TutorialZHCN(OpenWnnZHCN ime, View inputView, DefaultSoftKeyboardZH inputManager) { + mInputView = inputView; + mIme = ime; + + Context context = inputView.getContext(); + int inputWidth = inputView.getWidth(); + Resources r = inputView.getContext().getResources(); + final int x = inputWidth / 20; + r.getDimensionPixelOffset(R.dimen.bubble_pointer_offset); + + SpannableStringBuilder spannable = new SpannableStringBuilder(); + Bubble button; + + spannable.clear(); + spannable.append(r.getText(R.string.tip_en_to_open_keyboard)); + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + spannable.clear(); + spannable.append(r.getText(R.string.tip_en_to_close_keyboard)); + + setSpan(spannable, "\u2190", R.drawable.tutorial_back); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + spannable, R.string.touch_to_continue, false); + mBubbles.add(button); + + button = new Bubble(context, inputView, + R.drawable.dialog_bubble, x, 0, + R.string.tip_en_end_of_tutorial, R.string.touch_to_finish); + mBubbles.add(button); + } + + private void setSpan(SpannableStringBuilder spannable, String marker, int imageResourceId) { + String text = spannable.toString(); + int target = text.indexOf(marker); + while (0 <= target) { + ImageSpan span = new ImageSpan(mIme, imageResourceId, + DynamicDrawableSpan.ALIGN_BOTTOM); + spannable.setSpan(span, target, target + 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + target = text.indexOf(marker, target + 1); + } + } + + public void start() { + mInputView.getLocationInWindow(mLocation); + mBubbleIndex = -1; + mInputView.setOnTouchListener(this); + next(); + } + + boolean next() { + if (mBubbleIndex >= 0) { + if (!mBubbles.get(mBubbleIndex).isShowing()) { + return true; + } + for (int i = 0; i <= mBubbleIndex; i++) { + mBubbles.get(i).hide(); + } + } + mBubbleIndex++; + if (mBubbleIndex >= mBubbles.size()) { + mEnableKeyTouch = true; + mIme.sendDownUpKeyEvents(-1); + mIme.tutorialDone(); + return false; + } + + mHandler.sendMessageDelayed( + mHandler.obtainMessage(MSG_SHOW_BUBBLE, mBubbles.get(mBubbleIndex)), 500); + return true; + } + + void hide() { + for (int i = 0; i < mBubbles.size(); i++) { + mBubbles.get(i).hide(); + } + mInputView.setOnTouchListener(null); + } + + public boolean close() { + mHandler.removeMessages(MSG_SHOW_BUBBLE); + hide(); + return true; + } + + public boolean onTouch(View v, MotionEvent event) { + boolean ret = !mEnableKeyTouch; + if (event.getAction() == MotionEvent.ACTION_UP) { + if (mBubbleIndex >= mBubbles.size()) { + mInputView.setOnTouchListener(null); + } + } + return ret; + } +} diff --git a/src/jp/co/omronsoft/openwnn/ZH/CN/UserDictionaryToolsListZHCN.java b/src/jp/co/omronsoft/openwnn/ZH/CN/UserDictionaryToolsListZHCN.java index 7691560..586aba0 100644 --- a/src/jp/co/omronsoft/openwnn/ZH/CN/UserDictionaryToolsListZHCN.java +++ b/src/jp/co/omronsoft/openwnn/ZH/CN/UserDictionaryToolsListZHCN.java @@ -19,6 +19,7 @@ package jp.co.omronsoft.openwnn.ZH.CN; import jp.co.omronsoft.openwnn.*; import android.view.View; import android.view.Window; +import java.util.Comparator; /** * The user dictionary tool class for Chinese IME. @@ -34,6 +35,7 @@ public class UserDictionaryToolsListZHCN extends UserDictionaryToolsList { mEditViewName = "jp.co.omronsoft.openwnn.ZH.CN.UserDictionaryToolsEditZHCN"; mPackageName = "jp.co.omronsoft.openwnn"; } + /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#headerCreate */ @Override protected void headerCreate() { getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, @@ -55,4 +57,15 @@ public class UserDictionaryToolsListZHCN extends UserDictionaryToolsList { return false; } + /** @see jp.co.omronsoft.openwnn.UserDictionaryToolsList#getComparator */ + @Override protected Comparator<WnnWord> getComparator() { + return new ListComparatorZHCN(); + } + + /** Comparator class for sorting the list of Chinese user dictionary */ + protected class ListComparatorZHCN implements Comparator<WnnWord>{ + public int compare(WnnWord word1, WnnWord word2) { + return word1.stroke.compareTo(word2.stroke); + }; + } } diff --git a/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java b/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java index 139c4a8..29ce85a 100644 --- a/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java +++ b/src/jp/co/omronsoft/openwnn/ZH/DefaultSoftKeyboardZH.java @@ -19,6 +19,7 @@ package jp.co.omronsoft.openwnn.ZH; import jp.co.omronsoft.openwnn.*; import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; import android.inputmethodservice.Keyboard; import android.util.Log; import android.view.View; @@ -38,16 +39,11 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { KEYMODE_CN_PINYIN, KEYMODE_CN_ALPHABET, KEYMODE_CN_HALF_NUMBER }; - /** Definition for {@code mInputType} (toggle) */ - private static final int INPUT_TYPE_TOGGLE = 1; - /** Definition for {@code mInputType} (commit instantly) */ - private static final int INPUT_TYPE_INSTANT = 2; - /** The constant for mFixedKeyMode. It means that input mode is not fixed. */ - private static final int INVALID_KEYMODE = -1; + private static final int INVALID_KEYMODE = -1; /** Input mode that is not able to be changed. If ENABLE_CHANGE_KEYMODE is set, input mode can change. */ - private int mFixedKeyMode = INVALID_KEYMODE; + private int[] mLimitedKeyMode = null; /** Input mode that is given the first priority. If ENABLE_CHANGE_KEYMODE is set, input mode can change. */ private int mPreferenceKeyMode = INVALID_KEYMODE; @@ -62,32 +58,34 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { /** Auto caps mode */ private boolean mEnableAutoCaps = true; - /** - * Default constructor - */ + /** Whether the InputType is null */ + private boolean mIsInputTypeNull = false; + + + /** Default constructor */ public DefaultSoftKeyboardZH() { mCurrentLanguage = LANG_CN; mCurrentKeyboardType = KEYBOARD_QWERTY; mShiftOn = KEYBOARD_SHIFT_OFF; mCurrentKeyMode = KEYMODE_CN_PINYIN; } - + /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#createKeyboards */ @Override protected void createKeyboards(OpenWnn parent) { mKeyboard = new Keyboard[3][2][4][2][7][2]; if (mHardKeyboardHidden) { - /* Create the suitable keyboard object */ - if (mDisplayMode == DefaultSoftKeyboard.PORTRAIT) { - createKeyboardsPortrait(parent); - } else { - - } + /* Create the suitable keyboard object */ + if (mDisplayMode == DefaultSoftKeyboard.PORTRAIT) { + createKeyboardsPortrait(parent); + } else { + } } mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CHANGE_MODE, - OpenWnnJAJP.ENGINE_MODE_OPT_TYPE_QWERTY)); + OpenWnnZHCN.ENGINE_MODE_OPT_TYPE_QWERTY)); } + /** * Commit the pre-edit string for committing operation that is not explicit * (ex. when a candidate is selected) @@ -104,28 +102,21 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { * @param keyMode The type of input mode */ public void changeKeyMode(int keyMode) { - int targetMode = keyMode; - commitText(); + int targetMode = filterKeyMode(keyMode); + if (targetMode == INVALID_KEYMODE) { + return; + } + + commitText(); - if (mCapsLock) { - mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.INPUT_SOFT_KEY, + if (mCapsLock) { + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.INPUT_SOFT_KEY, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT))); - mCapsLock = false; - } - mShiftOn = KEYBOARD_SHIFT_OFF; - - if (mFixedKeyMode != INVALID_KEYMODE) { - targetMode = mFixedKeyMode; - } - - if (!mHardKeyboardHidden) { - if (targetMode == KEYMODE_CN_HALF_NUMBER) { - targetMode = KEYMODE_CN_ALPHABET; - } else if (targetMode == KEYMODE_CN_FULL_NUMBER) { - targetMode = KEYMODE_CN_PINYIN; - } + mCapsLock = false; } + mShiftOn = KEYBOARD_SHIFT_OFF; + Keyboard kbd = getModeChangeKeyboard(targetMode); mCurrentKeyMode = targetMode; @@ -163,9 +154,9 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#initView */ @Override public View initView(OpenWnn parent, int width, int height) { - View view = super.initView(parent, width, height); - changeKeyboard(mKeyboard[mCurrentLanguage][mDisplayMode][mCurrentKeyboardType][mShiftOn][mCurrentKeyMode][0]); - return view; + View view = super.initView(parent, width, height); + changeKeyboard(mKeyboard[mCurrentLanguage][mDisplayMode][mCurrentKeyboardType][mShiftOn][mCurrentKeyMode][0]); + return view; } /** @see jp.co.omronsoft.openwnn.DefaultSoftKeyboard#changeKeyboardType */ @@ -183,7 +174,9 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { switch (primaryCode) { case KEYCODE_QWERTY_TOGGLE_MODE: - nextKeyMode(); + if (!mIsInputTypeNull) { + nextKeyMode(); + } break; case KEYCODE_QWERTY_BACKSPACE: @@ -207,8 +200,8 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { break; case KEYCODE_QWERTY_EMOJI: - commitText(); - mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CHANGE_MODE, OpenWnnZHCN.ENGINE_MODE_SYMBOL)); + commitText(); + mWnn.onEvent(new OpenWnnEvent(OpenWnnEvent.CHANGE_MODE, OpenWnnZHCN.ENGINE_MODE_SYMBOL)); break; case KEYCODE_QWERTY_HAN_ALPHA: @@ -256,6 +249,7 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { break; } + /* update shift key's state */ if (!mCapsLock && (primaryCode != DefaultSoftKeyboard.KEYCODE_QWERTY_SHIFT)) { setShiftByEditorInfo(); } @@ -266,15 +260,25 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { super.setPreferences(pref, editor); int inputType = editor.inputType; - if (inputType == EditorInfo.TYPE_NULL) { - return; + if (mHardKeyboardHidden) { + if (inputType == EditorInfo.TYPE_NULL) { + if (!mIsInputTypeNull) { + mIsInputTypeNull = true; + } + return; + } + + if (mIsInputTypeNull) { + mIsInputTypeNull = false; + } } mEnableAutoCaps = pref.getBoolean("auto_caps", true); - mFixedKeyMode = INVALID_KEYMODE; + mLimitedKeyMode = null; mPreferenceKeyMode = INVALID_KEYMODE; mNoInput = true; mDisableKeyInput = false; + mCapsLock = false; switch (inputType & EditorInfo.TYPE_MASK_CLASS) { @@ -284,17 +288,23 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { break; case EditorInfo.TYPE_CLASS_PHONE: - mFixedKeyMode = KEYMODE_CN_PHONE; + if (mHardKeyboardHidden) { + mLimitedKeyMode = new int[] {KEYMODE_CN_PHONE}; + } else { + mLimitedKeyMode = new int[] {KEYMODE_CN_ALPHABET}; + } break; case EditorInfo.TYPE_CLASS_TEXT: switch (inputType & EditorInfo.TYPE_MASK_VARIATION) { case EditorInfo.TYPE_TEXT_VARIATION_PASSWORD: - mPreferenceKeyMode = KEYMODE_CN_ALPHABET; + mLimitedKeyMode = new int[] {KEYMODE_CN_ALPHABET, KEYMODE_CN_HALF_NUMBER}; break; case EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS: + mLimitedKeyMode = new int[] {KEYMODE_CN_ALPHABET, KEYMODE_CN_HALF_NUMBER}; + break; case EditorInfo.TYPE_TEXT_VARIATION_URI: mPreferenceKeyMode = KEYMODE_CN_ALPHABET; break; @@ -313,6 +323,7 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { mLastInputType = inputType; } + setStatusIcon(); setShiftByEditorInfo(); } @@ -331,6 +342,8 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { int keymode = KEYMODE_CN_PINYIN; if (mPreferenceKeyMode != INVALID_KEYMODE) { keymode = mPreferenceKeyMode; + } else if (mLimitedKeyMode != null) { + keymode = mLimitedKeyMode[0]; } changeKeyMode(keymode); } @@ -338,7 +351,8 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { /** * Change to the next input mode */ - private void nextKeyMode() { + public void nextKeyMode() { + /* Search the current mode in the toggle table */ boolean found = false; int index; for (index = 0; index < CN_MODE_CYCLE_TABLE.length; index++) { @@ -349,14 +363,24 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { } if (!found) { + /* If the current mode not exists, set the default mode */ setDefaultKeyboard(); } else { - index++; - if (CN_MODE_CYCLE_TABLE.length <= index) { - index = 0; + /* If the current mode exists, set the next input mode */ + int size = CN_MODE_CYCLE_TABLE.length; + int keyMode = INVALID_KEYMODE; + for (int i = 0; i < size; i++) { + index = (++index) % size; + + keyMode = filterKeyMode(CN_MODE_CYCLE_TABLE[index]); + if (keyMode != INVALID_KEYMODE) { + break; + } } - changeKeyMode(CN_MODE_CYCLE_TABLE[index]); + if (keyMode != INVALID_KEYMODE) { + changeKeyMode(keyMode); + } } } @@ -381,7 +405,7 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { /* qwerty shift_on */ keyList = mKeyboard[LANG_CN][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_ON]; keyList[KEYMODE_CN_ALPHABET][0] = - mKeyboard[LANG_CN][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_CN_ALPHABET][0]; + mKeyboard[LANG_CN][PORTRAIT][KEYBOARD_QWERTY][KEYBOARD_SHIFT_OFF][KEYMODE_CN_ALPHABET][0]; keyList[KEYMODE_CN_HALF_NUMBER][0] = new Keyboard(parent, R.xml.default_cn_half_symbols_shift); keyList[KEYMODE_CN_PHONE][0] = new Keyboard(parent, R.xml.keyboard_12key_phone); keyList[KEYMODE_CN_PINYIN][0] = new Keyboard(parent, R.xml.default_cn_qwerty_pinyin_shift); @@ -410,7 +434,7 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { icon = R.drawable.immodeic_half_number; break; default: - break; + break; } mWnn.showStatusIcon(icon); @@ -419,12 +443,17 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { /** * Get the shift key state from the editor. * <br> - * @param editor The editor information - * @return The state id of the shift key (0:off, 1:on) + * @param editor The editor information + * @return The state id of the shift key (0:off, 1:on) */ protected int getShiftKeyState(EditorInfo editor) { - int caps = mWnn.getCurrentInputConnection().getCursorCapsMode(editor.inputType); - return (caps == 0) ? 0 : 1; + InputConnection connection = mWnn.getCurrentInputConnection(); + if (connection != null) { + int caps = connection.getCursorCapsMode(editor.inputType); + return (caps == 0) ? 0 : 1; + } else { + return 0; + } } /** @@ -439,5 +468,51 @@ public class DefaultSoftKeyboardZH extends DefaultSoftKeyboard { } } + /** + * Change the key-mode to the allowed one which is restricted + * by the text input field or the type of the keyboard. + * @param keyMode The key-mode + * @return the key-mode allowed + */ + private int filterKeyMode(int keyMode) { + int targetMode = keyMode; + int[] limits = mLimitedKeyMode; + + if (!mHardKeyboardHidden) { /* for hardware keyboard */ + if (targetMode == KEYMODE_CN_HALF_NUMBER) { + targetMode = KEYMODE_CN_ALPHABET; + } else if (targetMode == KEYMODE_CN_FULL_NUMBER) { + targetMode = KEYMODE_CN_PINYIN; + } + } + + /* restrict by the type of the text field */ + if (limits != null) { + boolean hasAccepted = false; + boolean hasRequiredChange = true; + int size = limits.length; + int nowMode = mCurrentKeyMode; + + for (int i = 0; i < size; i++) { + if (targetMode == limits[i]) { + hasAccepted = true; + break; + } + if (nowMode == limits[i]) { + hasRequiredChange = false; + } + } + + if (!hasAccepted) { + if (hasRequiredChange) { + targetMode = mLimitedKeyMode[0]; + } else { + targetMode = INVALID_KEYMODE; + } + } + } + + return targetMode; + } } diff --git a/src/jp/co/omronsoft/openwnn/ZH/OpenWnnEngineZH.java b/src/jp/co/omronsoft/openwnn/ZH/OpenWnnEngineZH.java index 2be414c..538b8c0 100644 --- a/src/jp/co/omronsoft/openwnn/ZH/OpenWnnEngineZH.java +++ b/src/jp/co/omronsoft/openwnn/ZH/OpenWnnEngineZH.java @@ -111,6 +111,7 @@ public class OpenWnnEngineZH implements WnnEngine { /** Length of the search key */ private int mSearchLength; + /* Cache for results of search */ private HashMap<String,ArrayList<WnnWord>> mSearchCache; private ArrayList<WnnWord> mSearchCacheArray; private ArrayList<WnnWord> mNoWord; |