List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_DONE
int IME_ACTION_DONE
To view the source code for android.view.inputmethod EditorInfo IME_ACTION_DONE.
Click Source Link
From source file:com.ririjin.adminmobile.fragment.BasicFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View rootView = inflater.inflate(R.layout.basic_fragment, container, false);// ? dialog = new ProgressDialog(getActivity()); assetIdLinear = (LinearLayout) rootView.findViewById(R.id.assetId_linear); assetIdLinear.setVisibility(View.VISIBLE); SaveButton = (Button) rootView.findViewById(R.id.save_btn); CalculateButton = (Button) rootView.findViewById(R.id.calculate_btn); CarLinseceEdit = (EditText) rootView.findViewById(R.id.carlinsece_edit); ContractFilter = (EditText) rootView.findViewById(R.id.contract_filter); CarFactorAssess = (EditText) rootView.findViewById(R.id.car_factor_assess); AppraiserAsses = (EditText) rootView.findViewById(R.id.appraiser_asses); SaveButton.setOnClickListener(listener); CalculateButton.setOnClickListener(listener); postData = new RJPostData(getActivity().getApplicationContext(), apiUrl); CarLinseceEdit.setOnFocusChangeListener(new OnFocusChangeListener() { @Override/*w w w .ja v a2s.c om*/ public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (!hasFocus) { if (CarLinseceEdit.getText().toString().length() != 7) { Toast.makeText(getActivity(), "???", Toast.LENGTH_SHORT) .show(); ContractFilter.setText(""); } else { carlicense = GetCarLincese(CarLinseceEdit.getText().toString()); ((AddCarAcitivity) getActivity()).setcarLicense(carlicense); ContractFilter.setText(SFTP.GetNowTime() + carlicense); } } } }); CarLinseceEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Log.d(TAG, "" + actionId + "," + event); if (actionId == EditorInfo.IME_ACTION_DONE || (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { // do something; CarLinseceEdit.clearFocus(); return true; } return false; } }); return rootView; }
From source file:de.greenrobot.daoexample.NoteActivity.java
protected void addUiListeners() { editText.setOnEditorActionListener(new OnEditorActionListener() { @Override//from ww w . j a v a 2 s .c o m public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { addNote(); return true; } return false; } }); final View button = findViewById(R.id.buttonAdd); button.setEnabled(false); editText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { boolean enable = s.length() != 0; button.setEnabled(enable); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); mBtnAddAll.setOnClickListener(this); mBtnDeleteAll.setOnClickListener(this); mBtnDeleteByCount.setOnClickListener(this); mBtnQueryCount.setOnClickListener(this); mBtnQueryAll.setOnClickListener(this); mBtnQueryWithParam.setOnClickListener(this); }
From source file:org.telegram.ui.ChangeUsernameActivity.java
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("Username", R.string.Username)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override//from ww w.j a v a 2s . c o m public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == done_button) { saveName(); } } }); 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(); } fragmentView = new LinearLayout(context); ((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(0xff212121); firstNameField.setMaxLines(1); firstNameField.setLines(1); firstNameField.setPadding(0, 0, 0, 0); firstNameField.setSingleLine(true); 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.setHint(LocaleController.getString("UsernamePlaceholder", R.string.UsernamePlaceholder)); 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) fragmentView).addView(firstNameField, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 24, 24, 24, 0)); if (user != null && user.username != null && user.username.length() > 0) { firstNameField.setText(user.username); firstNameField.setSelection(firstNameField.length()); } checkTextView = new TextView(context); checkTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); checkTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); ((LinearLayout) fragmentView).addView(checkTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 24, 12, 24, 0)); TextView helpTextView = new TextView(context); helpTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); helpTextView.setTextColor(0xff6d6d72); helpTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT); helpTextView.setText( AndroidUtilities.replaceTags(LocaleController.getString("UsernameHelp", R.string.UsernameHelp))); ((LinearLayout) fragmentView).addView(helpTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 24, 10, 24, 0)); firstNameField.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { checkUserName(firstNameField.getText().toString(), false); } @Override public void afterTextChanged(Editable editable) { } }); checkTextView.setVisibility(View.GONE); return fragmentView; }
From source file:com.pindroid.authenticator.AuthenticatorActivity.java
/** * {@inheritDoc}/* ww w .j a va 2s . co m*/ */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mAccountAuthenticatorResponse = getIntent() .getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE); if (mAccountAuthenticatorResponse != null) { mAccountAuthenticatorResponse.onRequestContinued(); } mAccountManager = AccountManager.get(this); final Intent intent = getIntent(); mUsername = intent.getStringExtra(PARAM_USERNAME); mRequestNewAccount = mUsername == null; mConfirmCredentials = intent.getBooleanExtra(PARAM_CONFIRMCREDENTIALS, false); setContentView(R.layout.login_activity); mMessage = (TextView) findViewById(R.id.message); mUsernameEdit = (EditText) findViewById(R.id.username_edit); mPasswordEdit = (EditText) findViewById(R.id.password_edit); mPasswordEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { startLogin(); return true; } else { return false; } } }); if (!TextUtils.isEmpty(mUsername)) { mUsernameEdit.setText(mUsername); mPasswordEdit.requestFocus(); } }
From source file:com.xalops.spotifystreamer.fragments.SearchListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the * returned view hierarchy <em>must</em> have a ListView whose id * is {@link android.R.id#list android.R.id.list} and can optionally * have a sibling view id {@link android.R.id#empty android.R.id.empty} * that is to be shown when the list is empty. * * <p>If you are overriding this method with your own custom content, * consider including the standard layout {@link android.R.layout#list_content} * in your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only * way to have the built-in indeterminant progress state be shown. *///w w w . j av a 2s . c o m @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); //QUICK Inflate from XML file //inflater.inflate(R.layout.search_list_detail, root); // ------------------------------------------------------------------ LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ RelativeLayout rlayout = new RelativeLayout(context); EditText et = new EditText(getActivity()); et.setId(INTERNAL_SEARCH_FIELD_ID); et.setSingleLine(true); et.setInputType(InputType.TYPE_CLASS_TEXT); et.setImeOptions(EditorInfo.IME_ACTION_DONE); RelativeLayout.LayoutParams etRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); etRLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); RelativeLayout.LayoutParams lframeRLayoutParams = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); lframeRLayoutParams.addRule(RelativeLayout.BELOW, INTERNAL_SEARCH_FIELD_ID); TextView tv = new TextView(getActivity()); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); rlayout.addView(et, etRLayoutParams); rlayout.addView(lframe, lframeRLayoutParams); root.addView(rlayout, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.hbm.devices.scan.ui.android.ScanActivity.java
@Override public boolean onCreateOptionsMenu(@NonNull Menu menu) { final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.device_list_actions, menu); final MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setQueryHint(getString(R.string.search_hint)); searchView.setImeOptions(EditorInfo.IME_ACTION_DONE); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override//from ww w . j av a 2 s. co m public boolean onQueryTextSubmit(final String query) { searchView.clearFocus(); adapter.setFilterString(query); return true; } @Override public boolean onQueryTextChange(final String newText) { adapter.setFilterString(newText); return true; } }); adapter.setFilterString(null); final MenuItem pauseItem = menu.findItem(R.id.action_pause_control); if (adapter.isPaused()) { pauseItem.setIcon(R.drawable.ic_action_play); } else { pauseItem.setIcon(R.drawable.ic_action_pause); } return true; }
From source file:org.dmfs.webcal.fragments.InputTextDialogFragment.java
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (EditorInfo.IME_ACTION_DONE == actionId) { // Return input text to activity Fragment parentFragment = getParentFragment(); Activity activity = getActivity(); if (parentFragment instanceof OnTextInputListener) { ((OnTextInputListener) parentFragment).onTextInput(mEditText.getText().toString()); } else if (activity instanceof OnTextInputListener) { ((OnTextInputListener) activity).onTextInput(mEditText.getText().toString()); }// w w w .j av a2s. c om InputTextDialogFragment.this.dismiss(); return true; } return false; }
From source file:app.philm.in.fragments.LoginFragment.java
@Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent event) { if (textView == mPassword) { switch (actionId) { case EditorInfo.IME_ACTION_DONE: submit();// ww w . j a v a2 s.co m return true; } } return false; }
From source file:com.openerp.base.account.AccountFragment.java
@SuppressLint("DefaultLocale") @Override/*from w ww .j av a 2 s . c o m*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true); this.context = getActivity(); // Inflate the layout for this fragment rootView = inflater.inflate(R.layout.fragment_account, container, false); scope = new AppScope(this); rootView.findViewById(R.id.edtServerURL).requestFocus(); getActivity().setTitle(R.string.title_setup_account); chkSecureConnection = (CheckBox) rootView.findViewById(R.id.chkIsSecureConnection); edtServerUrl = (EditText) rootView.findViewById(R.id.edtServerURL); chkSecureConnection.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { String serverUrl = edtServerUrl.getText().toString().toLowerCase(); if (chkSecureConnection.isChecked()) { serverUrl = serverUrl.replace("http://", ""); serverUrl = serverUrl.replace("https://", ""); serverUrl = "https://" + serverUrl; } else { serverUrl = serverUrl.replace("https://", ""); serverUrl = serverUrl.replace("http://", ""); } edtServerUrl.setText(serverUrl); edtServerUrl.setSelection(edtServerUrl.length()); } }); edtServerUrl.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { goNext(); } return false; } }); return rootView; }
From source file:com.ririjin.adminmobile.fragment.UpdateBasiceFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View rootView = inflater.inflate(R.layout.basic_fragment, container, false);// ? dialog = new ProgressDialog(getActivity()); carlicense = ((UpdateCarActivity) getActivity()).gettcarLicense(); assetIdLinear = (LinearLayout) rootView.findViewById(R.id.assetId_linear); assetIdLinear.setVisibility(View.VISIBLE); AssetIdText = (TextView) rootView.findViewById(R.id.asset_id); AssetIdText.setText(assetId);/* w w w .j av a2s .co m*/ SaveButton = (Button) rootView.findViewById(R.id.save_btn); CalculateButton = (Button) rootView.findViewById(R.id.calculate_btn); CarLinseceEdit = (EditText) rootView.findViewById(R.id.carlinsece_edit); ContractFilter = (EditText) rootView.findViewById(R.id.contract_filter); AppraiserAsses = (EditText) rootView.findViewById(R.id.appraiser_asses); radioGroup = (RadioGroup) rootView.findViewById(R.id.cartype_radio); rZRadioButton = (RadioButton) rootView.findViewById(R.id.rongzi_btn); dYRadioButton = (RadioButton) rootView.findViewById(R.id.diya_btn); SaveButton.setOnClickListener(listener); CalculateButton.setOnClickListener(listener); postData = new RJPostData(getActivity().getApplicationContext(), apiUrl); CarLinseceEdit.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (!hasFocus) { carlicense = GetCarLincese(CarLinseceEdit.getText().toString()); ((UpdateCarActivity) getActivity()).setcarLicense(carlicense); ContractFilter.setText(SFTP.GetNowTime() + carlicense); } } }); CarLinseceEdit.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Log.d(TAG, "" + actionId + "," + event); if (actionId == EditorInfo.IME_ACTION_DONE || (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { // do something; CarLinseceEdit.clearFocus(); return true; } return false; } }); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { // TODO Auto-generated method stub } }); dialog.setMessage("?..."); dialog.setCancelable(false); dialog.show(); GetCarData(assetId); return rootView; }