java类android.text.method.KeyListener的实例源码

UserProfileActivity.java 文件源码 项目:Carrier 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Tapping the edit icon next to the phone number allows the user to edit their phone
 *
 * @param v v is a View, allows usage of on click in xml
 */
public void editPhoneNumber(View v) {
    editingPhone = true;
    ImageButton cancelButton = (ImageButton) findViewById(R.id.Button_cancelPhoneEdit);
    ImageButton saveButton = (ImageButton) findViewById(R.id.EditButton_savePhoneEdit);
    ImageButton editButton = (ImageButton) findViewById(R.id.ImageButton_phoneEditIcon);
    // Set visibility of the buttons.
    editButton.setVisibility(View.INVISIBLE);
    saveButton.setVisibility(View.VISIBLE);
    cancelButton.setVisibility(View.VISIBLE);
    TextView phoneNumber = (TextView) findViewById(R.id.EditText_phone);
    phoneNumber.setClickable(true);
    // Set it so the user can edit the EditText
    phoneNumber.setFocusableInTouchMode(true);
    phoneNumber.setFocusable(true);
    phoneNumber.setKeyListener((KeyListener) phoneNumber.getTag());
    phoneNumber.requestFocus();
    phoneNumber.moveCursorToVisibleOffset();
    phoneNumber.setText("");
    phoneNumber.append(currentUser.getPhone());
}
UserProfileActivity.java 文件源码 项目:Carrier 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Tapping the edit icon next to the email allows the user to edit their email
 *
 * @param v v is a View, allows usage of on click in xml
 */
public void editEmailAddress(View v) {
    editingEmail = true;
    ImageButton cancelButton = (ImageButton) findViewById(R.id.ImageButton_cancelEmailEdit);
    ImageButton saveButton = (ImageButton) findViewById(R.id.EditButton_saveEmail);
    ImageButton editButton = (ImageButton) findViewById(R.id.ImageButton_emailEditIcon);
    // Set visibility of the buttons.
    editButton.setVisibility(View.INVISIBLE);
    saveButton.setVisibility(View.VISIBLE);
    cancelButton.setVisibility(View.VISIBLE);
    EditText emailView = (EditText) findViewById(R.id.EditText_email);
    // Set it so the user can edit the EditText
    emailView.setFocusableInTouchMode(true);
    emailView.setClickable(true);
    emailView.setKeyListener((KeyListener) emailView.getTag());
    emailView.requestFocus();
    emailView.setText("");
    emailView.append(currentUser.getEmail());
}
TextView.java 文件源码 项目:JotaTextEditor 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Sets the key listener to be used with this TextView.  This can be null
 * to disallow user input.  Note that this method has significant and
 * subtle interactions with soft keyboards and other input method:
 * see {@link KeyListener#getInputType() KeyListener.getContentType()}
 * for important details.  Calling this method will replace the current
 * content type of the text view with the content type returned by the
 * key listener.
 * <p>
 * Be warned that if you want a TextView with a key listener or movement
 * method not to be focusable, or if you want a TextView without a
 * key listener or movement method to be focusable, you must call
 * {@link #setFocusable} again after calling this to get the focusability
 * back the way you want it.
 *
 * @attr ref android.R.styleable#TextView_numeric
 * @attr ref android.R.styleable#TextView_digits
 * @attr ref android.R.styleable#TextView_phoneNumber
 * @attr ref android.R.styleable#TextView_inputMethod
 * @attr ref android.R.styleable#TextView_capitalize
 * @attr ref android.R.styleable#TextView_autoText
 */
public void setKeyListener(KeyListener input) {
    setKeyListenerOnly(input);
    fixFocusableAndClickableSettings();

    if (input != null) {
        try {
            mInputType = mInput.getInputType();
        } catch (IncompatibleClassChangeError e) {
            mInputType = EditorInfo.TYPE_CLASS_TEXT;
        }
        if ((mInputType&EditorInfo.TYPE_MASK_CLASS)
                == EditorInfo.TYPE_CLASS_TEXT) {
            if (mSingleLine) {
                mInputType &= ~EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
            } else {
                mInputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
            }
        }
    } else {
        mInputType = EditorInfo.TYPE_NULL;
    }

    InputMethodManager imm = InputMethodManager.peekInstance();
    if (imm != null) imm.restartInput(this);
}
TextEntryElement.java 文件源码 项目:vit-04 阅读 25 收藏 0 点赞 0 评论 0
/** gets the key listener by type */
private static KeyListener getKeyListenerForType(NumericType type) {
    switch (type) {
    case DIALPAD:
        return new DialerKeyListener();
    case INTEGER:
        return new DigitsKeyListener();
    case SIGNED:
        return new DigitsKeyListener(true, false);
    case DECIMAL:
        return new DigitsKeyListener(true, true);
    case NONE:
    default:
        return null;
    }
}
TextEntryElement.java 文件源码 项目:vit-04 阅读 19 收藏 0 点赞 0 评论 0
/** {@inheritDoc} */
@Override
protected View createView(Context c) {
    et = new EditText(c);
    et.setText(answer);
    et.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT));
    if (!NumericType.NONE.equals(numericType)) {
        KeyListener listener = getKeyListenerForType(numericType);
        if (listener != null)
            et.setKeyListener(listener);
    } else {
        et.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | 
                TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    }
    return encapsulateQuestion(c, et);
}
TextEntryElement.java 文件源码 项目:sana.mobile 阅读 24 收藏 0 点赞 0 评论 0
/** gets the key listener by type */
protected static KeyListener getKeyListenerForType(NumericType type) {
    switch (type) {
    case DIALPAD:
        return new DialerKeyListener();
    case INTEGER:
        return new DigitsKeyListener();
    case SIGNED:
        return new DigitsKeyListener(true, false);
    case DECIMAL:
        return new DigitsKeyListener(true, true);
    case NONE:
    default:
        return null;
    }
}
TextEntryElement.java 文件源码 项目:sana.mobile 阅读 29 收藏 0 点赞 0 评论 0
/** {@inheritDoc} */
@Override
protected View createView(Context c) {
    et = new EditText(c);
    et.setBackgroundResource(R.drawable.oval);
    et.setTextColor(c.getResources()
            .getColorStateList(R.color.primary_text_holo_light));
    et.setText(answer);
    et.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
            LayoutParams.WRAP_CONTENT));
    if (!NumericType.NONE.equals(numericType)) {
        KeyListener listener = getKeyListenerForType(numericType);
        if (listener != null)
            et.setKeyListener(listener);
    } else {
        et.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | 
                TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    }
    return encapsulateQuestion(c, et);
}
LModEditor.java 文件源码 项目:ModPE-IDE-Source 阅读 41 收藏 0 点赞 0 评论 0
@Override
public void setReadOnly(boolean value) {
    KeyListener keyListener = getKeyListener();
    if (value) {
        setKeyListener(null);
    } else {
        if (keyListener != null)
            setKeyListener(keyListener);
    }
}
TextView.java 文件源码 项目:Tada 阅读 18 收藏 0 点赞 0 评论 0
private void setKeyListenerOnly(KeyListener input) {
    if (mEditor == null && input == null) return; // null is the default value

    createEditorIfNeeded();
    if (mEditor.mKeyListener != input) {
        mEditor.mKeyListener = input;
        if (input != null && !(mText instanceof Editable)) {
            setText(mText);
        }

        setFilters((Editable) mText, mFilters);
    }
}
MyKeyboard.java 文件源码 项目:topodroid 阅读 18 收藏 0 点赞 0 评论 0
static void setEditable( EditText et, MyKeyboard kbd, KeyListener kl, boolean editable, int flag )
{
  if ( TDSetting.mKeyboard ) {
    et.setKeyListener( null );
    et.setClickable( true );
    et.setFocusable( editable );
    if ( editable ) {
      registerEditText( kbd, et, flag );
      // et.setKeyListener( mKeyboard );
      et.setBackgroundResource( android.R.drawable.edit_text );
    } else {
      registerEditText( kbd, et, flag | FLAG_NOEDIT );
      et.setBackgroundColor( TDColor.MID_GRAY );
    }
  } else {
    if ( editable ) {
      et.setKeyListener( kl );
      et.setBackgroundResource( android.R.drawable.edit_text );
      et.setClickable( true );
      et.setFocusable( true );
    } else {
      // et.setFocusable( false );
      // et.setClickable( false );
      et.setKeyListener( null );
      et.setBackgroundColor( TDColor.MID_GRAY );
    }
  }
}
CalibGMDialog.java 文件源码 项目:topodroid 阅读 16 收藏 0 点赞 0 评论 0
private void setEditable( EditText et, KeyListener kl, boolean editable, int flag )
{
  if ( TDSetting.mKeyboard ) {
    et.setKeyListener( null );
    et.setClickable( true );
    et.setFocusable( editable );
    if ( editable ) {
      MyKeyboard.registerEditText( mKeyboard, et, flag );
      // et.setKeyListener( mKeyboard );
      et.setBackgroundResource( android.R.drawable.edit_text );
    } else {
      MyKeyboard.registerEditText( mKeyboard, et, flag | MyKeyboard.FLAG_NOEDIT );
      et.setBackgroundColor( TDColor.MID_GRAY );
    }
  } else {
    if ( editable ) {
      et.setKeyListener( kl );
      et.setBackgroundResource( android.R.drawable.edit_text );
      et.setClickable( true );
      et.setFocusable( true );
    } else {
      // et.setFocusable( false );
      // et.setClickable( false );
      et.setKeyListener( null );
      et.setBackgroundColor( TDColor.MID_GRAY );
    }
  }
}
TextView.java 文件源码 项目:JotaTextEditor 阅读 24 收藏 0 点赞 0 评论 0
private void setKeyListenerOnly(KeyListener input) {
    mInput = input;
    if (mInput != null && !(mText instanceof Editable))
        setText(mText);

    setFilters((Editable) mText, mFilters);
}
EditableInputConnection.java 文件源码 项目:JotaTextEditor 阅读 20 收藏 0 点赞 0 评论 0
public boolean clearMetaKeyStates(int states) {
    final Editable content = getEditable();
    if (content == null) return false;
    KeyListener kl = mTextView.getKeyListener();
    if (kl != null) {
        try {
            kl.clearMetaKeyState(mTextView, content, states);
        } catch (AbstractMethodError e) {
            // This is an old listener that doesn't implement the
            // new method.
        }
    }
    return true;
}
GenericUiControls.java 文件源码 项目:BluetoothHidEmu 阅读 17 收藏 0 点赞 0 评论 0
/**
 * onKeyDown()
 */
@Override
public boolean processKeyDown(int keyCode, KeyEvent event) {

    if (mEchoEditText != null && (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
        KeyListener keyListener = mEchoEditText.getKeyListener();
        keyListener.onKeyDown(mEchoEditText, mEchoEditText.getEditableText(), keyCode, event);
        return true;
    }
    return false;
}
GenericUiControls.java 文件源码 项目:BluetoothHidEmu 阅读 14 收藏 0 点赞 0 评论 0
/**
 * onKeyUp()
 */
@Override
public boolean processKeyUp(int keyCode, KeyEvent event) {

    if (mEchoEditText != null && (keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
        KeyListener keyListener = mEchoEditText.getKeyListener();
        keyListener.onKeyUp(mEchoEditText, mEchoEditText.getEditableText(), keyCode, event);
        return true;
    }

    return false;
}
AdvancedDisplay.java 文件源码 项目:CalcMate 阅读 28 收藏 0 点赞 0 评论 0
public void setKeyListener(KeyListener input) {
    mKeyListener = input;
}
TextViewWrapper.java 文件源码 项目:AndroidViewHelper 阅读 21 收藏 0 点赞 0 评论 0
/**
* @see TextView#setKeyListener(KeyListener)
*/
 public W setKeyListener(KeyListener input) {
     mView.setKeyListener(input);
     return (W) this;
 }
KeyListenerWrapper.java 文件源码 项目:Ymir 阅读 16 收藏 0 点赞 0 评论 0
public KeyListenerWrapper(KeyListener internalKeyListener) {
    this(internalKeyListener, 0);
}
KeyListenerWrapper.java 文件源码 项目:Ymir 阅读 17 收藏 0 点赞 0 评论 0
public KeyListenerWrapper(KeyListener internalKeyListener, int inputTypeFlags) {
    this.internalKeyListener = internalKeyListener;
    this.inputTypeFlags = inputTypeFlags;
}
MaterialEditText.java 文件源码 项目:MaterialEditText 阅读 27 收藏 0 点赞 0 评论 0
public MaterialEditText keyListener(KeyListener input) {
    mEditText.setKeyListener(input);
    return this;
}
TextView.java 文件源码 项目:Tada 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Sets the key listener to be used with this TextView.  This can be null
 * to disallow user input.  Note that this method has significant and
 * subtle interactions with soft keyboards and other input method:
 * see {@link KeyListener#getInputType() KeyListener.getContentType()}
 * for important details.  Calling this method will replace the current
 * content type of the text view with the content type returned by the
 * key listener.
 * <p>
 * Be warned that if you want a TextView with a key listener or movement
 * method not to be focusable, or if you want a TextView without a
 * key listener or movement method to be focusable, you must call
 * {@link #setFocusable} again after calling this to get the focusability
 * back the way you want it.
 *
 * @attr ref android.R.styleable#TextView_numeric
 * @attr ref android.R.styleable#TextView_digits
 * @attr ref android.R.styleable#TextView_phoneNumber
 * @attr ref android.R.styleable#TextView_inputMethod
 * @attr ref android.R.styleable#TextView_capitalize
 * @attr ref android.R.styleable#TextView_autoText
 */
public void setKeyListener(KeyListener input) {
    setKeyListenerOnly(input);
    fixFocusableAndClickableSettings();

    if (input != null) {
        createEditorIfNeeded();
        try {
            mEditor.mInputType = mEditor.mKeyListener.getInputType();
        } catch (IncompatibleClassChangeError e) {
            mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;
        }
        // Change inputType, without affecting transformation.
        // No need to applySingleLine since mSingleLine is unchanged.
        setInputTypeSingleLine(mSingleLine);
    } else {
        if (mEditor != null) mEditor.mInputType = EditorInfo.TYPE_NULL;
    }

    InputMethodManager imm = InputMethodManager.peekInstance();
    if (imm != null) imm.restartInput(this);
}
TextView.java 文件源码 项目:Tada 阅读 26 收藏 0 点赞 0 评论 0
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);
    }
}
FixedDialog.java 文件源码 项目:topodroid 阅读 18 收藏 0 点赞 0 评论 0
@Override
protected void onCreate(Bundle savedInstanceState) 
{
  super.onCreate(savedInstanceState);
  // TDLog.Log( TDLog.LOG_FIXED, "FixedDialog onCreate" );
  initLayout( R.layout.fixed_dialog, R.string.title_fixed_edit );

  mTVlng = (EditText) findViewById( R.id.fix_lng );
  mTVlat = (EditText) findViewById( R.id.fix_lat );
  mTValt = (EditText) findViewById( R.id.fix_alt );
  mTVasl = (EditText) findViewById( R.id.fix_asl );

  mTVdecl = (EditText) findViewById( R.id.fix_decl );
  {
    int year = TopoDroidUtil.year();
    int month = TopoDroidUtil.month();
    int day = TopoDroidUtil.day();
    MagElement elem = mWMM.computeMagElement( mFxd.lat, mFxd.lng, mFxd.alt, year, month, day );
    mTVdecl.setText( String.format(Locale.US, "%.4f", elem.Decl ) );
  }

  mButtonDecl = (CheckBox) findViewById( R.id.fix_save_decl );
  mButtonView = (Button) findViewById( R.id.fix_view );

  mButtonConvert = (Button) findViewById( R.id.fix_convert );
  mTVcrs         = (TextView) findViewById( R.id.fix_crs );
  mTVcs_coords   = (TextView) findViewById( R.id.fix_cs_coords );

  mETstation = (TextView) findViewById( R.id.fix_station );
  mETcomment = (EditText) findViewById( R.id.fix_comment );
  mETstation.setText( mFxd.name );
  mETcomment.setText( mFxd.comment );

  mButtonSave = (Button) findViewById( R.id.fix_save );
  mButtonDrop    = (Button) findViewById(R.id.fix_drop );
  // mButtonOK      = (Button) findViewById(R.id.fix_ok );
  // mButtonCancel  = (Button) findViewById(R.id.fix_cancel );
  int flag = MyKeyboard.FLAG_POINT_DEGREE;
  if ( TDSetting.mUnitLocation == TDConst.DEGREE ) {
    mTVlng.setText( FixedInfo.double2degree( mFxd.lng ) );
    mTVlat.setText( FixedInfo.double2degree( mFxd.lat ) );
  } else { // TDConst.DDMMSS
    mTVlng.setText( FixedInfo.double2ddmmss( mFxd.lng ) );
    mTVlat.setText( FixedInfo.double2ddmmss( mFxd.lat ) );
  }
  mTValt.setText( String.format( Locale.US, "%.0f", mFxd.alt ) );
  mTVasl.setText( String.format( Locale.US, "%.0f", mFxd.asl ) );


  mKeyboard = new MyKeyboard( mContext, (KeyboardView)findViewById( R.id.keyboardview ),
                              R.xml.my_keyboard, -1 );
  if ( TDSetting.mKeyboard ) {
    MyKeyboard.registerEditText( mKeyboard, mTValt, MyKeyboard.FLAG_POINT );
    MyKeyboard.registerEditText( mKeyboard, mTVasl, MyKeyboard.FLAG_POINT );
    MyKeyboard.registerEditText( mKeyboard, mTVlng, flag );
    MyKeyboard.registerEditText( mKeyboard, mTVlat, flag );
    // mKeyboard.hide();
  } else {
    mKeyboard.hide();
  }

  KeyListener mKLlng = mTVlng.getKeyListener();
  KeyListener mKLlat = mTVlat.getKeyListener();
  KeyListener mKLalt = mTValt.getKeyListener();
  KeyListener mKLasl = mTVasl.getKeyListener();

  editable = ( mFxd.source == FixedInfo.SRC_MANUAL );
  MyKeyboard.setEditable( mTValt, mKeyboard, mKLalt, editable, MyKeyboard.FLAG_POINT );
  MyKeyboard.setEditable( mTVasl, mKeyboard, mKLasl, editable, MyKeyboard.FLAG_POINT );
  MyKeyboard.setEditable( mTVlng, mKeyboard, mKLlng, editable, flag );
  MyKeyboard.setEditable( mTVlat, mKeyboard, mKLlat, editable, flag );

  mButtonDrop.setOnClickListener( this );
  mButtonView.setOnClickListener( this );
  mButtonSave.setOnClickListener( this );
  mButtonConvert.setOnClickListener( this );
  // mButtonCancel.setOnClickListener( this );

  showConvertedCoords( );
}
GeckoInputConnection.java 文件源码 项目:mc_backup 阅读 19 收藏 0 点赞 0 评论 0
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;
}
TextView.java 文件源码 项目:JotaTextEditor 阅读 21 收藏 0 点赞 0 评论 0
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);
    }
}
FloatingLabelEditText.java 文件源码 项目:android-floatinglabel-widgets 阅读 39 收藏 0 点赞 0 评论 0
/**
 * Delegate method for the input widget
 */
public void setInputWidgetKeyListener(KeyListener input) {
    getInputWidget().setKeyListener(input);
}
FloatingLabelAutoCompleteTextView.java 文件源码 项目:android-floatinglabel-widgets 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Delegate method for the input widget
 */
public void setInputWidgetKeyListener(KeyListener input) {
    getInputWidget().setKeyListener(input);
}
FloatLabelAutoCompleteTextView.java 文件源码 项目:android-shared 阅读 78 收藏 0 点赞 0 评论 0
/**
 * Delegate method for the input widget
 */
public void setKeyListener(KeyListener input) {
    getInput().setKeyListener(input);
}
FloatLabelEditText.java 文件源码 项目:android-shared 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Delegate method for the input widget
 */
public void setKeyListener(KeyListener input) {
    getInput().setKeyListener(input);
}
ItemBuilder.java 文件源码 项目:FastValueHolder 阅读 21 收藏 0 点赞 0 评论 0
public ItemBuilder setKeyListener(int viewId, KeyListener input) {
    TextView view = retrieveView(viewId);
    view.setKeyListener(input);
    return this;
}


问题


面经


文章

微信
公众号

扫码关注公众号