本文整理汇总了Java中android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD属性的典型用法代码示例。如果您正苦于以下问题:Java InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD属性的具体用法?Java InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD怎么用?Java InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.InputType
的用法示例。
在下文中一共展示了InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateInputConnection
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| 33554432 /* API 11: EditorInfo.IME_FLAG_NO_FULLSCREEN */;
return ic;
}
示例2: setupInputDialog
private static void setupInputDialog(final MaterialDialog dialog) {
final MaterialDialog.Builder builder = dialog.builder;
dialog.input = (EditText) dialog.view.findViewById(android.R.id.input);
if (dialog.input == null) return;
dialog.setTypeface(dialog.input, builder.regularFont);
if (builder.inputPrefill != null)
dialog.input.setText(builder.inputPrefill);
dialog.setInternalInputCallback();
dialog.input.setHint(builder.inputHint);
dialog.input.setSingleLine();
dialog.input.setTextColor(builder.contentColor);
dialog.input.setHintTextColor(DialogUtils.adjustAlpha(builder.contentColor, 0.3f));
MDTintHelper.setTint(dialog.input, dialog.builder.widgetColor);
if (builder.inputType != -1) {
dialog.input.setInputType(builder.inputType);
if (builder.inputType != InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD &&
(builder.inputType & InputType.TYPE_TEXT_VARIATION_PASSWORD) == InputType.TYPE_TEXT_VARIATION_PASSWORD) {
// If the flags contain TYPE_TEXT_VARIATION_PASSWORD, apply the password transformation method automatically
dialog.input.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
}
dialog.inputMinMax = (TextView) dialog.view.findViewById(R.id.md_minMax);
if (builder.inputMinLength > 0 || builder.inputMaxLength > -1) {
dialog.invalidateInputMinMaxIndicator(dialog.input.getText().toString().length(),
!builder.inputAllowEmpty);
} else {
dialog.inputMinMax.setVisibility(View.GONE);
dialog.inputMinMax = null;
}
}
示例3: togglePasswordVisibility
private void togglePasswordVisibility(boolean showPassword) {
int inputType;
if (showPassword) {
inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
} else {
inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
}
passwordBox.setInputType(inputType);
}
示例4: onCreateInputConnection
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
ic = new SDLInputConnection(this, true);
outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;
return ic;
}
示例5: toTextVariationString
private static String toTextVariationString(final int variation) {
switch (variation) {
case InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS:
return " TYPE_TEXT_VARIATION_EMAIL_ADDRESS";
case InputType.TYPE_TEXT_VARIATION_EMAIL_SUBJECT:
return "TYPE_TEXT_VARIATION_EMAIL_SUBJECT";
case InputType.TYPE_TEXT_VARIATION_FILTER:
return "TYPE_TEXT_VARIATION_FILTER";
case InputType.TYPE_TEXT_VARIATION_LONG_MESSAGE:
return "TYPE_TEXT_VARIATION_LONG_MESSAGE";
case InputType.TYPE_TEXT_VARIATION_NORMAL:
return "TYPE_TEXT_VARIATION_NORMAL";
case InputType.TYPE_TEXT_VARIATION_PASSWORD:
return "TYPE_TEXT_VARIATION_PASSWORD";
case InputType.TYPE_TEXT_VARIATION_PERSON_NAME:
return "TYPE_TEXT_VARIATION_PERSON_NAME";
case InputType.TYPE_TEXT_VARIATION_PHONETIC:
return "TYPE_TEXT_VARIATION_PHONETIC";
case InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS:
return "TYPE_TEXT_VARIATION_POSTAL_ADDRESS";
case InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE:
return "TYPE_TEXT_VARIATION_SHORT_MESSAGE";
case InputType.TYPE_TEXT_VARIATION_URI:
return "TYPE_TEXT_VARIATION_URI";
case InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD:
return "TYPE_TEXT_VARIATION_VISIBLE_PASSWORD";
case InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT:
return "TYPE_TEXT_VARIATION_WEB_EDIT_TEXT";
case InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS:
return "TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS";
case InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD:
return "TYPE_TEXT_VARIATION_WEB_PASSWORD";
default:
return String.format("unknownVariation<0x%08x>", variation);
}
}
示例6: toggleVisibility
@OnClick(R.id.copy_btn_toggle_visible)
public void toggleVisibility() {
switch (text.getInputType()) {
case InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD:
text.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
toggle.setImageDrawable(getResources().getDrawable(R.drawable.ic_eye_off_grey));
break;
case InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD:
text.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
toggle.setImageDrawable(getResources().getDrawable(R.drawable.ic_eye_grey));
break;
}
}
示例7: setAuthType
/**
* 设置验证类型
*
* @param authType {@link AuthType}
*/
public void setAuthType(AuthType authType)
{
if(this.authType == authType)
{
return;
}
/**
* 在 {@link #authType} 值被改变之前,判断是不是需要清空文本.
*/
boolean needClearText = needClearText(authType);
this.authType = authType;
int inputType = InputType.TYPE_CLASS_NUMBER;
switch(this.authType)
{
case NUMBER:
inputType = InputType.TYPE_CLASS_NUMBER;
break;
case PASSWORD:
inputType = InputType.TYPE_TEXT_VARIATION_PASSWORD;
break;
case VISIBLE_PASSWORD:
inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
break;
case NUMBER_PASSWORD:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
inputType = InputType.TYPE_NUMBER_VARIATION_PASSWORD;
}
break;
case DEFAULT:
/**
* 这里的 InputType 不设置为 {@link InputType.TYPE_NULL},是因为设置这个后,
* {@link AuthEditText} 的点击事件失效
*/
inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
break;
}
etInput.setInputType(inputType);
if(needClearText)
{
clearText();
}
/**
* 输入类型变化时,需要手动更改文本。直接调用 {@link TextView#setInputType(int)} 没有作用.
*/
for(int i = 0; i < list.size(); i++)
{
if(string.length() > i)
{
fillTextByIndex(i);
}
}
}
示例8: onStartInput
/**
* This is the main point where we do our initialization of the input method
* to begin operating on an application. At this point we have been
* bound to the client, and are now receiving all of the detailed information
* about the target of our edits.
*/
@Override public void onStartInput(EditorInfo attribute, boolean restarting) {
super.onStartInput(attribute, restarting);
// Reset our state. We want to do this even if restarting, because
// the underlying state of the text editor could have changed in any way.
mComposing.setLength(0);
updateCandidates();
mPredictionOn = false;
mCompletionOn = false;
mCompletions = null;
// We are now going to initialize our state based on the type of
// text being edited.
switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
case InputType.TYPE_CLASS_NUMBER:
case InputType.TYPE_CLASS_DATETIME:
// Numbers and dates default to the symbols keyboard, with
// no extra features.
mCurKeyboard = mSymbolsKeyboard;
break;
case InputType.TYPE_CLASS_PHONE:
// Phones will also default to the symbols keyboard, though
// often you will want to have a dedicated phone keyboard.
mCurKeyboard = mSymbolsKeyboard;
break;
case InputType.TYPE_CLASS_TEXT:
// This is general text editing. We will default to the
// normal alphabetic keyboard, and assume that we should
// be doing predictive text (showing candidates as the
// user types).
mCurKeyboard = mArabicKeyboard;
mPredictionOn = true;
// We now look for a few special variations of text that will
// modify our behavior.
int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION;
if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD ||
variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
// Do not display predictions / what the user is typing
// when they are entering a password.
mPredictionOn = false;
}
if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
|| variation == InputType.TYPE_TEXT_VARIATION_URI
|| variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
// Our predictions are not useful for e-mail addresses
// or URIs.
mPredictionOn = false;
}
if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
// If this is an auto-complete text view, then our predictions
// will not be shown and instead we will allow the editor
// to supply their own. We only show the editor's
// candidates when in fullscreen mode, otherwise relying
// own it displaying its own UI.
mPredictionOn = false;
mCompletionOn = isFullscreenMode();
}
break;
default:
// For all unknown input types, default to the alphabetic
// keyboard with no special features.
mCurKeyboard = mArabicKeyboard;
}
// Update the label on the enter key, depending on what the application
// says it will do.
mCurKeyboard.setImeOptions(this, attribute.imeOptions);
}
示例9: onStartInput
@Override
public void onStartInput(EditorInfo attribute, boolean restarting) {
super.onStartInput(attribute, restarting);
//get settings
MyConfig.setSoundOn(sharedPref.getBoolean("play_sound", true));
MyConfig.setSwitchIme(sharedPref.getBoolean("switch_ime", false));
mComposing.setLength(0);
if (!restarting) {
// clear shift states.
mMetaState = 0;
}
mPredictionOn = false;
mCompletionOn = false;
//initializing state base on the type of text being edited
switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
case InputType.TYPE_CLASS_NUMBER:
case InputType.TYPE_CLASS_DATETIME:
//Numbers and dates default to the symbols keyboard
mCurKeyboard = getSymbolsKeyboard(getLocaleId());
break;
case InputType.TYPE_CLASS_PHONE:
//Phones will default to phone keyboard
switch (getLocaleId()) {
case 1:
mCurKeyboard = enSymbolsKeyboard;
break;
case 2:
mCurKeyboard = mySymbolsShiftedKeyboard;
break;
}
break;
case InputType.TYPE_CLASS_TEXT:
// for general text editing, default to normal alphabetic keyboard and doing predictive text
mCurKeyboard = getKeyboard(getLocaleId());
mPredictionOn = true;
//looking for variation of text to modify the behavior
int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION;
if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
//do not display prediction
mPredictionOn = false;
}
if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS || variation == InputType.TYPE_TEXT_VARIATION_URI || variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
//prediction will not be useful for e-mail and URIs.
mPredictionOn = false;
}
if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
//displaying prediction supplied by the editor if the input field is auto complete text view
mPredictionOn = false;
mCompletionOn = isFullscreenMode();
}
//looking at the current state of the editor to decide whether alphabetic keyboard should start out shifted
updateShiftKeyState(attribute);
break;
default:
//for all other input types, default to alphabetic keyboard of appropriate subtype
mCurKeyboard = getKeyboard(getLocaleId());
updateShiftKeyState(attribute);
}
//updating the label on enter key depending on what the application says it will do
mCurKeyboard.setImeOptions(getResources(), attribute.imeOptions);
}