aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/res/drawable-hdpi/unbundled_check_01.pngbin0 -> 697 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_check_02.pngbin0 -> 763 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_earth_01.pngbin0 -> 1469 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_earth_02.pngbin0 -> 1544 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_key_01.pngbin0 -> 985 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_key_02.pngbin0 -> 1013 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_select_01.pngbin0 -> 1017 bytes
-rw-r--r--java/res/drawable-hdpi/unbundled_select_02.pngbin0 -> 1235 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_check_01.pngbin0 -> 597 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_check_02.pngbin0 -> 634 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_earth_01.pngbin0 -> 965 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_earth_02.pngbin0 -> 957 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_key_01.pngbin0 -> 709 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_key_02.pngbin0 -> 709 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_select_01.pngbin0 -> 685 bytes
-rw-r--r--java/res/drawable-mdpi/unbundled_select_02.pngbin0 -> 849 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_check_01.pngbin0 -> 876 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_check_02.pngbin0 -> 1090 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_earth_01.pngbin0 -> 2183 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_earth_02.pngbin0 -> 2305 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_key_01.pngbin0 -> 1306 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_key_02.pngbin0 -> 1309 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_select_01.pngbin0 -> 1401 bytes
-rw-r--r--java/res/drawable-xhdpi/unbundled_select_02.pngbin0 -> 1681 bytes
-rw-r--r--java/res/drawable/ic_setup_step1.xml30
-rw-r--r--java/res/drawable/ic_setup_step2.xml30
-rw-r--r--java/res/drawable/ic_setup_step3.xml30
-rw-r--r--java/res/drawable/ic_setup_step3_finish.xml30
-rw-r--r--java/res/drawable/setup_step_action_background.xml30
-rw-r--r--java/res/drawable/setup_step_action_color.xml30
-rw-r--r--java/res/layout/setup_step.xml26
-rw-r--r--java/res/layout/setup_wizard.xml99
-rw-r--r--java/res/raw/main_en.dictbin1069819 -> 1069822 bytes
-rw-r--r--java/res/raw/main_fr.dictbin1329626 -> 1329626 bytes
-rw-r--r--java/res/raw/main_ru.dictbin2228286 -> 2228285 bytes
-rw-r--r--java/res/values-v17/setup-styles.xml25
-rw-r--r--java/res/values/setup-styles-common.xml57
-rw-r--r--java/res/values/setup-styles.xml29
-rw-r--r--java/res/values/strings.xml39
-rw-r--r--java/src/com/android/inputmethod/compat/TextViewCompatUtils.java18
-rw-r--r--java/src/com/android/inputmethod/keyboard/MainKeyboardView.java10
-rw-r--r--java/src/com/android/inputmethod/latin/SettingsFragment.java9
-rw-r--r--java/src/com/android/inputmethod/latin/SubtypeSwitcher.java10
-rw-r--r--java/src/com/android/inputmethod/latin/setup/SetupActivity.java63
-rw-r--r--java/src/com/android/inputmethod/research/FeedbackFragment.java39
-rw-r--r--java/src/com/android/inputmethod/research/FixedLogBuffer.java26
-rw-r--r--java/src/com/android/inputmethod/research/MainLogBuffer.java17
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLog.java16
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogDirectory.java14
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java15
-rw-r--r--java/src/com/android/inputmethod/research/UploaderService.java25
51 files changed, 468 insertions, 249 deletions
diff --git a/java/res/drawable-hdpi/unbundled_check_01.png b/java/res/drawable-hdpi/unbundled_check_01.png
new file mode 100644
index 000000000..42cce2f0f
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_check_01.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_check_02.png b/java/res/drawable-hdpi/unbundled_check_02.png
new file mode 100644
index 000000000..dcd120eac
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_check_02.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_earth_01.png b/java/res/drawable-hdpi/unbundled_earth_01.png
new file mode 100644
index 000000000..4a0f087ed
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_earth_01.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_earth_02.png b/java/res/drawable-hdpi/unbundled_earth_02.png
new file mode 100644
index 000000000..f4bd421f2
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_earth_02.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_key_01.png b/java/res/drawable-hdpi/unbundled_key_01.png
new file mode 100644
index 000000000..87c9e2c9b
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_key_01.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_key_02.png b/java/res/drawable-hdpi/unbundled_key_02.png
new file mode 100644
index 000000000..0747384b4
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_key_02.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_select_01.png b/java/res/drawable-hdpi/unbundled_select_01.png
new file mode 100644
index 000000000..bb3de2f35
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_select_01.png
Binary files differ
diff --git a/java/res/drawable-hdpi/unbundled_select_02.png b/java/res/drawable-hdpi/unbundled_select_02.png
new file mode 100644
index 000000000..e56fdab97
--- /dev/null
+++ b/java/res/drawable-hdpi/unbundled_select_02.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_check_01.png b/java/res/drawable-mdpi/unbundled_check_01.png
new file mode 100644
index 000000000..d0d02a368
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_check_01.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_check_02.png b/java/res/drawable-mdpi/unbundled_check_02.png
new file mode 100644
index 000000000..d34fa2297
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_check_02.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_earth_01.png b/java/res/drawable-mdpi/unbundled_earth_01.png
new file mode 100644
index 000000000..ba60181ac
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_earth_01.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_earth_02.png b/java/res/drawable-mdpi/unbundled_earth_02.png
new file mode 100644
index 000000000..9c5263864
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_earth_02.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_key_01.png b/java/res/drawable-mdpi/unbundled_key_01.png
new file mode 100644
index 000000000..8cd72dbd5
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_key_01.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_key_02.png b/java/res/drawable-mdpi/unbundled_key_02.png
new file mode 100644
index 000000000..4ef6e0cb7
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_key_02.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_select_01.png b/java/res/drawable-mdpi/unbundled_select_01.png
new file mode 100644
index 000000000..9ab008a46
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_select_01.png
Binary files differ
diff --git a/java/res/drawable-mdpi/unbundled_select_02.png b/java/res/drawable-mdpi/unbundled_select_02.png
new file mode 100644
index 000000000..8af807b2d
--- /dev/null
+++ b/java/res/drawable-mdpi/unbundled_select_02.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_check_01.png b/java/res/drawable-xhdpi/unbundled_check_01.png
new file mode 100644
index 000000000..1300a7f5b
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_check_01.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_check_02.png b/java/res/drawable-xhdpi/unbundled_check_02.png
new file mode 100644
index 000000000..715188656
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_check_02.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_earth_01.png b/java/res/drawable-xhdpi/unbundled_earth_01.png
new file mode 100644
index 000000000..24b663488
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_earth_01.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_earth_02.png b/java/res/drawable-xhdpi/unbundled_earth_02.png
new file mode 100644
index 000000000..59aa031b0
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_earth_02.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_key_01.png b/java/res/drawable-xhdpi/unbundled_key_01.png
new file mode 100644
index 000000000..c8b117b44
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_key_01.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_key_02.png b/java/res/drawable-xhdpi/unbundled_key_02.png
new file mode 100644
index 000000000..dc2da5632
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_key_02.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_select_01.png b/java/res/drawable-xhdpi/unbundled_select_01.png
new file mode 100644
index 000000000..baf1e55b5
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_select_01.png
Binary files differ
diff --git a/java/res/drawable-xhdpi/unbundled_select_02.png b/java/res/drawable-xhdpi/unbundled_select_02.png
new file mode 100644
index 000000000..ad1058e0c
--- /dev/null
+++ b/java/res/drawable-xhdpi/unbundled_select_02.png
Binary files differ
diff --git a/java/res/drawable/ic_setup_step1.xml b/java/res/drawable/ic_setup_step1.xml
new file mode 100644
index 000000000..e26afb3ca
--- /dev/null
+++ b/java/res/drawable/ic_setup_step1.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:drawable="@drawable/unbundled_key_01" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@drawable/unbundled_key_01" />
+ <item
+ android:drawable="@drawable/unbundled_key_02" />
+</selector>
diff --git a/java/res/drawable/ic_setup_step2.xml b/java/res/drawable/ic_setup_step2.xml
new file mode 100644
index 000000000..46db29306
--- /dev/null
+++ b/java/res/drawable/ic_setup_step2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:drawable="@drawable/unbundled_select_01" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@drawable/unbundled_select_01" />
+ <item
+ android:drawable="@drawable/unbundled_select_02" />
+</selector>
diff --git a/java/res/drawable/ic_setup_step3.xml b/java/res/drawable/ic_setup_step3.xml
new file mode 100644
index 000000000..4ff9fd933
--- /dev/null
+++ b/java/res/drawable/ic_setup_step3.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:drawable="@drawable/unbundled_earth_01" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@drawable/unbundled_earth_01" />
+ <item
+ android:drawable="@drawable/unbundled_earth_02" />
+</selector>
diff --git a/java/res/drawable/ic_setup_step3_finish.xml b/java/res/drawable/ic_setup_step3_finish.xml
new file mode 100644
index 000000000..8ac8a86d1
--- /dev/null
+++ b/java/res/drawable/ic_setup_step3_finish.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:drawable="@drawable/unbundled_check_01" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@drawable/unbundled_check_01" />
+ <item
+ android:drawable="@drawable/unbundled_check_02" />
+</selector>
diff --git a/java/res/drawable/setup_step_action_background.xml b/java/res/drawable/setup_step_action_background.xml
new file mode 100644
index 000000000..25738e3a4
--- /dev/null
+++ b/java/res/drawable/setup_step_action_background.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:drawable="@color/setup_text_action" />
+ <item
+ android:state_pressed="true"
+ android:drawable="@color/setup_text_action" />
+ <item
+ android:drawable="@color/setup_step_background" />
+</selector>
diff --git a/java/res/drawable/setup_step_action_color.xml b/java/res/drawable/setup_step_action_color.xml
new file mode 100644
index 000000000..c53e026d5
--- /dev/null
+++ b/java/res/drawable/setup_step_action_color.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 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.
+*/
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:state_focused="true"
+ android:color="@color/setup_step_background" />
+ <item
+ android:state_pressed="true"
+ android:color="@color/setup_step_background" />
+ <item
+ android:color="@color/setup_text_action" />
+</selector>
diff --git a/java/res/layout/setup_step.xml b/java/res/layout/setup_step.xml
index 26d7fe799..c6462e903 100644
--- a/java/res/layout/setup_step.xml
+++ b/java/res/layout/setup_step.xml
@@ -25,34 +25,14 @@
<TextView
android:id="@+id/setup_step_title"
style="@style/setupStepTitleStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
android:paddingTop="16dp"
- android:paddingBottom="16dp"
- android:paddingLeft="24dp"
- android:paddingRight="24dp" />
+ android:paddingBottom="16dp" />
<TextView
android:id="@+id/setup_step_instruction"
style="@style/setupStepInstructionStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingBottom="16dp"
- android:paddingLeft="24dp"
- android:paddingRight="24dp" />
- <View
- android:layout_width="match_parent"
- android:layout_height="2dp" />
+ android:paddingBottom="16dp" />
<TextView
android:id="@+id/setup_step_action_label"
style="@style/setupStepActionLabelStyle"
- android:gravity="center_vertical"
- android:drawablePadding="12dp"
- android:layout_width="match_parent"
- android:layout_height="48dp"
- android:clickable="true"
- android:focusable="true"
- android:paddingLeft="12dp"
- android:paddingStart="12dp"
- android:paddingRight="24dp"
- android:paddingEnd="24dp" />
+ android:layout_marginTop="2dp" />
</LinearLayout>
diff --git a/java/res/layout/setup_wizard.xml b/java/res/layout/setup_wizard.xml
index acbbe30b3..a922fdab8 100644
--- a/java/res/layout/setup_wizard.xml
+++ b/java/res/layout/setup_wizard.xml
@@ -18,61 +18,56 @@
*/
-->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:fillViewport="true">
- <RelativeLayout
+ android:background="@color/setup_background"
+ android:paddingLeft="@dimen/setup_horizontal_padding"
+ android:paddingRight="@dimen/setup_horizontal_padding"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp">
+ <TextView
+ android:id="@+id/setup_title"
+ style="@style/setupTitleStyle"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true" />
+ <LinearLayout
+ android:id="@+id/setup_step_bullets"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/setup_background"
- android:paddingLeft="@dimen/setup_horizontal_padding"
- android:paddingRight="@dimen/setup_horizontal_padding"
+ android:layout_below="@id/setup_title"
android:paddingTop="16dp"
- android:paddingBottom="16dp">
+ android:orientation="horizontal">
<TextView
- android:id="@+id/setup_title"
- style="@style/setupTitleStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_alignParentStart="true"
- android:layout_alignParentTop="true" />
- <LinearLayout
- android:id="@+id/setup_step_bullets"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/setup_title"
- android:paddingTop="16dp"
- android:orientation="horizontal">
- <TextView
- style="@style/setupStepBulletStyle"
- android:text="@string/setup_step1_bullet" />
- <TextView
- style="@style/setupStepBulletStyle"
- android:text="@string/setup_step2_bullet" />
- <TextView
- style="@style/setupStepBulletStyle"
- android:text="@string/setup_step3_bullet" />
- </LinearLayout>
- <com.android.inputmethod.latin.setup.SetupStepIndicatorView
- android:id="@+id/setup_step_indicator"
- android:layout_width="match_parent"
- android:layout_height="24dp"
- android:layout_below="@id/setup_step_bullets" />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/setup_step_indicator">
- <include
- android:id="@+id/setup_step1"
- layout="@layout/setup_step" />
- <include
- android:id="@+id/setup_step2"
- layout="@layout/setup_step" />
- <include
- android:id="@+id/setup_step3"
- layout="@layout/setup_step" />
- </FrameLayout>
- </RelativeLayout>
-</ScrollView>
+ android:id="@+id/setup_step1_bullet"
+ style="@style/setupStepBulletStyle"
+ android:text="@string/setup_step1_bullet" />
+ <TextView
+ android:id="@+id/setup_step2_bullet"
+ style="@style/setupStepBulletStyle"
+ android:text="@string/setup_step2_bullet" />
+ <TextView
+ android:id="@+id/setup_step3_bullet"
+ style="@style/setupStepBulletStyle"
+ android:text="@string/setup_step3_bullet" />
+ </LinearLayout>
+ <com.android.inputmethod.latin.setup.SetupStepIndicatorView
+ android:id="@+id/setup_step_indicator"
+ android:layout_width="match_parent"
+ android:layout_height="24dp"
+ android:layout_below="@id/setup_step_bullets" />
+ <FrameLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/setup_step_indicator">
+ <include
+ android:id="@+id/setup_step1"
+ layout="@layout/setup_step" />
+ <include
+ android:id="@+id/setup_step2"
+ layout="@layout/setup_step" />
+ <include
+ android:id="@+id/setup_step3"
+ layout="@layout/setup_step" />
+ </FrameLayout>
+</RelativeLayout>
diff --git a/java/res/raw/main_en.dict b/java/res/raw/main_en.dict
index 526761ce0..086874dd6 100644
--- a/java/res/raw/main_en.dict
+++ b/java/res/raw/main_en.dict
Binary files differ
diff --git a/java/res/raw/main_fr.dict b/java/res/raw/main_fr.dict
index 7520898e3..9044c7e9e 100644
--- a/java/res/raw/main_fr.dict
+++ b/java/res/raw/main_fr.dict
Binary files differ
diff --git a/java/res/raw/main_ru.dict b/java/res/raw/main_ru.dict
index 216ff09da..9fd613343 100644
--- a/java/res/raw/main_ru.dict
+++ b/java/res/raw/main_ru.dict
Binary files differ
diff --git a/java/res/values-v17/setup-styles.xml b/java/res/values-v17/setup-styles.xml
new file mode 100644
index 000000000..8a9d66477
--- /dev/null
+++ b/java/res/values-v17/setup-styles.xml
@@ -0,0 +1,25 @@
+<?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">
+ <style name="setupTitleStyle" parent="setupTitleStyleCommon">
+ <item name="android:layout_alignParentStart">true</item>
+ </style>
+ <style name="setupStepActionLabelStyle" parent="setupStepActionLabelStyleCommon">
+ <item name="android:paddingStart">12dp</item>
+ <item name="android:paddingEnd">24dp</item>
+ </style>
+</resources>
diff --git a/java/res/values/setup-styles-common.xml b/java/res/values/setup-styles-common.xml
new file mode 100644
index 000000000..59a768a63
--- /dev/null
+++ b/java/res/values/setup-styles-common.xml
@@ -0,0 +1,57 @@
+<?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">
+ <style name="setupTitleStyleCommon">
+ <item name="android:textColor">@color/setup_text_dark</item>
+ <item name="android:textSize">@dimen/setup_title_text_size</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ </style>
+ <style name="setupStepBulletStyle">
+ <item name="android:textColor">@color/setup_text_dark</item>
+ <item name="android:textSize">22sp</item>
+ <item name="android:layout_width">0dp</item>
+ <item name="android:layout_weight">1.0</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:gravity">center_horizontal</item>
+ </style>
+ <style name="setupStepBaseStyle">
+ <item name="android:textColor">@color/setup_text_dark</item>
+ <item name="android:background">@color/setup_step_background</item>
+ <item name="android:layout_width">match_parent</item>
+ <item name="android:layout_height">wrap_content</item>
+ <item name="android:paddingLeft">24dp</item>
+ <item name="android:paddingRight">24dp</item>
+ </style>
+ <style name="setupStepTitleStyle" parent="setupStepBaseStyle">
+ <item name="android:textSize">22sp</item>
+ </style>
+ <style name="setupStepInstructionStyle" parent="setupStepBaseStyle">
+ <item name="android:textSize">14sp</item>
+ </style>
+ <style name="setupStepActionLabelStyleCommon" parent="setupStepBaseStyle">
+ <item name="android:textColor">@drawable/setup_step_action_color</item>
+ <item name="android:background">@drawable/setup_step_action_background</item>
+ <item name="android:layout_height">48dp</item>
+ <item name="android:paddingLeft">12dp</item>
+ <item name="android:textSize">18sp</item>
+ <item name="android:drawablePadding">12dp</item>
+ <item name="android:gravity">center_vertical</item>
+ <item name="android:clickable">true</item>
+ <item name="android:focusable">true</item>
+ </style>
+</resources>
diff --git a/java/res/values/setup-styles.xml b/java/res/values/setup-styles.xml
index cfc689a78..1ffe8ca46 100644
--- a/java/res/values/setup-styles.xml
+++ b/java/res/values/setup-styles.xml
@@ -15,31 +15,6 @@
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="setupTitleStyle">
- <item name="android:textColor">@color/setup_text_dark</item>
- <item name="android:textSize">@dimen/setup_title_text_size</item>
- </style>
- <style name="setupStepBulletStyle">
- <item name="android:textColor">@color/setup_text_dark</item>
- <item name="android:textSize">22sp</item>
- <item name="android:layout_width">0dp</item>
- <item name="android:layout_weight">1.0</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:gravity">center_horizontal</item>
- </style>
- <style name="setupStepTitleStyle">
- <item name="android:background">@color/setup_step_background</item>
- <item name="android:textColor">@color/setup_text_dark</item>
- <item name="android:textSize">22sp</item>
- </style>
- <style name="setupStepInstructionStyle">
- <item name="android:background">@color/setup_step_background</item>
- <item name="android:textColor">@color/setup_text_dark</item>
- <item name="android:textSize">14sp</item>
- </style>
- <style name="setupStepActionLabelStyle">
- <item name="android:background">@color/setup_step_background</item>
- <item name="android:textColor">@color/setup_text_action</item>
- <item name="android:textSize">18sp</item>
- </style>
+ <style name="setupTitleStyle" parent="setupTitleStyleCommon" />
+ <style name="setupStepActionLabelStyle" parent="setupStepActionLabelStyleCommon" />
</resources>
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index dbadfabb8..890537ad9 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -442,31 +442,42 @@
<!-- Title of the button to revert to the default value of the device in the settings dialog [CHAR LIMIT=15] -->
<string name="button_default">Default</string>
- <!-- TODO: Remove translatable="false" once wordings are finalized. -->
+ <!-- Title of the setup wizard welcome screen. [CHAR LIMT=40] -->
+ <string name="setup_welcome_title">"Welcome to <xliff:g id="application_name">%s</xliff:g>"</string>
+ <!-- Additional title of the setup wizard welcome screen, just below the setup_welcome_title. [CHAR_LIMIT=64] -->
+ <string name="setup_welcome_additional_description">with Gesture Typing</string>
+ <!-- The label of the button that starts the setup wizard. [CHAR_LIMIT=64] -->
+ <string name="setup_start_action">Get started</string>
+ <!-- The label of the button that navigates the user to the next step of the setup wizard. [CHAR_LIMIT=64] -->
+ <string name="setup_next_action">Next step</string>
<!-- Title of the setup wizard. [CHAR LIMT=40] -->
- <string name="setup_title" translatable="false">"Installing <xliff:g id="application_name">%s</xliff:g>"</string>
+ <string name="setup_steps_title">"Setting up <xliff:g id="application_name">%s</xliff:g>"</string>
<!-- Ordinal number of the 1st step in the setup wizard. [CHAR LIMIT=5] -->
<string name="setup_step1_bullet" translatable="false">1</string>
<!-- Title of the 1st step in the setup wizard. [CHAR LIMIT=64] -->
- <string name="setup_step1_title" translatable="false">"Enable <xliff:g id="application_name">%s</xliff:g> in settings."</string>
+ <string name="setup_step1_title">"Enable <xliff:g id="application_name">%s</xliff:g>"</string>
<!-- Detailed instruction of the 1st step in the setup wizard. [CHAR LIMIT=80] -->
- <string name="setup_step1_instruction" translatable="false">"For security, please check \"<xliff:g id="application_name">%s</xliff:g>\""</string>
+ <string name="setup_step1_instruction">"Please check \"<xliff:g id="application_name">%s</xliff:g>\" in your Language &amp; input settings. This will authorize it to run on your device."</string>
+ <!-- The label of the button that triggers the Language & input settings in order to enable the keyboard. [CHAR_LIMIT=64] -->
+ <string name="setup_step1_action">Enable in Settings</string>
<!-- Ordinal number of the 2nd step in the setup wizard. [CHAR LIMIT=5] -->
<string name="setup_step2_bullet" translatable="false">2</string>
<!-- Title of the 2nd step in the setup wizard. [CHAR LIMIT=64] -->
- <string name="setup_step2_title" translatable="false">"Switch to <xliff:g id="application_name">%s</xliff:g>."</string>
+ <string name="setup_step2_title">"Switch to <xliff:g id="application_name">%s</xliff:g>"</string>
<!-- Detailed instruction of the 2nd step in the setup wizard. [CHAR LIMIT=80] -->
- <string name="setup_step2_instruction" translatable="false">"Now that you've enabled <xliff:g id="application_name">%s</xliff:g>, you can switch to it."</string>
+ <string name="setup_step2_instruction">"Next, select \"<xliff:g id="application_name">%s</xliff:g>\" as your active text-input method."</string>
+ <!-- The label of the button that triggers the choose input method dialog in order to select the keyboard. [CHAR_LIMIT=64] -->
+ <string name="setup_step2_action">Switch input methods</string>
<!-- Ordinal number of the 3rd step in the setup wizard. [CHAR LIMIT=5] -->
<string name="setup_step3_bullet" translatable="false">3</string>
<!-- Title of the 3rd step in the setup wizard. [CHAR LIMIT=64] -->
- <string name="setup_step3_title" translatable="false">"Congratulations, you're all set!"</string>
+ <string name="setup_step3_title">"Congratulations, you're all set!"</string>
<!-- Detailed instruction of the 3rd step in the setup wizard. [CHAR LIMIT=80] -->
- <string name="setup_step3_instruction" translatable="false">Configure additional languages</string>
- <!-- Title of the Language & input settings. This should be aligned with msgid="5292716747264442359" -->
- <string name="language_settings">Language &amp; input</string>
- <!-- Title of the Input method picker. This should be aligned with msgid="4653387336791222978" -->
- <string name="select_input_method">Choose input method</string>
+ <string name="setup_step3_instruction">Now you can type in all your favorite apps with <xliff:g id="application_name">%s</xliff:g>.</string>
+ <!-- The label of the button that triggers the screen for configuaring additional languages of the keyboard. [CHAR_LIMIT=64] -->
+ <string name="setup_step3_action">Configure additional languages</string>
+ <!-- The label of the button that finishes the setup wizard. [CHAR_LIMIT=64] -->
+ <string name="setup_finish_action">Finished</string>
<!-- Option to show setup wizard icon. [CHAR LIMIT=30]-->
<string name="show_setup_wizard_icon" translatable="false">Show setup wizard icon</string>
@@ -498,9 +509,9 @@
<!-- Message about some dictionary indicating the file is installed, but the dictionary is disabled -->
<string name="dictionary_disabled">Installed, disabled</string>
- <!-- Message to display in the dictionaries setting screen when some error prevented us to list installed dictionaries [CHAR LIMIT=50] -->
+ <!-- Message to display in the dictionaries setting screen when some error prevented us to list installed dictionaries [CHAR LIMIT=20] -->
<string name="cannot_connect_to_dict_service">Problem connecting to dictionary service</string>
- <!-- Message to display in the dictionaries setting screen when we found that no dictionaries are available [CHAR LIMIT=50]-->
+ <!-- Message to display in the dictionaries setting screen when we found that no dictionaries are available [CHAR LIMIT=20]-->
<string name="no_dictionaries_available">No dictionaries available</string>
<!-- Title of the options to press to refresh the list (as in, check for updates now) [CHAR_LIMIT=50] -->
diff --git a/java/src/com/android/inputmethod/compat/TextViewCompatUtils.java b/java/src/com/android/inputmethod/compat/TextViewCompatUtils.java
index d4f1ea830..f8e1902c0 100644
--- a/java/src/com/android/inputmethod/compat/TextViewCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/TextViewCompatUtils.java
@@ -22,23 +22,23 @@ import android.widget.TextView;
import java.lang.reflect.Method;
public final class TextViewCompatUtils {
- // Note that TextView.setCompoundDrawablesRelative(Drawable,Drawable,Drawable,Drawable) has
- // been introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
- private static final Method METHOD_setCompoundDrawablesRelative = CompatUtils.getMethod(
- TextView.class, "setCompoundDrawablesRelative",
+ // Note that TextView.setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable,Drawable,
+ // Drawable,Drawable) has been introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
+ private static final Method METHOD_setCompoundDrawablesRelativeWithIntrinsicBounds =
+ CompatUtils.getMethod(TextView.class, "setCompoundDrawablesRelativeWithIntrinsicBounds",
Drawable.class, Drawable.class, Drawable.class, Drawable.class);
private TextViewCompatUtils() {
// This utility class is not publicly instantiable.
}
- public static void setCompoundDrawablesRelative(final TextView textView, final Drawable start,
- final Drawable top, final Drawable end, final Drawable bottom) {
- if (METHOD_setCompoundDrawablesRelative == null) {
- textView.setCompoundDrawables(start, top, end, bottom);
+ public static void setCompoundDrawablesRelativeWithIntrinsicBounds(final TextView textView,
+ final Drawable start, final Drawable top, final Drawable end, final Drawable bottom) {
+ if (METHOD_setCompoundDrawablesRelativeWithIntrinsicBounds == null) {
+ textView.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom);
return;
}
- CompatUtils.invoke(textView, null, METHOD_setCompoundDrawablesRelative,
+ CompatUtils.invoke(textView, null, METHOD_setCompoundDrawablesRelativeWithIntrinsicBounds,
start, top, end, bottom);
}
}
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index ba78d014a..d74644d9e 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -1189,10 +1189,12 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
if (ENABLE_USABILITY_STUDY_LOG) {
writeUsabilityStudyLog(me, action, eventTime, i, pointerId, px, py);
}
- if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
- ResearchLogger.mainKeyboardView_processMotionEvent(
- me, action, eventTime, i, pointerId, px, py);
- }
+ // TODO: This seems to be no longer necessary, and confusing because it leads to
+ // duplicate MotionEvents being recorded.
+ // if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
+ // ResearchLogger.mainKeyboardView_processMotionEvent(
+ // me, action, eventTime, i, pointerId, px, py);
+ // }
}
} else {
final PointerTracker tracker = PointerTracker.getPointerTracker(id, this);
diff --git a/java/src/com/android/inputmethod/latin/SettingsFragment.java b/java/src/com/android/inputmethod/latin/SettingsFragment.java
index a96c997c8..79036c276 100644
--- a/java/src/com/android/inputmethod/latin/SettingsFragment.java
+++ b/java/src/com/android/inputmethod/latin/SettingsFragment.java
@@ -77,10 +77,13 @@ public final class SettingsFragment extends InputMethodSettingsFragment
final Resources res = getResources();
final Context context = getActivity();
- // When we are called from the Settings application but we are not already running, the
- // {@link SubtypeLocale} class may not have been initialized. It is safe to call
- // {@link SubtypeLocale#init(Context)} multiple times.
+ // When we are called from the Settings application but we are not already running, some
+ // singleton and utility classes may not have been initialized. We have to call
+ // initialization method of these classes here. See {@link LatinIME#onCreate()}.
+ SubtypeSwitcher.init(context);
SubtypeLocale.init(context);
+ AudioAndHapticFeedbackManager.init(context);
+
mVoicePreference = (ListPreference) findPreference(Settings.PREF_VOICE_MODE);
mShowCorrectionSuggestionsPreference =
(ListPreference) findPreference(Settings.PREF_SHOW_SUGGESTIONS_SETTING);
diff --git a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
index 2f9e34ff1..bef8a3cf1 100644
--- a/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/SubtypeSwitcher.java
@@ -80,6 +80,7 @@ public final class SubtypeSwitcher {
public static void init(final Context context) {
SubtypeLocale.init(context);
+ RichInputMethodManager.init(context);
sInstance.initialize(context);
}
@@ -87,10 +88,13 @@ public final class SubtypeSwitcher {
// Intentional empty constructor for singleton.
}
- private void initialize(final Context service) {
- mResources = service.getResources();
+ private void initialize(final Context context) {
+ if (mResources != null) {
+ return;
+ }
+ mResources = context.getResources();
mRichImm = RichInputMethodManager.getInstance();
- mConnectivityManager = (ConnectivityManager) service.getSystemService(
+ mConnectivityManager = (ConnectivityManager) context.getSystemService(
Context.CONNECTIVITY_SERVICE);
mNoLanguageSubtype = mRichImm.findSubtypeByLocaleAndKeyboardLayoutSet(
SubtypeLocale.NO_LANGUAGE, SubtypeLocale.QWERTY);
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
index 15d0bac37..cb1de1834 100644
--- a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
+++ b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
@@ -20,7 +20,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
-import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Message;
@@ -109,17 +108,16 @@ public final class SetupActivity extends Activity {
return;
}
- // TODO: Use sans-serif-thin font family depending on the system locale white list and
- // the SDK version.
final TextView titleView = (TextView)findViewById(R.id.setup_title);
- final int appName = getApplicationInfo().labelRes;
- titleView.setText(getString(R.string.setup_title, getString(appName)));
+ final String applicationName = getResources().getString(getApplicationInfo().labelRes);
+ titleView.setText(getString(R.string.setup_steps_title, applicationName));
mStepIndicatorView = (SetupStepIndicatorView)findViewById(R.id.setup_step_indicator);
- final SetupStep step1 = new SetupStep(findViewById(R.id.setup_step1),
- appName, R.string.setup_step1_title, R.string.setup_step1_instruction,
- R.drawable.ic_settings_language, R.string.language_settings);
+ final SetupStep step1 = new SetupStep(applicationName,
+ (TextView)findViewById(R.id.setup_step1_bullet), findViewById(R.id.setup_step1),
+ R.string.setup_step1_title, R.string.setup_step1_instruction,
+ R.drawable.ic_setup_step1, R.string.setup_step1_action);
step1.setAction(new Runnable() {
@Override
public void run() {
@@ -129,9 +127,10 @@ public final class SetupActivity extends Activity {
});
mSetupSteps.addStep(STEP_1, step1);
- final SetupStep step2 = new SetupStep(findViewById(R.id.setup_step2),
- appName, R.string.setup_step2_title, R.string.setup_step2_instruction,
- 0 /* actionIcon */, R.string.select_input_method);
+ final SetupStep step2 = new SetupStep(applicationName,
+ (TextView)findViewById(R.id.setup_step2_bullet), findViewById(R.id.setup_step2),
+ R.string.setup_step2_title, R.string.setup_step2_instruction,
+ R.drawable.ic_setup_step2, R.string.setup_step2_action);
step2.setAction(new Runnable() {
@Override
public void run() {
@@ -142,9 +141,10 @@ public final class SetupActivity extends Activity {
});
mSetupSteps.addStep(STEP_2, step2);
- final SetupStep step3 = new SetupStep(findViewById(R.id.setup_step3),
- appName, R.string.setup_step3_title, 0 /* instruction */,
- R.drawable.sym_keyboard_language_switch, R.string.setup_step3_instruction);
+ final SetupStep step3 = new SetupStep(applicationName,
+ (TextView)findViewById(R.id.setup_step3_bullet), findViewById(R.id.setup_step3),
+ R.string.setup_step3_title, R.string.setup_step3_instruction,
+ R.drawable.ic_setup_step3, R.string.setup_step3_action);
step3.setAction(new Runnable() {
@Override
public void run() {
@@ -287,20 +287,26 @@ public final class SetupActivity extends Activity {
}
static final class SetupStep implements View.OnClickListener {
- private final View mRootView;
+ private final View mStepView;
+ private final TextView mBulletView;
+ private final int mActivatedColor;
+ private final int mDeactivatedColor;
private final TextView mActionLabel;
private Runnable mAction;
- public SetupStep(final View rootView, final int appName, final int title,
- final int instruction, final int actionIcon, final int actionLabel) {
- mRootView = rootView;
- final Resources res = rootView.getResources();
- final String applicationName = res.getString(appName);
+ public SetupStep(final String applicationName, final TextView bulletView,
+ final View stepView, final int title, final int instruction, final int actionIcon,
+ final int actionLabel) {
+ mStepView = stepView;
+ mBulletView = bulletView;
+ final Resources res = stepView.getResources();
+ mActivatedColor = res.getColor(R.color.setup_text_action);
+ mDeactivatedColor = res.getColor(R.color.setup_text_dark);
- final TextView titleView = (TextView)rootView.findViewById(R.id.setup_step_title);
+ final TextView titleView = (TextView)mStepView.findViewById(R.id.setup_step_title);
titleView.setText(res.getString(title, applicationName));
- final TextView instructionView = (TextView)rootView.findViewById(
+ final TextView instructionView = (TextView)mStepView.findViewById(
R.id.setup_step_instruction);
if (instruction == 0) {
instructionView.setVisibility(View.GONE);
@@ -308,23 +314,20 @@ public final class SetupActivity extends Activity {
instructionView.setText(res.getString(instruction, applicationName));
}
- mActionLabel = (TextView)rootView.findViewById(R.id.setup_step_action_label);
+ mActionLabel = (TextView)mStepView.findViewById(R.id.setup_step_action_label);
mActionLabel.setText(res.getString(actionLabel));
if (actionIcon == 0) {
final int paddingEnd = ViewCompatUtils.getPaddingEnd(mActionLabel);
ViewCompatUtils.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
} else {
- final int overrideColor = res.getColor(R.color.setup_text_action);
- final Drawable icon = res.getDrawable(actionIcon);
- icon.setColorFilter(overrideColor, PorterDuff.Mode.MULTIPLY);
- icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
- TextViewCompatUtils.setCompoundDrawablesRelative(
- mActionLabel, icon, null, null, null);
+ TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
+ mActionLabel, res.getDrawable(actionIcon), null, null, null);
}
}
public void setEnabled(final boolean enabled) {
- mRootView.setVisibility(enabled ? View.VISIBLE : View.GONE);
+ mStepView.setVisibility(enabled ? View.VISIBLE : View.GONE);
+ mBulletView.setTextColor(enabled ? mActivatedColor : mDeactivatedColor);
}
public void setAction(final Runnable action) {
diff --git a/java/src/com/android/inputmethod/research/FeedbackFragment.java b/java/src/com/android/inputmethod/research/FeedbackFragment.java
index 39f9c87a0..a0738292e 100644
--- a/java/src/com/android/inputmethod/research/FeedbackFragment.java
+++ b/java/src/com/android/inputmethod/research/FeedbackFragment.java
@@ -65,12 +65,10 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
mCancelButton.setOnClickListener(this);
if (savedInstanceState != null) {
- Log.d(TAG, "restoring from savedInstanceState");
restoreState(savedInstanceState);
} else {
final Bundle bundle = getActivity().getIntent().getExtras();
if (bundle != null) {
- Log.d(TAG, "restoring from getArguments()");
restoreState(bundle);
}
}
@@ -81,10 +79,7 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
public void onClick(final View view) {
final ResearchLogger researchLogger = ResearchLogger.getInstance();
if (view == mIncludingUserRecordingCheckBox) {
- if (hasUserRecording()) {
- // Remove the recording
- setHasUserRecording(false);
- } else {
+ if (mIncludingUserRecordingCheckBox.isChecked()) {
final Bundle bundle = new Bundle();
onSaveInstanceState(bundle);
@@ -103,9 +98,9 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
R.string.research_feedback_empty_feedback_error_message,
Toast.LENGTH_LONG).show();
} else {
- final boolean isIncludingAccountName = isIncludingAccountName();
- researchLogger.sendFeedback(feedbackContents,
- false /* isIncludingHistory */, isIncludingAccountName, hasUserRecording());
+ final boolean isIncludingAccountName = mIncludingAccountNameCheckBox.isChecked();
+ researchLogger.sendFeedback(feedbackContents, false /* isIncludingHistory */,
+ isIncludingAccountName, mIncludingUserRecordingCheckBox.isChecked());
getActivity().finish();
researchLogger.setFeedbackDialogBundle(null);
researchLogger.onLeavingSendFeedbackDialog();
@@ -125,29 +120,13 @@ public class FeedbackFragment extends Fragment implements OnClickListener {
final String savedFeedbackString = mEditText.getText().toString();
bundle.putString(KEY_FEEDBACK_STRING, savedFeedbackString);
- bundle.putBoolean(KEY_INCLUDE_ACCOUNT_NAME, isIncludingAccountName());
- bundle.putBoolean(KEY_HAS_USER_RECORDING, hasUserRecording());
+ bundle.putBoolean(KEY_INCLUDE_ACCOUNT_NAME, mIncludingAccountNameCheckBox.isChecked());
+ bundle.putBoolean(KEY_HAS_USER_RECORDING, mIncludingUserRecordingCheckBox.isChecked());
}
- public void restoreState(final Bundle bundle) {
+ private void restoreState(final Bundle bundle) {
mEditText.setText(bundle.getString(KEY_FEEDBACK_STRING));
- setIsIncludingAccountName(bundle.getBoolean(KEY_INCLUDE_ACCOUNT_NAME));
- setHasUserRecording(bundle.getBoolean(KEY_HAS_USER_RECORDING));
- }
-
- private boolean hasUserRecording() {
- return mIncludingUserRecordingCheckBox.isChecked();
- }
-
- private void setHasUserRecording(final boolean hasRecording) {
- mIncludingUserRecordingCheckBox.setChecked(hasRecording);
- }
-
- private boolean isIncludingAccountName() {
- return mIncludingAccountNameCheckBox.isChecked();
- }
-
- private void setIsIncludingAccountName(final boolean isIncludingAccountName) {
- mIncludingAccountNameCheckBox.setChecked(isIncludingAccountName);
+ mIncludingAccountNameCheckBox.setChecked(bundle.getBoolean(KEY_INCLUDE_ACCOUNT_NAME));
+ mIncludingUserRecordingCheckBox.setChecked(bundle.getBoolean(KEY_HAS_USER_RECORDING));
}
}
diff --git a/java/src/com/android/inputmethod/research/FixedLogBuffer.java b/java/src/com/android/inputmethod/research/FixedLogBuffer.java
index 78dc59562..641bf7eae 100644
--- a/java/src/com/android/inputmethod/research/FixedLogBuffer.java
+++ b/java/src/com/android/inputmethod/research/FixedLogBuffer.java
@@ -51,10 +51,6 @@ public class FixedLogBuffer extends LogBuffer {
mNumActualWords = 0;
}
- protected int getNumActualWords() {
- return mNumActualWords;
- }
-
/**
* Adds a new LogUnit to the front of the LIFO queue, evicting existing LogUnit's
* (oldest first) if word capacity is reached.
@@ -119,12 +115,24 @@ public class FixedLogBuffer extends LogBuffer {
return logUnit;
}
- protected void shiftOutWords(final int numWords) {
- final int targetNumWords = mNumActualWords - numWords;
- final LinkedList<LogUnit> logUnits = getLogUnits();
- while (mNumActualWords > targetNumWords && !logUnits.isEmpty()) {
- shiftOut();
+ /**
+ * Remove LogUnits from the front of the LogBuffer until {@code numWords} have been removed.
+ *
+ * If there are less than {@code numWords} word-containing {@link LogUnit}s, shifts out
+ * all {@code LogUnit}s in the buffer.
+ *
+ * @param numWords the number of word-containing {@link LogUnit}s to shift out
+ * @return the number of actual {@code LogUnit}s shifted out
+ */
+ protected int shiftOutWords(final int numWords) {
+ int numWordContainingLogUnitsShiftedOut = 0;
+ for (LogUnit logUnit = shiftOut(); logUnit != null
+ && numWordContainingLogUnitsShiftedOut < numWords; logUnit = shiftOut()) {
+ if (logUnit.hasWord()) {
+ numWordContainingLogUnitsShiftedOut++;
+ }
}
+ return numWordContainingLogUnitsShiftedOut;
}
public void shiftOutAll() {
diff --git a/java/src/com/android/inputmethod/research/MainLogBuffer.java b/java/src/com/android/inputmethod/research/MainLogBuffer.java
index 3303d2bdb..cd4c1db6e 100644
--- a/java/src/com/android/inputmethod/research/MainLogBuffer.java
+++ b/java/src/com/android/inputmethod/research/MainLogBuffer.java
@@ -25,7 +25,6 @@ import com.android.inputmethod.latin.define.ProductionFlag;
import java.util.ArrayList;
import java.util.LinkedList;
-import java.util.Random;
/**
* MainLogBuffer is a FixedLogBuffer that tracks the state of LogUnits to make privacy guarantees.
@@ -100,10 +99,6 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
return mSuggest.getMainDictionary();
}
- public void resetWordCounter() {
- mNumWordsUntilSafeToSample = mNumWordsBetweenNGrams;
- }
-
public void setIsStopping() {
mIsStopping = true;
}
@@ -201,7 +196,7 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
// Good n-gram at the front of the buffer. Publish it, disclosing details.
publish(logUnits, true /* canIncludePrivateData */);
shiftOutWords(N_GRAM_SIZE);
- resetWordCounter();
+ mNumWordsUntilSafeToSample = mNumWordsBetweenNGrams;
} else {
// No good n-gram at front, and buffer is full. Shift out the first word (or if there
// is none, the existing logUnits).
@@ -224,13 +219,13 @@ public abstract class MainLogBuffer extends FixedLogBuffer {
final boolean canIncludePrivateData);
@Override
- protected void shiftOutWords(final int numWords) {
- final int oldNumActualWords = getNumActualWords();
- super.shiftOutWords(numWords);
- final int numWordsShifted = oldNumActualWords - getNumActualWords();
- mNumWordsUntilSafeToSample -= numWordsShifted;
+ protected int shiftOutWords(final int numWords) {
+ final int numWordContainingLogUnitsShiftedOut = super.shiftOutWords(numWords);
+ mNumWordsUntilSafeToSample = Math.max(0, mNumWordsUntilSafeToSample
+ - numWordContainingLogUnitsShiftedOut);
if (DEBUG) {
Log.d(TAG, "wordsUntilSafeToSample now at " + mNumWordsUntilSafeToSample);
}
+ return numWordContainingLogUnitsShiftedOut;
}
}
diff --git a/java/src/com/android/inputmethod/research/ResearchLog.java b/java/src/com/android/inputmethod/research/ResearchLog.java
index 35a491f2c..18bf7ba54 100644
--- a/java/src/com/android/inputmethod/research/ResearchLog.java
+++ b/java/src/com/android/inputmethod/research/ResearchLog.java
@@ -108,10 +108,14 @@ public class ResearchLog {
@Override
public Object call() throws Exception {
try {
- if (mHasWrittenData) {
- mJsonWriter.endArray();
- mHasWrittenData = false;
+ // TODO: This is necessary to avoid an exception. Better would be to not even
+ // open the JsonWriter if the file is not even opened unless there is valid data
+ // to write.
+ if (!mHasWrittenData) {
+ mJsonWriter.beginArray();
}
+ mJsonWriter.endArray();
+ mHasWrittenData = false;
mJsonWriter.flush();
mJsonWriter.close();
if (DEBUG) {
@@ -159,6 +163,12 @@ public class ResearchLog {
public Object call() throws Exception {
try {
if (mHasWrittenData) {
+ // TODO: This is necessary to avoid an exception. Better would be to not
+ // even open the JsonWriter if the file is not even opened unless there is
+ // valid data to write.
+ if (!mHasWrittenData) {
+ mJsonWriter.beginArray();
+ }
mJsonWriter.endArray();
mJsonWriter.close();
mHasWrittenData = false;
diff --git a/java/src/com/android/inputmethod/research/ResearchLogDirectory.java b/java/src/com/android/inputmethod/research/ResearchLogDirectory.java
index 291dea5d0..d156068d6 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogDirectory.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogDirectory.java
@@ -97,15 +97,17 @@ public class ResearchLogDirectory {
}
}
- public File getLogFilePath(final long time) {
- return new File(mFilesDir, getUniqueFilename(LOG_FILENAME_PREFIX, time));
+ public File getLogFilePath(final long time, final long nanoTime) {
+ return new File(mFilesDir, getUniqueFilename(LOG_FILENAME_PREFIX, time, nanoTime));
}
- public File getUserRecordingFilePath(final long time) {
- return new File(mFilesDir, getUniqueFilename(USER_RECORDING_FILENAME_PREFIX, time));
+ public File getUserRecordingFilePath(final long time, final long nanoTime) {
+ return new File(mFilesDir, getUniqueFilename(USER_RECORDING_FILENAME_PREFIX, time,
+ nanoTime));
}
- private static String getUniqueFilename(final String prefix, final long time) {
- return prefix + "-" + time + FILENAME_SUFFIX;
+ private static String getUniqueFilename(final String prefix, final long time,
+ final long nanoTime) {
+ return prefix + "-" + time + "-" + nanoTime + FILENAME_SUFFIX;
}
}
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 7a23ddb05..cd18e3de6 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -389,7 +389,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
}
if (mMainLogBuffer == null) {
mMainResearchLog = new ResearchLog(mResearchLogDirectory.getLogFilePath(
- System.currentTimeMillis()), mLatinIME);
+ System.currentTimeMillis(), System.nanoTime()), mLatinIME);
final int numWordsToIgnore = new Random().nextInt(NUMBER_OF_WORDS_BETWEEN_SAMPLES + 1);
mMainLogBuffer = new MainLogBuffer(NUMBER_OF_WORDS_BETWEEN_SAMPLES, numWordsToIgnore,
mSuggest) {
@@ -420,7 +420,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private void resetFeedbackLogging() {
mFeedbackLog = new ResearchLog(mResearchLogDirectory.getLogFilePath(
- System.currentTimeMillis()), mLatinIME);
+ System.currentTimeMillis(), System.nanoTime()), mLatinIME);
mFeedbackLogBuffer = new FixedLogBuffer(FEEDBACK_WORD_BUFFER_SIZE);
}
@@ -545,7 +545,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
mUserRecordingLog.blockingAbort(RESEARCHLOG_ABORT_TIMEOUT_IN_MS);
}
mUserRecordingFile = mResearchLogDirectory.getUserRecordingFilePath(
- System.currentTimeMillis());
+ System.currentTimeMillis(), System.nanoTime());
mUserRecordingLog = new ResearchLog(mUserRecordingFile, mLatinIME);
mUserRecordingLogBuffer = new LogBuffer();
resetRecordingTimer();
@@ -813,7 +813,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// enabled. The dot is actually a zero-width, zero-height rectangle, placed at the
// lower-right corner of the canvas, painted with a non-zero border width.
paint.setStrokeWidth(3);
- canvas.drawRect(width, height, width, height, paint);
+ canvas.drawRect(width - 1, height - 1, width, height, paint);
}
paint.setColor(savedColor);
paint.setStyle(savedStyle);
@@ -894,7 +894,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
// Check that expected word matches.
if (oldLogUnit != null) {
final String oldLogUnitWord = oldLogUnit.getWord();
- if (!oldLogUnitWord.equals(expectedWord)) {
+ if (oldLogUnitWord != null && !oldLogUnitWord.equals(expectedWord)) {
return;
}
}
@@ -1107,7 +1107,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
packageInfo = mLatinIME.getPackageManager().getPackageInfo(mLatinIME.getPackageName(),
0);
final String versionName = packageInfo.versionName;
- return !(developerBuildRegex.matcher(versionName).find());
+ return developerBuildRegex.matcher(versionName).find();
} catch (final NameNotFoundException e) {
Log.e(TAG, "Could not determine package name", e);
return false;
@@ -1826,6 +1826,9 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
public static void latinIME_onEndBatchInput(final CharSequence enteredText,
final int enteredWordPos, final SuggestedWords suggestedWords) {
final ResearchLogger researchLogger = getInstance();
+ if (!TextUtils.isEmpty(enteredText) && hasLetters(enteredText.toString())) {
+ researchLogger.mCurrentLogUnit.setWord(enteredText.toString());
+ }
researchLogger.enqueueEvent(LOGSTATEMENT_LATINIME_ONENDBATCHINPUT, enteredText,
enteredWordPos);
researchLogger.mCurrentLogUnit.initializeSuggestions(suggestedWords);
diff --git a/java/src/com/android/inputmethod/research/UploaderService.java b/java/src/com/android/inputmethod/research/UploaderService.java
index 6a9717b7c..d2db34927 100644
--- a/java/src/com/android/inputmethod/research/UploaderService.java
+++ b/java/src/com/android/inputmethod/research/UploaderService.java
@@ -22,6 +22,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.os.SystemClock;
import com.android.inputmethod.latin.define.ProductionFlag;
@@ -79,28 +80,14 @@ public final class UploaderService extends IntentService {
*/
public static void cancelAndRescheduleUploadingService(final Context context,
final boolean needsRescheduling) {
- final PendingIntent pendingIntent = getPendingIntentForService(context);
+ final Intent intent = new Intent(context, UploaderService.class);
+ final PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0);
final AlarmManager alarmManager = (AlarmManager) context.getSystemService(
Context.ALARM_SERVICE);
- cancelAnyScheduledServiceAlarm(alarmManager, pendingIntent);
+ alarmManager.cancel(pendingIntent);
if (needsRescheduling) {
- scheduleServiceAlarm(alarmManager, pendingIntent);
+ alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime()
+ + UploaderService.RUN_INTERVAL, pendingIntent);
}
}
-
- private static PendingIntent getPendingIntentForService(final Context context) {
- final Intent intent = new Intent(context, UploaderService.class);
- return PendingIntent.getService(context, 0, intent, 0);
- }
-
- private static void cancelAnyScheduledServiceAlarm(final AlarmManager alarmManager,
- final PendingIntent pendingIntent) {
- alarmManager.cancel(pendingIntent);
- }
-
- private static void scheduleServiceAlarm(final AlarmManager alarmManager,
- final PendingIntent pendingIntent) {
- alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, UploaderService.RUN_INTERVAL,
- pendingIntent);
- }
}