Sync with jb-mr1-dev

Change-Id: I6bc4664468cb2f0b3c55e42859b5fe86231a1b2f
main
The Android Open Source Project 2012-07-31 07:52:42 -07:00
commit df3f09c2e7
33 changed files with 530 additions and 456 deletions

View File

@ -18,6 +18,8 @@
coreApp="true"
package="com.android.inputmethod.latin">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
@ -26,7 +28,8 @@
<application android:label="@string/aosp_android_keyboard_ime_name"
android:icon="@drawable/ic_ime_settings"
android:backupAgent="BackupAgent"
android:killAfterRestore="false">
android:killAfterRestore="false"
android:supportsRtl="true">
<service android:name="LatinIME"
android:label="@string/aosp_android_keyboard_ime_name"

View File

@ -24,15 +24,36 @@
<switch>
<case
latin:languageCode="fa"
latin:languageSwitchKeyEnabled="true"
>
<Key
latin:keyStyle="languageSwitchKeyStyle" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="24.141%p" />
<Key
latin:keyStyle="zwnjKeyStyle" />
</case>
<case
latin:languageCode="fa"
latin:languageSwitchKeyEnabled="false"
>
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="32.188%p" />
<!-- U+200C: "" ZERO WIDTH NON-JOINER
U+200D: "" ZERO WIDTH JOINER -->
<Key
latin:keyStyle="zwnjKeyStyle" />
</case>
<case
latin:languageSwitchKeyEnabled="true"
>
<Key
latin:keyStyle="languageSwitchKeyStyle" />
<Key
latin:keyStyle="spaceKeyStyle"
latin:keyWidth="32.188%p" />
</case>
<!-- languageSwitchKeyEnabled="false" -->
<default>
<Key
latin:keyStyle="spaceKeyStyle"

View File

@ -76,7 +76,7 @@
<key-style
latin:styleName="spaceKeyStyle"
latin:code="!code/key_space"
latin:keyActionFlags="noKeyPreview" />
latin:keyActionFlags="noKeyPreview|enableLongPress" />
<!-- U+200C: ZERO WIDTH NON-JOINER
U+200D: ZERO WIDTH JOINER -->
<key-style
@ -99,6 +99,12 @@
latin:keyIconDisabled="!icon/shortcut_key_disabled"
latin:keyActionFlags="noKeyPreview"
latin:backgroundType="functional" />
<key-style
latin:styleName="languageSwitchKeyStyle"
latin:code="!code/key_language_switch"
latin:keyIcon="!icon/language_switch_key"
latin:keyActionFlags="noKeyPreview|altCodeWhileTyping|enableLongPress"
latin:altCode="!code/key_space" />
<key-style
latin:styleName="settingsKeyStyle"
latin:code="!code/key_settings"

View File

@ -33,9 +33,8 @@
<include
latin:keyboardLayout="@xml/rowkeys_east_slavic1"
latin:keyLabelFlags="disableAdditionalMoreKeys|disableKeyHintLabel" />
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<Key
latin:keyLabel="&#x044A;" />
latin:keyLabel="!text/keylabel_for_east_slavic_row1_12" />
<Key
latin:keyStyle="deleteKeyStyle"
latin:keyWidth="fillRight" />

View File

@ -47,7 +47,7 @@
latin:keyLabel="&#x0435;"
latin:keyHintLabel="5"
latin:additionalMoreKeys="5"
latin:moreKeys="!text/more_keys_for_cyrillic_ye" />
latin:moreKeys="!text/more_keys_for_cyrillic_ie" />
<!-- U+043D: "н" CYRILLIC SMALL LETTER EN -->
<Key
latin:keyLabel="&#x043D;"
@ -58,7 +58,8 @@
<Key
latin:keyLabel="&#x0433;"
latin:keyHintLabel="7"
latin:additionalMoreKeys="7" />
latin:additionalMoreKeys="7"
latin:moreKeys="!text/more_keys_for_cyrillic_ghe" />
<!-- U+0448: "ш" CYRILLIC SMALL LETTER SHA -->
<Key
latin:keyLabel="&#x0448;"
@ -75,6 +76,5 @@
latin:additionalMoreKeys="0" />
<!-- U+0445: "х" CYRILLIC SMALL LETTER HA -->
<Key
latin:keyLabel="&#x0445;"
latin:moreKeys="!text/more_keys_for_cyrillic_ha" />
latin:keyLabel="&#x0445;" />
</merge>

View File

@ -52,7 +52,6 @@
<!-- U+0436: "ж" CYRILLIC SMALL LETTER ZHE -->
<Key
latin:keyLabel="&#x0436;" />
<!-- U+044D: "э" CYRILLIC SMALL LETTER E -->
<Key
latin:keyLabel="&#x044D;" />
latin:keyLabel="!text/keylabel_for_east_slavic_row2_11" />
</merge>

View File

@ -154,8 +154,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
}
break;
case MSG_TYPING_STATE_EXPIRED:
cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator,
keyboardView.mAltCodeKeyWhileTypingFadeinAnimator);
startWhileTypingFadeinAnimation(keyboardView);
break;
}
}
@ -229,7 +228,7 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
removeMessages(MSG_LONGPRESS_KEY);
}
public static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
final ObjectAnimator animatorToStart) {
float startFraction = 0.0f;
if (animatorToCancel.isStarted()) {
@ -241,18 +240,39 @@ public class MainKeyboardView extends KeyboardView implements PointerTracker.Key
animatorToStart.setCurrentPlayTime(startTime);
}
private static void startWhileTypingFadeinAnimation(final MainKeyboardView keyboardView) {
cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator,
keyboardView.mAltCodeKeyWhileTypingFadeinAnimator);
}
private static void startWhileTypingFadeoutAnimation(final MainKeyboardView keyboardView) {
cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeinAnimator,
keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator);
}
@Override
public void startTypingStateTimer() {
public void startTypingStateTimer(Key typedKey) {
if (typedKey.isModifier() || typedKey.altCodeWhileTyping()) {
return;
}
final boolean isTyping = isTypingState();
removeMessages(MSG_TYPING_STATE_EXPIRED);
final MainKeyboardView keyboardView = getOuterInstance();
// When user hits the space or the enter key, just cancel the while-typing timer.
final int typedCode = typedKey.mCode;
if (typedCode == Keyboard.CODE_SPACE || typedCode == Keyboard.CODE_ENTER) {
startWhileTypingFadeinAnimation(keyboardView);
return;
}
sendMessageDelayed(
obtainMessage(MSG_TYPING_STATE_EXPIRED), mParams.mIgnoreAltCodeKeyTimeout);
if (isTyping) {
return;
}
final MainKeyboardView keyboardView = getOuterInstance();
cancelAndStartAnimators(keyboardView.mAltCodeKeyWhileTypingFadeinAnimator,
keyboardView.mAltCodeKeyWhileTypingFadeoutAnimator);
startWhileTypingFadeoutAnimation(keyboardView);
}
@Override

View File

@ -82,7 +82,7 @@ public class PointerTracker {
}
public interface TimerProxy {
public void startTypingStateTimer();
public void startTypingStateTimer(Key typedKey);
public boolean isTypingState();
public void startKeyRepeatTimer(PointerTracker tracker);
public void startLongPressTimer(PointerTracker tracker);
@ -95,7 +95,7 @@ public class PointerTracker {
public static class Adapter implements TimerProxy {
@Override
public void startTypingStateTimer() {}
public void startTypingStateTimer(Key typedKey) {}
@Override
public boolean isTypingState() { return false; }
@Override
@ -329,9 +329,7 @@ public class PointerTracker {
mListener.onPressKey(key.mCode);
final boolean keyboardLayoutHasBeenChanged = mKeyboardLayoutHasBeenChanged;
mKeyboardLayoutHasBeenChanged = false;
if (!key.altCodeWhileTyping() && !key.isModifier()) {
mTimerProxy.startTypingStateTimer();
}
mTimerProxy.startTypingStateTimer(key);
return keyboardLayoutHasBeenChanged;
}
return false;
@ -956,9 +954,7 @@ public class PointerTracker {
public void onRegisterKey(Key key) {
if (key != null) {
detectAndSendKey(key, key.mX, key.mY);
if (!key.altCodeWhileTyping() && !key.isModifier()) {
mTimerProxy.startTypingStateTimer();
}
mTimerProxy.startTypingStateTimer(key);
}
}

View File

@ -21,10 +21,10 @@
#include "jni_common.h"
#include "proximity_info.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string>
#include <cassert>
#include <cerrno>
#include <cstdio>
#include <cstring>
namespace latinime {

View File

@ -25,9 +25,9 @@
#include "jni_common.h"
#include "proximity_info.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <cassert>
#include <cerrno>
#include <cstdio>
#ifdef USE_MMAP_FOR_DICTIONARY
#include <sys/mman.h>
@ -36,7 +36,7 @@
#include <fcntl.h>
#include <unistd.h>
#else // USE_MMAP_FOR_DICTIONARY
#include <stdlib.h>
#include <cstdlib>
#endif // USE_MMAP_FOR_DICTIONARY
namespace latinime {

View File

@ -18,7 +18,7 @@
#include "jni.h"
#include "jni_common.h"
#include <math.h>
#include <cmath>
namespace latinime {

View File

@ -23,9 +23,9 @@
#include "jni.h"
#include "proximity_info.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <cassert>
#include <cerrno>
#include <cstdio>
using namespace latinime;

View File

@ -17,8 +17,6 @@
#ifndef LATINIME_JNI_COMMON_H
#define LATINIME_JNI_COMMON_H
#include <stdlib.h>
#include "jni.h"
namespace latinime {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <string.h>
#include <cstring>
#define LOG_TAG "LatinIME: bigram_dictionary.cpp"

View File

@ -24,7 +24,6 @@
namespace latinime {
class Dictionary;
class BigramDictionary {
public:
BigramDictionary(const unsigned char *dict, int maxWordLength, int maxPredictions);

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
#include <stdlib.h>
#include <cstdlib>
namespace latinime {

View File

@ -14,11 +14,10 @@
* limitations under the License.
*/
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstring>
#define LOG_TAG "LatinIME: correction.cpp"

View File

@ -17,7 +17,7 @@
#ifndef LATINIME_CORRECTION_H
#define LATINIME_CORRECTION_H
#include <assert.h>
#include <cassert>
#include <stdint.h>
#include "correction_state.h"

View File

@ -14,8 +14,6 @@
* limitations under the License.
*/
#include <stdio.h>
#define LOG_TAG "LatinIME: dictionary.cpp"
#include "binary_format.h"

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <cassert>
#include <cmath>
#include <cstring>
#include <string>
#define LOG_TAG "LatinIME: proximity_info.cpp"

View File

@ -14,9 +14,8 @@
* limitations under the License.
*/
#include <assert.h>
#include <cassert>
#include <stdint.h>
#include <string>
#define LOG_TAG "LatinIME: proximity_info_state.cpp"

View File

@ -17,7 +17,7 @@
#ifndef LATINIME_PROXIMITY_INFO_STATE_H
#define LATINIME_PROXIMITY_INFO_STATE_H
#include <assert.h>
#include <cassert>
#include <stdint.h>
#include <string>

View File

@ -14,8 +14,8 @@
* limitations under the License.
*/
#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>
#define LOG_TAG "LatinIME: unigram_dictionary.cpp"

View File

@ -19,16 +19,15 @@
#include <map>
#include <stdint.h>
#include "correction.h"
#include "correction_state.h"
#include "defines.h"
#include "proximity_info.h"
#include "words_priority_queue.h"
#include "words_priority_queue_pool.h"
namespace latinime {
class Correction;
class ProximityInfo;
class TerminalAttributes;
class WordsPriorityQueuePool;
class UnigramDictionary {
typedef struct { int first; int second; int replacement; } digraph_t;

View File

@ -20,6 +20,8 @@
#include <cstring> // for memcpy()
#include <iostream>
#include <queue>
#include "correction.h"
#include "defines.h"
namespace latinime {

View File

@ -17,8 +17,7 @@
#ifndef LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
#define LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
#include <assert.h>
#include <new>
#include <cassert>
#include "words_priority_queue.h"
namespace latinime {

View File

@ -17,6 +17,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.inputmethod.latin.tests">
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application>

View File

@ -20,12 +20,16 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- U+045E: "ў" CYRILLIC SMALL LETTER SHORT U -->
<string name="keylabel_for_east_slavic_row1_9">&#x045E;</string>
<!-- U+0451: "ё" CYRILLIC SMALL LETTER IO -->
<string name="keylabel_for_east_slavic_row1_12">&#x0451;</string>
<!-- U+044B: "ы" CYRILLIC SMALL LETTER YERU -->
<string name="keylabel_for_east_slavic_row2_1">&#x044B;</string>
<!-- U+044D: "э" CYRILLIC SMALL LETTER E -->
<string name="keylabel_for_east_slavic_row2_11">&#x044D;</string>
<!-- U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I -->
<string name="keylabel_for_east_slavic_row3_5">&#x0456;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="more_keys_for_cyrillic_ha">&#x044A;</string>
<!-- U+0451: "ё" CYRILLIC SMALL LETTER IO -->
<string name="more_keys_for_cyrillic_ie">&#x0451;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="more_keys_for_cyrillic_soft_sign">&#x044A;</string>
</resources>

View File

@ -20,16 +20,20 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- U+0449: "щ" CYRILLIC SMALL LETTER SHCHA -->
<string name="keylabel_for_east_slavic_row1_9">&#x0449;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="keylabel_for_east_slavic_row1_12">&#x044A;</string>
<!-- U+044B: "ы" CYRILLIC SMALL LETTER YERU -->
<string name="keylabel_for_east_slavic_row2_1">&#x044B;</string>
<!-- U+044D: "э" CYRILLIC SMALL LETTER E -->
<string name="keylabel_for_east_slavic_row2_11">&#x044D;</string>
<!-- U+0438: "и" CYRILLIC SMALL LETTER I -->
<string name="keylabel_for_east_slavic_row3_5">&#x0438;</string>
<!-- U+04AF: "ү" CYRILLIC SMALL LETTER STRAIGHT U -->
<string name="more_keys_for_cyrillic_u">&#x04AF;</string>
<!-- U+0451: "ё" CYRILLIC SMALL LETTER IO -->
<string name="more_keys_for_cyrillic_ie">&#x0451;</string>
<!-- U+04A3: "ң" CYRILLIC SMALL LETTER EN WITH DESCENDER -->
<string name="more_keys_for_cyrillic_en">&#x04A3;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="more_keys_for_cyrillic_ha">&#x044A;</string>
<!-- U+04E9: "ө" CYRILLIC SMALL LETTER BARRED O -->
<string name="more_keys_for_cyrillic_o">&#x04E9;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->

View File

@ -20,14 +20,16 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- U+0449: "щ" CYRILLIC SMALL LETTER SHCHA -->
<string name="keylabel_for_east_slavic_row1_9">&#x0449;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="keylabel_for_east_slavic_row1_12">&#x044A;</string>
<!-- U+044B: "ы" CYRILLIC SMALL LETTER YERU -->
<string name="keylabel_for_east_slavic_row2_1">&#x044B;</string>
<!-- U+044D: "э" CYRILLIC SMALL LETTER E -->
<string name="keylabel_for_east_slavic_row2_11">&#x044D;</string>
<!-- U+0438: "и" CYRILLIC SMALL LETTER I -->
<string name="keylabel_for_east_slavic_row3_5">&#x0438;</string>
<!-- U+0451: "ё" CYRILLIC SMALL LETTER IO -->
<string name="more_keys_for_cyrillic_ye">&#x0451;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="more_keys_for_cyrillic_ha">&#x044A;</string>
<string name="more_keys_for_cyrillic_ie">&#x0451;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="more_keys_for_cyrillic_soft_sign">&#x044A;</string>
</resources>

View File

@ -20,12 +20,16 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- U+0449: "щ" CYRILLIC SMALL LETTER SHCHA -->
<string name="keylabel_for_east_slavic_row1_9">&#x0449;</string>
<!-- U+0457: "ї" CYRILLIC SMALL LETTER YI -->
<string name="keylabel_for_east_slavic_row1_12">&#x0457;</string>
<!-- U+0456: "і" CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I -->
<string name="keylabel_for_east_slavic_row2_1">&#x0456;</string>
<!-- U+0454: "є" CYRILLIC SMALL LETTER UKRAINIAN IE -->
<string name="keylabel_for_east_slavic_row2_11">&#x0454;</string>
<!-- U+0438: "и" CYRILLIC SMALL LETTER I -->
<string name="keylabel_for_east_slavic_row3_5">&#x0438;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->
<string name="more_keys_for_cyrillic_ha">&#x044A;</string>
<!-- U+0491: "ґ" CYRILLIC SMALL LETTER GHE WITH UPTURN -->
<string name="more_keys_for_cyrillic_ghe">&#x0491;</string>
<!-- U+0457: "ї" CYRILLIC SMALL LETTER YI -->
<string name="more_keys_for_east_slavic_row2_1">&#x0457;</string>
<!-- U+044A: "ъ" CYRILLIC SMALL LETTER HARD SIGN -->

View File

@ -44,12 +44,13 @@
<string name="more_keys_for_nordic_row2_10"></string>
<string name="more_keys_for_nordic_row2_11"></string>
<string name="keylabel_for_east_slavic_row1_9"></string>
<string name="keylabel_for_east_slavic_row1_12"></string>
<string name="keylabel_for_east_slavic_row2_1"></string>
<string name="keylabel_for_east_slavic_row2_11"></string>
<string name="keylabel_for_east_slavic_row3_5"></string>
<string name="more_keys_for_cyrillic_u"></string>
<string name="more_keys_for_cyrillic_ye"></string>
<string name="more_keys_for_cyrillic_en"></string>
<string name="more_keys_for_cyrillic_ha"></string>
<string name="more_keys_for_cyrillic_ghe"></string>
<string name="more_keys_for_east_slavic_row2_1"></string>
<string name="more_keys_for_cyrillic_o"></string>
<string name="more_keys_for_cyrillic_soft_sign"></string>