本文整理汇总了Java中android.view.inputmethod.CompletionInfo类的典型用法代码示例。如果您正苦于以下问题:Java CompletionInfo类的具体用法?Java CompletionInfo怎么用?Java CompletionInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompletionInfo类属于android.view.inputmethod包,在下文中一共展示了CompletionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
if (DEBUG) {
Log.i("foo", "Received completions:");
for (int i=0; i<(completions != null ? completions.length : 0); i++) {
Log.i("foo", " #" + i + ": " + completions[i]);
}
}
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
clearSuggestions();
return;
}
List<CharSequence> stringList = new ArrayList<CharSequence>();
for (int i=0; i<(completions != null ? completions.length : 0); i++) {
CompletionInfo ci = completions[i];
if (ci != null) stringList.add(ci.getText());
}
// When in fullscreen mode, show completions generated by the application
setSuggestions(stringList, true, true, true);
mBestWord = null;
setCandidatesViewShown(true);
}
}
示例2: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions(null, false, false);
return;
}
List<String> stringList = new ArrayList<String>();
for (int i = 0; i < completions.length; i++) {
CompletionInfo ci = completions[i];
if (ci != null) stringList.add(ci.getText().toString());
}
setSuggestions(stringList, true, true);
}
}
示例3: pickSuggestionManually
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public void pickSuggestionManually(int index) {
if (mCompletionOn && mCompletions != null && index >= 0
&& index < mCompletions.length) {
CompletionInfo ci = mCompletions[index];
getCurrentInputConnection().commitCompletion(ci);
if (mCandidateView != null) {
mCandidateView.clear();
}
updateShiftKeyState(getCurrentInputEditorInfo());
} else if (mComposing.length() > 0) {
if (mPredictionOn && mSuggestions != null && index >= 0) {
mComposing.replace(0, mComposing.length(), mSuggestions.get(index));
}
commitTyped(getCurrentInputConnection());
}
}
示例4: pickSuggestionManually
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public void pickSuggestionManually(int index) {
if (mCompletionOn && mCompletions != null && index >= 0
&& index < mCompletions.length) {
CompletionInfo ci = mCompletions[index];
getCurrentInputConnection().commitCompletion(ci);
if (mCandidateView != null) {
mCandidateView.clear();
}
updateShiftKeyState(getCurrentInputEditorInfo());
} else if (mComposing.length() > 0) {
// If we were generating candidate suggestions for the current
// text, we would commit one of them here. But for this sample,
// we will just commit the current text.
commitTyped(getCurrentInputConnection());
}
}
示例5: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions(null, false);
return;
}
List<String> stringList = new ArrayList<>();
for (CompletionInfo ci : completions) {
if (ci != null) stringList.add(ci.getText().toString());
}
setSuggestions(stringList, true);
}
}
示例6: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions(null, false, false);
return;
}
List<String> stringList = new ArrayList<String>();
for (int i=0; i<(completions != null ? completions.length : 0); i++) {
CompletionInfo ci = completions[i];
if (ci != null) stringList.add(ci.getText().toString());
}
setSuggestions(stringList, true, true);
}
}
示例7: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions(null, null, false, false);
return;
}
List<String> stringList = new ArrayList<String>();
for (int i = 0; i < completions.length; i++) {
CompletionInfo ci = completions[i];
if (ci != null) stringList.add(ci.getText().toString());
}
setSuggestions(stringList, null, true, true);
}
}
示例8: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions((List<Suggestion>) null, false, false);
return;
}
List<Suggestion> suggestions = new ArrayList<Suggestion>();
for (int i=0; i<(completions != null ? completions.length : 0); i++) {
CompletionInfo ci = completions[i];
if (ci != null) suggestions.add(new Suggestion(0, ci.getText().toString()));
}
this.suggestions = null;
setSuggestions(suggestions, true, true);
}
}
示例9: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions(null, false, false);
return;
}
List<String> stringList = new ArrayList<String>();
for (int i = 0; i < completions.length; i++) {
CompletionInfo ci = completions[i];
if (ci != null) stringList.add(ci.getText().toString());
}
setSuggestions(stringList, true, true);
}
}
示例10: pickSuggestionManually
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public void pickSuggestionManually(int index, String text) {
mComposing.setLength(0);
mComposing.append(text);
if (mCompletionOn && mCompletions != null && index >= 0
&& index < mCompletions.length) {
CompletionInfo ci = mCompletions[index];
getCurrentInputConnection().commitCompletion(ci);
if (mCandidateView != null) {
mCandidateView.clear();
}
} else if (mComposing.length() > 0) {
// If we were generating candidate suggestions for the current
// text, we would commit one of them here. But for this sample,
// we will just commit the current text.
commitTyped(getCurrentInputConnection());
}
}
示例11: onDisplayCompletions
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
/**
* This tells us about completions that the editor has determined based
* on the current text in it. We want to use this in fullscreen mode
* to show the completions ourself, since the editor can not be seen
* in that situation.
*/
@Override public void onDisplayCompletions(CompletionInfo[] completions) {
if (mCompletionOn) {
mCompletions = completions;
if (completions == null) {
setSuggestions(null, false, false);
return;
}
List<String> stringList = new ArrayList<String>();
for (int i = 0; i < completions.length; i++) {
CompletionInfo ci = completions[i];
if (ci != null) stringList.add(ci.getText().toString());
}
setSuggestions(stringList, true, true);
}
}
示例12: pickSuggestionManually
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public void pickSuggestionManually(int index) {
if (mCompletionOn && mCompletions != null && index >= 0
&& index < mCompletions.length) {
CompletionInfo ci = mCompletions[index];
getCurrentInputConnection().commitCompletion(ci);
store("["+ci.getText().toString()+"]");
if (mCandidateView != null) {
mCandidateView.clear();
}
updateShiftKeyState(getCurrentInputEditorInfo());
} else if (mComposing.length() > 0) {
// If we were generating candidate suggestions for the current
// text, we would commit one of them here. But for this sample,
// we will just commit the current text.
commitTyped(getCurrentInputConnection());
}
}
示例13: commitCompletion
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public void commitCompletion(final CompletionInfo completionInfo) {
if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
CharSequence text = completionInfo.getText();
// text should never be null, but just in case, it's better to insert nothing than to crash
if (null == text) text = "";
mCommittedTextBeforeComposingText.append(text);
mCurrentCursorPosition += text.length() - mComposingText.length();
mComposingText.setLength(0);
if (null != mIC) {
mIC.commitCompletion(completionInfo);
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.richInputConnection_commitCompletion(completionInfo);
}
}
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
示例14: commitCompletion
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public void commitCompletion(final CompletionInfo completionInfo) {
if (DEBUG_BATCH_NESTING) checkBatchEdit();
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
CharSequence text = completionInfo.getText();
// text should never be null, but just in case, it's better to insert nothing than to crash
if (null == text) text = "";
mCommittedTextBeforeComposingText.append(text);
mExpectedSelStart += text.length() - mComposingText.length();
mExpectedSelEnd = mExpectedSelStart;
mComposingText.setLength(0);
if (isConnected()) {
mIC.commitCompletion(completionInfo);
}
if (DEBUG_PREVIOUS_TEXT) checkConsistencyForDebug();
}
示例15: removeNulls
import android.view.inputmethod.CompletionInfo; //导入依赖的package包/类
public static CompletionInfo[] removeNulls(final CompletionInfo[] src) {
int j = 0;
final CompletionInfo[] dst = new CompletionInfo[src.length];
for (int i = 0; i < src.length; ++i) {
if (null != src[i] && !TextUtils.isEmpty(src[i].getText())) {
dst[j] = src[i];
++j;
}
}
return Arrays.copyOfRange(dst, 0, j);
}