Java 类android.text.method.TextKeyListener 实例源码

项目:LaunchEnr    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:LaunchEnr    文件:AllAppsContainerView.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:FlickLauncher    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:FlickLauncher    文件:AllAppsContainerView.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:SimpleUILauncher    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:SimpleUILauncher    文件:AllAppsContainerView.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:SimplOS    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:SimplOS    文件:AllAppsContainerView.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:Trebuchet    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:Trebuchet    文件:AllAppsContainerView.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (mSearchBarController != null &&
            !mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:EngineDriver    文件:function_settings.java   
void move_settings_to_view() {
    ViewGroup t = (ViewGroup) findViewById(R.id.label_func_table); //table
    //loop thru input rows, skipping first (headings)
    int ndx = 0;
    for (int i = 1; i < t.getChildCount(); i++) {
        ViewGroup r = (ViewGroup) t.getChildAt(i);
        //move to next non-blank array entry if it exists
        while (ndx < aFnc.size() && aLbl.get(ndx).length() == 0)
            ndx++;
        if (ndx < aFnc.size()) {
            ((EditText) r.getChildAt(0)).setText(aLbl.get(ndx));
            ((EditText) r.getChildAt(1)).setText(aFnc.get(ndx).toString());
            ndx++;
        } else {
            //          
            // work around for known EditText bug - see http://code.google.com/p/android/issues/detail?id=17508
            //          ((EditText)r.getChildAt(0)).setText("");
            //          ((EditText)r.getChildAt(1)).setText("");
            TextKeyListener.clear(((EditText) r.getChildAt(0)).getText());
            TextKeyListener.clear(((EditText) r.getChildAt(1)).getText());
        }
    }
}
项目:TurboLauncher    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0
            && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {

            return onSearchRequested();
        }
    }

    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:FLauncher    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:FLauncher    文件:AllAppsContainerView.java   
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    // Determine if the key event was actual text, if so, focus the search bar and then dispatch
    // the key normally so that it can process this key event
    if (!mSearchBarController.isSearchFieldFocused() &&
            event.getAction() == KeyEvent.ACTION_DOWN) {
        final int unicodeChar = event.getUnicodeChar();
        final boolean isKeyNotWhitespace = unicodeChar > 0 &&
                !Character.isWhitespace(unicodeChar) && !Character.isSpaceChar(unicodeChar);
        if (isKeyNotWhitespace) {
            boolean gotKey = TextKeyListener.getInstance().onKeyDown(this, mSearchQueryBuilder,
                    event.getKeyCode(), event);
            if (gotKey && mSearchQueryBuilder.length() > 0) {
                mSearchBarController.focusSearchField();
            }
        }
    }

    return super.dispatchKeyEvent(event);
}
项目:LB-Launcher    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:androidProject    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:open-gel-plus    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0 && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(mWorkspace, mDefaultKeySsb,
                keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:BluetoothHidEmu    文件:KeyboardKeyListener.java   
@Override
public boolean onKeyDown(View view, Editable content, int keyCode, KeyEvent event) {
    switch (keyCode) {

    case KeyEvent.KEYCODE_ENTER:
        TextKeyListener.clear(content);
        mHidPayload.assemblePayload(HidKeyPair.ENTER);
        mSocketManager.sendPayload(mHidPayload);
        return true;
    case KeyEvent.KEYCODE_DEL:
        mHidPayload.assemblePayload(HidKeyPair.DEL);
        mSocketManager.sendPayload(mHidPayload);
    case KeyEvent.KEYCODE_VOLUME_UP:
    case KeyEvent.KEYCODE_VOLUME_DOWN:
        mHidPayload.assemblePayload(keyCode);
        mSocketManager.sendPayload(mHidPayload);
    default:
        return mTextKeyListener.onKeyDown(view, content, keyCode, event);
    }
}
项目:LaunchEnr    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    mWorkspace.removeCallbacks(mBuildLayersRunnable);
    mWorkspace.removeFolderListeners();

    // Stop callbacks from LauncherModel
    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        LauncherAppState.getInstance(this).setLauncher(null);
    }

    if (mRotationPrefChangeHandler != null) {
        mSharedPrefs.unregisterOnSharedPreferenceChangeListener(mRotationPrefChangeHandler);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        ex.printStackTrace();
    }
    mAppWidgetHost = null;

    TextKeyListener.getInstance().release();

    ((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
            .removeAccessibilityStateChangeListener(this);

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}
项目:JotaTextEditor    文件:JotaTextKeyListener.java   
public static TextKeyListener getInstance(boolean autotext, Capitalize cap) {
    int off = cap.ordinal() * 2 + (autotext ? 1 : 0);

    if (sInstance[off] == null) {
        sInstance[off] = new JotaTextKeyListener(cap, autotext);
    }

    return sInstance[off];
}
项目:AbroadEasy    文件:CustomSearchBar.java   
public void cancelSearch() {
    hideInputPannel();
    post(new Runnable() {
        @Override
        public void run() {
            if (mListener != null) {
                mListener.cancelSearch();
            }
        }
    });
    TextKeyListener.clear(mSearchEdit.getText());
    mIsSearchMode = false;
}
项目:androidProject    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);

    // Stop callbacks from LauncherModel
    LauncherApplication app = ((LauncherApplication) getApplication());
    mModel.stopLoader();
    app.setLauncher(null);

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();


    unbindWorkspaceAndHotseatItems();

    getContentResolver().unregisterContentObserver(mWidgetObserver);
    unregisterReceiver(mCloseSystemDialogsReceiver);

    ((ViewGroup) mWorkspace.getParent()).removeAllViews();
    mWorkspace.removeAllViews();
    mWorkspace = null;
    mDragController = null;

    ValueAnimator.clearAllAnimations();
}
项目:fruit.launcher    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {             
    if (isWorkspaceLocked())
        return true;

    boolean handled = super.onKeyDown(keyCode, event);
    if (!handled && acceptFilter() && keyCode != KeyEvent.KEYCODE_ENTER) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog
            // takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    if (keyCode == KeyEvent.KEYCODE_BACK && mThumbnailWorkspace.isVisible()) {
        int currPageIndex = ((CellLayout) mWorkspace.getChildAt(mWorkspace.getCurrentScreen())).getPageIndex();
           mThumbnailWorkspace.setmCurSelectedScreenIndex(currPageIndex);
        closeThumbnailWorkspace(true);
        return true;
    }
    return handled;
}
项目:fruit.launcher    文件:Launcher.java   
@Override
    public void onDestroy() {
        super.onDestroy();

        Log.d(TAG,"launcherseq,onDestroy");

        try {
            mAppWidgetHost.stopListening();
        } catch (NullPointerException ex) {
            Log.w(TAG,
                    "problem while stopping AppWidgetHost during Launcher destruction",
                    ex);
        }

        TextKeyListener.getInstance().release();

        mThemeMgr.stopListener();
        mModel.stopLoader();

        mPhoneMonitor.removeAllCallback();
        mMssMonitor.removeAllCallback();

        unbindDesktopItems();

        getSharedPreferences(SettingUtils.LAUNCHER_SETTINGS_NAME, 0)
                .unregisterOnSharedPreferenceChangeListener(mSPChangeListener);

        getContentResolver().unregisterContentObserver(mWidgetObserver);

        unregisterReceiver(mCloseSystemDialogsReceiver);
        unregisterReceiver(mScreenConfigReceiver);
//      unregisterReceiver(mSCReceiver);
    }
项目:sagesmobile-mCollect    文件:StringWidget.java   
protected StringWidget(Context context, FormEntryPrompt prompt, boolean derived) {
    super(context, prompt);
    mAnswer = new EditText(context);
    mAnswer.setId(QuestionWidget.newUniqueId());
    mReadOnly = prompt.isReadOnly();

    mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);

    TableLayout.LayoutParams params = new TableLayout.LayoutParams();
    params.setMargins(7, 5, 7, 5);
    mAnswer.setLayoutParams(params);

    // capitalize the first letter of the sentence
    mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false));

    // needed to make long read only text scroll
    mAnswer.setHorizontallyScrolling(false);
    mAnswer.setSingleLine(false);

    String s = prompt.getAnswerText();
    if (s != null) {
        mAnswer.setText(s);
    }

    if (mReadOnly) {
        mAnswer.setBackgroundDrawable(null);
        mAnswer.setFocusable(false);
        mAnswer.setClickable(false);
    }

    addView(mAnswer);
}
项目:Fairphone    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0
            && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog
            // takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:Fairphone---DEPRECATED    文件:Launcher.java   
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    final int uniChar = event.getUnicodeChar();
    final boolean handled = super.onKeyDown(keyCode, event);
    final boolean isKeyNotWhitespace = uniChar > 0
            && !Character.isWhitespace(uniChar);
    if (!handled && acceptFilter() && isKeyNotWhitespace) {
        boolean gotKey = TextKeyListener.getInstance().onKeyDown(
                mWorkspace, mDefaultKeySsb, keyCode, event);
        if (gotKey && mDefaultKeySsb != null && mDefaultKeySsb.length() > 0) {
            // something usable has been typed - start a search
            // the typed text will be retrieved and cleared by
            // showSearchDialog()
            // If there are multiple keystrokes before the search dialog
            // takes focus,
            // onSearchRequested() will be called for every keystroke,
            // but it is idempotent, so it's fine.
            return onSearchRequested();
        }
    }

    // Eat the long press event so the keyboard doesn't come up.
    if (keyCode == KeyEvent.KEYCODE_MENU && event.isLongPress()) {
        return true;
    }

    return handled;
}
项目:Onosendai    文件:PostActivity.java   
public void setupAutoComplete () {
    if (this.txtBody.getAdapter() != null) return;
    this.txtBody.setThreshold(1);
    this.txtBody.setTokenizer(new UsernameTokenizer());
    this.txtBody.setAdapter(new UsernameSearchAdapter(this));
    this.txtBody.addTextChangedListener(new PopupPositioniner(this.txtBody));
    this.txtBody.setKeyListener(TextKeyListener.getInstance(true, TextKeyListener.Capitalize.SENTENCES));
}
项目:MyFlightbookAndroid    文件:PropertyEdit.java   
private void UpdateForProperty() {
    UpdateLabelTypefaceForProperty();
    CustomPropertyType.CFPPropertyType cptType = m_fp.getType();
    Boolean fIsBasicDecimal = cptType == CustomPropertyType.CFPPropertyType.cfpDecimal && (m_fp.CustomPropertyType().cptFlag & 0x00200000) != 0;

    m_tvLabel.setVisibility(VISIBLE);
    m_txtStringVal.setVisibility(GONE);
    m_txtNumericField.setVisibility(GONE);
    m_ck.setVisibility(GONE);
    m_tvDate.setVisibility(GONE);

    switch (cptType) {
        default:
            break;
        case cfpInteger:
            m_txtNumericField.setVisibility(VISIBLE);
            m_txtNumericField.setMode(DecimalEdit.EditMode.INTEGER);
            m_txtNumericField.setIntValue(m_fp.intValue);
            break;
        case cfpDecimal:
            m_txtNumericField.setVisibility(VISIBLE);
            m_txtNumericField.setMode(DecimalEdit.DefaultHHMM && !fIsBasicDecimal ? DecimalEdit.EditMode.HHMM : DecimalEdit.EditMode.DECIMAL);
            m_txtNumericField.setDoubleValue(m_fp.decValue);
            if (m_cfd != null)
                m_txtNumericField.setDelegate(m_cfd);
            break;
        case cfpCurrency:
            m_txtNumericField.setVisibility(VISIBLE);
            m_txtNumericField.setMode(DecimalEdit.EditMode.DECIMAL);
            m_txtNumericField.setDoubleValue(m_fp.decValue);
            break;
        case cfpString: {
            m_txtStringVal.setVisibility(VISIBLE);
            m_txtStringVal.setHint("");
            m_txtStringVal.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
                    | InputType.TYPE_CLASS_TEXT);
            m_txtStringVal.setKeyListener(TextKeyListener.getInstance());
            m_txtStringVal.setText(m_fp.toString());
            String[] rgPrevVals = m_fp.CustomPropertyType().PreviousValues;
            if (rgPrevVals != null && rgPrevVals.length > 0) {
                ArrayAdapter<String> adapter = new ArrayAdapter<>(
                        this.getContext(), android.R.layout.simple_list_item_1,
                        rgPrevVals);
                m_txtStringVal.setAdapter(adapter);
            }
            m_txtStringVal.setThreshold(1);
        }
            break;
        case cfpBoolean:
            m_ck.setVisibility(VISIBLE);
            m_tvLabel.setVisibility(GONE);
            break;
        case cfpDate:
            m_tvDate.setVisibility(VISIBLE);
            SetPropDate(m_fp.dateValue, false);
            break;
        case cfpDateTime:
            m_tvDate.setVisibility(VISIBLE);
            SetPropDate(m_fp.dateValue, true);
            break;
    }

    findViewById(R.id.imgFavorite).setVisibility(m_fIsPinned ? View.VISIBLE : View.INVISIBLE);
}
项目:FlickLauncher    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);
    mWorkspace.removeFolderListeners();
    if(mHomeWatcher != null) {
        mHomeWatcher.stopWatch();
    }

    // Stop callbacks from LauncherModel
    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        LauncherAppState.getInstance().setLauncher(null);
    }

    if (mRotationPrefChangeHandler != null) {
        mSharedPrefs.unregisterOnSharedPreferenceChangeListener(mRotationPrefChangeHandler);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    ((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
            .removeAccessibilityStateChangeListener(this);

    unregisterReceiver(mUiBroadcastReceiver);

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}
项目:SimpleUILauncher    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);
    mWorkspace.removeFolderListeners();

    // Stop callbacks from LauncherModel
    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        LauncherAppState.getInstance().setLauncher(null);
    }

    if (mRotationPrefChangeHandler != null) {
        mSharedPrefs.unregisterOnSharedPreferenceChangeListener(mRotationPrefChangeHandler);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    ((AccessibilityManager) getSystemService(ACCESSIBILITY_SERVICE))
            .removeAccessibilityStateChangeListener(this);

    unregisterReceiver(mUiBroadcastReceiver);

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}
项目:SimplOS    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);

    // Stop callbacks from LauncherModel
    LauncherAppState app = (LauncherAppState.getInstance());

    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        app.setLauncher(null);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    unregisterReceiver(mCloseSystemDialogsReceiver);

    mDragLayer.clearAllResizeFrames();
    ((ViewGroup) mWorkspace.getParent()).removeAllViews();
    mWorkspace.removeAllWorkspaceScreens();
    mWorkspace = null;
    mDragController = null;

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}
项目:Trebuchet    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);

    // Stop callbacks from LauncherModel
    LauncherAppState app = (LauncherAppState.getInstance());

    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        app.setLauncher(null);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    unregisterReceiver(mCloseSystemDialogsReceiver);
    unregisterReceiver(mConnectionReceiver);
    unregisterReceiver(mDeviceUnlockedReceiver);

    mDragLayer.clearAllResizeFrames();
    ((ViewGroup) mWorkspace.getParent()).removeAllViews();
    mWorkspace.removeAllWorkspaceScreens();
    mWorkspace = null;
    mDragController = null;

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }

    unregisterReceiver(protectedAppsChangedReceiver);
    unregisterReceiver(searchBarVisibilityChangedReceiver);
}
项目:Tada    文件:TextView.java   
private void setInputType(int type, boolean direct) {
    final int cls = type & EditorInfo.TYPE_MASK_CLASS;
    KeyListener input;
    if (cls == EditorInfo.TYPE_CLASS_TEXT) {
        boolean autotext = (type & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) != 0;
        TextKeyListener.Capitalize cap;
        if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) {
            cap = TextKeyListener.Capitalize.CHARACTERS;
        } else if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS) != 0) {
            cap = TextKeyListener.Capitalize.WORDS;
        } else if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES) != 0) {
            cap = TextKeyListener.Capitalize.SENTENCES;
        } else {
            cap = TextKeyListener.Capitalize.NONE;
        }
        input = TextKeyListener.getInstance(autotext, cap);
    } else if (cls == EditorInfo.TYPE_CLASS_NUMBER) {
        input = DigitsKeyListener.getInstance(
                (type & EditorInfo.TYPE_NUMBER_FLAG_SIGNED) != 0,
                (type & EditorInfo.TYPE_NUMBER_FLAG_DECIMAL) != 0);
    } else if (cls == EditorInfo.TYPE_CLASS_DATETIME) {
        switch (type & EditorInfo.TYPE_MASK_VARIATION) {
            case EditorInfo.TYPE_DATETIME_VARIATION_DATE:
                input = DateKeyListener.getInstance();
                break;
            case EditorInfo.TYPE_DATETIME_VARIATION_TIME:
                input = TimeKeyListener.getInstance();
                break;
            default:
                input = DateTimeKeyListener.getInstance();
                break;
        }
    } else if (cls == EditorInfo.TYPE_CLASS_PHONE) {
        input = DialerKeyListener.getInstance();
    } else {
        input = TextKeyListener.getInstance();
    }
    setRawInputType(type);
    if (direct) {
        createEditorIfNeeded();
        mEditor.mKeyListener = input;
    } else {
        setKeyListenerOnly(input);
    }
}
项目:ODK-Liberia    文件:StringWidget.java   
protected StringWidget(Context context, FormEntryPrompt prompt, boolean readOnlyOverride, boolean derived) {
    super(context, prompt);
    mAnswer = new EditText(context);
    mAnswer.setId(QuestionWidget.newUniqueId());
    mReadOnly = prompt.isReadOnly() || readOnlyOverride;

    mAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);

    TableLayout.LayoutParams params = new TableLayout.LayoutParams();

    /**
     * If a 'rows' attribute is on the input tag, set the minimum number of lines
     * to display in the field to that value.
     *
     * I.e.,
     * <input ref="foo" rows="5">
     *   ...
     * </input>
     *
     * will set the height of the EditText box to 5 rows high.
     */
    String height = prompt.getQuestion().getAdditionalAttribute(null, ROWS);
    if ( height != null && height.length() != 0 ) {
        try {
        int rows = Integer.valueOf(height);
        mAnswer.setMinLines(rows);
        mAnswer.setGravity(Gravity.TOP); // to write test starting at the top of the edit area
        } catch (Exception e) {
            Log.e(this.getClass().getName(), "Unable to process the rows setting for the answer field: " + e.toString());
        }
    }

    params.setMargins(7, 5, 7, 5);
    mAnswer.setLayoutParams(params);

    // capitalize the first letter of the sentence
    mAnswer.setKeyListener(new TextKeyListener(Capitalize.SENTENCES, false));

    // needed to make long read only text scroll
    mAnswer.setHorizontallyScrolling(false);
    mAnswer.setSingleLine(false);

    String s = prompt.getAnswerText();
    if (s != null) {
        mAnswer.setText(s);
    }

    if (mReadOnly) {
        mAnswer.setBackgroundDrawable(null);
        mAnswer.setFocusable(false);
        mAnswer.setClickable(false);
    }

    addView(mAnswer);
}
项目:TurboLauncher    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);

    // Stop callbacks from LauncherModel
    LauncherAppState app = (LauncherAppState.getInstance());
    mModel.stopLoader();
    app.setLauncher(null);

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG,
                "problem while stopping AppWidgetHost during Launcher destruction",
                ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    // Disconnect any of the callbacks and drawables associated with
    // ItemInfos on the workspace
    // to prevent leaking Launcher activities on orientation change.
    if (mModel != null) {
        mModel.unbindItemInfosAndClearQueuedBindRunnables();
    }

    getContentResolver().unregisterContentObserver(mWidgetObserver);
    unregisterReceiver(mCloseSystemDialogsReceiver);

    mDragLayer.clearAllResizeFrames();
    ((ViewGroup) mWorkspace.getParent()).removeAllViews();
    mWorkspace.removeAllWorkspaceScreens();
    mWorkspace = null;
    mDragController = null;

    LauncherAnimUtils.onDestroyActivity();

    unregisterReceiver(protectedAppsChangedReceiver);
}
项目:FLauncher    文件:Launcher.java   
@Override
public void onDestroy() {
    super.onDestroy();

    // Remove all pending runnables
    mHandler.removeMessages(ADVANCE_MSG);
    mHandler.removeMessages(0);
    mWorkspace.removeCallbacks(mBuildLayersRunnable);

    // Stop callbacks from LauncherModel
    LauncherAppState app = (LauncherAppState.getInstance());

    // It's possible to receive onDestroy after a new Launcher activity has
    // been created. In this case, don't interfere with the new Launcher.
    if (mModel.isCurrentCallbacks(this)) {
        mModel.stopLoader();
        app.setLauncher(null);
    }

    try {
        mAppWidgetHost.stopListening();
    } catch (NullPointerException ex) {
        Log.w(TAG, "problem while stopping AppWidgetHost during Launcher destruction", ex);
    }
    mAppWidgetHost = null;

    mWidgetsToAdvance.clear();

    TextKeyListener.getInstance().release();

    unregisterReceiver(mCloseSystemDialogsReceiver);

    mDragLayer.clearAllResizeFrames();
    ((ViewGroup) mWorkspace.getParent()).removeAllViews();
    mWorkspace.removeAllWorkspaceScreens();
    mWorkspace = null;
    mDragController = null;

    LauncherAnimUtils.onDestroyActivity();

    if (mLauncherCallbacks != null) {
        mLauncherCallbacks.onDestroy();
    }
}
项目:mc_backup    文件:GeckoInputConnection.java   
private boolean processKey(int keyCode, KeyEvent event, boolean down) {
    if (GamepadUtils.isSonyXperiaGamepadKeyEvent(event)) {
        event = GamepadUtils.translateSonyXperiaGamepadKeys(keyCode, event);
        keyCode = event.getKeyCode();
    }

    if (keyCode > KeyEvent.getMaxKeyCode() ||
        !shouldProcessKey(keyCode, event)) {
        return false;
    }
    final int action = down ? KeyEvent.ACTION_DOWN : KeyEvent.ACTION_UP;
    event = translateKey(keyCode, event);
    keyCode = event.getKeyCode();

    View view = getView();
    if (view == null) {
        InputThreadUtils.sInstance.sendEventFromUiThread(ThreadUtils.getUiHandler(),
            mEditableClient, GeckoEvent.createKeyEvent(event, action, 0));
        return true;
    }

    // KeyListener returns true if it handled the event for us. KeyListener is only
    // safe to use on the UI thread; therefore we need to pass a proxy Editable to it
    KeyListener keyListener = TextKeyListener.getInstance();
    Handler uiHandler = view.getRootView().getHandler();
    Editable uiEditable = InputThreadUtils.sInstance.
        getEditableForUiThread(uiHandler, mEditableClient);
    boolean skip = shouldSkipKeyListener(keyCode, event);
    if (down) {
        mEditableClient.setSuppressKeyUp(true);
    }
    if (skip ||
        (down && !keyListener.onKeyDown(view, uiEditable, keyCode, event)) ||
        (!down && !keyListener.onKeyUp(view, uiEditable, keyCode, event))) {
        InputThreadUtils.sInstance.sendEventFromUiThread(uiHandler, mEditableClient,
            GeckoEvent.createKeyEvent(event, action, TextKeyListener.getMetaState(uiEditable)));
        if (skip && down) {
            // Usually, the down key listener call above adjusts meta states for us.
            // However, if we skip that call above, we have to manually adjust meta
            // states so the meta states remain consistent
            TextKeyListener.adjustMetaAfterKeypress(uiEditable);
        }
    }
    if (down) {
        mEditableClient.setSuppressKeyUp(false);
    }
    return true;
}
项目:JotaTextEditor    文件:TextView.java   
private void setInputType(int type, boolean direct) {
    final int cls = type & EditorInfo.TYPE_MASK_CLASS;
    KeyListener input;
    if (cls == EditorInfo.TYPE_CLASS_TEXT) {
        boolean autotext = (type & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) != 0;
        TextKeyListener.Capitalize cap;
        if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_CHARACTERS) != 0) {
            cap = TextKeyListener.Capitalize.CHARACTERS;
        } else if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS) != 0) {
            cap = TextKeyListener.Capitalize.WORDS;
        } else if ((type & EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES) != 0) {
            cap = TextKeyListener.Capitalize.SENTENCES;
        } else {
            cap = TextKeyListener.Capitalize.NONE;
        }
        input = JotaTextKeyListener.getInstance(autotext, cap);
    } else if (cls == EditorInfo.TYPE_CLASS_NUMBER) {
        input = DigitsKeyListener.getInstance(
                (type & EditorInfo.TYPE_NUMBER_FLAG_SIGNED) != 0,
                (type & EditorInfo.TYPE_NUMBER_FLAG_DECIMAL) != 0);
    } else if (cls == EditorInfo.TYPE_CLASS_DATETIME) {
        switch (type & EditorInfo.TYPE_MASK_VARIATION) {
            case EditorInfo.TYPE_DATETIME_VARIATION_DATE:
                input = DateKeyListener.getInstance();
                break;
            case EditorInfo.TYPE_DATETIME_VARIATION_TIME:
                input = TimeKeyListener.getInstance();
                break;
            default:
                input = DateTimeKeyListener.getInstance();
                break;
        }
    } else if (cls == EditorInfo.TYPE_CLASS_PHONE) {
        input = DialerKeyListener.getInstance();
    } else {
        input = JotaTextKeyListener.getInstance();
    }
    setRawInputType(type);
    if (direct) mInput = input;
    else {
        setKeyListenerOnly(input);
    }
}
项目:JotaTextEditor    文件:Layout.java   
/**
 * Fills in the specified Path with a representation of a cursor
 * at the specified offset.  This will often be a vertical line
 * but can be multiple discontinous lines in text with multiple
 * directionalities.
 */
public void getCursorPath(int point, Path dest,
                          CharSequence editingBuffer) {
    dest.reset();

    int line = getLineForOffset(point);
    int top = getLineTop(line);
    int bottom = getLineTop(line+1);

    float h1 = getPrimaryHorizontal(point) - 0.5f;
    float h2 = getSecondaryHorizontal(point) - 0.5f;

    int caps = TextKeyListener.getMetaState(editingBuffer,
                                            KeyEvent.META_SHIFT_ON) |
               JotaTextKeyListener.getMetaStateSelecting(editingBuffer);
    int fn = TextKeyListener.getMetaState(editingBuffer,
                                          KeyEvent.META_ALT_ON);
    int dist = 0;

    if (caps != 0 || fn != 0) {
        dist = (bottom - top) >> 2;

        if (fn != 0)
            top += dist;
        if (caps != 0)
            bottom -= dist;
    }

    if (h1 < 0.5f)
        h1 = 0.5f;
    if (h2 < 0.5f)
        h2 = 0.5f;

    if (h1 == h2) {
        dest.moveTo(h1, top);
        dest.lineTo(h1, bottom);
    } else {
        dest.moveTo(h1, top);
        dest.lineTo(h1, (top + bottom) >> 1);

        dest.moveTo(h2, (top + bottom) >> 1);
        dest.lineTo(h2, bottom);
    }

    if (caps == 2) {
        dest.moveTo(h2, bottom);
        dest.lineTo(h2 - dist, bottom + dist);
        dest.lineTo(h2, bottom);
        dest.lineTo(h2 + dist, bottom + dist);
    } else if (caps == 1) {
        dest.moveTo(h2, bottom);
        dest.lineTo(h2 - dist, bottom + dist);

        dest.moveTo(h2 - dist, bottom + dist - 0.5f);
        dest.lineTo(h2 + dist, bottom + dist - 0.5f);

        dest.moveTo(h2 + dist, bottom + dist);
        dest.lineTo(h2, bottom);
    }

    if (fn == 2) {
        dest.moveTo(h1, top);
        dest.lineTo(h1 - dist, top - dist);
        dest.lineTo(h1, top);
        dest.lineTo(h1 + dist, top - dist);
    } else if (fn == 1) {
        dest.moveTo(h1, top);
        dest.lineTo(h1 - dist, top - dist);

        dest.moveTo(h1 - dist, top - dist + 0.5f);
        dest.lineTo(h1 + dist, top - dist + 0.5f);

        dest.moveTo(h1 + dist, top - dist);
        dest.lineTo(h1, top);
    }
}