本文整理汇总了Java中android.view.inputmethod.CompletionInfo.getText方法的典型用法代码示例。如果您正苦于以下问题:Java CompletionInfo.getText方法的具体用法?Java CompletionInfo.getText怎么用?Java CompletionInfo.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.inputmethod.CompletionInfo
的用法示例。
在下文中一共展示了CompletionInfo.getText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: getFromApplicationSpecifiedCompletions
import android.view.inputmethod.CompletionInfo; //导入方法依赖的package包/类
public static ArrayList<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
final CompletionInfo[] infos) {
final ArrayList<SuggestedWordInfo> result = new ArrayList<>();
for (final CompletionInfo info : infos) {
if (null == info || null == info.getText()) {
continue;
}
result.add(new SuggestedWordInfo(info));
}
return result;
}
示例4: getFromApplicationSpecifiedCompletions
import android.view.inputmethod.CompletionInfo; //导入方法依赖的package包/类
public static ArrayList<SuggestedWordInfo> getFromApplicationSpecifiedCompletions(
final CompletionInfo[] infos) {
final ArrayList<SuggestedWordInfo> result = CollectionUtils.newArrayList();
for (final CompletionInfo info : infos) {
if (info == null) continue;
final CharSequence text = info.getText();
if (null == text) continue;
final SuggestedWordInfo suggestedWordInfo = new SuggestedWordInfo(text.toString(),
SuggestedWordInfo.MAX_SCORE, SuggestedWordInfo.KIND_APP_DEFINED,
Dictionary.TYPE_APPLICATION_DEFINED);
result.add(suggestedWordInfo);
}
return result;
}