OSDN Git Service

reconcile w/p4
authorThe Android Open Source Project <initial-contribution@android.com>
Mon, 30 Mar 2009 05:05:50 +0000 (22:05 -0700)
committerThe Android Open Source Project <initial-contribution@android.com>
Mon, 30 Mar 2009 05:05:50 +0000 (22:05 -0700)
182 files changed:
Android.mk
AndroidManifest.xml [moved from PinyinIME/AndroidManifest.xml with 100% similarity]
PinyinIME/Android.mk [deleted file]
jni/Android.mk [moved from PinyinIME/jni/Android.mk with 100% similarity]
jni/android/com_android_inputmethod_pinyin_PinyinDecoderService.cpp [moved from PinyinIME/jni/android/com_android_inputmethod_pinyin_PinyinDecoderService.cpp with 94% similarity]
jni/command/Makefile [moved from PinyinIME/jni/command/Makefile with 100% similarity]
jni/command/pinyinime_dictbuilder.cpp [moved from PinyinIME/jni/command/pinyinime_dictbuilder.cpp with 100% similarity]
jni/data/rawdict_utf16_65105_freq.txt [moved from PinyinIME/jni/data/rawdict_utf16_65105_freq.txt with 100% similarity]
jni/data/valid_utf16.txt [moved from PinyinIME/jni/data/valid_utf16.txt with 100% similarity]
jni/include/atomdictbase.h [moved from PinyinIME/jni/include/atomdictbase.h with 100% similarity]
jni/include/dictbuilder.h [moved from PinyinIME/jni/include/dictbuilder.h with 100% similarity]
jni/include/dictdef.h [moved from PinyinIME/jni/include/dictdef.h with 100% similarity]
jni/include/dictlist.h [moved from PinyinIME/jni/include/dictlist.h with 100% similarity]
jni/include/dicttrie.h [moved from PinyinIME/jni/include/dicttrie.h with 100% similarity]
jni/include/lpicache.h [moved from PinyinIME/jni/include/lpicache.h with 100% similarity]
jni/include/matrixsearch.h [moved from PinyinIME/jni/include/matrixsearch.h with 99% similarity]
jni/include/mystdlib.h [moved from PinyinIME/jni/include/mystdlib.h with 100% similarity]
jni/include/ngram.h [moved from PinyinIME/jni/include/ngram.h with 100% similarity]
jni/include/pinyinime.h [moved from PinyinIME/jni/include/pinyinime.h with 100% similarity]
jni/include/searchutility.h [moved from PinyinIME/jni/include/searchutility.h with 100% similarity]
jni/include/spellingtable.h [moved from PinyinIME/jni/include/spellingtable.h with 100% similarity]
jni/include/spellingtrie.h [moved from PinyinIME/jni/include/spellingtrie.h with 100% similarity]
jni/include/splparser.h [moved from PinyinIME/jni/include/splparser.h with 100% similarity]
jni/include/sync.h [moved from PinyinIME/jni/include/sync.h with 100% similarity]
jni/include/userdict.h [moved from PinyinIME/jni/include/userdict.h with 100% similarity]
jni/include/utf16char.h [moved from PinyinIME/jni/include/utf16char.h with 100% similarity]
jni/include/utf16reader.h [moved from PinyinIME/jni/include/utf16reader.h with 100% similarity]
jni/share/dictbuilder.cpp [moved from PinyinIME/jni/share/dictbuilder.cpp with 98% similarity]
jni/share/dictlist.cpp [moved from PinyinIME/jni/share/dictlist.cpp with 100% similarity]
jni/share/dicttrie.cpp [moved from PinyinIME/jni/share/dicttrie.cpp with 100% similarity]
jni/share/lpicache.cpp [moved from PinyinIME/jni/share/lpicache.cpp with 100% similarity]
jni/share/matrixsearch.cpp [moved from PinyinIME/jni/share/matrixsearch.cpp with 95% similarity]
jni/share/mystdlib.cpp [moved from PinyinIME/jni/share/mystdlib.cpp with 100% similarity]
jni/share/ngram.cpp [moved from PinyinIME/jni/share/ngram.cpp with 100% similarity]
jni/share/pinyinime.cpp [moved from PinyinIME/jni/share/pinyinime.cpp with 100% similarity]
jni/share/searchutility.cpp [moved from PinyinIME/jni/share/searchutility.cpp with 100% similarity]
jni/share/spellingtable.cpp [moved from PinyinIME/jni/share/spellingtable.cpp with 100% similarity]
jni/share/spellingtrie.cpp [moved from PinyinIME/jni/share/spellingtrie.cpp with 100% similarity]
jni/share/splparser.cpp [moved from PinyinIME/jni/share/splparser.cpp with 100% similarity]
jni/share/sync.cpp [moved from PinyinIME/jni/share/sync.cpp with 100% similarity]
jni/share/userdict.cpp [moved from PinyinIME/jni/share/userdict.cpp with 100% similarity]
jni/share/utf16char.cpp [moved from PinyinIME/jni/share/utf16char.cpp with 100% similarity]
jni/share/utf16reader.cpp [moved from PinyinIME/jni/share/utf16reader.cpp with 100% similarity]
lib/Android.mk [moved from PinyinIME/lib/Android.mk with 100% similarity]
lib/com/android/inputmethod/pinyin/IPinyinDecoderService.aidl [moved from PinyinIME/lib/com/android/inputmethod/pinyin/IPinyinDecoderService.aidl with 100% similarity]
res/drawable/app_icon.png [moved from PinyinIME/res/drawable/app_icon.png with 100% similarity]
res/drawable/arrow_bg.xml [moved from PinyinIME/res/drawable/arrow_bg.xml with 100% similarity]
res/drawable/arrow_left.png [moved from PinyinIME/res/drawable/arrow_left.png with 100% similarity]
res/drawable/arrow_right.png [moved from PinyinIME/res/drawable/arrow_right.png with 100% similarity]
res/drawable/candidate_balloon_bg.9.png [moved from PinyinIME/res/drawable/candidate_balloon_bg.9.png with 100% similarity]
res/drawable/candidate_hl_bg.9.png [moved from PinyinIME/res/drawable/candidate_hl_bg.9.png with 100% similarity]
res/drawable/candidates_area_bg.9.png [moved from PinyinIME/res/drawable/candidates_area_bg.9.png with 100% similarity]
res/drawable/candidates_vertical_line.png [moved from PinyinIME/res/drawable/candidates_vertical_line.png with 100% similarity]
res/drawable/cands_container_bg.9.png [moved from PinyinIME/res/drawable/cands_container_bg.9.png with 100% similarity]
res/drawable/comma_full_icon.png [moved from PinyinIME/res/drawable/comma_full_icon.png with 100% similarity]
res/drawable/comma_full_popup_icon.png [moved from PinyinIME/res/drawable/comma_full_popup_icon.png with 100% similarity]
res/drawable/composing_area_bg.9.png [moved from PinyinIME/res/drawable/composing_area_bg.9.png with 100% similarity]
res/drawable/composing_area_cursor.png [moved from PinyinIME/res/drawable/composing_area_cursor.png with 100% similarity]
res/drawable/composing_hl_bg.9.png [moved from PinyinIME/res/drawable/composing_hl_bg.9.png with 100% similarity]
res/drawable/delete_icon.png [moved from PinyinIME/res/drawable/delete_icon.png with 100% similarity]
res/drawable/delete_popup_icon.png [moved from PinyinIME/res/drawable/delete_popup_icon.png with 100% similarity]
res/drawable/dun_icon.png [moved from PinyinIME/res/drawable/dun_icon.png with 100% similarity]
res/drawable/dun_popup_icon.png [moved from PinyinIME/res/drawable/dun_popup_icon.png with 100% similarity]
res/drawable/emotion_icon_00.png [moved from PinyinIME/res/drawable/emotion_icon_00.png with 100% similarity]
res/drawable/emotion_icon_00_popup.png [moved from PinyinIME/res/drawable/emotion_icon_00_popup.png with 100% similarity]
res/drawable/emotion_icon_01.png [moved from PinyinIME/res/drawable/emotion_icon_01.png with 100% similarity]
res/drawable/emotion_icon_01_popup.png [moved from PinyinIME/res/drawable/emotion_icon_01_popup.png with 100% similarity]
res/drawable/emotion_icon_02.png [moved from PinyinIME/res/drawable/emotion_icon_02.png with 100% similarity]
res/drawable/emotion_icon_02_popup.png [moved from PinyinIME/res/drawable/emotion_icon_02_popup.png with 100% similarity]
res/drawable/emotion_icon_03.png [moved from PinyinIME/res/drawable/emotion_icon_03.png with 100% similarity]
res/drawable/emotion_icon_03_popup.png [moved from PinyinIME/res/drawable/emotion_icon_03_popup.png with 100% similarity]
res/drawable/emotion_icon_04.png [moved from PinyinIME/res/drawable/emotion_icon_04.png with 100% similarity]
res/drawable/emotion_icon_04_popup.png [moved from PinyinIME/res/drawable/emotion_icon_04_popup.png with 100% similarity]
res/drawable/emotion_icon_05.png [moved from PinyinIME/res/drawable/emotion_icon_05.png with 100% similarity]
res/drawable/emotion_icon_05_popup.png [moved from PinyinIME/res/drawable/emotion_icon_05_popup.png with 100% similarity]
res/drawable/emotion_icon_06.png [moved from PinyinIME/res/drawable/emotion_icon_06.png with 100% similarity]
res/drawable/emotion_icon_06_popup.png [moved from PinyinIME/res/drawable/emotion_icon_06_popup.png with 100% similarity]
res/drawable/emotion_icon_10.png [moved from PinyinIME/res/drawable/emotion_icon_10.png with 100% similarity]
res/drawable/emotion_icon_10_popup.png [moved from PinyinIME/res/drawable/emotion_icon_10_popup.png with 100% similarity]
res/drawable/emotion_icon_11.png [moved from PinyinIME/res/drawable/emotion_icon_11.png with 100% similarity]
res/drawable/emotion_icon_11_popup.png [moved from PinyinIME/res/drawable/emotion_icon_11_popup.png with 100% similarity]
res/drawable/emotion_icon_12.png [moved from PinyinIME/res/drawable/emotion_icon_12.png with 100% similarity]
res/drawable/emotion_icon_12_popup.png [moved from PinyinIME/res/drawable/emotion_icon_12_popup.png with 100% similarity]
res/drawable/emotion_icon_13.png [moved from PinyinIME/res/drawable/emotion_icon_13.png with 100% similarity]
res/drawable/emotion_icon_13_popup.png [moved from PinyinIME/res/drawable/emotion_icon_13_popup.png with 100% similarity]
res/drawable/emotion_icon_14.png [moved from PinyinIME/res/drawable/emotion_icon_14.png with 100% similarity]
res/drawable/emotion_icon_14_popup.png [moved from PinyinIME/res/drawable/emotion_icon_14_popup.png with 100% similarity]
res/drawable/emotion_icon_15.png [moved from PinyinIME/res/drawable/emotion_icon_15.png with 100% similarity]
res/drawable/emotion_icon_15_popup.png [moved from PinyinIME/res/drawable/emotion_icon_15_popup.png with 100% similarity]
res/drawable/emotion_icon_16.png [moved from PinyinIME/res/drawable/emotion_icon_16.png with 100% similarity]
res/drawable/emotion_icon_16_popup.png [moved from PinyinIME/res/drawable/emotion_icon_16_popup.png with 100% similarity]
res/drawable/emotion_icon_20.png [moved from PinyinIME/res/drawable/emotion_icon_20.png with 100% similarity]
res/drawable/emotion_icon_20_popup.png [moved from PinyinIME/res/drawable/emotion_icon_20_popup.png with 100% similarity]
res/drawable/emotion_icon_21.png [moved from PinyinIME/res/drawable/emotion_icon_21.png with 100% similarity]
res/drawable/emotion_icon_21_popup.png [moved from PinyinIME/res/drawable/emotion_icon_21_popup.png with 100% similarity]
res/drawable/emotion_icon_22.png [moved from PinyinIME/res/drawable/emotion_icon_22.png with 100% similarity]
res/drawable/emotion_icon_22_popup.png [moved from PinyinIME/res/drawable/emotion_icon_22_popup.png with 100% similarity]
res/drawable/emotion_icon_23.png [moved from PinyinIME/res/drawable/emotion_icon_23.png with 100% similarity]
res/drawable/emotion_icon_23_popup.png [moved from PinyinIME/res/drawable/emotion_icon_23_popup.png with 100% similarity]
res/drawable/emotion_icon_24.png [moved from PinyinIME/res/drawable/emotion_icon_24.png with 100% similarity]
res/drawable/emotion_icon_24_popup.png [moved from PinyinIME/res/drawable/emotion_icon_24_popup.png with 100% similarity]
res/drawable/enter_icon.png [moved from PinyinIME/res/drawable/enter_icon.png with 100% similarity]
res/drawable/enter_popup_icon.png [moved from PinyinIME/res/drawable/enter_popup_icon.png with 100% similarity]
res/drawable/ime_en.png [moved from PinyinIME/res/drawable/ime_en.png with 100% similarity]
res/drawable/ime_pinyin.png [moved from PinyinIME/res/drawable/ime_pinyin.png with 100% similarity]
res/drawable/key_balloon_bg.9.png [moved from PinyinIME/res/drawable/key_balloon_bg.9.png with 100% similarity]
res/drawable/light_key_bg.9.png [moved from PinyinIME/res/drawable/light_key_bg.9.png with 100% similarity]
res/drawable/light_key_hl_bg.9.png [moved from PinyinIME/res/drawable/light_key_hl_bg.9.png with 100% similarity]
res/drawable/light_key_up_bg.9.png [moved from PinyinIME/res/drawable/light_key_up_bg.9.png with 100% similarity]
res/drawable/light_key_up_hl_bg.9.png [moved from PinyinIME/res/drawable/light_key_up_hl_bg.9.png with 100% similarity]
res/drawable/miniskb_bg.9.png [moved from PinyinIME/res/drawable/miniskb_bg.9.png with 100% similarity]
res/drawable/normal_key_bg.9.png [moved from PinyinIME/res/drawable/normal_key_bg.9.png with 100% similarity]
res/drawable/normal_key_hl_bg.9.png [moved from PinyinIME/res/drawable/normal_key_hl_bg.9.png with 100% similarity]
res/drawable/num0.png [moved from PinyinIME/res/drawable/num0.png with 100% similarity]
res/drawable/num1.png [moved from PinyinIME/res/drawable/num1.png with 100% similarity]
res/drawable/num2.png [moved from PinyinIME/res/drawable/num2.png with 100% similarity]
res/drawable/num3.png [moved from PinyinIME/res/drawable/num3.png with 100% similarity]
res/drawable/num4.png [moved from PinyinIME/res/drawable/num4.png with 100% similarity]
res/drawable/num5.png [moved from PinyinIME/res/drawable/num5.png with 100% similarity]
res/drawable/num6.png [moved from PinyinIME/res/drawable/num6.png with 100% similarity]
res/drawable/num7.png [moved from PinyinIME/res/drawable/num7.png with 100% similarity]
res/drawable/num8.png [moved from PinyinIME/res/drawable/num8.png with 100% similarity]
res/drawable/num9.png [moved from PinyinIME/res/drawable/num9.png with 100% similarity]
res/drawable/numalt.png [moved from PinyinIME/res/drawable/numalt.png with 100% similarity]
res/drawable/numpound.png [moved from PinyinIME/res/drawable/numpound.png with 100% similarity]
res/drawable/numstar.png [moved from PinyinIME/res/drawable/numstar.png with 100% similarity]
res/drawable/period_full_icon.png [moved from PinyinIME/res/drawable/period_full_icon.png with 100% similarity]
res/drawable/period_full_popup_icon.png [moved from PinyinIME/res/drawable/period_full_popup_icon.png with 100% similarity]
res/drawable/period_icon.png [moved from PinyinIME/res/drawable/period_icon.png with 100% similarity]
res/drawable/period_popup_icon.png [moved from PinyinIME/res/drawable/period_popup_icon.png with 100% similarity]
res/drawable/search_icon.png [moved from PinyinIME/res/drawable/search_icon.png with 100% similarity]
res/drawable/search_popup_icon.png [moved from PinyinIME/res/drawable/search_popup_icon.png with 100% similarity]
res/drawable/shift_off_icon.png [moved from PinyinIME/res/drawable/shift_off_icon.png with 100% similarity]
res/drawable/shift_off_popup_icon.png [moved from PinyinIME/res/drawable/shift_off_popup_icon.png with 100% similarity]
res/drawable/shift_on_icon.png [moved from PinyinIME/res/drawable/shift_on_icon.png with 100% similarity]
res/drawable/shift_on_popup_icon.png [moved from PinyinIME/res/drawable/shift_on_popup_icon.png with 100% similarity]
res/drawable/skb_bg.png [moved from PinyinIME/res/drawable/skb_bg.png with 100% similarity]
res/drawable/skb_container_bg.9.png [moved from PinyinIME/res/drawable/skb_container_bg.9.png with 100% similarity]
res/drawable/smiley_icon.png [moved from PinyinIME/res/drawable/smiley_icon.png with 100% similarity]
res/drawable/smiley_popup_icon.png [moved from PinyinIME/res/drawable/smiley_popup_icon.png with 100% similarity]
res/drawable/space_icon.png [moved from PinyinIME/res/drawable/space_icon.png with 100% similarity]
res/drawable/space_popup_icon.png [moved from PinyinIME/res/drawable/space_popup_icon.png with 100% similarity]
res/layout/candidates_container.xml [moved from PinyinIME/res/layout/candidates_container.xml with 100% similarity]
res/layout/floating_container.xml [moved from PinyinIME/res/layout/floating_container.xml with 100% similarity]
res/layout/skb_container.xml [moved from PinyinIME/res/layout/skb_container.xml with 100% similarity]
res/raw/dict_pinyin.dat [moved from PinyinIME/res/raw/dict_pinyin.dat with 100% similarity]
res/values-land/dimens.xml [moved from PinyinIME/res/values-land/dimens.xml with 100% similarity]
res/values-port/dimens.xml [moved from PinyinIME/res/values-port/dimens.xml with 100% similarity]
res/values-zh/bools.xml [moved from PinyinIME/res/values-zh/bools.xml with 100% similarity]
res/values/colors.xml [moved from PinyinIME/res/values/colors.xml with 100% similarity]
res/values/dimens.xml [moved from PinyinIME/res/values/dimens.xml with 100% similarity]
res/values/strings.xml [moved from PinyinIME/res/values/strings.xml with 100% similarity]
res/xml/method.xml [moved from PinyinIME/res/xml/method.xml with 100% similarity]
res/xml/settings.xml [moved from PinyinIME/res/xml/settings.xml with 100% similarity]
res/xml/skb_phone.xml [moved from PinyinIME/res/xml/skb_phone.xml with 100% similarity]
res/xml/skb_qwerty.xml [moved from PinyinIME/res/xml/skb_qwerty.xml with 100% similarity]
res/xml/skb_smiley.xml [moved from PinyinIME/res/xml/skb_smiley.xml with 100% similarity]
res/xml/skb_sym1.xml [moved from PinyinIME/res/xml/skb_sym1.xml with 100% similarity]
res/xml/skb_sym2.xml [moved from PinyinIME/res/xml/skb_sym2.xml with 100% similarity]
res/xml/skb_template1.xml [moved from PinyinIME/res/xml/skb_template1.xml with 100% similarity]
src/com/android/inputmethod/pinyin/BalloonHint.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/BalloonHint.java with 100% similarity]
src/com/android/inputmethod/pinyin/CandidateView.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/CandidateView.java with 100% similarity]
src/com/android/inputmethod/pinyin/CandidateViewListener.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/CandidateViewListener.java with 100% similarity]
src/com/android/inputmethod/pinyin/CandidatesContainer.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/CandidatesContainer.java with 100% similarity]
src/com/android/inputmethod/pinyin/ComposingView.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/ComposingView.java with 99% similarity]
src/com/android/inputmethod/pinyin/EnglishInputProcessor.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/EnglishInputProcessor.java with 100% similarity]
src/com/android/inputmethod/pinyin/Environment.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/Environment.java with 100% similarity]
src/com/android/inputmethod/pinyin/InputModeSwitcher.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/InputModeSwitcher.java with 97% similarity]
src/com/android/inputmethod/pinyin/KeyMapDream.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/KeyMapDream.java with 100% similarity]
src/com/android/inputmethod/pinyin/PinyinDecoderService.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/PinyinDecoderService.java with 100% similarity]
src/com/android/inputmethod/pinyin/PinyinIME.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/PinyinIME.java with 95% similarity]
src/com/android/inputmethod/pinyin/Settings.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/Settings.java with 100% similarity]
src/com/android/inputmethod/pinyin/SettingsActivity.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SettingsActivity.java with 100% similarity]
src/com/android/inputmethod/pinyin/SkbContainer.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SkbContainer.java with 100% similarity]
src/com/android/inputmethod/pinyin/SkbPool.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SkbPool.java with 100% similarity]
src/com/android/inputmethod/pinyin/SkbTemplate.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SkbTemplate.java with 100% similarity]
src/com/android/inputmethod/pinyin/SoftKey.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SoftKey.java with 100% similarity]
src/com/android/inputmethod/pinyin/SoftKeyToggle.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyToggle.java with 100% similarity]
src/com/android/inputmethod/pinyin/SoftKeyboard.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboard.java with 100% similarity]
src/com/android/inputmethod/pinyin/SoftKeyboardView.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SoftKeyboardView.java with 100% similarity]
src/com/android/inputmethod/pinyin/SoundManager.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/SoundManager.java with 100% similarity]
src/com/android/inputmethod/pinyin/XmlKeyboardLoader.java [moved from PinyinIME/src/com/android/inputmethod/pinyin/XmlKeyboardLoader.java with 100% similarity]

index 5053e7d..64224ae 100644 (file)
@@ -1 +1,25 @@
-include $(call all-subdir-makefiles)
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+         $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := PinyinIME
+
+LOCAL_JNI_SHARED_LIBRARIES := libjni_pinyinime
+
+LOCAL_STATIC_JAVA_LIBRARIES := com.android.inputmethod.pinyin.lib
+
+LOCAL_CERTIFICATE := shared
+
+# Make sure our dictionary file is not compressed, so we can read it with
+# a raw file descriptor.
+LOCAL_AAPT_FLAGS := -0 .dat
+
+include $(BUILD_PACKAGE)
+
+MY_PATH := $(LOCAL_PATH)
+
+include $(MY_PATH)/jni/Android.mk
+include $(MY_PATH)/lib/Android.mk
diff --git a/PinyinIME/Android.mk b/PinyinIME/Android.mk
deleted file mode 100644 (file)
index 64224ae..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-         $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := PinyinIME
-
-LOCAL_JNI_SHARED_LIBRARIES := libjni_pinyinime
-
-LOCAL_STATIC_JAVA_LIBRARIES := com.android.inputmethod.pinyin.lib
-
-LOCAL_CERTIFICATE := shared
-
-# Make sure our dictionary file is not compressed, so we can read it with
-# a raw file descriptor.
-LOCAL_AAPT_FLAGS := -0 .dat
-
-include $(BUILD_PACKAGE)
-
-MY_PATH := $(LOCAL_PATH)
-
-include $(MY_PATH)/jni/Android.mk
-include $(MY_PATH)/lib/Android.mk
similarity index 100%
rename from PinyinIME/jni/Android.mk
rename to jni/Android.mk
@@ -51,10 +51,15 @@ JNIEXPORT jboolean JNICALL nativeImOpenDecoder(JNIEnv* env, jclass jclazz,
   jbyte *fsd = (*env).GetByteArrayElements(fn_sys_dict, 0);
   jbyte *fud = (*env).GetByteArrayElements(fn_usr_dict, 0);
 
+  jboolean jret = JNI_FALSE;
+
   if (im_open_decoder((const char*)fsd, (const char*)fud))
-    return JNI_TRUE;
+    jret = JNI_TRUE;
 
-  return JNI_FALSE;
+  (*env).ReleaseByteArrayElements(fn_sys_dict, fsd, 0);
+  (*env).ReleaseByteArrayElements(fn_usr_dict, fud, 0);
+
+  return jret;
 }
 
 JNIEXPORT jboolean JNICALL nativeImOpenDecoderFd(JNIEnv* env, jclass jclazz,
@@ -65,14 +70,17 @@ JNIEXPORT jboolean JNICALL nativeImOpenDecoderFd(JNIEnv* env, jclass jclazz,
   jint fd = env->GetIntField(fd_sys_dict, gFileDescriptorOffsets.mDescriptor);
   jbyte *fud = (*env).GetByteArrayElements(fn_usr_dict, 0);
 
+  jboolean jret = JNI_FALSE;
+
   int newfd = dup(fd);
-  if (im_open_decoder_fd(newfd, startoffset, length, (const char*)fud)) {
-    close(newfd);
-    return JNI_TRUE;
-  }
+  if (im_open_decoder_fd(newfd, startoffset, length, (const char*)fud))
+    jret = JNI_TRUE;
 
   close(newfd);
-  return JNI_FALSE;
+
+  (*env).ReleaseByteArrayElements(fn_usr_dict, fud, 0);
+
+  return jret;
 }
 
 JNIEXPORT void JNICALL nativeImSetMaxLens(JNIEnv* env, jclass jclazz,
@@ -92,10 +100,14 @@ JNIEXPORT jint JNICALL nativeImSearch(JNIEnv* env, jclass jclazz,
                                       jbyteArray pybuf, jint pylen) {
   jbyte *array_body = (*env).GetByteArrayElements(pybuf, 0);
 
-  if (NULL == array_body)
-    return 0;
+  jint jret = 0;
+  if (NULL != array_body) {
+    jret = im_search((const char*)array_body, pylen);
+  }
+
+  (*env).ReleaseByteArrayElements(pybuf, array_body, 0);
 
-  return im_search((const char*)array_body, pylen);
+  return jret;
 }
 
 JNIEXPORT jint JNICALL nativeImDelSearch(JNIEnv* env, jclass jclazz, jint pos,
@@ -157,6 +169,9 @@ JNIEXPORT jintArray JNICALL nativeImGetSplStart(JNIEnv* env, jclass jclazz) {
   arr_body[0] = len; // element 0 is used to store the length of buffer.
   for (size_t i = 0; i <= len; i++)
     arr_body[i + 1] = spl_start[i];
+
+  (*env).ReleaseIntArrayElements(arr, arr_body, 0);
+
   return arr;
 }
 
@@ -213,6 +228,8 @@ JNIEXPORT jint JNICALL nativeImGetPredictsNum(JNIEnv *env, jclass clazz,
 
   predict_len = im_get_predicts(fixed_buf, predict_buf);
 
+  (*env).ReleaseStringChars(fixed_str, fixed_ptr);
+
   return predict_len;
 }
 
@@ -232,9 +249,14 @@ JNIEXPORT jstring JNICALL nativeImGetPredictItem(JNIEnv *env, jclass clazz,
 JNIEXPORT jboolean JNICALL nativeSyncBegin(JNIEnv *env, jclass clazz,
                                            jbyteArray dict_file) {
   jbyte *file_name = (*env).GetByteArrayElements(dict_file, 0);
+
+  jboolean jret = JNI_FALSE;
   if (true == sync_worker.begin((const char *)file_name))
-    return JNI_TRUE;
-  return JNI_FALSE;
+    jret = JNI_TRUE;
+
+  (*env).ReleaseByteArrayElements(dict_file, file_name, 0);
+
+  return jret;
 }
 
 JNIEXPORT jboolean JNICALL nativeSyncFinish(JNIEnv *env, jclass clazz) {
similarity index 99%
rename from PinyinIME/jni/include/matrixsearch.h
rename to jni/include/matrixsearch.h
index b9cf061..f581d30 100644 (file)
@@ -250,6 +250,9 @@ class MatrixSearch {
 
   void free_resource();
 
+  // Reset the search space totally.
+  bool reset_search0();
+
   // Reset the search space from ch_pos step. For example, if the original
   // input Pinyin is "an", reset_search(1) will reset the search space to the
   // result of "a". If the given position is out of range, return false.
similarity index 98%
rename from PinyinIME/jni/share/dictbuilder.cpp
rename to jni/share/dictbuilder.cpp
index b2e989c..6f0bd4f 100644 (file)
@@ -491,7 +491,6 @@ size_t DictBuilder::read_raw_dict(const char* fn_raw,
       i--;
       continue;
     }
-    //    printf("i: %d\n", i);
   }
 
   delete [] valid_hzs;
@@ -579,7 +578,6 @@ bool DictBuilder::build_dict(const char *fn_raw,
 
   get_top_lemmas();
 
-  // printf("Now begin construct tree\n");
 #ifdef ___DO_STATISTICS___
   stat_init();
 #endif
@@ -775,8 +773,6 @@ bool DictBuilder::construct_subset(void* parent, LemmaEntry* lemma_arr,
   if (level >= kMaxLemmaSize || item_end <= item_start)
     return false;
 
-  // printf("++ enter recursive\n");
-
   // 1. Scan for how many sons
   size_t parent_son_num = 0;
   // LemmaNode *son_1st = NULL;
@@ -853,8 +849,6 @@ bool DictBuilder::construct_subset(void* parent, LemmaEntry* lemma_arr,
   lma_last_start = lemma_arr_ + item_start;
   spl_idx_node = lma_last_start->spl_idx_arr[level];
 
-  //  printf("++ spl_idx_node: %d\n", spl_idx_node);
-
   size_t homo_num = 0;
   if (lma_last_start->spl_idx_arr[level + 1] == 0)
     homo_num = 1;
@@ -888,8 +882,6 @@ bool DictBuilder::construct_subset(void* parent, LemmaEntry* lemma_arr,
         homo_idx_num_gt1_ += homo_num;
       }
 
-      // printf("++ homo_num: %d\n++ lmaids: ", homo_num);
-
       if (homo_num > 0) {
         LemmaIdType* idx_buf = homo_idx_buf_ + homo_idx_num_eq1_ +
               homo_idx_num_gt1_ - homo_num;
@@ -903,10 +895,8 @@ bool DictBuilder::construct_subset(void* parent, LemmaEntry* lemma_arr,
 
         for (size_t homo_pos = 0; homo_pos < homo_num; homo_pos++) {
           idx_buf[homo_pos] = lemma_arr_[item_start_next + homo_pos].idx_by_hz;
-          // printf("[%d] %d ", item_start_next + homo_pos,  idx_buf[homo_pos]);
         }
 
-        // printf("\n");
 #ifdef ___DO_STATISTICS___
         if (homo_num > max_homobuf_len_[level])
           max_homobuf_len_[level] = homo_num;
similarity index 95%
rename from PinyinIME/jni/share/matrixsearch.cpp
rename to jni/share/matrixsearch.cpp
index d13a4c4..dd19f59 100644 (file)
@@ -139,7 +139,7 @@ bool MatrixSearch::init(const char *fn_sys_dict, const char *fn_usr_dict) {
     user_dict_->set_total_lemma_count_of_others(NGram::kSysDictTotalFreq);
   }
 
-  reset_search(0, true, true, true);
+  reset_search0();
 
   inited_ = true;
   return true;
@@ -163,7 +163,7 @@ bool MatrixSearch::init_fd(int sys_fd, long start_offset, long length,
     user_dict_->set_total_lemma_count_of_others(NGram::kSysDictTotalFreq);
   }
 
-  reset_search(0, true, true, true);
+  reset_search0();
 
   inited_ = true;
   return true;
@@ -198,16 +198,13 @@ bool MatrixSearch::get_xi_an_switch() {
 bool MatrixSearch::reset_search() {
   if (!inited_)
     return false;
-  return reset_search(0, true, true, true);
+  return reset_search0();
 }
 
-bool MatrixSearch::reset_search(size_t ch_pos, bool clear_fixed_this_step,
-                                bool clear_dmi_this_step,
-                                bool clear_mtrx_this_step) {
-  if (!inited_ || ch_pos > pys_decoded_len_ || ch_pos >= kMaxRowNum)
-    return false;
+bool MatrixSearch::reset_search0() {
+    if (!inited_)
+        return false;
 
-  if (0 == ch_pos) {
     pys_decoded_len_ = 0;
     mtrx_nd_pool_used_ = 0;
     dmi_pool_used_ = 0;
@@ -238,6 +235,18 @@ bool MatrixSearch::reset_search(size_t ch_pos, bool clear_fixed_this_step,
     dict_trie_->reset_milestones(0, 0);
     if (NULL != user_dict_)
       user_dict_->reset_milestones(0, 0);
+
+    return true;
+}
+
+bool MatrixSearch::reset_search(size_t ch_pos, bool clear_fixed_this_step,
+                                bool clear_dmi_this_step,
+                                bool clear_mtrx_this_step) {
+  if (!inited_ || ch_pos > pys_decoded_len_ || ch_pos >= kMaxRowNum)
+    return false;
+
+  if (0 == ch_pos) {
+    reset_search0();
   } else {
     // Prepare mile stones of this step to clear.
     MileStoneHandle *dict_handles_to_clear = NULL;
@@ -281,7 +290,10 @@ bool MatrixSearch::reset_search(size_t ch_pos, bool clear_fixed_this_step,
     }
 
     // Modify fixed_hzs_
-    if (fixed_hzs_ > 0 && kLemmaIdComposing != lma_id_[0]) {
+    if (fixed_hzs_ > 0 &&
+        ((kLemmaIdComposing != lma_id_[0]) ||
+         (kLemmaIdComposing == lma_id_[0] &&
+          spl_start_[c_phrase_.length] <= ch_pos))) {
       size_t fixed_ch_pos = ch_pos;
       if (clear_fixed_this_step)
         fixed_ch_pos = fixed_ch_pos > 0 ? fixed_ch_pos - 1 : 0;
@@ -350,8 +362,47 @@ bool MatrixSearch::reset_search(size_t ch_pos, bool clear_fixed_this_step,
       for (uint16 re_pos = fixed_ch_pos; re_pos < ch_pos; re_pos++) {
         add_char(pys_[re_pos]);
       }
-    } else if (kLemmaIdComposing == lma_id_[0]) {
-      // Do nothing for the composing phrase.
+    } else if (fixed_hzs_ > 0 && kLemmaIdComposing == lma_id_[0]) {
+      for (uint16 subpos = 0; subpos < c_phrase_.sublma_num; subpos++) {
+        uint16 splpos_begin = c_phrase_.sublma_start[subpos];
+        uint16 splpos_end = c_phrase_.sublma_start[subpos + 1];
+        for (uint16 splpos = splpos_begin; splpos < splpos_end; splpos++) {
+          // If ch_pos is in this spelling
+          uint16 spl_start = c_phrase_.spl_start[splpos];
+          uint16 spl_end = c_phrase_.spl_start[splpos + 1];
+          if (ch_pos >= spl_start && ch_pos < spl_end) {
+            // Clear everything after this position
+            c_phrase_.chn_str[splpos] = static_cast<char16>('\0');
+            c_phrase_.sublma_start[subpos + 1] = splpos;
+            c_phrase_.sublma_num = subpos + 1;
+            c_phrase_.length = splpos;
+
+            if (splpos == splpos_begin) {
+              c_phrase_.sublma_num = subpos;
+            }
+          }
+        }
+      }
+
+      // Extend the composing phrase.
+      reset_search0();
+      dmi_c_phrase_ = true;
+      uint16 c_py_pos = 0;
+      while (c_py_pos < spl_start_[c_phrase_.length]) {
+        bool b_ac_tmp = add_char(pys_[c_py_pos]);
+        assert(b_ac_tmp);
+        c_py_pos++;
+      }
+      dmi_c_phrase_ = false;
+
+      lma_id_num_ = 1;
+      fixed_lmas_ = 1;
+      fixed_lmas_no1_[0] = 0;  // A composing string is always modified.
+      fixed_hzs_ = c_phrase_.length;
+      lma_start_[1] = fixed_hzs_;
+      lma_id_[0] = kLemmaIdComposing;
+      matrix_[spl_start_[fixed_hzs_]].mtrx_nd_fixed = mtrx_nd_pool_ +
+          matrix_[spl_start_[fixed_hzs_]].mtrx_nd_pos;
     }
   }
 
@@ -431,9 +482,23 @@ size_t MatrixSearch::delsearch(size_t pos, bool is_pos_in_splid,
   if (!inited_)
     return 0;
 
+  size_t reset_pos = pos;
+
   // Out of range for both Pinyin mode and Spelling id mode.
   if (pys_decoded_len_ <= pos) {
     del_in_pys(pos, 1);
+
+    reset_pos = pys_decoded_len_;
+    // Decode the string after the un-decoded position
+    while ('\0' != pys_[reset_pos]) {
+      if (!add_char(pys_[reset_pos])) {
+        pys_decoded_len_ = reset_pos;
+        break;
+      }
+      reset_pos++;
+    }
+    get_spl_start_id();
+    prepare_candidates();
     return pys_decoded_len_;
   }
 
@@ -444,9 +509,7 @@ size_t MatrixSearch::delsearch(size_t pos, bool is_pos_in_splid,
   // Begin to handle two modes respectively.
   // Pinyin mode by default
   size_t c_py_len = 0;  // The length of composing phrase's Pinyin
-  size_t reset_pos = pos;
   size_t del_py_len = 1;
-  size_t stop_pos = pys_decoded_len_;
   if (!is_pos_in_splid) {
     // Pinyin mode is only allowed to delete beyond the fixed lemmas.
     if (fixed_lmas_ > 0 && pos < spl_start_[lma_start_[fixed_lmas_]])
@@ -490,7 +553,7 @@ size_t MatrixSearch::delsearch(size_t pos, bool is_pos_in_splid,
     // The composing phrase is valid, reset all search space,
     // and begin a new search which will only extend the composing
     // phrase.
-    reset_search(0, true, true, true);
+    reset_search0();
 
     dmi_c_phrase_ = true;
     // Extend the composing phrase.
@@ -517,8 +580,7 @@ size_t MatrixSearch::delsearch(size_t pos, bool is_pos_in_splid,
   }
 
   // Decode the string after the delete position.
-  stop_pos -= del_py_len;
-  while (reset_pos < stop_pos) {
+  while ('\0' != pys_[reset_pos]) {
     if (!add_char(pys_[reset_pos])) {
       pys_decoded_len_ = reset_pos;
       break;
@@ -528,7 +590,7 @@ size_t MatrixSearch::delsearch(size_t pos, bool is_pos_in_splid,
 
   get_spl_start_id();
   prepare_candidates();
-  return c_py_len;
+  return pys_decoded_len_;
 }
 
 size_t MatrixSearch::get_candidate_num() {
@@ -1591,7 +1653,8 @@ char16* MatrixSearch::get_candidate0(char16 *cand_str, size_t max_len,
 
     char16 str[kMaxLemmaSize + 1];
     uint16 str_len = get_lemma_str(idxs[id_num], str, kMaxLemmaSize + 1);
-    if (str_len > 0 && max_len - ret_pos > str_len) {
+    if (str_len > 0 && ((!only_unfixed && max_len - ret_pos > str_len) ||
+        (only_unfixed && max_len - ret_pos + fixed_hzs_ > str_len))) {
       if (!only_unfixed)
         utf16_strncpy(cand_str + ret_pos, str, str_len);
       else if (ret_pos >= fixed_hzs_)
similarity index 100%
rename from PinyinIME/lib/Android.mk
rename to lib/Android.mk
@@ -264,6 +264,7 @@ public class ComposingView extends View {
             mPaint.setColor(mStrColorIdle);
             int oriPos = activeCmpsLen;
             if (cursorPos > activeCmpsLen) {
+                if (cursorPos > cmpsStr.length()) cursorPos = cmpsStr.length();
                 canvas.drawText(cmpsStr, oriPos, cursorPos, x, y, mPaint);
                 x += mPaint.measureText(cmpsStr, oriPos, cursorPos);
 
@@ -543,9 +543,6 @@ public class InputModeSwitcher {
                 english = true;
             } else if (v == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
                 mShortMessageField = true;
-            } else if ((editorInfo.imeOptions &
-                    EditorInfo.IME_MASK_ACTION) == EditorInfo.IME_ACTION_SEARCH) {
-                newInputMode = MODE_HKB_CHINESE;
             }
             break;
         default:
@@ -594,13 +591,10 @@ public class InputModeSwitcher {
                     || v == EditorInfo.TYPE_TEXT_VARIATION_URI) {
                 // If the application request English mode, we switch to it.
                 newInputMode = MODE_SKB_ENGLISH_LOWER;
-            } else if (v == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
-                newInputMode = MODE_SKB_CHINESE;
-                mShortMessageField = true;
-            } else if ((editorInfo.imeOptions &
-                    EditorInfo.IME_MASK_ACTION) == EditorInfo.IME_ACTION_SEARCH) {
-                newInputMode = MODE_SKB_CHINESE;
             } else {
+                if (v == EditorInfo.TYPE_TEXT_VARIATION_SHORT_MESSAGE) {
+                    mShortMessageField = true;
+                }
                 // If the application do not request English mode, we will
                 // try to keep the previous mode.
                 int skbLayout = (mInputMode & MASK_SKB_LAYOUT);
@@ -615,7 +609,17 @@ public class InputModeSwitcher {
             }
             break;
         default:
-            newInputMode = MODE_SKB_CHINESE;
+            // Try to keep the previous mode.
+            int skbLayout = (mInputMode & MASK_SKB_LAYOUT);
+            newInputMode = mInputMode;
+            if (0 == skbLayout) {
+                if ((mInputMode & MASK_LANGUAGE) == MASK_LANGUAGE_CN) {
+                    newInputMode = MODE_SKB_CHINESE;
+                } else {
+                    newInputMode = MODE_SKB_ENGLISH_LOWER;
+                }
+            }
+            break;
         }
 
         mEditorInfo = editorInfo;
@@ -708,7 +712,7 @@ public class InputModeSwitcher {
         mInputMode = newInputMode;
 
         int skbLayout = (mInputMode & MASK_SKB_LAYOUT);
-        if (MASK_SKB_LAYOUT_QWERTY == skbLayout) {
+        if (MASK_SKB_LAYOUT_QWERTY == skbLayout || 0 == skbLayout) {
             mRecentLauageInputMode = mInputMode;
         }
 
@@ -235,17 +235,7 @@ public class PinyinIME extends InputMethodService {
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
-        int count = event.getRepeatCount();
-        if (0 == count) {
-            if (processKey(event, false)) return true;
-        } else {
-            boolean processed = false;
-            while (count > 0) {
-                processed |= processKey(event, true);
-                count--;
-            }
-            if (processed) return true;
-        }
+        if (processKey(event, 0 != event.getRepeatCount())) return true;
         return super.onKeyDown(keyCode, event);
     }
 
@@ -265,7 +255,7 @@ public class PinyinIME extends InputMethodService {
             if (!realAction) return true;
 
             updateIcon(mInputModeSwitcher.switchLanguageWithHkb());
-            resetToIdleState(true);
+            resetToIdleState(false);
 
             int allMetaState = KeyEvent.META_ALT_ON | KeyEvent.META_ALT_LEFT_ON
                     | KeyEvent.META_ALT_RIGHT_ON | KeyEvent.META_SHIFT_ON
@@ -462,6 +452,27 @@ public class PinyinIME extends InputMethodService {
 
     private boolean processStateInput(int keyChar, int keyCode, KeyEvent event,
             boolean realAction) {
+        // If ALT key is pressed, input alternative key. But if the
+        // alternative key is quote key, it will be used for input a splitter
+        // in Pinyin string.
+        if (event.isAltPressed()) {
+            if ('\'' != event.getUnicodeChar(event.getMetaState())) {
+                if (realAction) {
+                    char fullwidth_char = KeyMapDream.getChineseLabel(keyCode);
+                    if (0 != fullwidth_char) {
+                        commitResultText(mDecInfo
+                                .getCurrentFullSent(mCandidatesContainer
+                                        .getActiveCandiatePos()) +
+                                        String.valueOf(fullwidth_char));
+                        resetToIdleState(false);
+                    }
+                }
+                return true;
+            } else {
+                keyChar = '\'';
+            }
+        }
+
         if (keyChar >= 'a' && keyChar <= 'z' || keyChar == '\''
                 && !mDecInfo.charBeforeCursorIsSeparator()
                 || keyCode == KeyEvent.KEYCODE_DEL) {
@@ -513,13 +524,13 @@ public class PinyinIME extends InputMethodService {
             if (!realAction) return true;
             if (mInputModeSwitcher.isEnterNoramlState()) {
                 commitResultText(mDecInfo.getOrigianlSplStr().toString());
-                resetToIdleState(true);
+                resetToIdleState(false);
             } else {
                 commitResultText(mDecInfo
                         .getCurrentFullSent(mCandidatesContainer
                                 .getActiveCandiatePos()));
                 sendKeyChar('\n');
-                resetToIdleState(true);
+                resetToIdleState(false);
             }
             return true;
         } else if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER
@@ -529,7 +540,7 @@ public class PinyinIME extends InputMethodService {
             return true;
         } else if (keyCode == KeyEvent.KEYCODE_BACK) {
             if (!realAction) return true;
-            resetToIdleState(true);
+            resetToIdleState(false);
             requestHideSelf(0);
             return true;
         }
@@ -540,6 +551,18 @@ public class PinyinIME extends InputMethodService {
             KeyEvent event, boolean realAction) {
         if (!realAction) return true;
 
+        // If ALT key is pressed, input alternative key.
+        if (event.isAltPressed()) {
+            char fullwidth_char = KeyMapDream.getChineseLabel(keyCode);
+            if (0 != fullwidth_char) {
+                commitResultText(mDecInfo.getCandidate(mCandidatesContainer
+                                .getActiveCandiatePos()) +
+                                String.valueOf(fullwidth_char));
+                resetToIdleState(false);
+            }
+            return true;
+        }
+
         // In this status, when user presses keys in [a..z], the status will
         // change to input state.
         if (keyChar >= 'a' && keyChar <= 'z') {
@@ -569,7 +592,7 @@ public class PinyinIME extends InputMethodService {
         } else if (keyCode == KeyEvent.KEYCODE_BACK) {
             resetToIdleState(false);
             requestHideSelf(0);
-        } else if (keyCode >= KeyEvent.KEYCODE_1 
+        } else if (keyCode >= KeyEvent.KEYCODE_1
                 && keyCode <= KeyEvent.KEYCODE_9) {
             int activePos = keyCode - KeyEvent.KEYCODE_1;
             int currentPage = mCandidatesContainer.getCurrentPage();
@@ -595,6 +618,32 @@ public class PinyinIME extends InputMethodService {
             KeyEvent event, boolean realAction) {
         if (!realAction) return true;
 
+        ComposingView.ComposingStatus cmpsvStatus =
+                mComposingView.getComposingStatus();
+
+        // If ALT key is pressed, input alternative key. But if the
+        // alternative key is quote key, it will be used for input a splitter
+        // in Pinyin string.
+        if (event.isAltPressed()) {
+            if ('\'' != event.getUnicodeChar(event.getMetaState())) {
+                char fullwidth_char = KeyMapDream.getChineseLabel(keyCode);
+                if (0 != fullwidth_char) {
+                    String retStr;
+                    if (ComposingView.ComposingStatus.SHOW_STRING_LOWERCASE ==
+                            cmpsvStatus) {
+                        retStr = mDecInfo.getOrigianlSplStr().toString();
+                    } else {
+                        retStr = mDecInfo.getComposingStr();
+                    }
+                    commitResultText(retStr + String.valueOf(fullwidth_char));
+                    resetToIdleState(false);
+                }
+                return true;
+            } else {
+                keyChar = '\'';
+            }
+        }
+
         if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
             if (!mDecInfo.selectionFinished()) {
                 changeToStateInput(true);
@@ -606,9 +655,6 @@ public class PinyinIME extends InputMethodService {
                 .isEnterNoramlState())
                 || keyCode == KeyEvent.KEYCODE_DPAD_CENTER
                 || keyCode == KeyEvent.KEYCODE_SPACE) {
-            ComposingView.ComposingStatus cmpsvStatus = mComposingView
-                    .getComposingStatus();
-
             if (ComposingView.ComposingStatus.SHOW_STRING_LOWERCASE == cmpsvStatus) {
                 String str = mDecInfo.getOrigianlSplStr().toString();
                 if (!tryInputRawUnicode(str)) {
@@ -734,7 +780,7 @@ public class PinyinIME extends InputMethodService {
 
     private void commitResultText(String resultText) {
         InputConnection ic = getCurrentInputConnection();
-        if (null != ic) ic.commitText(resultText, resultText.length());
+        if (null != ic) ic.commitText(resultText, 1);
         if (null != mComposingView) {
             mComposingView.setVisibility(View.INVISIBLE);
             mComposingView.invalidate();
@@ -929,7 +975,7 @@ public class PinyinIME extends InputMethodService {
 
         if (sKey.isUserDefKey()) {
             updateIcon(mInputModeSwitcher.switchModeForUserKey(keyCode));
-            resetToIdleState(true);
+            resetToIdleState(false);
             mSkbContainer.updateInputMode();
         } else {
             if (sKey.isKeyCodeKey()) {
@@ -968,7 +1014,7 @@ public class PinyinIME extends InputMethodService {
             // back to the previous soft keyboard automatically.
             if (!mSkbContainer.isCurrentSkbSticky()) {
                 updateIcon(mInputModeSwitcher.requestBackToPreviousSkb());
-                resetToIdleState(true);
+                resetToIdleState(false);
                 mSkbContainer.updateInputMode();
             }
         }
@@ -1689,9 +1735,13 @@ public class PinyinIME extends InputMethodService {
         }
 
         public String getCurrentFullSent(int activeCandPos) {
-            String retStr = mFullSent.substring(0, mFixedLen);
-            retStr += mCandidatesList.get(activeCandPos);
-            return retStr;
+            try {
+                String retStr = mFullSent.substring(0, mFixedLen);
+                retStr += mCandidatesList.get(activeCandPos);
+                return retStr;
+            } catch (Exception e) {
+                return "";
+            }
         }
 
         public void resetCandidates() {
@@ -1818,6 +1868,9 @@ public class PinyinIME extends InputMethodService {
                 }
             } catch (RemoteException e) {
                 Log.w(TAG, "PinyinDecoderService died", e);
+            } catch (Exception e) {
+                mTotalChoicesNum = 0;
+                mComposingStr = "";
             }
             // Prepare page 0.
             if (!mFinishSelection) {