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:Main.java

public static void performEditorActionNext(InputConnection ic) {
    ic.performEditorAction(EditorInfo.IME_ACTION_NEXT);
}

From source file:pocheng.cs125.project.simplescada.SearchKeywordFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.search_keyword_fragment, container, false);
    final TextView textView_one = (TextView) rootView.findViewById(R.id.textView1);
    final EditText areaEditText = (EditText) rootView.findViewById(R.id.area_editText);
    areaEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override/* w  w  w.  j  a v a 2s . c  o  m*/
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            boolean handled = false;
            if (i == EditorInfo.IME_ACTION_NEXT) {
                textView_one.setText("");
                areaInput = textView.getText().toString();
                if (areaInput.equals("")) {
                    areaInput = "empty";
                    handled = true;
                }
            }
            return handled;
        }
    });
    EditText deviceEditText = (EditText) rootView.findViewById(R.id.device_editText);
    deviceEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_DONE) {
                deviceInput = textView.getText().toString();
                if (deviceInput.equals("")) {
                    deviceInput = "empty";
                }
            }
            return false;
        }
    });
    Button searchButton = (Button) rootView.findViewById(R.id.search_button);
    searchButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (isEmpty(areaEditText)) {
                textView_one.setText(R.string.area_empty_warning);
            } else if (areaInput.equals("empty")) {
                textView_one.setText(R.string.area_assign_warning);
            } else {
                textView_one.setText("");
                Keyword keyword = new Keyword(areaInput, deviceInput);
                Intent intent = new Intent(getActivity(), SearchResultsActivity.class);
                intent.putExtra("keyword", keyword);
                startActivity(intent);
            }
        }
    });
    return rootView;
}

From source file:ir.rasen.charsoo.view.fragment.FragmentUserRegisterOfferBusiness.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_user_register_page_two, container, false);

    editTextEmail = (EditTextFont) view.findViewById(R.id.editText_email);
    editTextPassword = (EditTextFont) view.findViewById(R.id.editText_password);
    editTextPhoneNumber = (EditTextFont) view.findViewById(R.id.editText_PhoneNumber);

    editTextEmail.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override/* w  w  w  .j  a v a 2 s .c o  m*/
        public boolean onEditorAction(TextView textView, int actionID, KeyEvent keyEvent) {
            boolean handeled = true;
            if (actionID == EditorInfo.IME_ACTION_NEXT) {
                if (editTextPassword.getText().toString().isEmpty()) {
                    editTextPassword.requestFocus();
                } else if (editTextPhoneNumber.getText().toString().isEmpty()) {
                    editTextPhoneNumber.requestFocus();
                } else {
                    InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                            .getSystemService(Activity.INPUT_METHOD_SERVICE);
                    inputMethodManager.hideSoftInputFromWindow(editTextEmail.getWindowToken(), 0);
                    ((ActivityUserRegister) getActivity()).onDoneButtonPressed(TAG);
                }
            }
            return handeled;
        }
    });

    editTextPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionID, KeyEvent keyEvent) {
            boolean handeled = true;
            if (actionID == EditorInfo.IME_ACTION_NEXT) {
                if (editTextPhoneNumber.getText().toString().isEmpty()) {
                    editTextPhoneNumber.requestFocus();
                } else if (editTextEmail.getText().toString().isEmpty()) {
                    editTextEmail.requestFocus();
                } else {
                    InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                            .getSystemService(Activity.INPUT_METHOD_SERVICE);
                    inputMethodManager.hideSoftInputFromWindow(editTextPassword.getWindowToken(), 0);
                    ((ActivityUserRegister) getActivity()).onDoneButtonPressed(TAG);
                }
            }
            return handeled;
        }
    });

    editTextPhoneNumber.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionID, KeyEvent keyEvent) {
            boolean handeled = true;
            if (actionID == EditorInfo.IME_ACTION_DONE) {
                InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                        .getSystemService(Activity.INPUT_METHOD_SERVICE);
                inputMethodManager.hideSoftInputFromWindow(editTextPhoneNumber.getWindowToken(), 0);
                ((ActivityUserRegister) getActivity()).onDoneButtonPressed(TAG);
            }
            return handeled;
        }
    });

    editTextEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                editTextEmail.setHint("");
            } else {
                editTextEmail.setHint(getActivity().getString(R.string.email_field_hint));
                //                    if (editTextName.getText().toString().equals("")) {
                //                        editTextUserIdentifier.setHint(getActivity().getString(R.string.identifier_field_hint));
                //                    }
            }
        }
    });

    editTextPassword.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                editTextPassword.setHint("");
            } else {
                editTextPassword.setHint(getActivity().getString(R.string.password_field_hint));
                //                    if (editTextName.getText().toString().equals("")) {
                //                        editTextUserIdentifier.setHint(getActivity().getString(R.string.identifier_field_hint));
                //                    }
            }
        }
    });

    editTextPhoneNumber.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                editTextPhoneNumber.setHint("");
            } else {
                editTextPhoneNumber.setHint(getActivity().getString(R.string.mobile));
                //                    if (editTextName.getText().toString().equals("")) {
                //                        editTextUserIdentifier.setHint(getActivity().getString(R.string.identifier_field_hint));
                //                    }
            }
        }
    });

    /*String ss=getActivity().getString(R.string.licenseAgreementEnglish);
    SpannableString licenseInEnglish = new SpannableString(ss);
    ClickableSpan clickableSpan = new ClickableSpan() {
            @Override
            public void onClick(View textView) {
    //                                navigate to license in persian
            }
    };
    int leftIndex=ss.indexOf("Privacy");
    int rightIndex=ss.length();
    licenseInEnglish.setSpan(clickableSpan, leftIndex, rightIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    licenseInEnglish.setSpan(new StyleSpan(Typeface.NORMAL), 0, ss.length(), 0);
    licenseInEnglish.setSpan(new StyleSpan(Typeface.BOLD), leftIndex, rightIndex, 0);
    licenseInEnglish.setSpan(new StyleSpan(Typeface.ITALIC), leftIndex, rightIndex, 0);
    englishLicenseTextView=(TextViewFont) view.findViewById(R.id.licensesInEnglish);
    englishLicenseTextView.setText(licenseInEnglish);
    englishLicenseTextView.setMovementMethod(LinkMovementMethod.getInstance());*/
    //                persianLicenseTextView=(TextViewFont) view.findViewById(R.id.licensesInPersian);
    //                persianLicenseTextView.setText(licenseInEnglish);
    //                persianLicenseTextView.setMovementMethod(LinkMovementMethod.getInstance());
    return view;

}

From source file:ir.rasen.charsoo.view.fragment.user_register.FragmentUserRegisterPageTwo.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_register_user_page_two, container, false);

    editTextEmail = (EditTextFont) view.findViewById(R.id.editText_email);
    editTextPassword = (EditTextFont) view.findViewById(R.id.editText_password);
    editTextPhoneNumber = (EditTextFont) view.findViewById(R.id.editText_PhoneNumber);

    editTextEmail.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override/*  w  w w  . j a  v  a 2s  . co  m*/
        public boolean onEditorAction(TextView textView, int actionID, KeyEvent keyEvent) {
            boolean handeled = true;
            if (actionID == EditorInfo.IME_ACTION_NEXT) {
                if (editTextPassword.getText().toString().isEmpty()) {
                    editTextPassword.requestFocus();
                } else if (editTextPhoneNumber.getText().toString().isEmpty()) {
                    editTextPhoneNumber.requestFocus();
                } else {
                    InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                            .getSystemService(Activity.INPUT_METHOD_SERVICE);
                    inputMethodManager.hideSoftInputFromWindow(editTextEmail.getWindowToken(), 0);
                    ((ActivityUserRegister) getActivity()).onDoneButtonPressed(TAG);
                }
            }
            return handeled;
        }
    });

    editTextPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionID, KeyEvent keyEvent) {
            boolean handeled = true;
            if (actionID == EditorInfo.IME_ACTION_NEXT) {
                if (editTextPhoneNumber.getText().toString().isEmpty()) {
                    editTextPhoneNumber.requestFocus();
                } else if (editTextEmail.getText().toString().isEmpty()) {
                    editTextEmail.requestFocus();
                } else {
                    InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                            .getSystemService(Activity.INPUT_METHOD_SERVICE);
                    inputMethodManager.hideSoftInputFromWindow(editTextPassword.getWindowToken(), 0);
                    ((ActivityUserRegister) getActivity()).onDoneButtonPressed(TAG);
                }
            }
            return handeled;
        }
    });

    editTextPhoneNumber.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionID, KeyEvent keyEvent) {
            boolean handeled = true;
            if (actionID == EditorInfo.IME_ACTION_DONE) {
                InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                        .getSystemService(Activity.INPUT_METHOD_SERVICE);
                inputMethodManager.hideSoftInputFromWindow(editTextPhoneNumber.getWindowToken(), 0);
                ((ActivityUserRegister) getActivity()).onDoneButtonPressed(TAG);
            }
            return handeled;
        }
    });

    editTextEmail.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                //                    editTextEmail.setHint("");
            } else {
                editTextEmail.setHint(getActivity().getString(R.string.email_field_hint));
                //                    if (editTextName.getText().toString().equals("")) {
                //                        editTextUserIdentifier.setHint(getActivity().getString(R.string.identifier_field_hint));
                //                    }
            }
        }
    });

    editTextPassword.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                //                    editTextPassword.setHint("");
            } else {
                editTextPassword.setHint(getActivity().getString(R.string.password));
                //                    if (editTextName.getText().toString().equals("")) {
                //                        editTextUserIdentifier.setHint(getActivity().getString(R.string.identifier_field_hint));
                //                    }
            }
        }
    });

    editTextPhoneNumber.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b) {
                //                    editTextPhoneNumber.setHint("");
            } else {
                editTextPhoneNumber.setHint(getActivity().getString(R.string.mobile));
                //                    if (editTextName.getText().toString().equals("")) {
                //                        editTextUserIdentifier.setHint(getActivity().getString(R.string.identifier_field_hint));
                //                    }
            }
        }
    });

    /*String ss=getActivity().getString(R.string.licenseAgreementEnglish);
    SpannableString licenseInEnglish = new SpannableString(ss);
    ClickableSpan clickableSpan = new ClickableSpan() {
            @Override
            public void onClick(View textView) {
    //                                navigate to license in persian
            }
    };
    int leftIndex=ss.indexOf("Privacy");
    int rightIndex=ss.length();
    licenseInEnglish.setSpan(clickableSpan, leftIndex, rightIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    licenseInEnglish.setSpan(new StyleSpan(Typeface.NORMAL), 0, ss.length(), 0);
    licenseInEnglish.setSpan(new StyleSpan(Typeface.BOLD), leftIndex, rightIndex, 0);
    licenseInEnglish.setSpan(new StyleSpan(Typeface.ITALIC), leftIndex, rightIndex, 0);
    englishLicenseTextView=(TextViewFont) view.findViewById(R.id.licensesInEnglish);
    englishLicenseTextView.setText(licenseInEnglish);
    englishLicenseTextView.setMovementMethod(LinkMovementMethod.getInstance());*/
    //                persianLicenseTextView=(TextViewFont) view.findViewById(R.id.licensesInPersian);
    //                persianLicenseTextView.setText(licenseInEnglish);
    //                persianLicenseTextView.setMovementMethod(LinkMovementMethod.getInstance());

    (view.findViewById(R.id.licensesInEnglish)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openTermsOfServicesLink();
        }
    });

    (view.findViewById(R.id.licensesInPersian)).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openTermsOfServicesLink();
        }
    });

    return view;

}

From source file:org.quantumbadger.redreader.views.SearchListingHeader.java

public SearchListingHeader(final Activity parentActivity, final SearchPostListURL url) {
    super(parentActivity);
    mUrl = url;/*from   w w w .  j  a  va2 s.  c  o m*/

    LayoutInflater layoutInflater = (LayoutInflater) parentActivity
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    layoutInflater.inflate(R.layout.search_listing_header, this, true);

    mQuery = (EditText) findViewById(R.id.search_listing_header_query_editText);
    mQuery.setText(url.query);
    mQuery.setImeOptions(EditorInfo.IME_ACTION_NEXT);

    mSubreddit = (EditText) findViewById(R.id.search_listing_header_sub_editText);
    // null and "all" are isomorphic; but SearchPostListURL takes null
    if (url.subreddit == null) {
        mSubreddit.setText("all");
    } else {
        mSubreddit.setText(url.subreddit);
    }

    TextView.OnEditorActionListener onEnter = new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            performSearch(parentActivity, mSubreddit, mQuery);
            return true;
        }
    };
    mSubreddit.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
    mSubreddit.setOnEditorActionListener(onEnter);

    mSearchButton = (Button) findViewById(R.id.search_listing_header_search);
    mSearchButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            performSearch(parentActivity, mSubreddit, mQuery);
        }
    });
}

From source file:dev.drsoran.moloko.util.UIUtils.java

public final static boolean hasInputCommitted(int actionId) {
    return actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT
            || actionId == EditorInfo.IME_NULL;
}

From source file:pl.bcichecki.rms.client.android.dialogs.RegisterDialog.java

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    context = getActivity();//from  www .j ava  2 s  . c  o m

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(getString(R.string.dialog_register_title));
    builder.setMessage(getString(R.string.dialog_register_message));

    final EditText usernameEditText = new EditText(getActivity());
    usernameEditText.setHint(getString(R.string.dialog_register_enter_username_hint));
    usernameEditText.setMaxLines(1);
    usernameEditText.setSingleLine();
    usernameEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    usernameEditText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            usernameEditText.setError(null);
        }

    });

    final EditText passwordEditText = new EditText(getActivity());
    passwordEditText.setHint(getString(R.string.dialog_register_enter_password_hint));
    passwordEditText.setMaxLines(1);
    passwordEditText.setSingleLine();
    passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
    passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    passwordEditText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            passwordEditText.setError(null);
        }

    });

    final EditText emailEditText = new EditText(getActivity());
    emailEditText.setHint(getString(R.string.dialog_register_enter_email_hint));
    emailEditText.setMaxLines(1);
    emailEditText.setSingleLine();
    emailEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
    emailEditText.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            emailEditText.setError(null);
        }

    });

    final LinearLayout layout = new LinearLayout(getActivity());
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setGravity(Gravity.CENTER_HORIZONTAL);
    int space = (int) AppUtils.convertDpToPixel(getActivity(), 16);
    layout.setPadding(space, 0, space, 0);

    layout.addView(usernameEditText);
    layout.addView(passwordEditText);
    layout.addView(emailEditText);

    builder.setView(layout);

    builder.setPositiveButton(getString(R.string.dialog_register_ok), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int whichButton) {
            return;
        }
    });

    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            return;
        }
    });

    final AlertDialog dialog = builder.create();

    dialog.setOnShowListener(new DialogInterface.OnShowListener() {

        @Override
        public void onShow(DialogInterface dialogInterface) {
            utilitiesRestClient = new UtilitiesRestClient(getActivity(),
                    SharedPreferencesWrapper.getServerAddress(), SharedPreferencesWrapper.getServerPort(),
                    SharedPreferencesWrapper.getWebserviceContextPath());

            final Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE);
            positiveButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (!AppUtils.checkInternetConnection(getActivity())) {
                        Log.d(TAG, "There is NO network connected!");
                        return;
                    }

                    usernameEditText.setError(null);
                    passwordEditText.setError(null);
                    emailEditText.setError(null);

                    if (StringUtils.isBlank(usernameEditText.getText().toString())) {
                        usernameEditText.setError(getString(R.string.dialog_register_field_required));
                        return;
                    }
                    if (StringUtils.isBlank(passwordEditText.getText().toString())) {
                        passwordEditText.setError(getString(R.string.dialog_register_field_required));
                        return;
                    }
                    if (StringUtils.isBlank(emailEditText.getText().toString())) {
                        emailEditText.setError(getString(R.string.dialog_register_field_required));
                        return;
                    }
                    if (!AppUtils.validateEmail(emailEditText.getText().toString())) {
                        emailEditText.setError(getString(R.string.dialog_register_email_not_valid));
                        return;
                    }

                    final User user = new User();
                    user.setUsername(usernameEditText.getText().toString());
                    user.setPassword(SecurityUtils.hashSHA512Base64(passwordEditText.getText().toString()));
                    user.setEmail(StringUtils.lowerCase(emailEditText.getText().toString()));
                    user.setAddress(new AddressData());

                    utilitiesRestClient.registerUser(user, new AsyncHttpResponseHandler() {

                        @Override
                        public void onFailure(Throwable error, String content) {
                            Log.d(TAG,
                                    "Registering user failed. [error= " + error + ", content=" + content + "]");
                            AppUtils.showCenteredToast(context, getString(R.string.dialog_register_failed),
                                    Toast.LENGTH_LONG);
                        }

                        @Override
                        public void onFinish() {
                            positiveButton.setEnabled(true);
                        }

                        @Override
                        public void onStart() {
                            Log.d(TAG, "Registering user: " + user.toString());
                            AppUtils.showCenteredToast(context, getString(R.string.dialog_register_in_progress),
                                    Toast.LENGTH_SHORT);
                            positiveButton.setEnabled(false);
                        }

                        @Override
                        public void onSuccess(int statusCode, String content) {
                            Log.d(TAG, "Registered user successfully.");
                            AppUtils.showCenteredToast(context, getString(R.string.dialog_register_successful),
                                    Toast.LENGTH_SHORT);

                            SharedPreferencesWrapper.setUsername(user.getUsername());
                            SharedPreferencesWrapper.setPasswordHash(user.getPassword());
                            SharedPreferencesWrapper.setRememberUser(true);

                            dialog.dismiss();
                        }

                    });

                }
            });

            final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
            negativeButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    cancelRequests();
                    dialog.dismiss();
                }
            });

        }
    });

    return dialog;
}

From source file:au.com.domain.AccountsAutoCompleteTextView.java

private void init(Context context) {
    addView(mAccountsAutocomplete = new AutoCompleteTextView(context));
    mAccountsAutocomplete.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    mAccountsAutocomplete.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

    if (TextUtils.isEmpty(getHint())) {
        setHint("Email");
    }/* ww w. jav a  2  s  .  c  om*/

    // TODO Make this a custom attr (currently does nothing)
    mThreshold = mAccountsAutocomplete.getThreshold();

    setAccountOptions();
    mAccountsAutocomplete.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View view, boolean b) {
            if (b && !isPermissionGranted()) {
                mAccountsAutocomplete.showDropDown();
            }
        }
    });
    mAccountsAutocomplete.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            String currentText = charSequence.toString();
            if (!currentText.equalsIgnoreCase(getContext().getString(R.string.allow_accounts_suggestion))) {
                mCurrentText = charSequence.toString();
            }
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (isErrorEnabled()) {
                setError(null);
                setErrorEnabled(false);
            }
        }
    });
}

From source file:com.hijacker.InstallFirmwareDialog.java

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

    firmView = (EditText) dialogView.findViewById(R.id.firm_location);
    utilView = (EditText) dialogView.findViewById(R.id.util_location);
    backup_cb = (CheckBox) dialogView.findViewById(R.id.backup);

    firmView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override//from w  ww .j  av  a  2 s .  c  om
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                utilView.requestFocus();
                return true;
            }
            return false;
        }
    });
    utilView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                attemptInstall(false);
                return true;
            }
            return false;
        }
    });

    //Adjust directories
    if (!(new File("/su").exists())) {
        utilView.setText("/system/xbin");
    }
    backup_cb.setChecked(!(new File(firm_backup_file).exists()));

    dialogView.findViewById(R.id.firm_fe_btn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final FileExplorerDialog dialog = new FileExplorerDialog();
            dialog.setToSelect(FileExplorerDialog.SELECT_DIR);
            dialog.setOnSelect(new Runnable() {
                @Override
                public void run() {
                    firmView.setText(dialog.result.getAbsolutePath());
                }
            });
            dialog.show(getFragmentManager(), "FileExplorerDialog");
        }
    });
    dialogView.findViewById(R.id.util_fe_btn).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final FileExplorerDialog dialog = new FileExplorerDialog();
            dialog.setToSelect(FileExplorerDialog.SELECT_DIR);
            dialog.setOnSelect(new Runnable() {
                @Override
                public void run() {
                    utilView.setText(dialog.result.getAbsolutePath());
                }
            });
            dialog.show(getFragmentManager(), "FileExplorerDialog");
        }
    });

    shell = Shell.getFreeShell();

    builder.setView(dialogView);
    builder.setTitle(R.string.install_nexmon_title);
    builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    builder.setPositiveButton(R.string.install, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    builder.setNeutralButton(R.string.find_firmware, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
        }
    });
    return builder.create();
}

From source file:de.Maxr1998.xposed.maxlock.ui.settings.lockingtype.PinSetupFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = (ViewGroup) inflater.inflate(R.layout.fragment_pin_setup, container, false);
    mDescView = (TextView) rootView.findViewById(R.id.description);
    mSetupPinInput = (EditText) rootView.findViewById(R.id.setup_pin_input);
    mSetupPinInput.addTextChangedListener(new TextWatcher() {
        @Override/*from   ww  w.  ja  va2 s.co m*/
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {

        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
            updateUi(charSequence.length());
        }

        @Override
        public void afterTextChanged(Editable editable) {

        }
    });
    mSetupPinInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_DONE
                    || actionId == EditorInfo.IME_ACTION_NEXT) {
                if (mSetupPinInput.getText().length() > 3) {
                    handleStage();
                }
                return true;
            }
            return false;
        }
    });
    mCancelButton = (Button) rootView.findViewById(R.id.button_cancel);
    mCancelButton.setOnClickListener(this);
    mNextButton = (Button) rootView.findViewById(R.id.button_positive);
    mNextButton.setOnClickListener(this);

    updateUi(0);

    return rootView;
}