Merge "Release and register current key when emoji palette is hidden"
diff --git a/java/res/values/strings-action-keys.xml b/java/res/values/strings-action-keys.xml
index 7003784..96b2e7d 100644
--- a/java/res/values/strings-action-keys.xml
+++ b/java/res/values/strings-action-keys.xml
@@ -29,6 +29,8 @@
<string name="label_done_key">Done</string>
<!-- Label for soft enter key when it performs SEND action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] -->
<string name="label_send_key">Send</string>
+ <!-- Label for soft enter key when it performs SEARCH action. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] -->
+ <string name="label_search_key">Search</string>
<!-- Label for "Pause" key of phone number keyboard. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7] -->
<string name="label_pause_key">Pause</string>
<!-- Label for "Wait" key of phone number keyboard. Must be short to fit on key. 5 chars or less is preferable. [CHAR LIMIT=7]-->
diff --git a/java/res/xml-sw600dp/key_styles_enter.xml b/java/res/xml-sw600dp/key_styles_enter.xml
index 742bb3e..3439625 100644
--- a/java/res/xml-sw600dp/key_styles_enter.xml
+++ b/java/res/xml-sw600dp/key_styles_enter.xml
@@ -131,7 +131,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_go_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -150,7 +149,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_next_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -169,7 +167,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_previous_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -188,7 +185,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_done_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -207,6 +203,15 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_send_key|!code/key_enter"
+ latin:parentStyle="defaultEnterKeyStyle" />
+ </case>
+ <case
+ latin:imeAction="actionSearch"
+ latin:isIconDefined="search_key"
+ >
+ <key-style
+ latin:styleName="enterKeyStyle"
+ latin:keySpec="!icon/search_key|!code/key_enter"
latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
@@ -215,8 +220,7 @@
>
<key-style
latin:styleName="enterKeyStyle"
- latin:keySpec="!icon/search_key|!code/key_enter"
- latin:backgroundType="action"
+ latin:keySpec="!text/label_search_key|!code/key_enter"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -226,7 +230,6 @@
latin:styleName="enterKeyStyle"
latin:keySpec="dummy_label|!code/key_enter"
latin:keyLabelFlags="fromCustomActionLabel"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<!-- imeAction is either actionNone or actionUnspecified. -->
diff --git a/java/res/xml/key_styles_enter.xml b/java/res/xml/key_styles_enter.xml
index 1d46dd5..8add316 100644
--- a/java/res/xml/key_styles_enter.xml
+++ b/java/res/xml/key_styles_enter.xml
@@ -298,7 +298,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_go_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -317,7 +316,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_next_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -336,7 +334,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_previous_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -355,7 +352,6 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_done_key|!code/key_enter"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -374,6 +370,15 @@
<key-style
latin:styleName="enterKeyStyle"
latin:keySpec="!text/label_send_key|!code/key_enter"
+ latin:parentStyle="defaultEnterKeyStyle" />
+ </case>
+ <case
+ latin:imeAction="actionSearch"
+ latin:isIconDefined="search_key"
+ >
+ <key-style
+ latin:styleName="enterKeyStyle"
+ latin:keySpec="!icon/search_key|!code/key_enter"
latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
@@ -382,8 +387,7 @@
>
<key-style
latin:styleName="enterKeyStyle"
- latin:keySpec="!icon/search_key|!code/key_enter"
- latin:backgroundType="action"
+ latin:keySpec="!text/label_search_key|!code/key_enter"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<case
@@ -393,7 +397,6 @@
latin:styleName="enterKeyStyle"
latin:keySpec="dummy_label|!code/key_enter"
latin:keyLabelFlags="fromCustomActionLabel"
- latin:backgroundType="action"
latin:parentStyle="defaultEnterKeyStyle" />
</case>
<!-- imeAction is either actionNone or actionUnspecified. -->
diff --git a/java/src/com/android/inputmethod/compat/ViewCompatUtils.java b/java/src/com/android/inputmethod/compat/ViewCompatUtils.java
new file mode 100644
index 0000000..767cc42
--- /dev/null
+++ b/java/src/com/android/inputmethod/compat/ViewCompatUtils.java
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+
+package com.android.inputmethod.compat;
+
+import android.view.View;
+
+import java.lang.reflect.Method;
+
+// TODO: Use {@link android.support.v4.view.ViewCompat} instead of this utility class.
+// Currently {@link #getPaddingEnd(View)} and {@link #setPaddingRelative(View,int,int,int,int)}
+// are missing from android-support-v4 static library in KitKat SDK.
+public final class ViewCompatUtils {
+ // Note that View.getPaddingEnd(), View.setPaddingRelative(int,int,int,int) have been
+ // introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
+ private static final Method METHOD_getPaddingEnd = CompatUtils.getMethod(
+ View.class, "getPaddingEnd");
+ private static final Method METHOD_setPaddingRelative = CompatUtils.getMethod(
+ View.class, "setPaddingRelative",
+ Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE);
+
+ private ViewCompatUtils() {
+ // This utility class is not publicly instantiable.
+ }
+
+ public static int getPaddingEnd(final View view) {
+ if (METHOD_getPaddingEnd == null) {
+ return view.getPaddingRight();
+ }
+ return (Integer)CompatUtils.invoke(view, 0, METHOD_getPaddingEnd);
+ }
+
+ public static void setPaddingRelative(final View view, final int start, final int top,
+ final int end, final int bottom) {
+ if (METHOD_setPaddingRelative == null) {
+ view.setPadding(start, top, end, bottom);
+ return;
+ }
+ CompatUtils.invoke(view, null, METHOD_setPaddingRelative, start, top, end, bottom);
+ }
+}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index 2ec5bcc..cd6abee 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -140,6 +140,7 @@
"label_send_key",
"label_next_key",
"label_done_key",
+ "label_search_key",
"label_previous_key",
// Other labels.
"label_pause_key",
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java
index fcceaff..bcac05a 100644
--- a/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java
+++ b/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java
@@ -25,7 +25,6 @@
import android.os.Bundle;
import android.os.Message;
import android.provider.Settings;
-import android.support.v4.view.ViewCompat;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodInfo;
@@ -35,6 +34,7 @@
import android.widget.VideoView;
import com.android.inputmethod.compat.TextViewCompatUtils;
+import com.android.inputmethod.compat.ViewCompatUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.settings.SettingsActivity;
import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
@@ -448,8 +448,8 @@
mActionLabel = (TextView)mStepView.findViewById(R.id.setup_step_action_label);
mActionLabel.setText(res.getString(actionLabel));
if (actionIcon == 0) {
- final int paddingEnd = ViewCompat.getPaddingEnd(mActionLabel);
- ViewCompat.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
+ final int paddingEnd = ViewCompatUtils.getPaddingEnd(mActionLabel);
+ ViewCompatUtils.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
} else {
TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
mActionLabel, res.getDrawable(actionIcon), null, null, null);
diff --git a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
index 674d4f8..5af724f 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
@@ -89,13 +89,16 @@
private final StripVisibilityGroup mStripVisibilityGroup;
private static class StripVisibilityGroup {
+ private final View mSuggestionStripView;
private final View mSuggestionsStrip;
private final View mVoiceKey;
private final View mAddToDictionaryStrip;
private final View mImportantNoticeStrip;
- public StripVisibilityGroup(final View suggestionsStrip, final View voiceKey,
- final View addToDictionaryStrip, final View importantNoticeStrip) {
+ public StripVisibilityGroup(final View suggestionStripView,
+ final ViewGroup suggestionsStrip, final ImageButton voiceKey,
+ final ViewGroup addToDictionaryStrip, final View importantNoticeStrip) {
+ mSuggestionStripView = suggestionStripView;
mSuggestionsStrip = suggestionsStrip;
mVoiceKey = voiceKey;
mAddToDictionaryStrip = addToDictionaryStrip;
@@ -103,7 +106,10 @@
showSuggestionsStrip(false /* voiceKeyEnabled */);
}
- public void setLayoutDirection(final int layoutDirection) {
+ public void setLayoutDirection(final boolean isRtlLanguage) {
+ final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL
+ : ViewCompat.LAYOUT_DIRECTION_LTR;
+ ViewCompat.setLayoutDirection(mSuggestionStripView, layoutDirection);
ViewCompat.setLayoutDirection(mSuggestionsStrip, layoutDirection);
ViewCompat.setLayoutDirection(mAddToDictionaryStrip, layoutDirection);
ViewCompat.setLayoutDirection(mImportantNoticeStrip, layoutDirection);
@@ -155,7 +161,7 @@
mVoiceKey = (ImageButton)findViewById(R.id.suggestions_strip_voice_key);
mAddToDictionaryStrip = (ViewGroup)findViewById(R.id.add_to_dictionary_strip);
mImportantNoticeStrip = findViewById(R.id.important_notice_strip);
- mStripVisibilityGroup = new StripVisibilityGroup(mSuggestionsStrip, mVoiceKey,
+ mStripVisibilityGroup = new StripVisibilityGroup(this, mSuggestionsStrip, mVoiceKey,
mAddToDictionaryStrip, mImportantNoticeStrip);
for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) {
@@ -216,10 +222,7 @@
public void setSuggestions(final SuggestedWords suggestedWords, final boolean isRtlLanguage) {
clear();
- final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL
- : ViewCompat.LAYOUT_DIRECTION_LTR;
- ViewCompat.setLayoutDirection(this, layoutDirection);
- mStripVisibilityGroup.setLayoutDirection(layoutDirection);
+ mStripVisibilityGroup.setLayoutDirection(isRtlLanguage);
mSuggestedWords = suggestedWords;
mSuggestionsCountInStrip = mLayoutHelper.layoutAndReturnSuggestionCountInStrip(
mSuggestedWords, mSuggestionsStrip, this);
diff --git a/tools/dicttool/Android.mk b/tools/dicttool/Android.mk
index a3698bd..ba57fbe 100644
--- a/tools/dicttool/Android.mk
+++ b/tools/dicttool/Android.mk
@@ -15,7 +15,9 @@
# HACK: Temporarily disable host tool build on Mac until the build system is ready for C++11.
LATINIME_HOST_OSNAME := $(shell uname -s)
-ifneq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this
+ifeq ($(LATINIME_HOST_OSNAME), Darwin) # TODO: Remove this
+$(warning dicttool_aosp is not supported on $(LATINIME_HOST_OSNAME))
+else # TODO: Remove this
LATINIME_DICTTOOL_AOSP_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(LATINIME_DICTTOOL_AOSP_LOCAL_PATH)