Example usage for android.text InputType TYPE_TEXT_VARIATION_NORMAL

List of usage examples for android.text InputType TYPE_TEXT_VARIATION_NORMAL

Introduction

In this page you can find the example usage for android.text InputType TYPE_TEXT_VARIATION_NORMAL.

Prototype

int TYPE_TEXT_VARIATION_NORMAL

To view the source code for android.text InputType TYPE_TEXT_VARIATION_NORMAL.

Click Source Link

Document

Default variation of #TYPE_CLASS_TEXT : plain old normal text.

Usage

From source file:com.wikaba.ogapp.NoAccountFragment.java

@Override
public void onClick(View v) {
    int id = v.getId();
    switch (id) {
    case R.id.login:
        String username = usernameField.getText().toString();
        String passwd = passwdField.getText().toString();
        View selectedView = uniSpinner.getSelectedView();
        if (selectedView == null) {
            Toast.makeText(act, "Please select a valid universe.", Toast.LENGTH_SHORT).show();
            return;
        }//from  www.  ja  v a2  s  . c  o m

        TextView selectedText = (TextView) selectedView;
        String universe = selectedText.getText().toString();

        act.addAccount(universe, username, passwd);
        break;
    case R.id.pw_checkbox:
        int inputType = (pwCheckBox.isChecked())
                ? (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL
                        | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
                : (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        passwdField.setInputType(inputType);
        break;
    }
}

From source file:jp.watnow.plugins.dialog.Notification.java

/**
 * //from   w  w w  .  j av  a  2s  . c o m
 * @param message
 * @param title
 * @param buttonLabels
 * @param defaultTexts
 * @param callbackContext
 */
public synchronized void login(final String title, final String message, final JSONArray buttonLabels,
        final JSONArray defaultTexts, final CallbackContext callbackContext) {

    final CordovaInterface cordova = this.cordova;

    Runnable runnable = new Runnable() {
        public void run() {
            LinearLayout layout = new LinearLayout(cordova.getActivity());
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setPadding(10, 0, 10, 0);
            final EditText usernameInput = new EditText(cordova.getActivity());
            usernameInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL);
            final EditText passwordInput = new EditText(cordova.getActivity());
            passwordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
            try {
                usernameInput.setHint("ID");
                usernameInput.setText(defaultTexts.getString(0));
                passwordInput.setHint("PASSWORD");
                passwordInput.setText(defaultTexts.getString(1));
            } catch (JSONException e1) {
            }

            layout.addView(usernameInput, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT));
            layout.addView(passwordInput, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                    LinearLayout.LayoutParams.WRAP_CONTENT));

            AlertDialog.Builder dlg = createDialog(cordova); // new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            dlg.setMessage(message);
            dlg.setTitle(title);
            dlg.setCancelable(false);

            dlg.setView(layout);

            final JSONObject result = new JSONObject();

            try {
                dlg.setNegativeButton(buttonLabels.getString(0), new AlertDialog.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        try {
                            result.put("buttonIndex", 1);
                            result.put("input1", usernameInput.getText());
                            result.put("input2", passwordInput.getText());
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
                    }
                });
            } catch (JSONException e) {
            }

            try {
                dlg.setPositiveButton(buttonLabels.getString(1), new AlertDialog.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        try {
                            result.put("buttonIndex", 3);
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                        callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
                    }
                });
            } catch (JSONException e) {
            }

            dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                    try {
                        result.put("buttonIndex", 0);
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result));
                }
            });

            changeTextDirection(dlg);
        };
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}