Cosmetic fixes
Change-Id: I44ac89edaba2e57bd1b7e091ff74b77a5e598f2f
This commit is contained in:
parent
4012fcd2dc
commit
513b99dfa2
4 changed files with 30 additions and 36 deletions
|
@ -55,8 +55,7 @@ abstract public class AbstractDictionaryWriter extends Dictionary {
|
||||||
|
|
||||||
// TODO: Remove lastModifiedTime after making binary dictionary support forgetting curve.
|
// TODO: Remove lastModifiedTime after making binary dictionary support forgetting curve.
|
||||||
abstract public void addBigramWords(final String word0, final String word1,
|
abstract public void addBigramWords(final String word0, final String word1,
|
||||||
final int frequency, final boolean isValid,
|
final int frequency, final boolean isValid, final long lastModifiedTime);
|
||||||
final long lastModifiedTime);
|
|
||||||
|
|
||||||
abstract public void removeBigramWords(final String word0, final String word1);
|
abstract public void removeBigramWords(final String word0, final String word1);
|
||||||
|
|
||||||
|
|
|
@ -432,8 +432,9 @@ public final class BinaryDictionaryFileDumper {
|
||||||
|
|
||||||
// Actually copy the file
|
// Actually copy the file
|
||||||
final byte[] buffer = new byte[FILE_READ_BUFFER_SIZE];
|
final byte[] buffer = new byte[FILE_READ_BUFFER_SIZE];
|
||||||
for (int readBytes = input.read(buffer); readBytes >= 0; readBytes = input.read(buffer))
|
for (int readBytes = input.read(buffer); readBytes >= 0; readBytes = input.read(buffer)) {
|
||||||
output.write(buffer, 0, readBytes);
|
output.write(buffer, 0, readBytes);
|
||||||
|
}
|
||||||
input.close();
|
input.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,8 +479,7 @@ public final class BinaryDictionaryFileDumper {
|
||||||
* @param context the context for resources and providers.
|
* @param context the context for resources and providers.
|
||||||
* @param clientId the client ID to use.
|
* @param clientId the client ID to use.
|
||||||
*/
|
*/
|
||||||
public static void initializeClientRecordHelper(final Context context,
|
public static void initializeClientRecordHelper(final Context context, final String clientId) {
|
||||||
final String clientId) {
|
|
||||||
try {
|
try {
|
||||||
final ContentProviderClient client = context.getContentResolver().
|
final ContentProviderClient client = context.getContentResolver().
|
||||||
acquireContentProviderClient(getProviderUriBuilder("").build());
|
acquireContentProviderClient(getProviderUriBuilder("").build());
|
||||||
|
|
|
@ -52,8 +52,7 @@ public final class InputAttributes {
|
||||||
} else if (inputClass == 0) {
|
} else if (inputClass == 0) {
|
||||||
// TODO: is this check still necessary?
|
// TODO: is this check still necessary?
|
||||||
Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x"
|
Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x"
|
||||||
+ " imeOptions=0x%08x",
|
+ " imeOptions=0x%08x", inputType, editorInfo.imeOptions));
|
||||||
inputType, editorInfo.imeOptions));
|
|
||||||
}
|
}
|
||||||
mIsSettingsSuggestionStripOn = false;
|
mIsSettingsSuggestionStripOn = false;
|
||||||
mInputTypeNoAutoCorrect = false;
|
mInputTypeNoAutoCorrect = false;
|
||||||
|
@ -204,8 +203,7 @@ public final class InputAttributes {
|
||||||
public static boolean inPrivateImeOptions(String packageName, String key,
|
public static boolean inPrivateImeOptions(String packageName, String key,
|
||||||
EditorInfo editorInfo) {
|
EditorInfo editorInfo) {
|
||||||
if (editorInfo == null) return false;
|
if (editorInfo == null) return false;
|
||||||
final String findingKey = (packageName != null) ? packageName + "." + key
|
final String findingKey = (packageName != null) ? packageName + "." + key : key;
|
||||||
: key;
|
|
||||||
return StringUtils.containsInCommaSplittableText(findingKey, editorInfo.privateImeOptions);
|
return StringUtils.containsInCommaSplittableText(findingKey, editorInfo.privateImeOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -758,8 +758,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
.findViewById(android.R.id.extractArea);
|
.findViewById(android.R.id.extractArea);
|
||||||
mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing);
|
mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing);
|
||||||
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
|
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
|
||||||
if (mSuggestionStripView != null)
|
if (mSuggestionStripView != null) {
|
||||||
mSuggestionStripView.setListener(this, view);
|
mSuggestionStripView.setListener(this, view);
|
||||||
|
}
|
||||||
if (LatinImeLogger.sVISUALDEBUG) {
|
if (LatinImeLogger.sVISUALDEBUG) {
|
||||||
mKeyPreviewBackingView.setBackgroundColor(0x10FF0000);
|
mKeyPreviewBackingView.setBackgroundColor(0x10FF0000);
|
||||||
}
|
}
|
||||||
|
@ -1099,8 +1100,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// TODO: revisit this when LatinIME supports hardware keyboards.
|
// TODO: revisit this when LatinIME supports hardware keyboards.
|
||||||
// NOTE: the test harness subclasses LatinIME and overrides isInputViewShown().
|
// NOTE: the test harness subclasses LatinIME and overrides isInputViewShown().
|
||||||
// TODO: find a better way to simulate actual execution.
|
// TODO: find a better way to simulate actual execution.
|
||||||
if (isInputViewShown()
|
if (isInputViewShown() && !mConnection.isBelatedExpectedUpdate(oldSelStart, newSelStart)) {
|
||||||
&& !mConnection.isBelatedExpectedUpdate(oldSelStart, newSelStart)) {
|
|
||||||
// TODO: the following is probably better done in resetEntireInputState().
|
// TODO: the following is probably better done in resetEntireInputState().
|
||||||
// it should only happen when the cursor moved, and the very purpose of the
|
// it should only happen when the cursor moved, and the very purpose of the
|
||||||
// test below is to narrow down whether this happened or not. Likewise with
|
// test below is to narrow down whether this happened or not. Likewise with
|
||||||
|
@ -1330,8 +1330,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
@Override
|
@Override
|
||||||
public boolean onEvaluateFullscreenMode() {
|
public boolean onEvaluateFullscreenMode() {
|
||||||
// Reread resource value here, because this method is called by framework anytime as needed.
|
// Reread resource value here, because this method is called by framework anytime as needed.
|
||||||
final boolean isFullscreenModeAllowed =
|
final boolean isFullscreenModeAllowed = Settings.readUseFullscreenMode(getResources());
|
||||||
Settings.readUseFullscreenMode(getResources());
|
|
||||||
if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
|
if (super.onEvaluateFullscreenMode() && isFullscreenModeAllowed) {
|
||||||
// TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
|
// TODO: Remove this hack. Actually we should not really assume NO_EXTRACT_UI
|
||||||
// implies NO_FULLSCREEN. However, the framework mistakenly does. i.e. NO_EXTRACT_UI
|
// implies NO_FULLSCREEN. However, the framework mistakenly does. i.e. NO_EXTRACT_UI
|
||||||
|
@ -1371,8 +1370,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
private void resetComposingState(final boolean alsoResetLastComposedWord) {
|
private void resetComposingState(final boolean alsoResetLastComposedWord) {
|
||||||
mWordComposer.reset();
|
mWordComposer.reset();
|
||||||
if (alsoResetLastComposedWord)
|
if (alsoResetLastComposedWord) {
|
||||||
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void commitTyped(final String separatorString) {
|
private void commitTyped(final String separatorString) {
|
||||||
|
@ -1419,15 +1419,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (0 != (auto & TextUtils.CAP_MODE_CHARACTERS)) {
|
if (0 != (auto & TextUtils.CAP_MODE_CHARACTERS)) {
|
||||||
return WordComposer.CAPS_MODE_AUTO_SHIFT_LOCKED;
|
return WordComposer.CAPS_MODE_AUTO_SHIFT_LOCKED;
|
||||||
}
|
}
|
||||||
if (0 != auto) return WordComposer.CAPS_MODE_AUTO_SHIFTED;
|
if (0 != auto) {
|
||||||
|
return WordComposer.CAPS_MODE_AUTO_SHIFTED;
|
||||||
|
}
|
||||||
return WordComposer.CAPS_MODE_OFF;
|
return WordComposer.CAPS_MODE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void swapSwapperAndSpace() {
|
private void swapSwapperAndSpace() {
|
||||||
final CharSequence lastTwo = mConnection.getTextBeforeCursor(2, 0);
|
final CharSequence lastTwo = mConnection.getTextBeforeCursor(2, 0);
|
||||||
// It is guaranteed lastTwo.charAt(1) is a swapper - else this method is not called.
|
// It is guaranteed lastTwo.charAt(1) is a swapper - else this method is not called.
|
||||||
if (lastTwo != null && lastTwo.length() == 2
|
if (lastTwo != null && lastTwo.length() == 2 && lastTwo.charAt(0) == Constants.CODE_SPACE) {
|
||||||
&& lastTwo.charAt(0) == Constants.CODE_SPACE) {
|
|
||||||
mConnection.deleteSurroundingText(2, 0);
|
mConnection.deleteSurroundingText(2, 0);
|
||||||
final String text = lastTwo.charAt(1) + " ";
|
final String text = lastTwo.charAt(1) + " ";
|
||||||
mConnection.commitText(text, 1);
|
mConnection.commitText(text, 1);
|
||||||
|
@ -1861,8 +1862,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) {
|
if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHandler.obtainMessage(
|
mHandler.obtainMessage(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, batchPointers)
|
||||||
MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, batchPointers)
|
|
||||||
.sendToTarget();
|
.sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1954,8 +1954,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
// This method must run in UI Thread.
|
// This method must run in UI Thread.
|
||||||
public void onEndBatchInputAsyncInternal(final SuggestedWords suggestedWords) {
|
public void onEndBatchInputAsyncInternal(final SuggestedWords suggestedWords) {
|
||||||
final String batchInputText = suggestedWords.isEmpty()
|
final String batchInputText = suggestedWords.isEmpty() ? null : suggestedWords.getWord(0);
|
||||||
? null : suggestedWords.getWord(0);
|
|
||||||
if (TextUtils.isEmpty(batchInputText)) {
|
if (TextUtils.isEmpty(batchInputText)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2171,8 +2170,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
/*
|
/*
|
||||||
* Strip a trailing space if necessary and returns whether it's a swap weak space situation.
|
* Strip a trailing space if necessary and returns whether it's a swap weak space situation.
|
||||||
*/
|
*/
|
||||||
private boolean maybeStripSpace(final int code,
|
private boolean maybeStripSpace(final int code, final int spaceState,
|
||||||
final int spaceState, final boolean isFromSuggestionStrip) {
|
final boolean isFromSuggestionStrip) {
|
||||||
if (Constants.CODE_ENTER == code && SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
|
if (Constants.CODE_ENTER == code && SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
|
||||||
mConnection.removeTrailingSpace();
|
mConnection.removeTrailingSpace();
|
||||||
return false;
|
return false;
|
||||||
|
@ -2187,8 +2186,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCharacter(final int primaryCode, final int x,
|
private void handleCharacter(final int primaryCode, final int x, final int y,
|
||||||
final int y, final int spaceState) {
|
final int spaceState) {
|
||||||
// TODO: refactor this method to stop flipping isComposingWord around all the time, and
|
// TODO: refactor this method to stop flipping isComposingWord around all the time, and
|
||||||
// make it shorter (possibly cut into several pieces). Also factor handleNonSpecialCharacter
|
// make it shorter (possibly cut into several pieces). Also factor handleNonSpecialCharacter
|
||||||
// which has the same name as other handle* methods but is not the same.
|
// which has the same name as other handle* methods but is not the same.
|
||||||
|
@ -2255,8 +2254,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
mConnection.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1);
|
mConnection.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()), 1);
|
||||||
} else {
|
} else {
|
||||||
final boolean swapWeakSpace = maybeStripSpace(primaryCode,
|
final boolean swapWeakSpace = maybeStripSpace(primaryCode, spaceState,
|
||||||
spaceState, Constants.SUGGESTION_STRIP_COORDINATE == x);
|
Constants.SUGGESTION_STRIP_COORDINATE == x);
|
||||||
|
|
||||||
sendKeyCodePoint(primaryCode);
|
sendKeyCodePoint(primaryCode);
|
||||||
|
|
||||||
|
@ -2975,8 +2974,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
throw new RuntimeException("revertCommit, but we are composing a word");
|
throw new RuntimeException("revertCommit, but we are composing a word");
|
||||||
}
|
}
|
||||||
final CharSequence wordBeforeCursor =
|
final CharSequence wordBeforeCursor =
|
||||||
mConnection.getTextBeforeCursor(deleteLength, 0)
|
mConnection.getTextBeforeCursor(deleteLength, 0).subSequence(0, cancelLength);
|
||||||
.subSequence(0, cancelLength);
|
|
||||||
if (!TextUtils.equals(committedWord, wordBeforeCursor)) {
|
if (!TextUtils.equals(committedWord, wordBeforeCursor)) {
|
||||||
throw new RuntimeException("revertCommit check failed: we thought we were "
|
throw new RuntimeException("revertCommit check failed: we thought we were "
|
||||||
+ "reverting \"" + committedWord
|
+ "reverting \"" + committedWord
|
||||||
|
@ -3177,8 +3175,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
|
final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
|
||||||
mRichImm.getInputMethodIdOfThisIme(),
|
mRichImm.getInputMethodIdOfThisIme(),
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||||
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -3187,9 +3185,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
final AlertDialog.Builder builder =
|
||||||
.setItems(items, listener)
|
new AlertDialog.Builder(this).setItems(items, listener).setTitle(title);
|
||||||
.setTitle(title);
|
|
||||||
showOptionDialog(builder.create());
|
showOptionDialog(builder.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3254,7 +3251,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
|
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
|
||||||
p.println(" Keyboard mode = " + keyboardMode);
|
p.println(" Keyboard mode = " + keyboardMode);
|
||||||
final SettingsValues settingsValues = mSettings.getCurrent();
|
final SettingsValues settingsValues = mSettings.getCurrent();
|
||||||
p.println(" mIsSuggestionsSuggestionsRequested = "
|
p.println(" mIsSuggestionsRequested = "
|
||||||
+ settingsValues.isSuggestionsRequested(mDisplayOrientation));
|
+ settingsValues.isSuggestionsRequested(mDisplayOrientation));
|
||||||
p.println(" mCorrectionEnabled=" + settingsValues.mCorrectionEnabled);
|
p.println(" mCorrectionEnabled=" + settingsValues.mCorrectionEnabled);
|
||||||
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
|
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
|
||||||
|
|
Loading…
Reference in a new issue