android.text.InputType Java Examples

The following examples show how to use android.text.InputType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: Gizwits-SmartSocket_Android   Author: gizwits   File: RegisterActivity.java    License: MIT License 6 votes vote down vote up
/**
 * Inits the events.
 */
private void initEvents() {
	btnGetCaptchaCode.setOnClickListener(this);
	//
	btnGetCode.setOnClickListener(this);
	btnReGetCode.setOnClickListener(this);
	btnSure.setOnClickListener(this);
	tvPhoneSwitch.setOnClickListener(this);
	ivBack.setOnClickListener(this);
	tbPswFlag.setOnCheckedChangeListener(new OnCheckedChangeListener() {

		@Override
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			if (isChecked) {
				etInputPsw.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
			} else {
				etInputPsw.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
			}

		}

	});
}
 
Example #2
Source Project: ticdesign   Author: mobvoi   File: NumberPicker.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Sets the values to be displayed.
 *
 * @param displayedValues The displayed values.
 *
 * <strong>Note:</strong> The length of the displayed values array
 * must be equal to the range of selectable numbers which is equal to
 * {@link #getMaxValue()} - {@link #getMinValue()} + 1.
 */
public void setDisplayedValues(String[] displayedValues) {
    if (mDisplayedValues == displayedValues) {
        return;
    }
    mDisplayedValues = displayedValues;
    if (mDisplayedValues != null) {
        // Allow text entry rather than strictly numeric entry.
        mInputText.setRawInputType(InputType.TYPE_CLASS_TEXT
                | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    } else {
        mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
    }
    updateInputTextView();
    initializeSelectorWheelIndices();
    tryComputeMaxWidth();
}
 
Example #3
Source Project: Android-Application-ZJB   Author: pinguo-sunjianfei   File: UserTextDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 根据 hint 来判断 type
 */
private void initHint() {
    if ("请输入QQ号".equals(hintTextStr)) {
        dialogType = TYPE_QQ;
        setMaxLength(18);
        mEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
    } else if ("请输入手机号".equals(hintTextStr)) {
        dialogType = TYPE_PHONE;
        setMaxLength(11);
        mEditText.setInputType(InputType.TYPE_CLASS_NUMBER);
    } else if ("请输入常去考场".equals(hintTextStr) || "请输入常练车地址".equals(hintTextStr)) {
        setMaxLength(28);
    } else {
        setMaxLength(23);
    }
    mEditText.setHint(hintTextStr);
    mEditText.setText(realTextStr);
    mEditText.setSelection(realTextStr.length());
}
 
Example #4
Source Project: ncalc   Author: tranleduy2000   File: ModuleActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle(R.string.module);
    mHint1.setHint("A = ");
    mHint2.setVisibility(View.VISIBLE);
    mHint2.setHint("B = ");
    mBtnEvaluate.setText("A mod B");

    mInputFormula.setInputType(InputType.TYPE_CLASS_NUMBER |
            InputType.TYPE_NUMBER_FLAG_SIGNED);
    mInputFormula2.setInputType(InputType.TYPE_CLASS_NUMBER |
            InputType.TYPE_NUMBER_FLAG_SIGNED);

    getIntentData();

    boolean isStarted = mPreferences.getBoolean(STARTED, false);
    if (!isStarted || DLog.UI_TESTING_MODE) {
        if (isDataNull) {
            mInputFormula.setText("100");
            mInputFormula2.setText("20");
        }
    }

}
 
Example #5
Source Project: react-native-GPay   Author: hellochirag   File: ReactTextInputPropertyTest.java    License: MIT License 6 votes vote down vote up
@Test
public void testPasswordInput() {
  ReactEditText view = mManager.createViewInstance(mThemedContext);

  mManager.updateProperties(view, buildStyles());
  assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isZero();

  mManager.updateProperties(view, buildStyles("secureTextEntry", false));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isZero();

  mManager.updateProperties(view, buildStyles("secureTextEntry", true));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isNotZero();

  mManager.updateProperties(view, buildStyles("secureTextEntry", null));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD).isZero();
}
 
Example #6
Source Project: MuslimMateAndroid   Author: fekracomputers   File: Utility.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static void getInput(Context context, String title, DialogInterface.OnClickListener onOkListener)
{
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle(title);

    final EditText input = new EditText(context);
    input.setInputType(InputType.TYPE_CLASS_TEXT);
    input.setId(R.id.text1);
    builder.setView(input);

    builder.setPositiveButton("OK", onOkListener);

    builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    });

    builder.show();
}
 
Example #7
Source Project: Gizwits-SmartSocket_Android   Author: gizwits   File: ForgetPswActivity.java    License: MIT License 6 votes vote down vote up
/**
 * Inits the events.
 */
private void initEvents() {
	btnReGetCaptchaCode_farget.setOnClickListener(this);
	//
	rlDialog.setOnClickListener(this);
	btnGetCode.setOnClickListener(this);
	btnReGetCode.setOnClickListener(this);
	btnSureEmail.setOnClickListener(this);
	btnSure.setOnClickListener(this);
	btnPhoneReset.setOnClickListener(this);
	btnEmailReset.setOnClickListener(this);
	// tvPhoneSwitch.setOnClickListener(this);
	ivBack.setOnClickListener(this);
	tbPswFlag.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

		@Override
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
			if (isChecked) {
				etInputPsw.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
			} else {
				etInputPsw.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
			}
		}

	});
}
 
Example #8
Source Project: CSipSimple   Author: treasure-lau   File: Mobex.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
* {@inheritDoc}
*/
  @Override
  public void fillLayout(SipProfile account) {
      super.fillLayout(account);
      accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);
      
      if(TextUtils.isEmpty(account.username)){
          accountUsername.setText(USUAL_PREFIX);
      }

      //Get wizard specific row
      customWizardText = (TextView) parent.findViewById(R.id.custom_wizard_text);
      customWizard = (LinearLayout) parent.findViewById(R.id.custom_wizard_row);
      

      updateAccountInfos(account);
  }
 
Example #9
Source Project: jellyfin-androidtv   Author: jellyfin   File: Utils.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void processPasswordEntry(final Activity activity, final UserDto user, final String directItemId) {
    if (TvApp.getApplication().getUserPreferences().get(UserPreferences.Companion.getPasswordDPadEnabled())) {
        Intent pwIntent = new Intent(activity, DpadPwActivity.class);
        pwIntent.putExtra("User", SerializerRepository.INSTANCE.getSerializer().SerializeToString(user));
        pwIntent.putExtra("ItemId", directItemId);
        pwIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        activity.startActivity(pwIntent);
    } else {
        Timber.d("Requesting dialog...");
        final EditText password = new EditText(activity);
        password.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        new AlertDialog.Builder(activity)
                .setTitle("Enter Password")
                .setMessage("Please enter password for " + user.getName())
                .setView(password)
                .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        String pw = password.getText().toString();
                        AuthenticationHelper.loginUser(user.getName(), pw, TvApp.getApplication().getLoginApiClient(), activity, directItemId);
                    }
                }).show();
    }
}
 
Example #10
Source Project: SmartPack-Kernel-Manager   Author: SmartPack   File: PowerHalFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
private void powerhalTunablesInit(List<RecyclerViewItem> items) {
    TitleView powerhal = new TitleView();
    powerhal.setText(getString(R.string.powerhal_tunables));
    items.add(powerhal);

    for (int i = 0; i < VoxPopuli.VoxpopuliTunablesize(); i++) {
        if (VoxPopuli.VoxpopuliTunableexists(i)) {
            GenericSelectView tunables = new GenericSelectView();
            tunables.setSummary(VoxPopuli.getVoxpopuliTunableName(i));
            tunables.setValue(VoxPopuli.getVoxpopuliTunableValue(i));
            tunables.setValueRaw(tunables.getValue());
            tunables.setInputType(InputType.TYPE_CLASS_NUMBER);
            final int position = i;
            tunables.setOnGenericValueListener((genericSelectView, value) -> {
                VoxPopuli.setVoxpopuliTunableValue(value, position, getActivity());
                genericSelectView.setValue(value);
            });

            items.add(tunables);
        }
    }
}
 
Example #11
Source Project: tysq-android   Author: tysqapp   File: ArticleReportFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void initView(View view) {
    String name = String.format(getString(R.string.article_report_person), articleTitle);
    tvTitle.setText(name);
    initReportType();

    adapter = new ArticleReportAdapter(getContext(), articleReportResps, this);
    recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    recyclerView.setAdapter(adapter);


    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    etDescription.setInputType(InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
    etDescription.setSingleLine(false);
    etDescription.setHorizontallyScrolling(false);
    etDescription.addTextChangedListener(this);

    btnReport.setOnClickListener(this);
}
 
Example #12
Source Project: Conversations   Author: iNPUTmice   File: SearchActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
	getMenuInflater().inflate(R.menu.activity_search, menu);
	final MenuItem searchActionMenuItem = menu.findItem(R.id.action_search);
	final EditText searchField = searchActionMenuItem.getActionView().findViewById(R.id.search_field);
	final String term = pendingSearchTerm.pop();
	if (term != null) {
		searchField.append(term);
		List<String> searchTerm = FtsUtils.parse(term);
		if (xmppConnectionService != null) {
			if (currentSearch.watch(searchTerm)) {
				xmppConnectionService.search(searchTerm, this);
			}
		} else {
			pendingSearch.push(searchTerm);
		}
	}
	searchField.addTextChangedListener(this);
	searchField.setHint(R.string.search_messages);
	searchField.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
	if (term == null) {
		showKeyboard(searchField);
	}
	return super.onCreateOptionsMenu(menu);
}
 
Example #13
Source Project: Quran-For-My-Android   Author: frrahat   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void setSearchModeOn() {
	if(PRIMARY_TEXT_INDEX==Word_Info_Index){
		Toast.makeText(this, "Searching Cannot Be Done In Word By Word Text Mode."
				+ "\nChange Primary Text.", Toast.LENGTH_LONG).show();
		return;
		
	}
	if((Search_Operand_Text_Id==Search_Operand_Only_English
			|| Search_Operand_Text_Id==Search_Operand_All)
			&& allQuranTexts[English_Text_Index]==null){
		new TextUpdatingTask(this,"English Text").execute(English_Text_Index);
		//update text info, that is, search operand text is allQText[english text index]
	}
	isInSearchMode = true;
	commandText.setInputType(InputType.TYPE_CLASS_TEXT);
	commandText.setHint(R.string.hint_commandTextToSearch);
	
	invalidateOptionsMenu();
}
 
Example #14
Source Project: AndroidFrame   Author: DaleSmith   File: GridPasswordView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void setPasswordType(PasswordType passwordType) {
    boolean visible = getPassWordVisibility();
    int inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
    switch (passwordType) {

        case TEXT:
            inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
            break;

        case TEXTVISIBLE:
            inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
            break;

        case TEXTWEB:
            inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD;
            break;
    }

    for (TextView textView : mViewArr)
        textView.setInputType(inputType);

    setPasswordVisibility(visible);
}
 
Example #15
Source Project: SearchPreference   Author: ByteHamster   File: SearchPreference.java    License: MIT License 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    EditText searchText = (EditText) holder.findViewById(R.id.search);
    searchText.setFocusable(false);
    searchText.setInputType(InputType.TYPE_NULL);
    searchText.setOnClickListener(this);

    if (hint != null) {
        searchText.setHint(hint);
    }

    holder.findViewById(R.id.search_card).setOnClickListener(this);
    holder.itemView.setOnClickListener(this);
    holder.itemView.setBackgroundColor(0x0);
}
 
Example #16
Source Project: imsdk-android   Author: qunarcorp   File: QChatLoginActivity.java    License: MIT License 5 votes vote down vote up
private void bindViews() {
    tv_reset_account = (TextView) findViewById(R.id.tv_reset_account);
    tv_other_login_type = (TextView) findViewById(R.id.tv_other_login_type);
    tv_sel_country_region = (TextView) findViewById(R.id.tv_sel_country_region);
    ll_country_region = (LinearLayout) findViewById(R.id.ll_country_region);
    editText_username = (EditText) findViewById(R.id.editText_username);
    edit_password = (EditText) findViewById(R.id.edit_password);
    btnlogin = (Button) findViewById(R.id.btnlogin);
    ll_username = (LinearLayout) findViewById(R.id.ll_username);
    ll_password = (LinearLayout) findViewById(R.id.ll_password);
    img_show_pwd = (ImageView) findViewById(R.id.img_show_pwd);

    ll_country_region.setOnClickListener(this);
    tv_other_login_type.setOnClickListener(this);
    btnlogin.setOnClickListener(this);
    tv_reset_account.setOnClickListener(this);

    editText_username.setOnFocusChangeListener(this);
    edit_password.setOnFocusChangeListener(this);

    img_show_pwd.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_POINTER_DOWN:
                    edit_password.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
                    //edit_password.setTransformationMethod(PasswordTransformationMethod.getInstance());
                    return true;
                case MotionEvent.ACTION_UP:
                case MotionEvent.ACTION_POINTER_UP:
                    edit_password.setInputType(InputType.TYPE_CLASS_TEXT |
                            InputType.TYPE_TEXT_VARIATION_PASSWORD);
                    //edit_password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                    return true;
            }
            return false;
        }
    });
}
 
Example #17
Source Project: Quran-For-My-Android   Author: frrahat   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void setSearchModeOff() {
	isInSearchMode = false;
	commandText.setInputType(InputType.TYPE_CLASS_DATETIME);
	commandText.setHint(R.string.hint_commandText);
	
	invalidateOptionsMenu();
}
 
Example #18
Source Project: Android-nRF-Mesh-Library   Author: NordicSemiconductor   File: DialogFragmentAuthenticationInput.java    License: BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void updateStaticOOBUI() {
    dialogSummary.setText(R.string.provisioner_input_static_oob);
    hexPrefix.setVisibility(View.VISIBLE);
    pinInput.setInputType(InputType.TYPE_CLASS_TEXT);
    pinInput.setHint(getString((R.string.hint_static_oob)));
    pinInput.setFilters(new InputFilter[]{new InputFilter.LengthFilter(ProvisioningConfirmationState.AUTH_VALUE_LENGTH * 2)});
    pinInput.setKeyListener(new HexKeyListener());
}
 
Example #19
Source Project: zhangshangwuda   Author: Consoar   File: SearchView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Updates the auto-complete text view.
 */
private void updateSearchAutoComplete() {
    // TODO mQueryTextView.setDropDownAnimationStyle(0); // no animation
    mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
    mQueryTextView.setImeOptions(mSearchable.getImeOptions());
    int inputType = mSearchable.getInputType();
    // We only touch this if the input type is set up for text (which it almost certainly
    // should be, in the case of search!)
    if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
        // The existence of a suggestions authority is the proxy for "suggestions
        // are available here"
        inputType &= ~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
        if (mSearchable.getSuggestAuthority() != null) {
            inputType |= InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
            // TYPE_TEXT_FLAG_AUTO_COMPLETE means that the text editor is performing
            // auto-completion based on its own semantics, which it will present to the user
            // as they type. This generally means that the input method should not show its
            // own candidates, and the spell checker should not be in action. The text editor
            // supplies its candidates by calling InputMethodManager.displayCompletions(),
            // which in turn will call InputMethodSession.displayCompletions().
            inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
        }
    }
    mQueryTextView.setInputType(inputType);
    if (mSuggestionsAdapter != null) {
        mSuggestionsAdapter.changeCursor(null);
    }
    // attach the suggestions adapter, if suggestions are available
    // The existence of a suggestions authority is the proxy for "suggestions available here"
    if (mSearchable.getSuggestAuthority() != null) {
        mSuggestionsAdapter = new SuggestionsAdapter(getContext(),
                this, mSearchable, mOutsideDrawablesCache);
        mQueryTextView.setAdapter(mSuggestionsAdapter);
        ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement(
                mQueryRefinement ? SuggestionsAdapter.REFINE_ALL
                : SuggestionsAdapter.REFINE_BY_ENTRY);
    }
}
 
Example #20
Source Project: Hauk   Author: bilde2910   File: AdoptDialogBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a View that is rendered in the dialog window.
 *
 * @param ctx Android application context.
 * @return A View instance to render on the dialog.
 */
@Override
public final View createView(Context ctx) {
    // TODO: Inflate this instead
    // Ensure input boxes fill the entire width of the dialog.
    TableRow.LayoutParams trParams = new TableRow.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT);
    trParams.weight = 1.0F;

    TableLayout layout = new TableLayout(ctx);
    TableRow shareRow = new TableRow(ctx);
    shareRow.setLayoutParams(trParams);
    TableRow nickRow = new TableRow(ctx);
    nickRow.setLayoutParams(trParams);

    TextView textShare = new TextView(ctx);
    textShare.setText(R.string.label_share_url);

    TextView textNick = new TextView(ctx);
    textNick.setText(R.string.label_nickname);

    this.dialogTxtShare = new EditText(ctx);
    this.dialogTxtShare.setInputType(InputType.TYPE_CLASS_TEXT);
    this.dialogTxtShare.setLayoutParams(trParams);
    this.dialogTxtShare.addTextChangedListener(new LinkIDMatchReplacementListener(this.dialogTxtShare));

    this.dialogTxtNick = new EditText(ctx);
    this.dialogTxtNick.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
    this.dialogTxtNick.setLayoutParams(trParams);

    shareRow.addView(textShare);
    shareRow.addView(this.dialogTxtShare);
    nickRow.addView(textNick);
    nickRow.addView(this.dialogTxtNick);

    layout.addView(shareRow);
    layout.addView(nickRow);

    return layout;
}
 
Example #21
Source Project: commcare-android   Author: dimagi   File: DecimalWidget.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void setTextInputType(EditText mAnswer) {
    if (secret) {
        mAnswer.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
        mAnswer.setTransformationMethod(PasswordTransformationMethod.getInstance());
    }
}
 
Example #22
Source Project: EosCommander   Author: playerone-id   File: AbiBigIntegerViewHolder.java    License: MIT License 5 votes vote down vote up
@Override
protected View getItemView(LayoutInflater layoutInflater, ViewGroup parentView, String label ) {
    ViewGroup container = (ViewGroup)super.getItemView( layoutInflater, parentView, label);

    // add TYPE_NUMBER_FLAG_SIGNED when type is "signed int".
    TextInputEditText tie = container.findViewById( R.id.et_input);
    tie.setInputType( getTypeName().startsWith( TYPE_PREFIX_FOR_SIGNED ) ?
            ( InputType.TYPE_CLASS_NUMBER | TYPE_NUMBER_FLAG_SIGNED) : InputType.TYPE_CLASS_NUMBER );

    return container;
}
 
Example #23
Source Project: kernel_adiutor   Author: yoinx   File: SettingsFragment.java    License: Apache License 2.0 5 votes vote down vote up
private void deletePasswordDialog(final String password) {
    if (password.isEmpty()) {
        Utils.toast(getString(R.string.set_password_first), getActivity());
        return;
    }

    LinearLayout linearLayout = new LinearLayout(getActivity());
    linearLayout.setOrientation(LinearLayout.VERTICAL);
    linearLayout.setGravity(Gravity.CENTER);
    linearLayout.setPadding(30, 20, 30, 20);

    final AppCompatEditText mPassword = new AppCompatEditText(getActivity());
    mPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    mPassword.setHint(getString(R.string.password));
    linearLayout.addView(mPassword);

    new AlertDialog.Builder(getActivity()).setView(linearLayout)
            .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    if (!mPassword.getText().toString().equals(Utils.decodeString(password))) {
                        Utils.toast(getString(R.string.password_wrong), getActivity());
                        return;
                    }

                    Utils.saveString("password", "", getActivity());
                }
            }).show();
}
 
Example #24
Source Project: ToDay   Author: doljko   File: ToDayStateActivity.java    License: MIT License 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
private AlertDialog.Builder customDialog(EditText inTime) {
    final EditText in = inTime;
    final AlertDialog.Builder newFlowDialog = new AlertDialog.Builder(ToDayStateActivity.this);
    //Sets up Layout Parameters
    LinearLayout layout = new LinearLayout(ToDayStateActivity.this);
    layout.setOrientation(LinearLayout.VERTICAL);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.MATCH_PARENT);
    params.setMarginStart(42);
    params.setMarginEnd(50);


    //Sets up length and 1 line filters
    in.setInputType(InputType.TYPE_CLASS_NUMBER);

    in.setFilters(new InputFilter[]{
            new InputFilter.LengthFilter(3)
    });

    //Adds the ET and params to the layout of the dialog box
    layout.addView(in, params);

    newFlowDialog.setTitle(R.string.fs_dialog_more_time_title);

    newFlowDialog.setView(layout);

    return newFlowDialog;
}
 
Example #25
Source Project: BaseProject   Author: qyxxjd   File: EditTextUtil.java    License: MIT License 5 votes vote down vote up
/**
 * 设置密码是否可见
 */
public static void passwordVisibleToggle(@NonNull EditText editText) {
    if (editText.getInputType() == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
        editText.setInputType(
                InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
    } else {
        editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    }
}
 
Example #26
Source Project: shadowsocks-android-java   Author: dawei101   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void showProxyUrlInputDialog() {
    final EditText editText = new EditText(this);
    editText.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
    editText.setHint(getString(R.string.config_url_hint));
    editText.setText(readProxyUrl());

    new AlertDialog.Builder(this)
            .setTitle(R.string.config_url)
            .setView(editText)
            .setPositiveButton(R.string.btn_ok, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (editText.getText() == null) {
                        return;
                    }

                    String ProxyUrl = editText.getText().toString().trim();
                    if (isValidUrl(ProxyUrl)) {
                        setProxyUrl(ProxyUrl);
                        textViewProxyUrl.setText(ProxyUrl);
                    } else {
                        Toast.makeText(MainActivity.this, R.string.err_invalid_url, Toast.LENGTH_SHORT).show();
                    }
                }
            })
            .setNegativeButton(R.string.btn_cancel, null)
            .show();
}
 
Example #27
Source Project: Field-Book   Author: PhenoApps   File: NewTraitDialog.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void prepareFields(int index) {
    TraitFormat traitFormat = traitFormats.getTraitFormatByIndex(index);

    details.setHint(traitFormat.detailsBox().getParameterHint());
    def.setHint(traitFormat.defaultBox().getParameterHint());
    minimum.setHint(traitFormat.minimumBox().getParameterHint());
    maximum.setHint(traitFormat.maximumBox().getParameterHint());

    defBox.setVisibility(viewVisibility(traitFormat.isDefBoxVisible()));
    def.setVisibility(viewVisibility(traitFormat.defaultBox().getParameterVisibility()));
    minBox.setVisibility(viewVisibility(traitFormat.minimumBox().getParameterVisibility()));
    maxBox.setVisibility(viewVisibility(traitFormat.maximumBox().getParameterVisibility()));
    bool.setVisibility(viewVisibility(traitFormat.isBooleanVisible()));
    categoryBox.setVisibility(viewVisibility(traitFormat.categoriesBox().getParameterVisibility()));

    minimum.setText(traitFormat.minimumBox().getParameterDefaultValue());
    maximum.setText(traitFormat.maximumBox().getParameterDefaultValue());
    def.setText(traitFormat.defaultBox().getParameterDefaultValue());

    if (traitFormat.isNumericInputType()) {
        final int inputType = InputType.TYPE_CLASS_NUMBER |
                InputType.TYPE_NUMBER_FLAG_DECIMAL;
        def.setInputType(inputType);
        minimum.setInputType(inputType);
        maximum.setInputType(inputType);
    }
}
 
Example #28
Source Project: simpleSDL   Author: suikki   File: SDLActivity.java    License: MIT License 5 votes vote down vote up
@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;
}
 
Example #29
Source Project: CSipSimple   Author: treasure-lau   File: Optimus.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void fillLayout(final SipProfile account) {
	super.fillLayout(account);
	
	accountUsername.setTitle(R.string.w_common_phone_number);
	accountUsername.setDialogTitle(R.string.w_common_phone_number);
	accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);

       if(TextUtils.isEmpty(account.username)){
           accountUsername.setText(USUAL_PREFIX);
       }
	
}
 
Example #30
Source Project: react-native-GPay   Author: hellochirag   File: ReactTextInputPropertyTest.java    License: MIT License 5 votes vote down vote up
@Test
public void testIncrementalInputTypeUpdates() {
  ReactEditText view = mManager.createViewInstance(mThemedContext);

  mManager.updateProperties(view, buildStyles());
  assertThat(view.getInputType() & InputType.TYPE_CLASS_NUMBER).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS).isZero();

  mManager.updateProperties(view, buildStyles("multiline", true));
  assertThat(view.getInputType() & InputType.TYPE_CLASS_NUMBER).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS).isZero();

  mManager.updateProperties(view, buildStyles("autoCorrect", false));
  assertThat(view.getInputType() & InputType.TYPE_CLASS_NUMBER).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS).isNotZero();

  mManager.updateProperties(view, buildStyles("keyboardType", "NUMERIC"));
  assertThat(view.getInputType() & InputType.TYPE_CLASS_NUMBER).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS).isNotZero();

  mManager.updateProperties(view, buildStyles("multiline", null));
  assertThat(view.getInputType() & InputType.TYPE_CLASS_NUMBER).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS).isNotZero();
}