Example usage for android.text InputType TYPE_TEXT_VARIATION_PERSON_NAME

List of usage examples for android.text InputType TYPE_TEXT_VARIATION_PERSON_NAME

Introduction

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

Prototype

int TYPE_TEXT_VARIATION_PERSON_NAME

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

Click Source Link

Document

Variation of #TYPE_CLASS_TEXT : entering the name of a person.

Usage

From source file:net.kourlas.voipms_sms.activities.NewConversationActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.new_conversation);

    Intent intent = getIntent();//w  ww .jav a 2 s .  com
    String action = intent.getAction();
    String type = intent.getType();
    if (Intent.ACTION_SEND.equals(action) && type != null && type.equals("text/plain")) {
        this.messageText = intent.getStringExtra(Intent.EXTRA_TEXT);
    }

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    ViewCompat.setElevation(toolbar, getResources().getDimension(R.dimen.toolbar_elevation));
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);

        actionBar.setCustomView(R.layout.new_conversation_toolbar);
        actionBar.setDisplayShowCustomEnabled(true);
    }

    final Activity newConversationActivity = this;

    final NewConversationListViewAdapter newConversationListViewAdapter = new NewConversationListViewAdapter(
            this);

    if (actionBar != null) {
        SearchView searchView = (SearchView) actionBar.getCustomView().findViewById(R.id.search_view);
        searchView.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
        searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String query) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                String phoneNumber = newText.replaceAll("[^0-9]", "");
                if (phoneNumber.equals("")) {
                    newConversationListViewAdapter.hideTypedInItem();
                } else {
                    newConversationListViewAdapter.showTypedInItem(phoneNumber);
                }
                newConversationListViewAdapter.refresh(newText);
                return true;
            }
        });
        searchView.requestFocus();

        // Hide search icon
        ImageView searchMagIcon = (ImageView) searchView.findViewById(R.id.search_mag_icon);
        searchMagIcon.setLayoutParams(new LinearLayout.LayoutParams(0, 0));
    }

    final ListView listView = (ListView) findViewById(R.id.list);
    listView.setAdapter(newConversationListViewAdapter);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ContactItem contactItem = (ContactItem) newConversationListViewAdapter.getItem(position);

            String phoneNumber = contactItem.getPhoneNumber().replaceAll("[^0-9]", "");

            Intent intent = new Intent(newConversationActivity, ConversationActivity.class);
            intent.putExtra(getString(R.string.conversation_extra_contact), phoneNumber);
            if (messageText != null) {
                intent.putExtra(getString(R.string.conversation_extra_message_text), messageText);
            }
            intent.putExtra(getString(R.string.conversation_extra_focus), true);
            startActivity(intent);
        }
    });
    listView.setFastScrollEnabled(true);

    newConversationListViewAdapter.refresh("");
}

From source file:luxsyp.corona.com.base.ui.activity.HomeActivity.java

private void initSearchButton() {
    search_fab.setClickable(true);//from www. j ava  2  s.c o m
    search_fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            search_fab.setClickable(true);
            search_fab.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    try {
                        new MaterialDialog.Builder(HomeActivity.this).title(R.string.movie_name_search)
                                .content(R.string.movie_name_search)
                                .inputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME
                                        | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)
                                .input(R.string.movie_name_search, R.string.no_prefill,
                                        new MaterialDialog.InputCallback() {
                                            @Override
                                            public void onInput(MaterialDialog dialog, CharSequence input) {
                                                homeFragment.doSearch(input.toString());
                                                InputMethodManager imm = (InputMethodManager) getSystemService(
                                                        Context.INPUT_METHOD_SERVICE);
                                                imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
                                            }
                                        })
                                .show();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
    });
}

From source file:com.tingtingapps.securesms.ContactSelectionActivity.java

private void initializeResources() {
    this.action = (ImageView) findViewById(R.id.action_icon);
    this.searchText = (EditText) findViewById(R.id.search_view);
    this.toggle = (AnimatingToggle) findViewById(R.id.button_toggle);
    this.keyboardToggle = (ImageView) findViewById(R.id.search_keyboard);
    this.dialpadToggle = (ImageView) findViewById(R.id.search_dialpad);
    this.clearToggle = (ImageView) findViewById(R.id.search_clear);
    this.toggleContainer = (LinearLayout) findViewById(R.id.toggle_container);

    contactsFragment = (ContactSelectionListFragment) getSupportFragmentManager()
            .findFragmentById(R.id.contact_selection_list_fragment);
    contactsFragment.setOnContactSelectedListener(this);
    contactsFragment.setOnRefreshListener(this);

    this.keyboardToggle.setOnClickListener(new View.OnClickListener() {
        @Override//w w w  .j  av  a2 s .c o m
        public void onClick(View v) {
            searchText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
            ServiceUtil.getInputMethodManager(ContactSelectionActivity.this).showSoftInput(searchText, 0);
            displayTogglingView(dialpadToggle);
        }
    });

    this.dialpadToggle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            searchText.setInputType(InputType.TYPE_CLASS_PHONE);
            ServiceUtil.getInputMethodManager(ContactSelectionActivity.this).showSoftInput(searchText, 0);
            displayTogglingView(keyboardToggle);
        }
    });

    this.clearToggle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            searchText.setText("");

            if (SearchUtil.isTextInput(searchText))
                displayTogglingView(dialpadToggle);
            else
                displayTogglingView(keyboardToggle);
        }
    });

    expandTapArea(toolbar, action, 500);
    expandTapArea(toggleContainer, dialpadToggle, 500);
}

From source file:com.scigames.slidegame.Registration1UserNameActivity.java

/** Called with the activity is first created. */
@Override//from w  ww.  j av a 2  s . c o m
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Intent i = getIntent();
    Log.d(TAG, "...getIntent");
    //       firstNameIn = i.getStringExtra("fName");
    //       lastNameIn = i.getStringExtra("lName");
    //       studentIdIn = i.getStringExtra("studentId");
    //       visitIdIn = i.getStringExtra("visitId");
    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration1_username);
    Log.d(TAG, "...setContentView");
    // Find the text editor view inside the layout, because we
    // want to do various programmatic things with it.
    firstName = (EditText) findViewById(R.id.first_name);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    firstName.setInputType(InputType.TYPE_NULL);
    firstName.setOnTouchListener(new View.OnTouchListener() {
        //@Override
        public boolean onTouch(View v, MotionEvent event) {
            firstName.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
            firstName
                    .setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
            firstName.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });
    lastName = (EditText) findViewById(R.id.last_name);
    password = (EditText) findViewById(R.id.password);
    Log.d(TAG, "...instantiateEditTexts");

    // Hook up button presses to the appropriate event handler.
    ((Button) findViewById(R.id.back)).setOnClickListener(mBackListener);
    //((Button) findViewById(R.id.clear)).setOnClickListener(mClearListener);
    ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener);
    Log.d(TAG, "...instantiateButtons");

    //set info to what we know already
    //firstName.setText(firstNameIn);
    //lastName.setText(lastNameIn);
    //password.setText(passwordIn);
    //Log.d(TAG,"...setTexts with incoming name/pw");

    //set listener
    task.setOnResultsListener(this);

    alertDialog = new AlertDialog.Builder(Registration1UserNameActivity.this).create();
    // Setting Dialog Title
    alertDialog.setTitle("Login Failed");
    // Setting Dialog Message
    alertDialog.setMessage("Welcome to AndroidHive.info");
    // Setting Icon to Dialog
    //alertDialog.setIcon(R.drawable.tick);

    alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "You clicked on OK", Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:com.scigames.registration.Registration1UserNameActivity.java

/** Called with the activity is first created. */
@Override/*from  www  .  j  a  va  2  s . c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "super.OnCreate");

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    Intent i = getIntent();
    Log.d(TAG, "...getIntent");
    firstNameIn = i.getStringExtra("fName");
    lastNameIn = i.getStringExtra("lName");
    passwordIn = i.getStringExtra("pword");

    Log.d(TAG, "...getStringExtra");
    // Inflate our UI from its XML layout description.
    setContentView(R.layout.registration1_username);
    Log.d(TAG, "...setContentView");

    lastName = (EditText) findViewById(R.id.last_name);
    password = (EditText) findViewById(R.id.password);
    password_confirm = (EditText) findViewById(R.id.confirm_password);
    firstName = (EditText) findViewById(R.id.first_name);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    firstName.setCursorVisible(false);
    firstName.setInputType(InputType.TYPE_NULL);
    firstName.setOnTouchListener(new View.OnTouchListener() {
        //@Override
        public boolean onTouch(View v, MotionEvent event) {
            firstName.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
            firstName
                    .setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
            firstName.setCursorVisible(true);
            firstName.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });

    Log.d(TAG, "...instantiateEditTexts");

    // Hook up button presses to the appropriate event handler.
    ((Button) findViewById(R.id.continue_button)).setOnClickListener(mContinueButtonListener);
    Log.d(TAG, "...instantiateButtons");

    Typeface ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Typeface Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Typeface Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Typeface Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    setEditTextFont(Museo500Regular, firstName, lastName, password, password_confirm);

    //set info to what we know already
    firstName.setText(firstNameIn);
    lastName.setText(lastNameIn);
    //password.setText(passwordIn);
    Log.d(TAG, "...setTexts with incoming name/pw");

    //set listener
    task.setOnResultsListener(this);

    alertDialog = new AlertDialog.Builder(Registration1UserNameActivity.this).create();
    // Setting Dialog Title
    alertDialog.setTitle("Login Failed");
    // Setting Dialog Message
    alertDialog.setMessage("Welcome to AndroidHive.info");
    // Setting Icon to Dialog
    //alertDialog.setIcon(R.drawable.tick);

    alertDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT).show();
        }
    });
}

From source file:com.scigames.registration.LoginActivity.java

/** Called with the activity is first created. */
@Override/*from  w  w  w .  j a v  a 2 s .c om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION );
    // View v = findViewById(R.layout.login_page);
    // v.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); 
    //Window w = this.getWindow(); // in Activity's onCreate() for instance
    //w.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    //        WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.login_page);
    Log.d(TAG, "super.OnCreate");
    // Inflate our UI from its XML layout description.       
    //        Intent i = getIntent();
    //        if (i.hasExtra("token")){
    //           setContentView(R.layout.login_page);
    //        } else {
    //           setContentView(R.layout.no_device);
    //        }
    lastName = (EditText) findViewById(R.id.last_name);
    password = (EditText) findViewById(R.id.password);
    classId = (EditText) findViewById(R.id.class_id);
    firstName = (EditText) findViewById(R.id.first_name);
    /* to hide the keyboard on launch, then open when tap in firstname field */
    //firstName.setActivated(false);
    //firstName.setSelected(false);
    firstName.setCursorVisible(false);
    firstName.setInputType(InputType.TYPE_NULL);
    firstName.setOnTouchListener(new View.OnTouchListener() {
        //@Override
        public boolean onTouch(View v, MotionEvent event) {
            firstName.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
            firstName
                    .setInputType(InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
            firstName.setCursorVisible(true);
            firstName.onTouchEvent(event); // call native handler
            return true; // consume touch even
        }
    });

    //for faster testing:
    //        firstName.setText("joseph7");
    //        lastName.setText("christopher");
    //        password.setText("qweasd");
    //        classId.setText("66");
    //        
    // Hook up button presses to the appropriate event handler.
    ((Button) findViewById(R.id.login_button)).setOnClickListener(mLogInListener);
    ((Button) findViewById(R.id.register)).setOnClickListener(mRegisterListener);

    //set listener
    task.setOnResultsListener(this);

    alertDialog = new AlertDialog.Builder(LoginActivity.this).create();
    // Setting Dialog Title
    alertDialog.setTitle("Login Failed");
    // Setting Dialog Message
    alertDialog.setMessage("Welcome to AndroidHive.info");
    // Setting Icon to Dialog
    //alertDialog.setIcon(R.drawable.tick);

    alertDialog.setButton(RESULT_OK, "OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to execute after dialog closed
            Toast.makeText(getApplicationContext(), "Check your login info!", Toast.LENGTH_SHORT).show();
        }
    });

    Typeface ExistenceLightOtf = Typeface.createFromAsset(getAssets(), "fonts/Existence-Light.ttf");
    Typeface Museo300Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo300-Regular.otf");
    Typeface Museo500Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo500-Regular.otf");
    Typeface Museo700Regular = Typeface.createFromAsset(getAssets(), "fonts/Museo700-Regular.otf");

    //       TextView welcome = (TextView)findViewById(R.id.welcome);
    TextView notascigamersentence = (TextView) findViewById(R.id.notascigamersentence);
    //       setTextViewFont(ExistenceLightOtf, welcome);
    setTextViewFont(Museo500Regular, notascigamersentence);
    setEditTextFont(Museo500Regular, firstName, lastName, password, classId);

    login = (Button) findViewById(R.id.login_button);
    register = (Button) findViewById(R.id.register); /* out for now */
    setButtonFont(ExistenceLightOtf, login, register);
    setButtonFont(Museo500Regular, register);

    //        if (getIntent().getBooleanExtra("EXIT", false)) {
    //            finish();
    //        }

}

From source file:org.kontalk.ui.ConversationList.java

private void askForPersonalName() {
    DialogInterface.OnClickListener okListener = new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // no key pair found, generate a new one
            if (BuildConfig.DEBUG) {
                Toast.makeText(ConversationList.this, R.string.msg_generating_keypair, Toast.LENGTH_LONG)
                        .show();// w  w w  . ja v a 2  s.  c  om
            }

            String name = InputDialog.getInputText((Dialog) dialog).toString();

            // upgrade account
            proceedXmppUpgrade(name);
        }
    };

    DialogInterface.OnCancelListener cancelListener = new DialogInterface.OnCancelListener() {
        public void onCancel(DialogInterface dialog) {
            new AlertDialog.Builder(ConversationList.this).setTitle(R.string.title_no_personal_key)
                    .setMessage(R.string.msg_no_personal_key).setPositiveButton(android.R.string.ok, null)
                    .show();
        }
    };

    new InputDialog.Builder(this, InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME)
            .setTitle(R.string.title_no_name).setMessage(R.string.msg_no_name)
            .setPositiveButton(android.R.string.ok, okListener)
            .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.cancel();
                }
            }).setOnCancelListener(cancelListener).show();
}

From source file:com.amazonaws.mobile.auth.userpools.SignUpView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    this.signUpForm = (FormView) findViewById(R.id.signup_form);
    userNameEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME,
            getContext().getString(R.string.username_text));

    passwordEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD,
            getContext().getString(R.string.sign_in_password));

    givenNameEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME,
            getContext().getString(R.string.given_name_text));

    emailEditText = signUpForm.addFormField(getContext(),
            InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS,
            getContext().getString(R.string.email_address_text));

    phoneEditText = signUpForm.addFormField(getContext(), InputType.TYPE_CLASS_PHONE,
            getContext().getString(R.string.phone_number_text));

    this.signUpMessage = (TextView) findViewById(R.id.signup_message);
    this.signUpButton = (Button) findViewById(R.id.signup_button);

    setupSignUpButtonBackground();/*from   w  w w  .jav a 2  s  .c  o m*/
    setupFontFamily();
}

From source file:net.kourlas.voipms_sms.activities.NewConversationActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        switch (item.getItemId()) {
        case R.id.keyboard_button:
            SearchView searchView = (SearchView) actionBar.getCustomView().findViewById(R.id.search_view);
            if (searchView.getInputType() == (InputType.TYPE_TEXT_VARIATION_PERSON_NAME)) {
                searchView.setInputType(InputType.TYPE_CLASS_PHONE);
                item.setIcon(R.drawable.ic_keyboard_white_24dp);
                item.setTitle(R.string.new_conversation_action_keyboard);
            } else {
                searchView.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
                item.setIcon(R.drawable.ic_dialpad_white_24dp);
                item.setTitle(R.string.new_conversation_action_dialpad);
            }//w ww  . j a va2s.c o m
            return true;
        }
    }

    return super.onOptionsItemSelected(item);
}

From source file:org.kontalk.ui.MainActivity.java

private void askForPersonalName() {
    new MaterialDialog.Builder(this).content(R.string.msg_no_name).positiveText(android.R.string.ok)
            .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME)
            .input(R.string.hint_validation_name, 0, false, new MaterialDialog.InputCallback() {
                @Override//w  w  w .  ja  va  2  s .  c  om
                public void onInput(MaterialDialog dialog, CharSequence input) {
                    // no key pair found, generate a new one
                    if (BuildConfig.DEBUG) {
                        Toast.makeText(MainActivity.this, R.string.msg_generating_keypair, Toast.LENGTH_LONG)
                                .show();
                    }

                    String name = input.toString();

                    // upgrade account
                    proceedXmppUpgrade(name);
                }
            }).onNegative(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction dialogAction) {
                    dialog.cancel();
                }
            }).negativeText(android.R.string.cancel).cancelListener(new DialogInterface.OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    new MaterialDialog.Builder(MainActivity.this).title(R.string.title_no_personal_key)
                            .content(R.string.msg_no_personal_key).positiveText(android.R.string.ok).show();
                }
            }).show();
}