Java Code Examples for android.text.method.KeyListener

The following are top voted examples for showing how to use android.text.method.KeyListener. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Carrier   File: UserProfileActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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());
}
 
Example 2
Project: Carrier   File: UserProfileActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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());
}
 
Example 3
Project: JotaTextEditor   File: TextView.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 4
Project: vit-04   File: TextEntryElement.java   Source Code and License 6 votes vote down vote up
/** 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;
	}
}
 
Example 5
Project: vit-04   File: TextEntryElement.java   Source Code and License 6 votes vote down vote up
/** {@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);
}
 
Example 6
Project: sana.mobile   File: TextEntryElement.java   Source Code and License 6 votes vote down vote up
/** 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;
	}
}
 
Example 7
Project: sana.mobile   File: TextEntryElement.java   Source Code and License 6 votes vote down vote up
/** {@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);
}
 
Example 8
Project: ModPE-IDE-Source   File: LModEditor.java   Source Code and License 5 votes vote down vote up
@Override
public void setReadOnly(boolean value) {
    KeyListener keyListener = getKeyListener();
    if (value) {
        setKeyListener(null);
    } else {
        if (keyListener != null)
            setKeyListener(keyListener);
    }
}
 
Example 9
Project: Tada   File: TextView.java   Source Code and License 5 votes vote down vote up
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);
    }
}
 
Example 10
Project: topodroid   File: MyKeyboard.java   Source Code and License 5 votes vote down vote up
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 );
    }
  }
}
 
Example 11
Project: topodroid   File: CalibGMDialog.java   Source Code and License 5 votes vote down vote up
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 );
    }
  }
}
 
Example 12
Project: JotaTextEditor   File: TextView.java   Source Code and License 5 votes vote down vote up
private void setKeyListenerOnly(KeyListener input) {
    mInput = input;
    if (mInput != null && !(mText instanceof Editable))
        setText(mText);

    setFilters((Editable) mText, mFilters);
}
 
Example 13
Project: JotaTextEditor   File: EditableInputConnection.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 14
Project: BluetoothHidEmu   File: GenericUiControls.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 15
Project: BluetoothHidEmu   File: GenericUiControls.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 16
Project: CalcMate   File: AdvancedDisplay.java   Source Code and License 4 votes vote down vote up
public void setKeyListener(KeyListener input) {
    mKeyListener = input;
}
 
Example 17
Project: AndroidViewHelper   File: TextViewWrapper.java   Source Code and License 4 votes vote down vote up
/**
* @see TextView#setKeyListener(KeyListener)
*/
 public W setKeyListener(KeyListener input) {
     mView.setKeyListener(input);
     return (W) this;
 }
 
Example 18
Project: Ymir   File: KeyListenerWrapper.java   Source Code and License 4 votes vote down vote up
public KeyListenerWrapper(KeyListener internalKeyListener) {
	this(internalKeyListener, 0);
}
 
Example 19
Project: Ymir   File: KeyListenerWrapper.java   Source Code and License 4 votes vote down vote up
public KeyListenerWrapper(KeyListener internalKeyListener, int inputTypeFlags) {
	this.internalKeyListener = internalKeyListener;
	this.inputTypeFlags = inputTypeFlags;
}
 
Example 20
Project: MaterialEditText   File: MaterialEditText.java   Source Code and License 4 votes vote down vote up
public MaterialEditText keyListener(KeyListener input) {
    mEditText.setKeyListener(input);
    return this;
}
 
Example 21
Project: Tada   File: TextView.java   Source Code and License 4 votes vote down vote up
/**
 * 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);
}
 
Example 22
Project: Tada   File: TextView.java   Source Code and License 4 votes vote down vote up
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);
    }
}
 
Example 23
Project: topodroid   File: FixedDialog.java   Source Code and License 4 votes vote down vote up
@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( );
}
 
Example 24
Project: mc_backup   File: GeckoInputConnection.java   Source Code and License 4 votes vote down vote up
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;
}
 
Example 25
Project: JotaTextEditor   File: TextView.java   Source Code and License 4 votes vote down vote up
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);
    }
}
 
Example 26
Project: android-floatinglabel-widgets   File: FloatingLabelEditText.java   Source Code and License 4 votes vote down vote up
/**
 * Delegate method for the input widget
 */
public void setInputWidgetKeyListener(KeyListener input) {
    getInputWidget().setKeyListener(input);
}
 
Example 27
Project: android-floatinglabel-widgets   File: FloatingLabelAutoCompleteTextView.java   Source Code and License 4 votes vote down vote up
/**
 * Delegate method for the input widget
 */
public void setInputWidgetKeyListener(KeyListener input) {
    getInputWidget().setKeyListener(input);
}
 
Example 28
Project: android-shared   File: FloatLabelAutoCompleteTextView.java   Source Code and License 4 votes vote down vote up
/**
 * Delegate method for the input widget
 */
public void setKeyListener(KeyListener input) {
    getInput().setKeyListener(input);
}
 
Example 29
Project: android-shared   File: FloatLabelEditText.java   Source Code and License 4 votes vote down vote up
/**
 * Delegate method for the input widget
 */
public void setKeyListener(KeyListener input) {
    getInput().setKeyListener(input);
}
 
Example 30
Project: FastValueHolder   File: ItemBuilder.java   Source Code and License 4 votes vote down vote up
public ItemBuilder setKeyListener(int viewId, KeyListener input) {
    TextView view = retrieveView(viewId);
    view.setKeyListener(input);
    return this;
}
 
Example 31
Project: FastValueHolder   File: ItemBuilder.java   Source Code and License 4 votes vote down vote up
public ItemBuilder setKeyListener(int viewId, KeyListener input) {
    TextView view = retrieveView(viewId);
    view.setKeyListener(input);
    return this;
}
 
Example 32
Project: com.numix.calculator   File: AdvancedDisplay.java   Source Code and License 4 votes vote down vote up
public void setKeyListener(KeyListener input) {
    mKeyListener = input;
}
 
Example 33
Project: MDPreference   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * @return the current key listener for this TextView.
    * This will frequently be null for non-EditText TextViews.
    *
    * @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 final KeyListener getKeyListener (){
	return mInputView.getKeyListener();
}
 
Example 34
Project: MDPreference   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * 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){
	mInputView.setKeyListener(input);
}
 
Example 35
Project: instalist-android   File: ViewUtils.java   Source Code and License 2 votes vote down vote up
/**
 * Retrieve a KeyListener that accepts decimal numbers and dots as separator. Additionally the
 * decimal separator of the current language is accepted.
 *
 * @return An instance of a DigitKeyListener with additional separator.
 */
public static KeyListener getNumberListener() {
    return DigitsKeyListener.getInstance(NUMBERS_AND_SEPARATOR);
}
 
Example 36
Project: material-master   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * @return the current key listener for this TextView.
    * This will frequently be null for non-EditText TextViews.
    *
    * @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 final KeyListener getKeyListener (){
	return mInputView.getKeyListener();
}
 
Example 37
Project: material-master   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * 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 android.text.method.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){
	mInputView.setKeyListener(input);
}
 
Example 38
Project: Tada   File: TextView.java   Source Code and License 2 votes vote down vote up
/**
 * @return the current key listener for this TextView.
 * This will frequently be null for non-EditText TextViews.
 *
 * @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 final KeyListener getKeyListener() {
    return mEditor == null ? null : mEditor.mKeyListener;
}
 
Example 39
Project: material_fork   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * @return the current key listener for this TextView.
    * This will frequently be null for non-EditText TextViews.
    *
    * @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 final KeyListener getKeyListener (){
	return mInputView.getKeyListener();
}
 
Example 40
Project: material_fork   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * 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 android.text.method.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){
	mInputView.setKeyListener(input);
}
 
Example 41
Project: JotaTextEditor   File: TextView.java   Source Code and License 2 votes vote down vote up
/**
 * @return the current key listener for this TextView.
 * This will frequently be null for non-EditText TextViews.
 */
public final KeyListener getKeyListener() {
    return mInput;
}
 
Example 42
Project: AndroidMaterialValidation   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
 * @return the current key listener for this TextView. This will frequently be null for
 * non-EditText TextViews.
 */
public final KeyListener getKeyListener() {
    return getView().getKeyListener();
}
 
Example 43
Project: AndroidMaterialValidation   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
 * 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.
 */
public final void setKeyListener(final KeyListener input) {
    getView().setKeyListener(input);
}
 
Example 44
Project: Material-Components   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * @return the current key listener for this TextView.
    * This will frequently be null for non-EditText TextViews.
    *
    * @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 final KeyListener getKeyListener (){
	return mInputView.getKeyListener();
}
 
Example 45
Project: Material-Components   File: EditText.java   Source Code and License 2 votes vote down vote up
/**
    * 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 android.text.method.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){
	mInputView.setKeyListener(input);
}