Merge "Import translations. DO NOT MERGE"
diff --git a/java/res/values-km-rKH/strings.xml b/java/res/values-km-rKH/strings.xml
index 91ba5b9..2cf51d8 100644
--- a/java/res/values-km-rKH/strings.xml
+++ b/java/res/values-km-rKH/strings.xml
@@ -28,7 +28,7 @@
<string name="popup_on_keypress" msgid="123894815723512944">"លេចឡើងនៅពេលចុចគ្រាប់ចុច"</string>
<string name="general_category" msgid="1859088467017573195">"ទូទៅ"</string>
<string name="correction_category" msgid="2236750915056607613">"ការកែអត្ថបទ"</string>
- <string name="gesture_typing_category" msgid="497263612130532630">"បញ្ចូលដោយប្រើកាយវិការ"</string>
+ <string name="gesture_typing_category" msgid="497263612130532630">"បញ្ចូលដោយប្រើកាយវិការ"</string>
<string name="misc_category" msgid="6894192814868233453">"ជម្រើសផ្សេងទៀត"</string>
<string name="advanced_settings" msgid="362895144495591463">"ការកំណត់កម្រិតខ្ពស់"</string>
<string name="advanced_settings_summary" msgid="4487980456152830271">"ជម្រើសសម្រាប់អ្នកជំនាញ"</string>
@@ -38,7 +38,7 @@
<string name="show_language_switch_key_summary" msgid="7343403647474265713">"បង្ហាញនៅពេលដែលបើកភាសាបញ្ចូលច្រើន"</string>
<string name="sliding_key_input_preview" msgid="6604262359510068370">"បង្ហាញទ្រនិចបង្ហាញស្លាយ"</string>
<string name="sliding_key_input_preview_summary" msgid="6340524345729093886">"បង្ហាញសញ្ញាមើលឃើញខណៈពេលដែលរុញពីឆ្វេង ឬគ្រាប់ចុចនិមិត្តសញ្ញា"</string>
- <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"សោលេចឡើងបោះបង់ការពន្យារពេល"</string>
+ <string name="key_preview_popup_dismiss_delay" msgid="6213164897443068248">"សោលេចឡើងបោះបង់ការពន្យារពេល"</string>
<string name="key_preview_popup_dismiss_no_delay" msgid="2096123151571458064">"គ្មានការពន្យារពេល"</string>
<string name="key_preview_popup_dismiss_default_delay" msgid="2166964333903906734">"លំនាំដើម"</string>
<string name="abbreviation_unit_milliseconds" msgid="8700286094028323363">"<xliff:g id="MILLISECONDS">%s</xliff:g> មិល្លីវិនាទី"</string>
@@ -50,7 +50,7 @@
<skip />
<string name="use_double_space_period" msgid="8781529969425082860">"រយៈពេលចុចដកឃ្លាពីរដង"</string>
<string name="use_double_space_period_summary" msgid="6532892187247952799">"ប៉ះដកឃ្លាពីរដងបញ្ចូលរយៈពេលដែលអនុវត្តតាមដកឃ្លា"</string>
- <string name="auto_cap" msgid="1719746674854628252">"ការសរសេរជាអក្សរធំស្វ័យប្រវត្តិ"</string>
+ <string name="auto_cap" msgid="1719746674854628252">"ការសរសេរជាអក្សរធំស្វ័យប្រវត្តិ"</string>
<string name="auto_cap_summary" msgid="7934452761022946874">"សរសេរពាក្យដំបូងជាអក្សរធំនៃប្រយោគនីមួយៗ"</string>
<string name="edit_personal_dictionary" msgid="3996910038952940420">"វចនានុក្រមផ្ទាល់ខ្លួន"</string>
<string name="configure_dictionaries_title" msgid="4238652338556902049">"ផ្នែកបន្ថែមវចនានុក្រម"</string>
@@ -61,7 +61,7 @@
<string name="prefs_suggestion_visibility_show_only_portrait_name" msgid="3859783767435239118">"បង្ហាញនៅក្នុងរបៀបបញ្ឈរ"</string>
<string name="prefs_suggestion_visibility_hide_name" msgid="6309143926422234673">"លាក់ជានិច្ច"</string>
<string name="prefs_block_potentially_offensive_title" msgid="5078480071057408934">"ទប់ស្កាត់ពាក្យបំពាន"</string>
- <string name="prefs_block_potentially_offensive_summary" msgid="2371835479734991364">"កុំស្នើឲ្យពាក្យបំពានមានសក្ដានុពល"</string>
+ <string name="prefs_block_potentially_offensive_summary" msgid="2371835479734991364">"កុំស្នើឲ្យពាក្យបំពានមានសក្ដានុពល"</string>
<string name="auto_correction" msgid="7630720885194996950">"ការកែស្វ័យប្រវត្តិ"</string>
<string name="auto_correction_summary" msgid="5625751551134658006">"ចន្លោះមិនឃើញ និងសញ្ញាវណ្ណយុត្តកែពាក្យដែលបានវាយខុសស្វ័យប្រវត្តិ"</string>
<string name="auto_correction_threshold_mode_off" msgid="8470882665417944026">"បិទ"</string>
@@ -121,7 +121,7 @@
<string name="prefs_keypress_vibration_duration_settings" msgid="7918341459947439226">"ថិរវេលាញ័រពេលចុចគ្រាប់ចុច"</string>
<string name="prefs_keypress_sound_volume_settings" msgid="6027007337036891623">"កម្រិតសំឡេងពេលចុចគ្រាប់ចុច"</string>
<string name="prefs_read_external_dictionary" msgid="2588931418575013067">"អានឯកសារវចនានុក្រមខាងក្រៅ"</string>
- <string name="read_external_dictionary_no_files_message" msgid="4947420942224623792">"គ្មានឯកសារវចនានុក្រមនៅក្នុងថតទាញយក"</string>
+ <string name="read_external_dictionary_no_files_message" msgid="4947420942224623792">"គ្មានឯកសារវចនានុក្រមនៅក្នុងថតទាញយក"</string>
<string name="read_external_dictionary_multiple_files_title" msgid="7637749044265808628">"ជ្រើសឯកសារវចនានុក្រម ដើម្បីដំឡើង"</string>
<string name="read_external_dictionary_confirm_install_message" msgid="4782116251651288054">"ពិតជាដំឡើងឯកសារនេះសម្រាប់ <xliff:g id="LANGUAGE_NAME">%s</xliff:g>?"</string>
<string name="error" msgid="8940763624668513648">"មានកំហុស"</string>
@@ -148,7 +148,7 @@
<string name="dictionary_provider_name" msgid="3027315045397363079">"កម្មវិធីផ្ដល់វចនានុក្រម"</string>
<string name="dictionary_service_name" msgid="6237472350693511448">"សេវាកម្មវចនានុក្រម"</string>
<string name="download_description" msgid="6014835283119198591">"ព័ត៌មានបច្ចុប្បន្នភាពវចនានុក្រម"</string>
- <string name="dictionary_settings_title" msgid="8091417676045693313">"ផ្នែកបន្ថែមវចនានុក្រម"</string>
+ <string name="dictionary_settings_title" msgid="8091417676045693313">"ផ្នែកបន្ថែមវចនានុក្រម"</string>
<string name="dictionary_install_over_metered_network_prompt" msgid="3587517870006332980">"វចនានុក្រមអាចប្រើបាន"</string>
<string name="dictionary_settings_summary" msgid="5305694987799824349">"ការកំណត់សម្រាប់វចនានុក្រម"</string>
<string name="user_dictionaries" msgid="3582332055892252845">"វចនានុក្រមអ្នកប្រើ"</string>
@@ -164,10 +164,10 @@
<string name="message_updating" msgid="4457761393932375219">"ពិនិត្យមើលបច្ចុប្បន្នភាព"</string>
<string name="message_loading" msgid="5638680861387748936">"កំពុងផ្ទុក..."</string>
<string name="main_dict_description" msgid="3072821352793492143">"វចនានុក្រមចម្បង"</string>
- <string name="cancel" msgid="6830980399865683324">"បោះបង់"</string>
+ <string name="cancel" msgid="6830980399865683324">"បោះបង់"</string>
<string name="go_to_settings" msgid="3876892339342569259">"ការកំណត់"</string>
<string name="install_dict" msgid="180852772562189365">"ដំឡើង"</string>
- <string name="cancel_download_dict" msgid="7843340278507019303">"បោះបង់"</string>
+ <string name="cancel_download_dict" msgid="7843340278507019303">"បោះបង់"</string>
<string name="delete_dict" msgid="756853268088330054">"លុប"</string>
<string name="should_download_over_metered_prompt" msgid="1583881200688185508">"ភាសាដែលបានជ្រើសនៅលើឧបករណ៍ចល័តមានវចនានុក្រមអាចប្រើបាន។<br/> យើងផ្ដល់អនុសាសន៍ឲ្យ <b>ទាញយក</b> វចនានុក្រមភាសា <xliff:g id="LANGUAGE_NAME">%1$s</xliff:g> ដើម្បីបង្កើនបទពិសោធន៍វាយបញ្ចូលរបស់អ្នក។<br/> <br/> ការទាញយកអាចចំណាយពេលប្រហែលពីរនាទីនៅតាម 3G។ ការគិតថ្លៃអាចអនុវត្តប្រសិនបើអ្នកមិនប្រើ <b>ផែនការទិន្នន័យគ្មានដែនកំណត់</b>.<br/> បើអ្នកមិនប្រាកដថាផែនការណាមួយដែលអ្នកមាន យើងផ្ដល់អនុសាសន៍ឲ្យភ្ជាប់វ៉ាយហ្វាយ ដើម្បីចាប់ផ្ដើមទាញយកដោយស្វ័យប្រវត្តិ។<br/> <br/> ជំនួយ៖ អ្នកអាចទាញយក និងលុបវចនានុក្រមដោយចូលទៅ <b>ភាសា & ការបញ្ចូល</b> នៅក្នុងម៉ឺនុយ <b>ការកំណត់</b> សម្រាប់ឧបករណ៍ចល័ត។"</string>
<string name="download_over_metered" msgid="1643065851159409546">"ទាញយកឥឡូវនេះ (<xliff:g id="SIZE_IN_MEGABYTES">%1$.1f</xliff:g> មេកាបៃ)"</string>
@@ -185,7 +185,7 @@
<string name="user_dict_settings_add_word_option_name" msgid="6665558053408962865">"ពាក្យ៖"</string>
<string name="user_dict_settings_add_shortcut_option_name" msgid="3094731590655523777">"ផ្លូវកាត់៖"</string>
<string name="user_dict_settings_add_locale_option_name" msgid="4738643440987277705">"ភាសា៖"</string>
- <string name="user_dict_settings_add_word_hint" msgid="4902434148985906707">"វាយបញ្ចូលពាក្យ"</string>
+ <string name="user_dict_settings_add_word_hint" msgid="4902434148985906707">"វាយបញ្ចូលពាក្យ"</string>
<string name="user_dict_settings_add_shortcut_hint" msgid="2265453012555060178">"ផ្លូវកាត់ជាជម្រើស"</string>
<string name="user_dict_settings_edit_dialog_title" msgid="3765774633869590352">"កែពាក្យ"</string>
<string name="user_dict_settings_context_menu_edit_title" msgid="6812255903472456302">"កែ"</string>
diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
index 9a859bf..f513ac1 100644
--- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java
@@ -35,7 +35,6 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodSubtype;
-import android.widget.TextView;
import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.accessibility.MainKeyboardAccessibilityDelegate;
@@ -48,6 +47,7 @@
import com.android.inputmethod.keyboard.internal.KeyPreviewChoreographer;
import com.android.inputmethod.keyboard.internal.KeyPreviewDrawParams;
import com.android.inputmethod.keyboard.internal.LanguageOnSpacebarHelper;
+import com.android.inputmethod.keyboard.internal.MoreKeySpec;
import com.android.inputmethod.keyboard.internal.NonDistinctMultitouchHelper;
import com.android.inputmethod.keyboard.internal.SlidingKeyInputDrawingPreview;
import com.android.inputmethod.keyboard.internal.TimerHandler;
@@ -428,15 +428,6 @@
windowContentView.addView(mDrawingPreviewPlacerView);
}
- /**
- * Returns the enabled state of the key feedback preview
- * @return whether or not the key feedback preview is enabled
- * @see #setKeyPreviewPopupEnabled(boolean, int)
- */
- public boolean isKeyPreviewPopupEnabled() {
- return mKeyPreviewDrawParams.isPopupEnabled();
- }
-
// Implements {@link DrawingHandler.Callbacks} method.
@Override
public void dismissAllKeyPreviews() {
@@ -461,12 +452,9 @@
}
locatePreviewPlacerView();
- final TextView previewTextView = mKeyPreviewChoreographer.getKeyPreviewTextView(
- key, mDrawingPreviewPlacerView);
getLocationInWindow(mOriginCoords);
- mKeyPreviewChoreographer.placeKeyPreview(key, previewTextView, keyboard.mIconsSet,
- mKeyDrawParams, getWidth(), mOriginCoords);
- mKeyPreviewChoreographer.showKeyPreview(key, previewTextView, isHardwareAccelerated());
+ mKeyPreviewChoreographer.placeKeyPreviewAndShow(key, keyboard.mIconsSet, mKeyDrawParams,
+ getWidth(), mOriginCoords, mDrawingPreviewPlacerView, isHardwareAccelerated());
}
// Implements {@link TimerHandler.Callbacks} method.
@@ -557,13 +545,25 @@
}
private MoreKeysPanel onCreateMoreKeysPanel(final Key key, final Context context) {
- if (key.getMoreKeys() == null) {
+ final MoreKeySpec[] moreKeys = key.getMoreKeys();
+ if (moreKeys == null) {
return null;
}
Keyboard moreKeysKeyboard = mMoreKeysKeyboardCache.get(key);
if (moreKeysKeyboard == null) {
- moreKeysKeyboard = new MoreKeysKeyboard.Builder(
- context, key, this, mKeyPreviewDrawParams).build();
+ // {@link KeyPreviewDrawParams#mPreviewVisibleWidth} should have been set at
+ // {@link KeyPreviewChoreographer#placeKeyPreview(Key,TextView,KeyboardIconsSet,KeyDrawParams,int,int[]},
+ // though there may be some chances that the value is zero. <code>width == 0</code>
+ // will cause zero-division error at
+ // {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}.
+ final boolean singleMoreKeyWithPreview = mKeyPreviewDrawParams.isPopupEnabled()
+ && !key.noKeyPreview() && moreKeys.length == 1
+ && mKeyPreviewDrawParams.getVisibleWidth() > 0;
+ final MoreKeysKeyboard.Builder builder = new MoreKeysKeyboard.Builder(
+ context, key, getKeyboard(), singleMoreKeyWithPreview,
+ mKeyPreviewDrawParams.getVisibleWidth(),
+ mKeyPreviewDrawParams.getVisibleHeight(), newLabelPaint(key));
+ moreKeysKeyboard = builder.build();
mMoreKeysKeyboardCache.put(key, moreKeysKeyboard);
}
@@ -619,7 +619,8 @@
final int[] lastCoords = CoordinateUtils.newInstance();
tracker.getLastCoordinates(lastCoords);
- final boolean keyPreviewEnabled = isKeyPreviewPopupEnabled() && !key.noKeyPreview();
+ final boolean keyPreviewEnabled = mKeyPreviewDrawParams.isPopupEnabled()
+ && !key.noKeyPreview();
// The more keys keyboard is usually horizontally aligned with the center of the parent key.
// If showMoreKeysKeyboardAtTouchedPoint is true and the key preview is disabled, the more
// keys keyboard is placed at the touch point of the parent key.
diff --git a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
index a72f791..353e07c 100644
--- a/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/MoreKeysKeyboard.java
@@ -21,7 +21,6 @@
import android.graphics.drawable.Drawable;
import com.android.inputmethod.annotations.UsedForTesting;
-import com.android.inputmethod.keyboard.internal.KeyPreviewDrawParams;
import com.android.inputmethod.keyboard.internal.KeyboardBuilder;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParams;
@@ -260,32 +259,25 @@
/**
* The builder of MoreKeysKeyboard.
* @param context the context of {@link MoreKeysKeyboardView}.
- * @param parentKey the {@link Key} that invokes more keys keyboard.
- * @param parentKeyboardView the {@link KeyboardView} that contains the parentKey.
+ * @param key the {@link Key} that invokes more keys keyboard.
+ * @param keyboard the {@link Keyboard} that contains the parentKey.
+ * @param singleMoreKeyWithPreview true if the <code>key</code> has only one more key
+ * and key popup preview is enabled.
* @param keyPreviewDrawParams the parameter to place key preview.
+ * @param paintToMeasure the {@link Paint} object to measure a more key width
*/
- public Builder(final Context context, final Key parentKey,
- final MainKeyboardView parentKeyboardView,
- final KeyPreviewDrawParams keyPreviewDrawParams) {
+ public Builder(final Context context, final Key key, final Keyboard keyboard,
+ final boolean singleMoreKeyWithPreview, final int keyPreviewVisibleWidth,
+ final int keyPreviewVisibleHeight, final Paint paintToMeasure) {
super(context, new MoreKeysKeyboardParams());
- final Keyboard parentKeyboard = parentKeyboardView.getKeyboard();
- load(parentKeyboard.mMoreKeysTemplate, parentKeyboard.mId);
+ load(keyboard.mMoreKeysTemplate, keyboard.mId);
// TODO: More keys keyboard's vertical gap is currently calculated heuristically.
// Should revise the algorithm.
- mParams.mVerticalGap = parentKeyboard.mVerticalGap / 2;
- mParentKey = parentKey;
+ mParams.mVerticalGap = keyboard.mVerticalGap / 2;
+ mParentKey = key;
- final MoreKeySpec[] moreKeys = parentKey.getMoreKeys();
- final int width, height;
- // {@link KeyPreviewDrawParams#mPreviewVisibleWidth} should have been set at
- // {@link MainKeyboardView#showKeyPreview(PointerTracker}, though there may be
- // some chances that the value is zero. <code>width == 0</code> will cause
- // zero-division error at
- // {@link MoreKeysKeyboardParams#setParameters(int,int,int,int,int,int,boolean,int)}.
- final boolean singleMoreKeyWithPreview = parentKeyboardView.isKeyPreviewPopupEnabled()
- && !parentKey.noKeyPreview() && moreKeys.length == 1
- && keyPreviewDrawParams.getVisibleWidth() > 0;
+ final int keyWidth, rowHeight;
if (singleMoreKeyWithPreview) {
// Use pre-computed width and height if this more keys keyboard has only one key to
// mitigate visual flicker between key preview and more keys keyboard.
@@ -294,29 +286,28 @@
// left/right/top paddings. The bottom paddings of both backgrounds don't need to
// be considered because the vertical positions of both backgrounds were already
// adjusted with their bottom paddings deducted.
- width = keyPreviewDrawParams.getVisibleWidth();
- height = keyPreviewDrawParams.getVisibleHeight() + mParams.mVerticalGap;
+ keyWidth = keyPreviewVisibleWidth;
+ rowHeight = keyPreviewVisibleHeight + mParams.mVerticalGap;
} else {
final float padding = context.getResources().getDimension(
R.dimen.config_more_keys_keyboard_key_horizontal_padding)
- + (parentKey.hasLabelsInMoreKeys()
+ + (key.hasLabelsInMoreKeys()
? mParams.mDefaultKeyWidth * LABEL_PADDING_RATIO : 0.0f);
- width = getMaxKeyWidth(parentKey, mParams.mDefaultKeyWidth, padding,
- parentKeyboardView.newLabelPaint(parentKey));
- height = parentKeyboard.mMostCommonKeyHeight;
+ keyWidth = getMaxKeyWidth(key, mParams.mDefaultKeyWidth, padding, paintToMeasure);
+ rowHeight = keyboard.mMostCommonKeyHeight;
}
final int dividerWidth;
- if (parentKey.needsDividersInMoreKeys()) {
+ if (key.needsDividersInMoreKeys()) {
mDivider = mResources.getDrawable(R.drawable.more_keys_divider);
- dividerWidth = (int)(width * DIVIDER_RATIO);
+ dividerWidth = (int)(keyWidth * DIVIDER_RATIO);
} else {
mDivider = null;
dividerWidth = 0;
}
- mParams.setParameters(moreKeys.length, parentKey.getMoreKeysColumn(),
- width, height, parentKey.getX() + parentKey.getWidth() / 2,
- parentKeyboard.mId.mWidth, parentKey.isFixedColumnOrderMoreKeys(),
- dividerWidth);
+ final MoreKeySpec[] moreKeys = key.getMoreKeys();
+ mParams.setParameters(moreKeys.length, key.getMoreKeysColumn(), keyWidth, rowHeight,
+ key.getX() + key.getWidth() / 2, keyboard.mId.mWidth,
+ key.isFixedColumnOrderMoreKeys(), dividerWidth);
}
private static int getMaxKeyWidth(final Key parentKey, final int minKeyWidth,
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
index 605519b..d4c6710 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyPreviewChoreographer.java
@@ -57,7 +57,7 @@
mParams = params;
}
- public TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) {
+ private TextView getKeyPreviewTextView(final Key key, final ViewGroup placerView) {
TextView previewTextView = mShowingKeyPreviewTextViews.remove(key);
if (previewTextView != null) {
return previewTextView;
@@ -134,7 +134,16 @@
private static final int STATE_NORMAL = 0;
private static final int STATE_HAS_MOREKEYS = 1;
- public void placeKeyPreview(final Key key, final TextView previewTextView,
+ public void placeKeyPreviewAndShow(final Key key, final KeyboardIconsSet iconsSet,
+ final KeyDrawParams drawParams, final int keyboardViewWidth, final int[] keyboardOrigin,
+ final ViewGroup placerView, final boolean withAnimation) {
+ final TextView previewTextView = getKeyPreviewTextView(key, placerView);
+ placeKeyPreview(
+ key, previewTextView, iconsSet, drawParams, keyboardViewWidth, keyboardOrigin);
+ showKeyPreview(key, previewTextView, withAnimation);
+ }
+
+ private void placeKeyPreview(final Key key, final TextView previewTextView,
final KeyboardIconsSet iconsSet, final KeyDrawParams drawParams,
final int keyboardViewWidth, final int[] originCoords) {
previewTextView.setTextColor(drawParams.mPreviewTextColor);
@@ -189,7 +198,7 @@
previewTextView.setPivotY(previewHeight);
}
- public void showKeyPreview(final Key key, final TextView previewTextView,
+ private void showKeyPreview(final Key key, final TextView previewTextView,
final boolean withAnimation) {
if (!withAnimation) {
previewTextView.setVisibility(View.VISIBLE);
diff --git a/java/src/com/android/inputmethod/latin/InputAttributes.java b/java/src/com/android/inputmethod/latin/InputAttributes.java
index e1ae3df..ebe4361 100644
--- a/java/src/com/android/inputmethod/latin/InputAttributes.java
+++ b/java/src/com/android/inputmethod/latin/InputAttributes.java
@@ -41,6 +41,7 @@
final public boolean mShouldShowSuggestions;
final public boolean mApplicationSpecifiedCompletionOn;
final public boolean mShouldInsertSpacesAutomatically;
+ final public boolean mShouldShowVoiceInputKey;
final private int mInputType;
final private EditorInfo mEditorInfo;
final private String mPackageNameForPrivateImeOptions;
@@ -74,6 +75,7 @@
mInputTypeNoAutoCorrect = false;
mApplicationSpecifiedCompletionOn = false;
mShouldInsertSpacesAutomatically = false;
+ mShouldShowVoiceInputKey = false;
return;
}
// inputClass == InputType.TYPE_CLASS_TEXT
@@ -99,6 +101,12 @@
mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType);
+ final boolean noMicrophone = mIsPasswordField
+ || InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS == variation
+ || InputType.TYPE_TEXT_VARIATION_URI == variation
+ || hasNoMicrophoneKeyOption();
+ mShouldShowVoiceInputKey = !noMicrophone;
+
// If it's a browser edit field and auto correct is not ON explicitly, then
// disable auto correction, but keep suggestions on.
// If NO_SUGGESTIONS is set, don't do prediction.
@@ -119,7 +127,7 @@
return editorInfo.inputType == mInputType;
}
- public boolean hasNoMicrophoneKeyOption() {
+ private boolean hasNoMicrophoneKeyOption() {
@SuppressWarnings("deprecation")
final boolean deprecatedNoMicrophone = InputAttributes.inPrivateImeOptions(
null, NO_MICROPHONE_COMPAT, mEditorInfo);
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index de95b97..d216d65 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -1187,6 +1187,8 @@
Log.w(TAG, "Called updateSuggestionsOrPredictions but suggestions were not "
+ "requested!");
}
+ // Clear the suggestions strip.
+ mSuggestionStripViewAccessor.showSuggestionStrip(SuggestedWords.EMPTY);
return;
}
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
index 4410401..8de5fed 100644
--- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
@@ -125,8 +125,7 @@
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res)
- && !mInputAttributes.mIsPasswordField
- && !mInputAttributes.hasNoMicrophoneKeyOption()
+ && mInputAttributes.mShouldShowVoiceInputKey
&& SubtypeSwitcher.getInstance().isShortcutImeEnabled();
final String autoCorrectionThresholdRawValue = prefs.getString(
Settings.PREF_AUTO_CORRECTION_THRESHOLD,