当前位置: 首页>>代码示例>>Java>>正文


Java CompletionInfo类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:27,代码来源:KP2AKeyboard.java

示例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);
    }
}
 
开发者ID:VladThodo,项目名称:behe-keyboard,代码行数:23,代码来源:PCKeyboard.java

示例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());

    }
}
 
开发者ID:VladThodo,项目名称:behe-keyboard,代码行数:19,代码来源:PCKeyboard.java

示例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());
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:17,代码来源:TerminalKeyboard.java

示例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);
    }
}
 
开发者ID:cdjalel,项目名称:QuranKeyboard,代码行数:22,代码来源:QuranKeyboardIME.java

示例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);
    }
}
 
开发者ID:iamironrabbit,项目名称:tibetan-keyboard,代码行数:23,代码来源:SoftKeyboard.java

示例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);
    }
}
 
开发者ID:accentype,项目名称:accentype-android,代码行数:23,代码来源:SoftKeyboard.java

示例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);
    }
}
 
开发者ID:divec,项目名称:literatim,代码行数:24,代码来源:SoftKeyboard.java

示例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);
    }
}
 
开发者ID:open-sinovoice,项目名称:sinovoice-pathfinder,代码行数:24,代码来源:Pathfinder.java

示例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());
    }
}
 
开发者ID:open-sinovoice,项目名称:sinovoice-pathfinder,代码行数:19,代码来源:Pathfinder.java

示例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);
    }
}
 
开发者ID:dioh,项目名称:animal,代码行数:23,代码来源:AnimalKeyboard.java

示例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());
    }
}
 
开发者ID:dioh,项目名称:animal,代码行数:18,代码来源:AnimalKeyboard.java

示例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();
}
 
开发者ID:slightfoot,项目名称:android-kioskime,代码行数:18,代码来源:RichInputConnection.java

示例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();
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:16,代码来源:RichInputConnection.java

示例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);
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:12,代码来源:CompletionInfoUtils.java


注:本文中的android.view.inputmethod.CompletionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。