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

This commit is contained in:
Ken Wakasa 2012-11-09 15:13:14 +09:00
commit c026b578dd
7 changed files with 74 additions and 27 deletions

View File

@ -69,7 +69,7 @@
<string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: gespeichert"</string>
<string name="label_go_key" msgid="1635148082137219148">"Los"</string>
<string name="label_next_key" msgid="362972844525672568">"Weiter"</string>
<string name="label_previous_key" msgid="1211868118071386787">"Vorh."</string>
<string name="label_previous_key" msgid="1211868118071386787">"Zurück"</string>
<string name="label_done_key" msgid="2441578748772529288">"Fertig"</string>
<string name="label_send_key" msgid="2815056534433717444">"Senden"</string>
<string name="label_to_alpha_key" msgid="4793983863798817523">"ABC"</string>
@ -121,7 +121,7 @@
<string name="prefs_enable_log" msgid="6620424505072963557">"Nutzer-Feedback aktivieren"</string>
<string name="prefs_description_log" msgid="5827825607258246003">"Tragen Sie zur Verbesserung dieses Eingabemethodeneditors bei, indem Sie automatisch Nutzungsstatistiken und Absturzberichte an Google senden."</string>
<string name="keyboard_layout" msgid="8451164783510487501">"Tastaturdesign"</string>
<string name="subtype_en_GB" msgid="88170601942311355">"Englisch (Großbritannien)"</string>
<string name="subtype_en_GB" msgid="88170601942311355">"Englisch (UK)"</string>
<string name="subtype_en_US" msgid="6160452336634534239">"Englisch (USA)"</string>
<string name="subtype_with_layout_en_GB" msgid="2179097748724725906">"Englisch (GB) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string>
<string name="subtype_with_layout_en_US" msgid="1362581347576714579">"Englisch (USA) (<xliff:g id="LAYOUT">%s</xliff:g>)"</string>

View File

@ -204,6 +204,12 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mState.onUpdateShiftState(mLatinIME.getCurrentAutoCapsState());
}
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
public void resetKeyboardStateToAlphabet() {
mState.onResetKeyboardStateToAlphabet();
}
public void onPressKey(int code) {
if (isVibrateAndSoundFeedbackRequired()) {
mFeedbackManager.hapticAndAudioFeedback(code, mKeyboardView);

View File

@ -253,6 +253,22 @@ public final class KeyboardState {
}
}
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
private void resetKeyboardStateToAlphabet() {
if (DEBUG_ACTION) {
Log.d(TAG, "resetKeyboardStateToAlphabet: " + this);
}
if (mIsAlphabetMode) return;
mPrevSymbolsKeyboardWasShifted = mIsSymbolShifted;
setAlphabetKeyboard();
if (mPrevMainKeyboardWasShiftLocked) {
setShiftLocked(true);
}
mPrevMainKeyboardWasShiftLocked = false;
}
private void toggleShiftInSymbols() {
if (mIsSymbolShifted) {
setSymbolsKeyboard();
@ -379,6 +395,15 @@ public final class KeyboardState {
updateAlphabetShiftState(autoCaps);
}
// TODO: Remove this method. Come up with a more comprehensive way to reset the keyboard layout
// when a keyboard layout set doesn't get reloaded in LatinIME.onStartInputViewInternal().
public void onResetKeyboardStateToAlphabet() {
if (DEBUG_EVENT) {
Log.d(TAG, "onResetKeyboardStateToAlphabet: " + this);
}
resetKeyboardStateToAlphabet();
}
private void updateAlphabetShiftState(int autoCaps) {
if (!mIsAlphabetMode) return;
if (!mShiftKeyState.isReleasing()) {

View File

@ -16,6 +16,7 @@
package com.android.inputmethod.latin;
import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.makedict.BinaryDictInputOutput;
import com.android.inputmethod.latin.makedict.FormatSpec;
@ -422,8 +423,11 @@ final class BinaryDictionaryGetter {
// cacheWordListsFromContentProvider returns the list of files it copied to local
// storage, but we don't really care about what was copied NOW: what we want is the
// list of everything we ever cached, so we ignore the return value.
BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
hasDefaultWordList);
// TODO: The experimental version is not supported by the Dictionary Pack Service yet
if (!ProductionFlag.IS_EXPERIMENTAL) {
BinaryDictionaryFileDumper.cacheWordListsFromContentProvider(locale, context,
hasDefaultWordList);
}
final File[] cachedWordLists = getCachedWordLists(locale.toString(), context);
final String mainDictId = getMainDictId(locale);
final DictPackSettings dictPackSettings = new DictPackSettings(context);

View File

@ -168,8 +168,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private int mDisplayOrientation;
// Object for reacting to adding/removing a dictionary pack.
// TODO: The experimental version is not supported by the Dictionary Pack Service yet.
private BroadcastReceiver mDictionaryPackInstallReceiver =
new DictionaryPackInstallBroadcastReceiver(this);
ProductionFlag.IS_EXPERIMENTAL
? null : new DictionaryPackInstallBroadcastReceiver(this);
// Keeps track of most recently inserted text (multi-character key) for reverting
private String mEnteredText;
@ -410,16 +412,19 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION);
registerReceiver(mReceiver, filter);
final IntentFilter packageFilter = new IntentFilter();
packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
packageFilter.addDataScheme(SCHEME_PACKAGE);
registerReceiver(mDictionaryPackInstallReceiver, packageFilter);
// TODO: The experimental version is not supported by the Dictionary Pack Service yet.
if (!ProductionFlag.IS_EXPERIMENTAL) {
final IntentFilter packageFilter = new IntentFilter();
packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
packageFilter.addDataScheme(SCHEME_PACKAGE);
registerReceiver(mDictionaryPackInstallReceiver, packageFilter);
final IntentFilter newDictFilter = new IntentFilter();
newDictFilter.addAction(
DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION);
registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
final IntentFilter newDictFilter = new IntentFilter();
newDictFilter.addAction(
DictionaryPackInstallBroadcastReceiver.NEW_DICTIONARY_INTENT_ACTION);
registerReceiver(mDictionaryPackInstallReceiver, newDictFilter);
}
}
// Has to be package-visible for unit tests
@ -539,7 +544,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
mSuggest = null;
}
unregisterReceiver(mReceiver);
unregisterReceiver(mDictionaryPackInstallReceiver);
// TODO: The experimental version is not supported by the Dictionary Pack Service yet.
if (!ProductionFlag.IS_EXPERIMENTAL) {
unregisterReceiver(mDictionaryPackInstallReceiver);
}
LatinImeLogger.commit();
LatinImeLogger.onDestroy();
super.onDestroy();
@ -730,6 +738,10 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
}
switcher.loadKeyboard(editorInfo, mCurrentSettings);
} else if (restarting) {
// TODO: Come up with a more comprehensive way to reset the keyboard layout when
// a keyboard layout set doesn't get reloaded in this method.
switcher.resetKeyboardStateToAlphabet();
}
setSuggestionStripShownInternal(
isSuggestionsStripVisible(), /* needsInputViewShown */ false);

View File

@ -68,6 +68,7 @@ public final class Settings extends InputMethodSettingsFragment
public static final String PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY =
"pref_key_preview_popup_dismiss_delay";
public static final String PREF_BIGRAM_PREDICTIONS = "next_word_prediction";
public static final String PREF_GESTURE_SETTINGS = "gesture_typing_settings";
public static final String PREF_GESTURE_INPUT = "gesture_input";
public static final String PREF_VIBRATION_DURATION_SETTINGS =
"pref_vibration_duration_settings";
@ -136,6 +137,8 @@ public final class Settings extends InputMethodSettingsFragment
(PreferenceGroup) findPreference(PREF_GENERAL_SETTINGS);
final PreferenceGroup textCorrectionGroup =
(PreferenceGroup) findPreference(PREF_CORRECTION_SETTINGS);
final PreferenceGroup gestureTypingSettings =
(PreferenceGroup) findPreference(PREF_GESTURE_SETTINGS);
final PreferenceGroup miscSettings =
(PreferenceGroup) findPreference(PREF_MISC_SETTINGS);
@ -200,23 +203,15 @@ public final class Settings extends InputMethodSettingsFragment
final Intent intent = dictionaryLink.getIntent();
final int number = context.getPackageManager().queryIntentActivities(intent, 0).size();
if (0 >= number) {
// TODO: The experimental version is not supported by the Dictionary Pack Service yet
if (ProductionFlag.IS_EXPERIMENTAL || 0 >= number) {
textCorrectionGroup.removePreference(dictionaryLink);
}
final boolean gestureInputEnabledByBuildConfig = res.getBoolean(
R.bool.config_gesture_input_enabled_by_build_config);
final Preference gesturePreviewTrail = findPreference(PREF_GESTURE_PREVIEW_TRAIL);
final Preference gestureFloatingPreviewText = findPreference(
PREF_GESTURE_FLOATING_PREVIEW_TEXT);
if (!gestureInputEnabledByBuildConfig) {
miscSettings.removePreference(findPreference(PREF_GESTURE_INPUT));
miscSettings.removePreference(gesturePreviewTrail);
miscSettings.removePreference(gestureFloatingPreviewText);
} else {
final boolean gestureInputEnabledByUser = prefs.getBoolean(PREF_GESTURE_INPUT, true);
setPreferenceEnabled(gesturePreviewTrail, gestureInputEnabledByUser);
setPreferenceEnabled(gestureFloatingPreviewText, gestureInputEnabledByUser);
getPreferenceScreen().removePreference(gestureTypingSettings);
}
mKeypressVibrationDurationSettingsPref =

View File

@ -181,16 +181,21 @@ public class Diff extends Dicttool.Command {
if (!list1.contains(attribute0)) {
hasDifferences = true;
// Search for a word with the same string but a different frequency
boolean foundString = false;
for (final WeightedString attribute1 : list1) {
if (attribute0.mWord.equals(attribute1.mWord)) {
System.out.println(type + " freq changed: " + word + " "
+ attribute0.mWord + " " + attribute0.mFrequency + " -> "
+ attribute1.mFrequency);
list1.remove(attribute1);
foundString = true;
break;
}
}
if (!foundString) {
// We come here if we haven't found any matching string.
System.out.println(type + " removed: " + word + " " + attribute0.mWord);
System.out.println(type + " removed: " + word + " " + attribute0.mWord + " "
+ attribute0.mFrequency);
}
} else {
list1.remove(attribute0);