diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin')
3 files changed, 26 insertions, 11 deletions
diff --git a/java/src/com/android/inputmethod/latin/CandidateView.java b/java/src/com/android/inputmethod/latin/CandidateView.java index 4baf52e52..713f3abe2 100644 --- a/java/src/com/android/inputmethod/latin/CandidateView.java +++ b/java/src/com/android/inputmethod/latin/CandidateView.java @@ -323,8 +323,11 @@ public class CandidateView extends LinearLayout implements OnClickListener { word.setTag(i); word.setOnClickListener(this); mWords.add(word); + final View divider = inflater.inflate(R.layout.candidate_divider, null); + divider.setTag(i); + divider.setOnClickListener(this); + mDividers.add(divider); mInfos.add((TextView)inflater.inflate(R.layout.candidate_info, null)); - mDividers.add(inflater.inflate(R.layout.candidate_divider, null)); } mTouchToSave = findViewById(R.id.touch_to_save); @@ -476,6 +479,7 @@ public class CandidateView extends LinearLayout implements OnClickListener { final TextView word = mWords.get(pos); final TextPaint paint = word.getPaint(); + final View divider = mDividers.get(pos); // TODO: Reorder candidates in strip as appropriate. The center candidate should hold // the word when space is typed (valid typed word or auto corrected word). word.setTextColor(getCandidateTextColor(isAutoCorrect, @@ -505,7 +509,7 @@ public class CandidateView extends LinearLayout implements OnClickListener { word.setTextScaleX(scaleX); if (i != 0) { // Add divider if this isn't the left most suggestion in candidate strip. - mCandidatesStrip.addView(mDividers.get(i)); + mCandidatesStrip.addView(divider); } mCandidatesStrip.addView(word); if (params.mCanUseFixedWidthColumns) { @@ -534,7 +538,6 @@ public class CandidateView extends LinearLayout implements OnClickListener { } if (x != 0) { // Add divider if this isn't the left most suggestion in current row. - final View divider = mDividers.get(i); mCandidatesPane.addView(divider); FrameLayoutCompatUtils.placeViewAt( divider, x, y + (mCandidateStripHeight - params.mDividerHeight) / 2, diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index d9d421411..225c7c899 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -872,7 +872,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar @Override public void hideWindow() { LatinImeLogger.commit(); - mKeyboardSwitcher.onAutoCorrectionStateChanged(false); + mKeyboardSwitcher.onHideWindow(); if (TRACE) Debug.stopMethodTracing(); if (mOptionsDialog != null && mOptionsDialog.isShowing()) { @@ -917,7 +917,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar if (onEvaluateInputViewShown() && mCandidateViewContainer != null) { final boolean shouldShowCandidates = shown && (needsInputViewShown ? mKeyboardSwitcher.isInputViewShown() : true); - if (isExtractViewShown()) { + if (isFullscreenMode()) { // No need to have extra space to show the key preview. mCandidateViewContainer.setMinimumHeight(0); mCandidateViewContainer.setVisibility( @@ -2163,8 +2163,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } }; final AlertDialog.Builder builder = new AlertDialog.Builder(this) - .setIcon(R.drawable.ic_dialog_keyboard) - .setNegativeButton(android.R.string.cancel, null) .setItems(items, listener) .setTitle(title); showOptionDialogInternal(builder.create()); @@ -2191,8 +2189,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar } }; final AlertDialog.Builder builder = new AlertDialog.Builder(this) - .setIcon(R.drawable.ic_dialog_keyboard) - .setNegativeButton(android.R.string.cancel, null) .setItems(items, listener) .setTitle(title); showOptionDialogInternal(builder.create()); diff --git a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java index 156510b40..ae938aea8 100644 --- a/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java +++ b/java/src/com/android/inputmethod/latin/spellcheck/AndroidSpellCheckerService.java @@ -17,6 +17,7 @@ package com.android.inputmethod.latin.spellcheck; import android.service.textservice.SpellCheckerService; +import android.util.Log; import android.view.textservice.SuggestionsInfo; import android.view.textservice.TextInfo; @@ -24,11 +25,26 @@ import android.view.textservice.TextInfo; * Service for spell checking, using LatinIME's dictionaries and mechanisms. */ public class AndroidSpellCheckerService extends SpellCheckerService { + private static final String TAG = AndroidSpellCheckerService.class.getSimpleName(); + private static final boolean DBG = true; @Override public SuggestionsInfo getSuggestions(TextInfo textInfo, int suggestionsLimit, String locale) { // TODO: implement this - String[] candidates = new String[] {"candidate1", "candidate2", "candidate3"}; - return new SuggestionsInfo(0, candidates); + final String text = textInfo.getText(); + if (DBG) { + Log.w(TAG, "getSuggestions: " + text); + } + String[] candidates0 = new String[] {text, "candidate1", "candidate2", "candidate3"}; + String[] candidates1 = new String[] {text, "candidateA", "candidateB"}; + final int textLength = textInfo.getText().length() % 3; + if (textLength % 3 == 0) { + return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_LOOKS_TYPO + | SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, candidates0); + } else if (textLength % 3 == 1) { + return new SuggestionsInfo(SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, candidates1); + } else { + return new SuggestionsInfo(0, null); + } } } |