Merge remote-tracking branch 'goog/master' into merge

main
satok 2011-06-24 21:50:08 +09:00
commit 49043b841a
9 changed files with 79 additions and 11 deletions

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2011, 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.
*/
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid
android:color="@android:color/transparent" />
<size
android:width="50dp"
android:height="40dp" />
</shape>

View File

@ -76,7 +76,9 @@
<!-- Modest : Suggestion whose normalized score is greater than this value <!-- Modest : Suggestion whose normalized score is greater than this value
will be subject to auto-correction. --> will be subject to auto-correction. -->
<item>0.22</item> <item>0.22</item>
<!-- Aggressive : Suggestion whose normalized score is greater than this value <!-- Aggressive -->
<item>0.08</item>
<!-- Very Aggressive : Suggestion whose normalized score is greater than this value
will be subject to auto-correction. --> will be subject to auto-correction. -->
<item>0</item> <item>0</item>
</string-array> </string-array>

View File

@ -86,15 +86,18 @@
<string name="auto_correction_threshold_mode_index_off">0</string> <string name="auto_correction_threshold_mode_index_off">0</string>
<string name="auto_correction_threshold_mode_index_modest">1</string> <string name="auto_correction_threshold_mode_index_modest">1</string>
<string name="auto_correction_threshold_mode_index_aggeressive">2</string> <string name="auto_correction_threshold_mode_index_aggeressive">2</string>
<string name="auto_correction_threshold_mode_index_very_aggeressive">3</string>
<string-array name="auto_correction_threshold_mode_indexes"> <string-array name="auto_correction_threshold_mode_indexes">
<item>@string/auto_correction_threshold_mode_index_off</item> <item>@string/auto_correction_threshold_mode_index_off</item>
<item>@string/auto_correction_threshold_mode_index_modest</item> <item>@string/auto_correction_threshold_mode_index_modest</item>
<item>@string/auto_correction_threshold_mode_index_aggeressive</item> <item>@string/auto_correction_threshold_mode_index_aggeressive</item>
<item>@string/auto_correction_threshold_mode_index_very_aggeressive</item>
</string-array> </string-array>
<string-array name="auto_correction_threshold_modes"> <string-array name="auto_correction_threshold_modes">
<item>@string/auto_correction_threshold_mode_off</item> <item>@string/auto_correction_threshold_mode_off</item>
<item>@string/auto_correction_threshold_mode_modest</item> <item>@string/auto_correction_threshold_mode_modest</item>
<item>@string/auto_correction_threshold_mode_aggeressive</item> <item>@string/auto_correction_threshold_mode_aggeressive</item>
<item>@string/auto_correction_threshold_mode_very_aggeressive</item>
</string-array> </string-array>
<string name="voice_mode_main">0</string> <string name="voice_mode_main">0</string>

View File

@ -60,7 +60,7 @@
<item name="iconNum0Key">@drawable/sym_keyboard_num0</item> <item name="iconNum0Key">@drawable/sym_keyboard_num0</item>
<!-- <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked_holo</item> --> <!-- <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked_holo</item> -->
<item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked</item> <item name="iconShiftedShiftKey">@drawable/sym_keyboard_shift_locked</item>
<item name="iconPreviewSpaceKey">@drawable/sym_keyboard_space_holo</item> <item name="iconPreviewSpaceKey">@drawable/transparent</item>
<!-- <item name="iconPreviewTabKey">@drawable/sym_keyboard_tab_holo</item> --> <!-- <item name="iconPreviewTabKey">@drawable/sym_keyboard_tab_holo</item> -->
<item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item> <item name="iconPreviewTabKey">@drawable/sym_keyboard_feedback_tab</item>
<!-- <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item> --> <!-- <item name="iconPreviewSettingsKey">@drawable/sym_keyboard_settings_holo</item> -->
@ -72,7 +72,7 @@
<item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item> <item name="disabledShortcutIcon">@drawable/sym_keyboard_voice_off_holo</item>
<item name="spacebarArrowLeftIcon">@drawable/sym_keyboard_language_arrows_left</item> <item name="spacebarArrowLeftIcon">@drawable/sym_keyboard_language_arrows_left</item>
<item name="spacebarArrowRightIcon">@drawable/sym_keyboard_language_arrows_right</item> <item name="spacebarArrowRightIcon">@drawable/sym_keyboard_language_arrows_right</item>
<item name="spacebarArrowPreviewLeftIcon">@drawable/sym_keyboard_feedback_language_arrows_left</item> <!-- <item name="spacebarArrowPreviewLeftIcon">@drawable/sym_keyboard_feedback_language_arrows_left</item> -->
<item name="spacebarArrowPreviewRightIcon">@drawable/sym_keyboard_feedback_language_arrows_right</item> <!-- <item name="spacebarArrowPreviewRightIcon">@drawable/sym_keyboard_feedback_language_arrows_right</item> -->
</style> </style>
</resources> </resources>

View File

@ -66,6 +66,9 @@
<!-- Option to enable auto capitalization of sentences --> <!-- Option to enable auto capitalization of sentences -->
<string name="auto_cap">Auto-capitalization</string> <string name="auto_cap">Auto-capitalization</string>
<!-- Option to configure dictionaries -->
<string name="configure_dictionaries_title">Configure dictionaries</string>
<!-- Option to enable quick fixes --> <!-- Option to enable quick fixes -->
<string name="quick_fixes">Quick fixes</string> <string name="quick_fixes">Quick fixes</string>
<!-- Description for quick fixes --> <!-- Description for quick fixes -->
@ -101,6 +104,8 @@
<string name="auto_correction_threshold_mode_modest">Modest</string> <string name="auto_correction_threshold_mode_modest">Modest</string>
<!-- Option to suggest auto correction candidates aggressively. Auto-corrects to a word which has even large edit distance from typed word. [CHAR LIMIT=20] --> <!-- Option to suggest auto correction candidates aggressively. Auto-corrects to a word which has even large edit distance from typed word. [CHAR LIMIT=20] -->
<string name="auto_correction_threshold_mode_aggeressive">Aggressive</string> <string name="auto_correction_threshold_mode_aggeressive">Aggressive</string>
<!-- Option to suggest auto correction candidates very aggressively. Auto-corrects to a word which has even large edit distance from typed word. [CHAR LIMIT=20] -->
<string name="auto_correction_threshold_mode_very_aggeressive">Very Aggressive</string>
<!-- Option to enable bigram correction --> <!-- Option to enable bigram correction -->
<string name="bigram_suggestion">Bigram suggestions</string> <string name="bigram_suggestion">Bigram suggestions</string>

View File

@ -68,6 +68,14 @@
<PreferenceCategory <PreferenceCategory
android:title="@string/correction_category" android:title="@string/correction_category"
android:key="correction_settings"> android:key="correction_settings">
<PreferenceScreen
android:key="configure_dictionaries_key"
android:title="@string/configure_dictionaries_title">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.google.android.inputmethod.latin.dictionarypack"
android:targetClass="com.google.android.inputmethod.latin.dictionarypack.DictionarySettings" />
</PreferenceScreen>
<CheckBoxPreference <CheckBoxPreference
android:key="quick_fixes" android:key="quick_fixes"
android:title="@string/quick_fixes" android:title="@string/quick_fixes"

View File

@ -130,6 +130,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// Key preview // Key preview
private boolean mInForeground; private boolean mInForeground;
private TextView mPreviewText; private TextView mPreviewText;
private Drawable mPreviewBackground;
private float mPreviewTextRatio; private float mPreviewTextRatio;
private int mPreviewTextSize; private int mPreviewTextSize;
private boolean mShowKeyPreviewPopup = true; private boolean mShowKeyPreviewPopup = true;
@ -357,6 +358,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
if (previewLayout != 0) { if (previewLayout != 0) {
mPreviewText = (TextView) LayoutInflater.from(context).inflate(previewLayout, null); mPreviewText = (TextView) LayoutInflater.from(context).inflate(previewLayout, null);
mPreviewBackground = mPreviewText.getBackground();
mPreviewTextRatio = getRatio(res, R.fraction.key_preview_text_ratio); mPreviewTextRatio = getRatio(res, R.fraction.key_preview_text_ratio);
} else { } else {
mShowKeyPreviewPopup = false; mShowKeyPreviewPopup = false;
@ -982,6 +984,11 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
previewIcon != null ? previewIcon : key.getIcon()); previewIcon != null ? previewIcon : key.getIcon());
previewText.setText(null); previewText.setText(null);
} }
if (key.mCode == Keyboard.CODE_SPACE) {
previewText.setBackgroundColor(Color.TRANSPARENT);
} else {
previewText.setBackgroundDrawable(mPreviewBackground);
}
// Set the preview background state // Set the preview background state
previewText.getBackground().setState( previewText.getBackground().setState(
key.mPopupCharacters != null ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET); key.mPopupCharacters != null ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);

View File

@ -58,7 +58,7 @@ public class SlidingLocaleDrawable extends Drawable {
public SlidingLocaleDrawable(Context context, Drawable background, int width, int height) { public SlidingLocaleDrawable(Context context, Drawable background, int width, int height) {
mBackground = background; mBackground = background;
Keyboard.setDefaultBounds(mBackground); Keyboard.setDefaultBounds(background);
mWidth = width; mWidth = width;
mHeight = height; mHeight = height;
final TextPaint textPaint = new TextPaint(); final TextPaint textPaint = new TextPaint();
@ -68,7 +68,7 @@ public class SlidingLocaleDrawable extends Drawable {
textPaint.setTextAlign(Align.CENTER); textPaint.setTextAlign(Align.CENTER);
textPaint.setAntiAlias(true); textPaint.setAntiAlias(true);
mTextPaint = textPaint; mTextPaint = textPaint;
mMiddleX = (mWidth - mBackground.getIntrinsicWidth()) / 2; mMiddleX = (background != null) ? (mWidth - mBackground.getIntrinsicWidth()) / 2 : 0;
final TypedArray a = context.obtainStyledAttributes( final TypedArray a = context.obtainStyledAttributes(
null, R.styleable.LatinKeyboard, R.attr.latinKeyboardStyle, R.style.LatinKeyboard); null, R.styleable.LatinKeyboard, R.attr.latinKeyboardStyle, R.style.LatinKeyboard);
@ -119,12 +119,14 @@ public class SlidingLocaleDrawable extends Drawable {
canvas.drawText(mNextLanguage, diff - width / 2, baseline, paint); canvas.drawText(mNextLanguage, diff - width / 2, baseline, paint);
canvas.drawText(mPrevLanguage, diff + width + width / 2, baseline, paint); canvas.drawText(mPrevLanguage, diff + width + width / 2, baseline, paint);
if (lArrow != null && rArrow != null) {
Keyboard.setDefaultBounds(lArrow); Keyboard.setDefaultBounds(lArrow);
rArrow.setBounds(width - rArrow.getIntrinsicWidth(), 0, width, rArrow.setBounds(width - rArrow.getIntrinsicWidth(), 0, width,
rArrow.getIntrinsicHeight()); rArrow.getIntrinsicHeight());
lArrow.draw(canvas); lArrow.draw(canvas);
rArrow.draw(canvas); rArrow.draw(canvas);
} }
}
if (mBackground != null) { if (mBackground != null) {
canvas.translate(mMiddleX, 0); canvas.translate(mMiddleX, 0);
mBackground.draw(canvas); mBackground.draw(canvas);

View File

@ -25,6 +25,7 @@ import com.android.inputmethod.compat.VibratorCompatWrapper;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.backup.BackupManager; import android.app.backup.BackupManager;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -65,6 +66,7 @@ public class Settings extends PreferenceActivity
public static final String PREF_SELECTED_LANGUAGES = "selected_languages"; public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
public static final String PREF_SUBTYPES = "subtype_settings"; public static final String PREF_SUBTYPES = "subtype_settings";
public static final String PREF_CONFIGURE_DICTIONARIES_KEY = "configure_dictionaries_key";
public static final String PREF_CORRECTION_SETTINGS_KEY = "correction_settings"; public static final String PREF_CORRECTION_SETTINGS_KEY = "correction_settings";
public static final String PREF_QUICK_FIXES = "quick_fixes"; public static final String PREF_QUICK_FIXES = "quick_fixes";
public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting"; public static final String PREF_SHOW_SUGGESTIONS_SETTING = "show_suggestions_setting";
@ -424,6 +426,15 @@ public class Settings extends PreferenceActivity
} }
mKeyPreviewPopupDismissDelay.setEnabled( mKeyPreviewPopupDismissDelay.setEnabled(
Settings.Values.isKeyPreviewPopupEnabled(prefs, res)); Settings.Values.isKeyPreviewPopupEnabled(prefs, res));
final PreferenceScreen dictionaryLink =
(PreferenceScreen) findPreference(PREF_CONFIGURE_DICTIONARIES_KEY);
final Intent intent = dictionaryLink.getIntent();
final int number = getPackageManager().queryIntentActivities(intent, 0).size();
if (0 >= number) {
textCorrectionGroup.removePreference(dictionaryLink);
}
} }
@Override @Override