Android ExtractedTextRequest - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ExtractedTextRequest class.

This code example shows how to use the following methods:
        InputConnection conn, Bundle bundle) {
        if (conn == null) {
            return; 
        } 
 
        ExtractedText et = conn.getExtractedText(new ExtractedTextRequest(), 0);
        if (et == null) {
            return; 
        } 
        bundle.putBoolean(SINGLE_LINE, (et.flags & et.FLAG_SINGLE_LINE) > 0);
    } 
     
    private static void addLanguageInfoToBundle( 
            String selectedLanguage, String[] enabledLanguages, Bundle bundle) {
        bundle.putString(SELECTED_LANGUAGE, selectedLanguage);
        bundle.putStringArray(ENABLED_LANGUAGES, enabledLanguages);
    } 
 
    public Bundle getBundle() {
        return mFieldInfo;
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    private static int getCursorPosition(InputConnection connection) {
        if (null == connection) return INVALID_CURSOR_POSITION;
        ExtractedText extracted = connection.getExtractedText(
            new ExtractedTextRequest(), 0);
        if (extracted == null) {
            return INVALID_CURSOR_POSITION;
        } 
        return extracted.startOffset + extracted.selectionStart;
    } 
 
    /** 
     * @param connection connection to the current text field. 
     * @param separators characters which may separate words 
     * @return the word that surrounds the cursor, including up to one trailing 
     *   separator. For example, if the field contains "he|llo world", where | 
     *   represents the cursor, then "hello " will be returned. 
     */ 
    public static String getWordAtCursor(InputConnection connection, String separators) {
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getExtractedText
            return ""; 
        } 
    } 
 
    private void updateText() { 
        final ExtractedText t = this.getCurrentInputConnection()
                .getExtractedText(new ExtractedTextRequest(), 0);
        if (t != null) {
            mTypedText = t.text.toString();
        } else { 
            mTypedText = "";
        } 
    } 
 
    public void inputText(final char c) {
        this.getCurrentInputConnection().beginBatchEdit();
        this.getCurrentInputConnection().commitText("" + c, 1);
        mTypedText += c;
        this.getCurrentInputConnection().endBatchEdit();
        this.mSuppressNextMovement = true;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        InputConnection conn, Bundle bundle) {
        if (conn == null) {
            return; 
        } 
 
        ExtractedText et = conn.getExtractedText(new ExtractedTextRequest(), 0);
        if (et == null) {
            return; 
        } 
        bundle.putBoolean(SINGLE_LINE, (et.flags & et.FLAG_SINGLE_LINE) > 0);
    } 
     
    private static void addLanguageInfoToBundle( 
            String selectedLanguage, String[] enabledLanguages, Bundle bundle) {
        bundle.putString(SELECTED_LANGUAGE, selectedLanguage);
        bundle.putStringArray(ENABLED_LANGUAGES, enabledLanguages);
    } 
 
    public Bundle getBundle() {
        return mFieldInfo;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        InputConnection conn, Bundle bundle) {
        if (conn == null) {
            return; 
        } 
 
        ExtractedText et = conn.getExtractedText(new ExtractedTextRequest(), 0);
        if (et == null) {
            return; 
        } 
        bundle.putBoolean(SINGLE_LINE, (et.flags & et.FLAG_SINGLE_LINE) > 0);
    } 
     
    private static void addLanguageInfoToBundle( 
            String selectedLanguage, String[] enabledLanguages, Bundle bundle) {
        bundle.putString(SELECTED_LANGUAGE, selectedLanguage);
        bundle.putStringArray(ENABLED_LANGUAGES, enabledLanguages);
    } 
 
    public Bundle getBundle() {
        return mFieldInfo;
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        InputConnection conn, Bundle bundle) {
        if (conn == null) {
            return; 
        } 
 
        ExtractedText et = conn.getExtractedText(new ExtractedTextRequest(), 0);
        if (et == null) {
            return; 
        } 
        bundle.putBoolean(SINGLE_LINE, (et.flags & et.FLAG_SINGLE_LINE) > 0);
    } 
     
    private static void addLanguageInfoToBundle( 
            String selectedLanguage, String[] enabledLanguages, Bundle bundle) {
        bundle.putString(SELECTED_LANGUAGE, selectedLanguage);
        bundle.putStringArray(ENABLED_LANGUAGES, enabledLanguages);
    } 
 
    public Bundle getBundle() {
        return mFieldInfo;
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    private static int getCursorPosition(InputConnection connection) {
        if (null == connection) return INVALID_CURSOR_POSITION;
        ExtractedText extracted = connection.getExtractedText(
            new ExtractedTextRequest(), 0);
        if (extracted == null) {
            return INVALID_CURSOR_POSITION;
        } 
        return extracted.startOffset + extracted.selectionStart;
    } 
 
    /** 
     * @param connection connection to the current text field. 
     * @param separators characters which may separate words 
     * @return the word that surrounds the cursor, including up to one trailing 
     *   separator. For example, if the field contains "he|llo world", where | 
     *   represents the cursor, then "hello " will be returned. 
     */ 
    public static String getWordAtCursor(InputConnection connection, String separators) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
        InputConnection conn, Bundle bundle) {
        if (conn == null) {
            return; 
        } 
 
        ExtractedText et = conn.getExtractedText(new ExtractedTextRequest(), 0);
        if (et == null) {
            return; 
        } 
        bundle.putBoolean(SINGLE_LINE, (et.flags & et.FLAG_SINGLE_LINE) > 0);
    } 
     
    private static void addLanguageInfoToBundle( 
            String selectedLanguage, String[] enabledLanguages, Bundle bundle) {
        bundle.putString(SELECTED_LANGUAGE, selectedLanguage);
        bundle.putStringArray(ENABLED_LANGUAGES, enabledLanguages);
    } 
 
    public Bundle getBundle() {
        return mFieldInfo;
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	CompassKeyboardView		ckvHorizontal, ckvVertical;		// the layout views for horizontal and vertical screens
	CompassKeyboardView		ckv;					// the current layout view, either @ckvHorizontal or @ckvVertical
	int				currentLayout;
	boolean				forcePortrait;				// use the portrait layout even for horizontal screens
 
	ExtractedTextRequest		etreq = new ExtractedTextRequest();
	int				selectionStart = -1, selectionEnd = -1;
 
	// send an auto-revoked notification with a title and a message 
	void sendNotification(String title, String msg) {
		// Simple as a pie, isn't it... 
		Notification n = new Notification(android.R.drawable.ic_notification_clear_all, title, System.currentTimeMillis());
		n.flags = Notification.FLAG_AUTO_CANCEL;
		n.setLatestEventInfo(this, title, msg, PendingIntent.getActivity(this, 0, new Intent(), 0));
		((NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE)).notify(1, n);
		Log.e(TAG, title+"; "+msg);
	} 
 
	// Read a layout from a parser, both horizontal and vertical, if possible 
	String updateLayoutFromParser(XmlPullParser parser) throws XmlPullParserException, java.io.IOException {
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
			return true; 
		case KeyEvent.KEYCODE_BUTTON_X:
			if (event.getRepeatCount() == 0 && mInputView != null) {
				InputConnection ic = getCurrentInputConnection();
				ExtractedText et = ic.getExtractedText(
						new ExtractedTextRequest(), 0);
				if (et != null) {
					int selectionStart = et.selectionStart;
					int selectionEnd = et.selectionEnd;
 
					if (selectionStart == selectionEnd && selectionStart > 0) {
						keyDownUp(KeyEvent.KEYCODE_DEL);
						updateShiftKeyState(getCurrentInputEditorInfo());
						return true; 
					} else if (selectionStart != selectionEnd) {
						keyDownUp(KeyEvent.KEYCODE_DEL);
						updateShiftKeyState(getCurrentInputEditorInfo());
						return true; 
					} 
				} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Android ExtractedTextRequest Methods: