Example usage for android.view.inputmethod EditorInfo IME_ACTION_NEXT

List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_NEXT

Introduction

In this page you can find the example usage for android.view.inputmethod EditorInfo IME_ACTION_NEXT.

Prototype

int IME_ACTION_NEXT

To view the source code for android.view.inputmethod EditorInfo IME_ACTION_NEXT.

Click Source Link

Document

Bits of #IME_MASK_ACTION : the action key performs a "next" operation, taking the user to the next field that will accept text.

Usage

From source file:com.hijacker.FeedbackDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    dialogView = getActivity().getLayoutInflater().inflate(R.layout.feedback_dialog, null);

    emailView = (EditText) dialogView.findViewById(R.id.email_et);
    include_report = (CheckBox) dialogView.findViewById(R.id.include_report);
    feedbackView = (EditText) dialogView.findViewById(R.id.feedback_et);
    progress = (ProgressBar) dialogView.findViewById(R.id.progress);

    emailView.setText(pref.getString("user_email", ""));
    emailView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override/*from  w  w  w  . j  av  a2s.  c om*/
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                feedbackView.requestFocus();
                return true;
            }
            return false;
        }
    });

    report = null;
    include_report.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked && report == null) {
                progress.setIndeterminate(true);
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        report = new File(Environment.getExternalStorageDirectory() + "/report.txt");
                        if (!createReport(report, path, null, Shell.getFreeShell().getShell())) {
                            if (debug)
                                Log.e("HIJACKER/feedbackDialog", "Report not generated");
                            report = null;
                        }
                        runInHandler(new Runnable() {
                            @Override
                            public void run() {
                                progress.setIndeterminate(false);
                            }
                        });
                    }
                }).start();
            }
        }
    });

    builder.setView(dialogView);
    builder.setTitle(getString(R.string.feedback));
    builder.setPositiveButton(R.string.send, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    builder.setNeutralButton(R.string.send_email, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            Intent intent = new Intent(Intent.ACTION_SEND);
            intent.setType("plain/text");
            intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "kiriakopoulos44@gmail.com" });
            intent.putExtra(Intent.EXTRA_SUBJECT, "Hijacker feedback");
            if (report != null) {
                Uri attachment = FileProvider.getUriForFile(
                        FeedbackDialog.this.getActivity().getApplicationContext(),
                        BuildConfig.APPLICATION_ID + ".provider", report);
                intent.putExtra(Intent.EXTRA_STREAM, attachment);
            }
            intent.putExtra(Intent.EXTRA_TEXT, feedbackView.getText().toString());
            startActivity(intent);
        }
    });
    return builder.create();
}

From source file:org.telegram.ui.ChangeNameActivity.java

@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("EditName", R.string.EditName));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override//from w  w  w  . j  a va2  s .  c  om
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                if (firstNameField.getText().length() != 0) {
                    saveName();
                    finishFragment();
                }
            }
        }
    });

    ActionBarMenu menu = actionBar.createMenu();
    doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

    TLRPC.User user = MessagesController.getInstance().getUser(UserConfig.getClientUserId());
    if (user == null) {
        user = UserConfig.getCurrentUser();
    }

    LinearLayout linearLayout = new LinearLayout(context);
    fragmentView = linearLayout;
    fragmentView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    ((LinearLayout) fragmentView).setOrientation(LinearLayout.VERTICAL);
    fragmentView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });

    firstNameField = new EditText(context);
    firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    //firstNameField.setHintTextColor(0xff979797);
    firstNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    firstNameField.setMaxLines(1);
    firstNameField.setLines(1);
    firstNameField.setSingleLine(true);
    firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    firstNameField.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    firstNameField.setHint(LocaleController.getString("FirstName", R.string.FirstName));
    AndroidUtilities.clearCursorDrawable(firstNameField);
    linearLayout.addView(firstNameField,
            LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 24, 24, 24, 0));
    firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_NEXT) {
                lastNameField.requestFocus();
                lastNameField.setSelection(lastNameField.length());
                return true;
            }
            return false;
        }
    });

    lastNameField = new EditText(context);
    lastNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    //lastNameField.setHintTextColor(0xff979797);
    lastNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    lastNameField.setMaxLines(1);
    lastNameField.setLines(1);
    lastNameField.setSingleLine(true);
    lastNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    lastNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    lastNameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
    lastNameField.setHint(LocaleController.getString("LastName", R.string.LastName));
    AndroidUtilities.clearCursorDrawable(lastNameField);
    linearLayout.addView(lastNameField,
            LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 24, 16, 24, 0));
    lastNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_DONE) {
                doneButton.performClick();
                return true;
            }
            return false;
        }
    });

    if (user != null) {
        firstNameField.setText(user.first_name);
        firstNameField.setSelection(firstNameField.length());
        lastNameField.setText(user.last_name);
    }

    return fragmentView;
}

From source file:com.hijacker.SendLogActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setFinishOnTouchOutside(false);/*from  w  ww  .  j  av a2 s  .  c  om*/
    setContentView(R.layout.activity_send_log);

    rootView = findViewById(R.id.activity_send_log);
    userEmailView = (EditText) findViewById(R.id.email_et);
    extraView = (EditText) findViewById(R.id.extra_et);
    progressBar = findViewById(R.id.reportProgressBar);
    console = (TextView) findViewById(R.id.console);
    sendProgress = findViewById(R.id.progress);
    sendCompleted = findViewById(R.id.completed);
    sendBtn = findViewById(R.id.sendBtn);
    sendEmailBtn = findViewById(R.id.sendEmailBtn);

    userEmailView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                extraView.requestFocus();
                return true;
            }
            return false;
        }
    });

    busybox = getFilesDir().getAbsolutePath() + "/bin/busybox";
    stackTrace = getIntent().getStringExtra("exception");
    Log.e("HIJACKER/SendLog", stackTrace);

    pref = PreferenceManager.getDefaultSharedPreferences(SendLogActivity.this);
    pref_edit = pref.edit();
    userEmailView.setText(pref.getString("user_email", ""));

    //Load device info
    PackageManager manager = getPackageManager();
    PackageInfo info;
    try {
        info = manager.getPackageInfo(getPackageName(), 0);
        versionName = info.versionName.replace(" ", "_");
        versionCode = info.versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        Log.e("HIJACKER/SendLog", e.toString());
    }
    deviceModel = Build.MODEL;
    if (!deviceModel.startsWith(Build.MANUFACTURER))
        deviceModel = Build.MANUFACTURER + " " + deviceModel;
    deviceModel = deviceModel.replace(" ", "_");

    deviceID = pref.getLong("deviceID", -1);

    new SetupTask().execute();
}

From source file:com.yahala.ui.LoginActivitySmsView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    confirmTextView = (TextView) findViewById(R.id.login_sms_confirm_text);
    codeField = (EditText) findViewById(R.id.login_sms_code_field);
    codeField.setHint(LocaleController.getString("Code", R.string.Code));
    timeText = (TextView) findViewById(R.id.login_time_text);
    TextView wrongNumber = (TextView) findViewById(R.id.wrong_number);
    wrongNumber.setText(LocaleController.getString("WrongNumber", R.string.WrongNumber));

    wrongNumber.setOnClickListener(new OnClickListener() {
        @Override/*  w ww  .  java 2s.  c  o m*/
        public void onClick(View view) {
            onBackPressed();
            delegate.setPage(0, true, null, true);
        }
    });

    codeField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_NEXT) {
                if (delegate != null) {
                    delegate.onNextAction();
                }
                return true;
            }
            return false;
        }
    });
}

From source file:com.tomeokin.lspush.biz.auth.adapter.PhoneFieldViewHolder.java

@Override
public void onCreateView(View view) {
    mCountryCodePicker.setText(mCountryCodeData.formatSimple());
    mCountryCodePicker.setOnClickListener(new View.OnClickListener() {
        @Override/*from ww w .  j av  a  2  s  .  co m*/
        public void onClick(View v) {
            mCountryCodePickerDialog = new CountryCodePickerDialog();
            mCountryCodePickerDialog.setTargetFragment(mFragment, 0);
            mCountryCodePickerDialog.show(mFragmentManager, null);
        }
    });

    updatePhoneNumberFormatting(mCountryCodeData);
    mPhoneField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT && mCaptchaView.isFieldValid()) {
                onSendCaptcha();
                return true;
            }
            return false;
        }
    });

    mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onSendCaptcha();
        }
    });
}

From source file:org.openlmis.core.view.widget.MMIAInfoList.java

private void addItemView(BaseInfoItem item, boolean isHeaderView, final int position) {
    View view = layoutInflater.inflate(R.layout.item_mmia_info, this, false);
    TextView tvName = (TextView) view.findViewById(R.id.tv_name);
    EditText etValue = (EditText) view.findViewById(R.id.et_value);

    if (isHeaderView) {
        tvName.setText(R.string.label_mmia_info_header_name);
        etValue.setText(getResources().getString(R.string.label_total_mmia).toUpperCase());
        etValue.setEnabled(false);/* w w w . j a v a  2 s.  c o m*/
        etValue.setGravity(Gravity.CENTER);
        view.setBackgroundResource(R.color.color_mmia_info_name);
    } else {
        tvName.setText(item.getName());
        editTexts.add(etValue);
        etValue.setText(item.getValue());

        if (isTotalPatient(item)) {
            totalPatientsItem = item;

            totalPatientsView = etValue;
            totalPatientsView.setEnabled(false);
        } else {
            etValue.addTextChangedListener(new EditTextWatcher(item));
        }
        setTotalViewBackground(item, etValue);
    }
    addView(view);

    etValue.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                if ((position + 1) < editTexts.size()) {
                    editTexts.get(position + 1).requestFocus();
                    return true;
                }
            }
            return false;
        }
    });

}

From source file:com.tomeokin.lspush.biz.home.UriDialogFragment.java

@SuppressLint("InflateParams")
@NonNull//from   w  w w . j  a v a 2s . c om
@Override
protected BaseDialogFragment.Builder config(@NonNull BaseDialogFragment.Builder builder) {
    View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_add_link, null);
    builder.addCustomMessageView(view);

    final View content = getActivity().getWindow().findViewById(Window.ID_ANDROID_CONTENT);
    final FrameLayout container = builder.getCustomViewHolder();
    ViewGroup.LayoutParams lp = container.getLayoutParams();
    lp.width = content.getWidth() / 6 * 5;
    container.setLayoutParams(lp);

    mUrlField = (EditText) view.findViewById(R.id.url_field);

    mNextButton = (TextView) view.findViewById(R.id.next_button);
    mNextButton.setTextColor(Color.BLACK);
    mNextButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getUrlInfo();
        }
    });
    mNextButton.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT && isAvailableCheck()
                    && isValidWebUri(mUrlField.getText())) {
                getUrlInfo();
                return true;
            }

            return false;
        }
    });
    Drawable clear = getContext().getDrawable(R.drawable.search_clear);
    DrawableCompat.setTint(clear, ContextCompat.getColor(getContext(), R.color.blue_5_whiteout));
    mNextButton.setCompoundDrawables(null, null, clear, null);
    mProgressBar = (ProgressBar) view.findViewById(R.id.next_progress);

    final String text = ClipboardUtils.getText(getContext());
    if (!TextUtils.isEmpty(text) && isValidWebUri(text)) {
        mUrlField.setText(text);
        activeNextButton();
    } else {
        disableNextButton();
    }

    return builder;
}

From source file:io.plaidapp.ui.DesignerNewsLogin.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_designer_news_login);
    ButterKnife.bind(this);
    if (!FabTransform.setup(this, container)) {
        MorphTransform.setup(this, container, ContextCompat.getColor(this, R.color.background_light),
                getResources().getDimensionPixelSize(R.dimen.dialog_corners));
    }//from  ww w .  j  a  v  a2 s  .  c om

    loading.setVisibility(View.GONE);
    setupAccountAutocomplete();
    username.addTextChangedListener(loginFieldWatcher);
    // the primer checkbox messes with focus order so force it
    username.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                password.requestFocus();
                return true;
            }
            return false;
        }
    });
    password.addTextChangedListener(loginFieldWatcher);
    password.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE && isLoginValid()) {
                login.performClick();
                return true;
            }
            return false;
        }
    });
    designerNewsPrefs = DesignerNewsPrefs.get(this);
}

From source file:io.plaidapp.ui.DesignerNewsLogin.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_designer_news_login);
    ButterKnife.bind(this);
    FabDialogMorphSetup.setupSharedEelementTransitions(this, container,
            getResources().getDimensionPixelSize(R.dimen.dialog_corners));
    if (getWindow().getSharedElementEnterTransition() != null) {
        getWindow().getSharedElementEnterTransition().addListener(new AnimUtils.TransitionListenerAdapter() {
            @Override/*  ww  w  .j  a va2  s .  c  o m*/
            public void onTransitionEnd(Transition transition) {
                finishSetup();
            }
        });
    } else {
        finishSetup();
    }

    loading.setVisibility(View.GONE);
    setupAccountAutocomplete();
    username.addTextChangedListener(loginFieldWatcher);
    // the primer checkbox messes with focus order so force it
    username.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                password.requestFocus();
                return true;
            }
            return false;
        }
    });
    password.addTextChangedListener(loginFieldWatcher);
    password.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE && isLoginValid()) {
                login.performClick();
                return true;
            }
            return false;
        }
    });
    designerNewsPrefs = DesignerNewsPrefs.get(this);
}

From source file:com.microsoft.projectoxford.face.samples.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    isSmsPermissionGranted();//from  w ww. j av  a  2s .  com
    final SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);
    String userName = settings.getString("userName", "");
    String password = settings.getString("password", "");
    passwordField = (EditText) findViewById(R.id.passwordFieldText);
    userNameField = (EditText) findViewById(R.id.userNameFieldText);
    forgot_password = (TextView) findViewById(R.id.forgot_password);
    passwordField.setText(password);
    userNameField.setText(userName);

    signButton = (ImageButton) findViewById(R.id.signButton);
    registerNowButton = (ImageButton) findViewById(R.id.registerButton);

    helloGuest = (TextView) findViewById(R.id.helloGuestLable);

    logo = (ImageView) findViewById(R.id.logo);
    progressDialog = new ProgressDialog(this);
    progressDialog.setTitle(getString(R.string.progress_dialog_title));
    userNameField.setImeActionLabel("", EditorInfo.IME_ACTION_NEXT);

    userNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                if (userNameField.getText().toString().trim().equalsIgnoreCase("")) {
                    userNameField.setError("Oops! you need to fill this field");

                    View view = getCurrentFocus();
                    if (view != null) {
                        InputMethodManager imm = (InputMethodManager) getSystemService(
                                Context.INPUT_METHOD_SERVICE);
                        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
                    }
                }
                return false;
            }

            return false;
        }

    });

    //forgot password action
    forgot_password.setOnClickListener(new View.OnClickListener()

    {
        public void onClick(View v) {

            LayoutInflater li = LayoutInflater.from(MainActivity.this);
            View promptsView = li.inflate(R.layout.email_prompt, null);

            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(MainActivity.this);

            // set prompts.xml to alertdialog builder
            alertDialogBuilder.setView(promptsView);

            final EditText userInput = (EditText) promptsView.findViewById(R.id.editTextDialogUserInput);

            // set dialog message
            alertDialogBuilder.setCancelable(false)
                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            // get user input and set it to result
                            // edit text
                            //result.setText(userInput.getText());
                            if (!userInput.getText().toString().equals("")) {
                                ParseUser.requestPasswordResetInBackground(userInput.getText().toString(),
                                        new RequestPasswordResetCallback() {
                                            public void done(ParseException e) {
                                                if (e == null) {
                                                    Toast.makeText(MainActivity.this,
                                                            "An email was successfully "
                                                                    + "sent with reset instructions.",
                                                            Toast.LENGTH_LONG).show();
                                                } else {
                                                    Toast.makeText(MainActivity.this, "Something went wrong.",
                                                            Toast.LENGTH_LONG).show();
                                                    // Something went wrong. Look at the ParseException to see what's up.
                                                }
                                            }
                                        });
                            } else
                                Toast.makeText(getApplicationContext(), "sorry you must enter your mail",
                                        Toast.LENGTH_SHORT).show();

                        }
                    }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    });

            // create alert dialog
            AlertDialog alertDialog = alertDialogBuilder.create();

            // show it
            alertDialog.show();

        }
    }

    );

    registerNowButton.setOnClickListener(new View.OnClickListener()

    {
        public void onClick(View v) {

            Intent intent = new Intent(getBaseContext(), LoginActivity.class);
            startActivity(intent);

        }
    }

    );

    signButton.setOnClickListener(new View.OnClickListener()

    {

        public void onClick(View arg0) {
            usernametxt = userNameField.getText().toString();
            passwordtxt = passwordField.getText().toString();
            if (!usernametxt.equals(settings.getString("userName", ""))
                    || !passwordtxt.equals(settings.getString("password", ""))) {
                open(getCurrentFocus());
            } else {
                // Retrieve the text entered from the EditText

                progressDialog.setMessage("please wait...");
                progressDialog.show();
                connect();
            }

        }

    }

    );

}