Example usage for android.view.inputmethod EditorInfo IME_ACTION_DONE

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

Introduction

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

Prototype

int IME_ACTION_DONE

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

Click Source Link

Document

Bits of #IME_MASK_ACTION : the action key performs a "done" operation, typically meaning there is nothing more to input and the IME will be closed.

Usage

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  w w.  j av  a 2  s. c  o  m
        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.teambluebaer.patientix.activities.LoginActivity.java

/**
 * In this method is defined what happens on create of the Activity:
 * Set Layout and remove titlebar// w w w .j ava2 s.c om
 *
 * @param savedInstanceState Standard parameter
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);

    setContentView(R.layout.activity_login);
    Constants.CURRENTACTIVITY = this;
    Constants.LISTOFACTIVITIES.add(this);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    Constants.TORESTART = false;
    PrefUtils.setKioskModeActive(true, this);
    buttonLogin = (Button) findViewById(R.id.buttonLogin);
    editTextPassword = (EditText) findViewById(R.id.editTextPassword);
    editTextPassword.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onClickLoginButton(v);
            }
            return true;
        }
    });
    InsertConfig.getConfig();
}

From source file:org.lunci.dumbthing.dialog.EditDumbThingDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.dialog_edit_dumb_thing, container);
    mEditText = (EditText) view.findViewById(R.id.editText_content);
    if (mModel != null) {
        mEditText.setText(mModel.getContent());
    }/*from  w ww.j a v a2  s .c om*/
    if (savedInstanceState != null) {
        mEditText.setText(savedInstanceState.getString(EXTRA_CONTENT));
    }
    mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (EditorInfo.IME_ACTION_DONE == actionId) {
                final ContentValues updatedValues = new ContentValues();
                updatedValues.put(DumbModel.Content_Field, mEditText.getText().toString());
                EventBus.getDefault()
                        .post(new EditDumbThingDialogCallbacks(mModel.getId(), updatedValues, mPosition));
                dismiss();
                return true;
            }
            return false;
        }
    });
    view.findViewById(R.id.button_positive).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            final ContentValues updatedValues = new ContentValues();
            updatedValues.put(DumbModel.Content_Field, mEditText.getText().toString());
            EventBus.getDefault()
                    .post(new EditDumbThingDialogCallbacks(mModel.getId(), updatedValues, mPosition));
            dismiss();
        }
    });
    view.findViewById(R.id.button_negative).setOnClickListener(new View.OnClickListener() {

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

    return view;
}

From source file:com.mobile.lapa.waitandsee.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mRegistrationProgressBar = (ProgressBar) findViewById(R.id.registrationProgressBar);
    mRegistrationBroadcastReceiver = new BroadcastReceiver() {
        @Override//from w  w w.ja  va 2 s  .  com
        public void onReceive(Context context, Intent intent) {
            mRegistrationProgressBar.setVisibility(ProgressBar.GONE);
            SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            boolean sentToken = sharedPreferences.getBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false);
            if (!sentToken) {
                mMessageTextView.setText(getString(R.string.token_error_message));
            }
        }
    };

    mMessageTextView = (TextView) findViewById(R.id.messageTextView);
    mTitleTextView = (TextView) findViewById(R.id.titleTextView);
    mUserNameEditText = (EditText) findViewById(R.id.userNameEditText);
    mSubmitButton = (Button) findViewById(R.id.submitButton);

    mUserNameEditText.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                mSubmitButton.performClick();
                return true;
            }
            return false;
        }
    });

    if (this.textToSpeech == null) {
        textToSpeech = new TextToSpeech(this.getApplicationContext(), new TextToSpeech.OnInitListener() {
            @Override
            public void onInit(int status) {
                if (status != TextToSpeech.ERROR) {
                    textToSpeech.setLanguage(Locale.ENGLISH); //getDefault());
                }
            }
        });
    }

    Bundle b = getIntent().getExtras();
    String title = "";
    String message = "";
    if (b != null) {
        title = b.getString("TITLE_KEY");
        message = b.getString("MESSAGE_KEY");
    }

    if (title == "" && message == "") { //(b == null) {
        mTitleTextView.setText(getString(R.string.welcome_title));
        mMessageTextView.setText(getString(R.string.welcome_message));
    } else {
        mTitleTextView.setText(title);
        mMessageTextView.setText(message);
        playSound(title);
    }

    if (checkPlayServices()) {
        // Start IntentService to register this application with GCM.
        Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);
    }
    // ------- User name ------------
    settings = getSharedPreferences("PREF_NAME", Context.MODE_PRIVATE);
    userName = settings.getString("USER_NAME", "");
    if (userName != "") {
        // user name already set
        hideUserFields();
    }
    setUserTitle();
}

From source file:am.roadpolice.roadpolice.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Initialize Database Helper.
    mDbHelper = new SQLiteHelper(getApplicationContext());

    // Get Shared Preferences.
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    mCerNum = sp.getString(CER_NUMBER, EMPTY_STRING);
    mRegNum = sp.getString(REG_NUMBER, EMPTY_STRING);
    mAutoLogin = sp.getBoolean(AUTO_LOGIN, false);

    // Edit Text Registration Certificate
    EditText regCer = ((EditText) findViewById(R.id.editTextRegistrationCertificate));
    regCer.setText(mCerNum);/*from w  ww . j a  v a  2s . com*/

    // Edit Text Registration Number.
    EditText regNum = ((EditText) findViewById(R.id.editTextVehicleRegNumber));
    regNum.setText(mRegNum);
    regNum.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onClickSubmit(null);
            }
            return false;
        }
    });

    // Automatic login into application is credentials were
    // save by the user choise.
    if (mAutoLogin) {
        startSubmission();
    }
}

From source file:de.aw.monma.hbci.FragmentMasterPassword.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    passwordView = view.findViewById(R.id.etPassword);
    passwordView.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override//from  www. j a v a  2s.  c  o m
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                onClick(passwordView);
                return true;
            }
            return false;
        }
    });
    newPasswordView = view.findViewById(R.id.etNewPassword);
    AWApplication.Log("Passwort Abfrage gestartet");
    String key = prefs.getString(getString(R.string.key), null);
    if (key != null) {
        mKey = Base64.decode(key, Base64.NO_WRAP);
    }
    if (mKey != null) {
        newPasswordView.setVisibility(View.GONE);
    }
    view.findViewById(R.id.loginBtn).setOnClickListener(this);
}

From source file:com.mercandalli.android.apps.files.user.RegistrationFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_registration, container, false);
    this.mUsername = (EditText) rootView.findViewById(R.id.fragment_registration_username);
    this.mPassword = (EditText) rootView.findViewById(R.id.fragment_registration_password);

    ((CheckBox) rootView.findViewById(R.id.fragment_registration_auto_connection))
            .setChecked(Config.isAutoConnection());
    ((CheckBox) rootView.findViewById(R.id.fragment_registration_auto_connection))
            .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override//from www  . j  a  v a  2s  .c  om
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    Config.setAutoConnection(getContext(), isChecked);
                }
            });

    this.mUsername.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
                    || (actionId == EditorInfo.IME_ACTION_DONE)) {
                RegistrationFragment.this.mPassword.requestFocus();
                return true;
            }
            return false;
        }
    });

    this.mPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER))
                    || (actionId == EditorInfo.IME_ACTION_DONE)) {
                inscription();
                return true;
            }
            return false;
        }
    });

    return rootView;
}

From source file:com.toppatch.mv.ui.activities.LoginActivity2.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
        startLoginCheck();//from ww w. j  ava2  s  .c o m
        Toast.makeText(getApplicationContext(), "Test Login", Toast.LENGTH_LONG).show();
        return true;
    }
    return false;
}

From source file:com.github.vase4kin.teamcityapp.login.view.LoginViewImpl.java

/**
 * {@inheritDoc}//from w  w w .  ja  v  a 2 s  .  c om
 */
@Override
public void initViews(final OnLoginButtonClickListener listener) {
    mUnbinder = ButterKnife.bind(this, mActivity);

    mProgressDialog = new MaterialDialog.Builder(mActivity).content(R.string.text_progress_bar_loading)
            .progress(true, 0).widgetColor(mWhiteColor).contentColor(mWhiteColor).autoDismiss(false)
            .backgroundColor(mPrimaryColor).build();
    mProgressDialog.setCancelable(false);
    mProgressDialog.setCanceledOnTouchOutside(false);

    mPassword.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                listener.onUserLoginButtonClick(mServerUrl.getText().toString().trim(),
                        mUserName.getText().toString().trim(), mPassword.getText().toString().trim());
                return true;
            }
            return false;
        }
    });

    mGuestUserSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            mUserName.setVisibility(b ? View.GONE : View.VISIBLE);
            mUserNameWrapperLayout.setVisibility(b ? View.GONE : View.VISIBLE);
            mPassword.setVisibility(b ? View.GONE : View.VISIBLE);
            mPasswordWrapperLayout.setVisibility(b ? View.GONE : View.VISIBLE);
            setupViewsRegardingUserType(b, listener);
            hideKeyboard();
        }
    });

    setupViewsRegardingUserType(false, listener);

    //Set text selection to the end
    mServerUrl.setSelection(mServerUrl.getText().length());
}

From source file:org.telegram.ui.ChangeChatNameActivity.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  o  m*/
        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.Chat currentChat = MessagesController.getInstance().getChat(chat_id);

    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.setText(currentChat.title);
    firstNameField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
    //firstNameField.setHintTextColor(0xff979797);
    firstNameField.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
    firstNameField.setMaxLines(3);
    firstNameField.setPadding(0, 0, 0, 0);
    firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    firstNameField.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE
            | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
    firstNameField.setImeOptions(EditorInfo.IME_ACTION_DONE);
    firstNameField.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    AndroidUtilities.clearCursorDrawable(firstNameField);
    firstNameField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) {
                doneButton.performClick();
                return true;
            }
            return false;
        }
    });

    linearLayout.addView(firstNameField,
            LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 24, 24, 24, 0));

    if (chat_id > 0) {
        firstNameField.setHint(LocaleController.getString("GroupName", R.string.GroupName));
    } else {
        firstNameField.setHint(LocaleController.getString("EnterListName", R.string.EnterListName));
    }
    firstNameField.setSelection(firstNameField.length());

    return fragmentView;
}