aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/res/values-h1200dp-port/setup-dimens-large-tablet-port.xml40
-rw-r--r--java/res/values-h330dp-land/setup-dimens-large-phone-land.xml40
-rw-r--r--java/res/values-h520dp-land/setup-dimens-small-tablet-land.xml40
-rw-r--r--java/res/values-h540dp-port/setup-dimens-large-phone-port.xml (renamed from java/res/values/setup-dimens.xml)2
-rw-r--r--java/res/values-h720dp-land/setup-dimens-large-tablet-land.xml40
-rw-r--r--java/res/values-h800dp-port/setup-dimens-small-tablet-port.xml40
-rw-r--r--java/res/values-land/setup-dimens-small-phone-land.xml40
-rw-r--r--java/res/values-port/setup-dimens-small-phone-port.xml40
-rw-r--r--java/res/values-sw600dp-land/setup-dimens.xml21
-rw-r--r--java/res/values-sw768dp-land/setup-dimens.xml21
-rw-r--r--java/res/values/config.xml5
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/WordListPreference.java11
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsValues.java13
-rw-r--r--native/jni/src/suggest/core/dicnode/dic_node_utils.cpp9
-rw-r--r--native/jni/src/suggest/core/dicnode/dic_node_utils.h1
-rw-r--r--native/jni/src/suggest/core/session/dic_traverse_session.cpp10
16 files changed, 306 insertions, 67 deletions
diff --git a/java/res/values-h1200dp-port/setup-dimens-large-tablet-port.xml b/java/res/values-h1200dp-port/setup-dimens-large-tablet-port.xml
new file mode 100644
index 000000000..ad61c1a3a
--- /dev/null
+++ b/java/res/values-h1200dp-port/setup-dimens-large-tablet-port.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for large-tablet/portrait. -->
+ <dimen name="setup_title_text_size">72sp</dimen>
+ <dimen name="setup_welcome_description_text_size">36sp</dimen>
+ <dimen name="setup_step_bullet_text_size">24sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">24dp</dimen>
+ <dimen name="setup_step_indicator_height">24dp</dimen>
+ <dimen name="setup_step_title_text_size">24sp</dimen>
+ <dimen name="setup_step_instruction_text_size">18sp</dimen>
+ <dimen name="setup_step_action_text_size">20sp</dimen>
+ <dimen name="setup_vertical_padding">96dp</dimen>
+ <dimen name="setup_horizontal_padding">144dp</dimen>
+ <dimen name="setup_step_action_height">48dp</dimen>
+ <dimen name="setup_step_horizontal_padding">24dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">12dp</dimen>
+ <dimen name="setup_step_vertical_padding">16dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">24dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">50</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">25</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">25</integer>
+</resources>
diff --git a/java/res/values-h330dp-land/setup-dimens-large-phone-land.xml b/java/res/values-h330dp-land/setup-dimens-large-phone-land.xml
new file mode 100644
index 000000000..69a8a7ad5
--- /dev/null
+++ b/java/res/values-h330dp-land/setup-dimens-large-phone-land.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for large-phone/landscape. -->
+ <dimen name="setup_title_text_size">42sp</dimen>
+ <dimen name="setup_welcome_description_text_size">24sp</dimen>
+ <dimen name="setup_step_bullet_text_size">22sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">24dp</dimen>
+ <dimen name="setup_step_indicator_height">24dp</dimen>
+ <dimen name="setup_step_title_text_size">22sp</dimen>
+ <dimen name="setup_step_instruction_text_size">14sp</dimen>
+ <dimen name="setup_step_action_text_size">18sp</dimen>
+ <dimen name="setup_vertical_padding">16dp</dimen>
+ <dimen name="setup_horizontal_padding">16dp</dimen>
+ <dimen name="setup_step_action_height">48dp</dimen>
+ <dimen name="setup_step_horizontal_padding">24dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">12dp</dimen>
+ <dimen name="setup_step_vertical_padding">16dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">24dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">80</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">10</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">10</integer>
+</resources>
diff --git a/java/res/values-h520dp-land/setup-dimens-small-tablet-land.xml b/java/res/values-h520dp-land/setup-dimens-small-tablet-land.xml
new file mode 100644
index 000000000..6a14d5918
--- /dev/null
+++ b/java/res/values-h520dp-land/setup-dimens-small-tablet-land.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for small-tablet/landscape. -->
+ <dimen name="setup_title_text_size">56sp</dimen>
+ <dimen name="setup_welcome_description_text_size">28sp</dimen>
+ <dimen name="setup_step_bullet_text_size">24sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">24dp</dimen>
+ <dimen name="setup_step_indicator_height">24dp</dimen>
+ <dimen name="setup_step_title_text_size">24sp</dimen>
+ <dimen name="setup_step_instruction_text_size">18sp</dimen>
+ <dimen name="setup_step_action_text_size">20sp</dimen>
+ <dimen name="setup_vertical_padding">32dp</dimen>
+ <dimen name="setup_horizontal_padding">96dp</dimen>
+ <dimen name="setup_step_action_height">48dp</dimen>
+ <dimen name="setup_step_horizontal_padding">24dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">12dp</dimen>
+ <dimen name="setup_step_vertical_padding">16dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">24dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">60</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">20</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">20</integer>
+</resources>
diff --git a/java/res/values/setup-dimens.xml b/java/res/values-h540dp-port/setup-dimens-large-phone-port.xml
index 5abc28982..b8dd33df4 100644
--- a/java/res/values/setup-dimens.xml
+++ b/java/res/values-h540dp-port/setup-dimens-large-phone-port.xml
@@ -15,10 +15,12 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for large-phone/portrait. -->
<dimen name="setup_title_text_size">46sp</dimen>
<dimen name="setup_welcome_description_text_size">26sp</dimen>
<dimen name="setup_step_bullet_text_size">22sp</dimen>
<dimen name="setup_step_triangle_indicator_height">24dp</dimen>
+ <dimen name="setup_step_indicator_height">24dp</dimen>
<dimen name="setup_step_title_text_size">22sp</dimen>
<dimen name="setup_step_instruction_text_size">14sp</dimen>
<dimen name="setup_step_action_text_size">18sp</dimen>
diff --git a/java/res/values-h720dp-land/setup-dimens-large-tablet-land.xml b/java/res/values-h720dp-land/setup-dimens-large-tablet-land.xml
new file mode 100644
index 000000000..0004a3c85
--- /dev/null
+++ b/java/res/values-h720dp-land/setup-dimens-large-tablet-land.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for large-tablet/landscape. -->
+ <dimen name="setup_title_text_size">58sp</dimen>
+ <dimen name="setup_welcome_description_text_size">28sp</dimen>
+ <dimen name="setup_step_bullet_text_size">24sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">24dp</dimen>
+ <dimen name="setup_step_indicator_height">24dp</dimen>
+ <dimen name="setup_step_title_text_size">24sp</dimen>
+ <dimen name="setup_step_instruction_text_size">18sp</dimen>
+ <dimen name="setup_step_action_text_size">20sp</dimen>
+ <dimen name="setup_vertical_padding">96dp</dimen>
+ <dimen name="setup_horizontal_padding">192dp</dimen>
+ <dimen name="setup_step_action_height">48dp</dimen>
+ <dimen name="setup_step_horizontal_padding">24dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">12dp</dimen>
+ <dimen name="setup_step_vertical_padding">16dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">24dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">50</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">25</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">25</integer>
+</resources>
diff --git a/java/res/values-h800dp-port/setup-dimens-small-tablet-port.xml b/java/res/values-h800dp-port/setup-dimens-small-tablet-port.xml
new file mode 100644
index 000000000..87c991c4d
--- /dev/null
+++ b/java/res/values-h800dp-port/setup-dimens-small-tablet-port.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for small-tablet/portrait. -->
+ <dimen name="setup_title_text_size">72sp</dimen>
+ <dimen name="setup_welcome_description_text_size">36sp</dimen>
+ <dimen name="setup_step_bullet_text_size">24sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">24dp</dimen>
+ <dimen name="setup_step_indicator_height">24dp</dimen>
+ <dimen name="setup_step_title_text_size">24sp</dimen>
+ <dimen name="setup_step_instruction_text_size">18sp</dimen>
+ <dimen name="setup_step_action_text_size">20sp</dimen>
+ <dimen name="setup_vertical_padding">32dp</dimen>
+ <dimen name="setup_horizontal_padding">64dp</dimen>
+ <dimen name="setup_step_action_height">48dp</dimen>
+ <dimen name="setup_step_horizontal_padding">24dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">12dp</dimen>
+ <dimen name="setup_step_vertical_padding">16dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">24dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">60</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">20</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">20</integer>
+</resources>
diff --git a/java/res/values-land/setup-dimens-small-phone-land.xml b/java/res/values-land/setup-dimens-small-phone-land.xml
new file mode 100644
index 000000000..63f4661d1
--- /dev/null
+++ b/java/res/values-land/setup-dimens-small-phone-land.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for small-phone/landscape. -->
+ <dimen name="setup_title_text_size">36sp</dimen>
+ <dimen name="setup_welcome_description_text_size">18sp</dimen>
+ <dimen name="setup_step_bullet_text_size">18sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">18dp</dimen>
+ <dimen name="setup_step_indicator_height">18dp</dimen>
+ <dimen name="setup_step_title_text_size">18sp</dimen>
+ <dimen name="setup_step_instruction_text_size">14sp</dimen>
+ <dimen name="setup_step_action_text_size">16sp</dimen>
+ <dimen name="setup_vertical_padding">12dp</dimen>
+ <dimen name="setup_horizontal_padding">12dp</dimen>
+ <dimen name="setup_step_action_height">42dp</dimen>
+ <dimen name="setup_step_horizontal_padding">20dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">10dp</dimen>
+ <dimen name="setup_step_vertical_padding">12dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">24dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">80</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">10</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">10</integer>
+</resources>
diff --git a/java/res/values-port/setup-dimens-small-phone-port.xml b/java/res/values-port/setup-dimens-small-phone-port.xml
new file mode 100644
index 000000000..34f4d9240
--- /dev/null
+++ b/java/res/values-port/setup-dimens-small-phone-port.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 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.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- Setup wizard dimensions for small-phone/portrait. -->
+ <dimen name="setup_title_text_size">40sp</dimen>
+ <dimen name="setup_welcome_description_text_size">20sp</dimen>
+ <dimen name="setup_step_bullet_text_size">18sp</dimen>
+ <dimen name="setup_step_triangle_indicator_height">18dp</dimen>
+ <dimen name="setup_step_indicator_height">18dp</dimen>
+ <dimen name="setup_step_title_text_size">18sp</dimen>
+ <dimen name="setup_step_instruction_text_size">14sp</dimen>
+ <dimen name="setup_step_action_text_size">16sp</dimen>
+ <dimen name="setup_vertical_padding">12dp</dimen>
+ <dimen name="setup_horizontal_padding">12dp</dimen>
+ <dimen name="setup_step_action_height">42dp</dimen>
+ <dimen name="setup_step_horizontal_padding">20dp</dimen>
+ <dimen name="setup_step_horizontal_padding_half">10dp</dimen>
+ <dimen name="setup_step_vertical_padding">12dp</dimen>
+ <dimen name="setup_step_horizontal_line_height">2dp</dimen>
+ <integer name="setup_title_weight_in_screen">40</integer>
+ <integer name="setup_body_weight_in_screen">60</integer>
+ <dimen name="setup_welcome_video_vertical_margin">16dp</dimen>
+ <integer name="setup_welcome_video_weight_in_screen">80</integer>
+ <integer name="setup_welcome_video_left_padding_weight_in_screen">10</integer>
+ <integer name="setup_welcome_video_right_padding_weight_in_screen">10</integer>
+</resources>
diff --git a/java/res/values-sw600dp-land/setup-dimens.xml b/java/res/values-sw600dp-land/setup-dimens.xml
deleted file mode 100644
index e5051eac7..000000000
--- a/java/res/values-sw600dp-land/setup-dimens.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <dimen name="setup_title_text_size">64sp</dimen>
- <dimen name="setup_welcome_description_text_size">36sp</dimen>
- <dimen name="setup_horizontal_padding">96dp</dimen>
-</resources>
diff --git a/java/res/values-sw768dp-land/setup-dimens.xml b/java/res/values-sw768dp-land/setup-dimens.xml
deleted file mode 100644
index 34b7f429d..000000000
--- a/java/res/values-sw768dp-land/setup-dimens.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <dimen name="setup_title_text_size">64sp</dimen>
- <dimen name="setup_welcome_description_text_size">36sp</dimen>
- <dimen name="setup_horizontal_padding">192dp</dimen>
-</resources>
diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index 4e2936c5c..f2e76bd29 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -111,8 +111,9 @@
<!-- Aggressive -->
<item>0.067</item>
<!-- Very Aggressive : Suggestion whose normalized score is greater than this value
- will be subject to auto-correction. -->
- <item>0</item>
+ will be subject to auto-correction. "floatNegativeInfinity" is a special marker
+ string for Float.NEGATIVE_INFINITY -->
+ <item>floatNegativeInfinity</item>
</string-array>
<!-- Threshold of the normalized score of the best suggestion for the spell checker to declare
a word to be "recommended" -->
diff --git a/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java b/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java
index 93f12d53e..f042795dd 100644
--- a/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java
+++ b/java/src/com/android/inputmethod/dictionarypack/WordListPreference.java
@@ -16,10 +16,9 @@
package com.android.inputmethod.dictionarypack;
-import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
-import android.preference.DialogPreference;
+import android.preference.Preference;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -38,7 +37,7 @@ import java.util.Locale;
* pack. Upon being pressed, it displays a menu to allow the user to install, disable,
* enable or delete it as appropriate for the current state of the word list.
*/
-public final class WordListPreference extends DialogPreference {
+public final class WordListPreference extends Preference {
static final private String TAG = WordListPreference.class.getSimpleName();
// What to display in the "status" field when we receive unknown data as a status from
@@ -93,12 +92,6 @@ public final class WordListPreference extends DialogPreference {
if (status == mStatus) return;
mStatus = status;
setSummary(getSummary(status));
- // If we are currently displaying the dialog, we should update it, or at least
- // dismiss it.
- final Dialog dialog = getDialog();
- if (null != dialog) {
- dialog.dismiss();
- }
}
private String getSummary(final int status) {
diff --git a/java/src/com/android/inputmethod/latin/SettingsValues.java b/java/src/com/android/inputmethod/latin/SettingsValues.java
index f77a92885..838863c71 100644
--- a/java/src/com/android/inputmethod/latin/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/SettingsValues.java
@@ -34,6 +34,9 @@ import java.util.Arrays;
*/
public final class SettingsValues {
private static final String TAG = SettingsValues.class.getSimpleName();
+ // "floatNegativeInfinity" is a special marker string for Float.NEGATIVE_INFINITE
+ // currently used for auto-correction
+ private static final String FLOAT_NEGATIVE_INFINITY_MARKER_STRING = "floatNegativeInfinity";
// From resources:
public final int mDelayUpdateOldSuggestions;
@@ -266,8 +269,12 @@ public final class SettingsValues {
try {
final int arrayIndex = Integer.valueOf(currentAutoCorrectionSetting);
if (arrayIndex >= 0 && arrayIndex < autoCorrectionThresholdValues.length) {
- autoCorrectionThreshold = Float.parseFloat(
- autoCorrectionThresholdValues[arrayIndex]);
+ final String val = autoCorrectionThresholdValues[arrayIndex];
+ if (FLOAT_NEGATIVE_INFINITY_MARKER_STRING.equals(val)) {
+ autoCorrectionThreshold = Float.NEGATIVE_INFINITY;
+ } else {
+ autoCorrectionThreshold = Float.parseFloat(val);
+ }
}
} catch (NumberFormatException e) {
// Whenever the threshold settings are correct, never come here.
@@ -275,7 +282,7 @@ public final class SettingsValues {
Log.w(TAG, "Cannot load auto correction threshold setting."
+ " currentAutoCorrectionSetting: " + currentAutoCorrectionSetting
+ ", autoCorrectionThresholdValues: "
- + Arrays.toString(autoCorrectionThresholdValues));
+ + Arrays.toString(autoCorrectionThresholdValues), e);
}
return autoCorrectionThreshold;
}
diff --git a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp
index 031e706ae..a25339174 100644
--- a/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp
+++ b/native/jni/src/suggest/core/dicnode/dic_node_utils.cpp
@@ -280,15 +280,6 @@ namespace latinime {
return NOT_A_PROBABILITY;
}
-/* static */ int DicNodeUtils::getWordPos(const uint8_t *const dicRoot, const int *word,
- const int wordLength) {
- if (!word) {
- return NOT_VALID_WORD;
- }
- return BinaryFormat::getTerminalPosition(
- dicRoot, word, wordLength, false /* forceLowerCaseSearch */);
-}
-
/* static */ bool DicNodeUtils::isMatchedNodeCodePoint(const ProximityInfoState *pInfoState,
const int pointIndex, const bool exactOnly, const int nodeCodePoint) {
if (!pInfoState) {
diff --git a/native/jni/src/suggest/core/dicnode/dic_node_utils.h b/native/jni/src/suggest/core/dicnode/dic_node_utils.h
index 15f9730de..2e6361d87 100644
--- a/native/jni/src/suggest/core/dicnode/dic_node_utils.h
+++ b/native/jni/src/suggest/core/dicnode/dic_node_utils.h
@@ -41,7 +41,6 @@ class DicNodeUtils {
static void initByCopy(DicNode *srcNode, DicNode *destNode);
static void getAllChildDicNodes(DicNode *dicNode, const uint8_t *const dicRoot,
DicNodeVector *childDicNodes);
- static int getWordPos(const uint8_t *const dicRoot, const int *word, const int prevWordLength);
static float getBigramNodeImprobability(const uint8_t *const dicRoot,
const DicNode *const node, hash_map_compat<int, int16_t> *const bigramCacheMap);
static bool isDicNodeFilteredOut(const int nodeCodePoint, const ProximityInfo *const pInfo,
diff --git a/native/jni/src/suggest/core/session/dic_traverse_session.cpp b/native/jni/src/suggest/core/session/dic_traverse_session.cpp
index 3c44db21c..b3d47326d 100644
--- a/native/jni/src/suggest/core/session/dic_traverse_session.cpp
+++ b/native/jni/src/suggest/core/session/dic_traverse_session.cpp
@@ -69,7 +69,15 @@ void DicTraverseSession::init(const Dictionary *const dictionary, const int *pre
mPrevWordPos = NOT_VALID_WORD;
return;
}
- mPrevWordPos = DicNodeUtils::getWordPos(dictionary->getOffsetDict(), prevWord, prevWordLength);
+ // TODO: merge following similar calls to getTerminalPosition into one case-insensitive call.
+ mPrevWordPos = BinaryFormat::getTerminalPosition(dictionary->getOffsetDict(), prevWord,
+ prevWordLength, false /* forceLowerCaseSearch */);
+ if (mPrevWordPos == NOT_VALID_WORD) {
+ // Check bigrams for lower-cased previous word if original was not found. Useful for
+ // auto-capitalized words like "The [current_word]".
+ mPrevWordPos = BinaryFormat::getTerminalPosition(dictionary->getOffsetDict(), prevWord,
+ prevWordLength, true /* forceLowerCaseSearch */);
+ }
}
void DicTraverseSession::setupForGetSuggestions(const ProximityInfo *pInfo,