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:org.bombusim.lime.fragments.ChatFragment.java

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

    contactBar = (ContactBar) v.findViewById(R.id.contact_head);
    mMessageBox = (ChatEditText) v.findViewById(R.id.messageBox);
    mSendButton = (ImageButton) v.findViewById(R.id.sendButton);
    mSmileButton = (ImageButton) v.findViewById(R.id.smileButton);
    chatListView = (ListView) v.findViewById(R.id.chatListView);

    mChatActive = v.findViewById(R.id.chatActive);
    mChatInactive = v.findViewById(R.id.chatInactive);

    if (!getChatFragmentListener().isTabMode()) {
        contactBar.setVisibility(View.GONE);

        View abCustomView = getSherlockActivity().getSupportActionBar().getCustomView();

        contactBar = (ContactBar) abCustomView.findViewById(R.id.contactHeadActionbar);
        contactBar.removeBackground();//w  w w  .  java  2s.  c  om
    }

    registerForContextMenu(chatListView);
    enableTrackballTraversing();

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

    mSmileButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mMessageBox.showAddSmileDialog();
        }
    });

    //TODO: optional
    mMessageBox.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            if (event.getAction() != KeyEvent.ACTION_DOWN)
                return false; //filtering only KEY_DOWN

            if (keyCode != KeyEvent.KEYCODE_ENTER)
                return false;
            //if (event.isShiftPressed()) return false; //typing multiline messages with SHIFT+ENTER
            sendMessage();
            return true; //Key was processed
        }
    });

    mMessageBox.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s.length() > 0)
                sendChatState(ChatStates.COMPOSING);
        }
    });

    //TODO: optional behavior
    //messageBox.setImeActionLabel("Send", EditorInfo.IME_ACTION_SEND); //Keeps IME opened
    mMessageBox.setImeActionLabel(getString(R.string.sendMessage), EditorInfo.IME_ACTION_DONE); //Closes IME

    mMessageBox.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            switch (actionId) {
            case EditorInfo.IME_ACTION_SEND:
                sendMessage();
                return true;
            case EditorInfo.IME_ACTION_DONE:
                sendMessage();
                return false; //let IME to be closed
            }
            return false;
        }
    });

    contactBar.getContactIconView().setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            new ContactResourceSwitcher().showResources(getActivity(), visavis);
        }
    });

    return v;
}

From source file:org.alfresco.mobile.android.application.fragments.browser.CreateDocumentDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().setTitle(R.string.content_upload);
    getDialog().requestWindowFeature(Window.FEATURE_LEFT_ICON);

    View v = inflater.inflate(R.layout.sdk_create_content_props, container, false);
    tv = (EditText) v.findViewById(R.id.content_name);
    final EditText desc = (EditText) v.findViewById(R.id.content_description);
    TextView tsize = (TextView) v.findViewById(R.id.content_size);

    editTags = (EditText) v.findViewById(R.id.content_tags);

    Button button = (Button) v.findViewById(R.id.cancel);
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            File uploadFile = ((ContentFile) getArguments().getSerializable(ARGUMENT_CONTENT_FILE)).getFile();

            // If the file is a temporary file, remove it on cancellation of
            // dialog.
            if (StorageManager.isTempFile(getActivity(), uploadFile)) {
                uploadFile.delete();/*from w w w.  j a v a2s  .c o m*/
            }

            CreateDocumentDialogFragment.this.dismiss();
        }
    });

    final Button bcreate = UIUtils.initValidation(v, R.string.confirm);
    bcreate.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            createDocument(tv, desc, bcreate);
        }
    });

    if (getArguments().getSerializable(ARGUMENT_CONTENT_FILE) != null) {
        contentFile = (ContentFile) getArguments().getSerializable(ARGUMENT_CONTENT_FILE);
        originalName = contentFile.getFileName();
        tv.setText(originalName);
        tsize.setText(Formatter.formatFileSize(getActivity(), contentFile.getLength()));
        tsize.setVisibility(View.VISIBLE);
        bcreate.setEnabled(true);
    } else {
        tsize.setVisibility(View.GONE);
    }

    tv.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
            if (tv.getText().length() == 0) {
                bcreate.setEnabled(false);
                tv.setError(null);
            } else {
                bcreate.setEnabled(true);
                if (UIUtils.hasInvalidName(tv.getText().toString().trim())) {
                    tv.setError(getString(R.string.filename_error_character));
                    bcreate.setEnabled(false);
                } else {
                    tv.setError(null);
                }
            }
            if (originalName.equals(tv.getText().toString())) {
                tv.setError(getString(R.string.create_document_filename_error));
            } else {
                tv.setError(null);
            }
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {

        }
    });

    editTags.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                createDocument(tv, desc, bcreate);
                handled = true;
            }
            return handled;
        }
    });

    Folder parentFolder = getParent();
    OperationsRequestGroup group = new OperationsRequestGroup(getActivity(),
            SessionUtils.getAccount(getActivity()));
    group.enqueue(new RetrieveDocumentNameRequest(parentFolder.getIdentifier(), contentFile.getFileName())
            .setNotificationVisibility(OperationRequest.VISIBILITY_HIDDEN));
    BatchOperationManager.getInstance(getActivity()).enqueue(group);

    return v;
}

From source file:org.dmfs.tasks.InputTextDialogFragment.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (EditorInfo.IME_ACTION_DONE == actionId) {
        handleSave();//from  ww w . ja va2s.c  o  m
        return true;
    }
    return false;
}

From source file:com.b44t.ui.PasscodeActivity.java

@Override
public View createView(Context context) {
    actionBar/*from  w ww .  j a  v  a  2  s.  c om*/
            .setBackButtonImage(screen == SCREEN0_SETTINGS ? R.drawable.ic_ab_back : R.drawable.ic_close_white);
    actionBar.setAllowOverlayTitle(false);
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            } else if (id == done_button) {
                if (passcodeSetStep == 0) {
                    processNext();
                } else if (passcodeSetStep == 1) {
                    processDone();
                }
            } else if (id == pin_item) {
                currentPasswordType = 0;
                updateDropDownTextView();
            } else if (id == password_item) {
                currentPasswordType = 1;
                updateDropDownTextView();
            }
        }
    });

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;

    if (screen != SCREEN0_SETTINGS) {
        ActionBarMenu menu = actionBar.createMenu();
        menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

        titleTextView = new TextView(context);
        titleTextView.setTextColor(0xff757575);
        if (screen == SCREEN1_ENTER_CODE1) {
            if (UserConfig.passcodeHash.length() != 0) {
                titleTextView
                        .setText(LocaleController.getString("EnterNewPasscode", R.string.EnterNewPasscode));
            } else {
                titleTextView.setText(
                        LocaleController.getString("EnterNewFirstPasscode", R.string.EnterNewFirstPasscode));
            }
        } else {
            titleTextView
                    .setText(LocaleController.getString("EnterCurrentPasscode", R.string.EnterCurrentPasscode));
        }
        titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
        titleTextView.setGravity(Gravity.CENTER_HORIZONTAL);
        frameLayout.addView(titleTextView);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) titleTextView.getLayoutParams();
        layoutParams.width = LayoutHelper.WRAP_CONTENT;
        layoutParams.height = LayoutHelper.WRAP_CONTENT;
        layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
        layoutParams.topMargin = AndroidUtilities.dp(38);
        titleTextView.setLayoutParams(layoutParams);

        passwordEditText = new EditText(context);
        passwordEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
        passwordEditText.setTextColor(0xff000000);
        passwordEditText.setMaxLines(1);
        passwordEditText.setLines(1);
        passwordEditText.setGravity(Gravity.CENTER_HORIZONTAL);
        passwordEditText.setSingleLine(true);
        if (screen == SCREEN1_ENTER_CODE1) {
            passcodeSetStep = 0;
            passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
        } else {
            passcodeSetStep = 1;
            passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
        }
        passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
        passwordEditText.setTypeface(Typeface.DEFAULT);
        AndroidUtilities.clearCursorDrawable(passwordEditText);
        frameLayout.addView(passwordEditText);
        layoutParams = (FrameLayout.LayoutParams) passwordEditText.getLayoutParams();
        layoutParams.topMargin = AndroidUtilities.dp(90);
        layoutParams.height = AndroidUtilities.dp(36);
        layoutParams.leftMargin = AndroidUtilities.dp(40);
        layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
        layoutParams.rightMargin = AndroidUtilities.dp(40);
        layoutParams.width = LayoutHelper.MATCH_PARENT;
        passwordEditText.setLayoutParams(layoutParams);
        passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                if (passcodeSetStep == 0) {
                    processNext();
                    return true;
                } else if (passcodeSetStep == 1) {
                    processDone();
                    return true;
                }
                return false;
            }
        });
        passwordEditText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                if (passwordEditText.length() == 4) {
                    if (screen == SCREEN2_ENTER_CODE2 && UserConfig.passcodeType == 0) {
                        processDone();
                    } else if (screen == SCREEN1_ENTER_CODE1 && currentPasswordType == 0) {
                        if (passcodeSetStep == 0) {
                            processNext();
                        } else if (passcodeSetStep == 1) {
                            processDone();
                        }
                    }
                }
            }
        });

        passwordEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
            public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            public void onDestroyActionMode(ActionMode mode) {
            }

            public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                return false;
            }

            public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                return false;
            }
        });

        if (screen == SCREEN1_ENTER_CODE1) {
            dropDownContainer = new ActionBarMenuItem(context, menu, 0);
            dropDownContainer.setSubMenuOpenSide(1);
            dropDownContainer.addSubItem(pin_item,
                    LocaleController.getString("PasscodePIN", R.string.PasscodePIN), 0);
            dropDownContainer.addSubItem(password_item,
                    LocaleController.getString("PasscodePassword", R.string.PasscodePassword), 0);
            actionBar.addView(dropDownContainer);
            layoutParams = (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
            layoutParams.height = LayoutHelper.MATCH_PARENT;
            layoutParams.width = LayoutHelper.WRAP_CONTENT;
            layoutParams.rightMargin = AndroidUtilities.dp(40);
            layoutParams.leftMargin = AndroidUtilities.isTablet() ? AndroidUtilities.dp(64)
                    : AndroidUtilities.dp(56);
            layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
            dropDownContainer.setLayoutParams(layoutParams);
            dropDownContainer.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    dropDownContainer.toggleSubMenu();
                }
            });

            dropDown = new TextView(context);
            dropDown.setGravity(Gravity.LEFT);
            dropDown.setSingleLine(true);
            dropDown.setLines(1);
            dropDown.setMaxLines(1);
            dropDown.setEllipsize(TextUtils.TruncateAt.END);
            dropDown.setTextColor(0xffffffff);
            dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0);
            dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4));
            dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0);
            dropDownContainer.addView(dropDown);
            layoutParams = (FrameLayout.LayoutParams) dropDown.getLayoutParams();
            layoutParams.width = LayoutHelper.WRAP_CONTENT;
            layoutParams.height = LayoutHelper.WRAP_CONTENT;
            layoutParams.leftMargin = AndroidUtilities.dp(16);
            layoutParams.gravity = Gravity.CENTER_VERTICAL;
            layoutParams.bottomMargin = AndroidUtilities.dp(1);
            dropDown.setLayoutParams(layoutParams);
        } else {
            actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode));
        }

        updateDropDownTextView();
    } else {
        actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode));
        frameLayout.setBackgroundColor(0xfff0f0f0);
        listView = new ListView(context);
        listView.setDivider(null);
        listView.setDividerHeight(0);
        listView.setVerticalScrollBarEnabled(false);
        listView.setDrawSelectorOnTop(true);
        frameLayout.addView(listView);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
        layoutParams.width = LayoutHelper.MATCH_PARENT;
        layoutParams.height = LayoutHelper.MATCH_PARENT;
        layoutParams.gravity = Gravity.TOP;
        listView.setLayoutParams(layoutParams);
        listView.setAdapter(listAdapter = new ListAdapter(context));
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) {
                if (i == changePasscodeRow) {
                    presentFragment(new PasscodeActivity(SCREEN1_ENTER_CODE1));
                } else if (i == passcodeOnOffRow) {
                    TextCheckCell cell = (TextCheckCell) view;
                    if (UserConfig.passcodeHash.length() != 0) {
                        UserConfig.passcodeHash = "";
                        UserConfig.appLocked = false;
                        UserConfig.saveConfig(false);
                        int count = listView.getChildCount();
                        for (int a = 0; a < count; a++) {
                            View child = listView.getChildAt(a);
                            if (child instanceof TextSettingsCell) {
                                TextSettingsCell textCell = (TextSettingsCell) child;
                                textCell.setTextColor(0xffc6c6c6);
                                break;
                            }
                        }
                        cell.setChecked(UserConfig.passcodeHash.length() != 0);
                        NotificationCenter.getInstance()
                                .postNotificationName(NotificationCenter.didSetPasscode);
                    } else {
                        presentFragment(new PasscodeActivity(SCREEN1_ENTER_CODE1));
                    }
                } else if (i == autoLockRow) {
                    if (getParentActivity() == null) {
                        return;
                    }
                    AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
                    builder.setTitle(LocaleController.getString("AutoLock", R.string.AutoLock));
                    final NumberPicker numberPicker = new NumberPicker(getParentActivity());
                    numberPicker.setMinValue(0);
                    numberPicker.setMaxValue(4);
                    if (UserConfig.autoLockIn == 0) {
                        numberPicker.setValue(0);
                    } else if (UserConfig.autoLockIn == 60) {
                        numberPicker.setValue(1);
                    } else if (UserConfig.autoLockIn == 60 * 5) {
                        numberPicker.setValue(2);
                    } else if (UserConfig.autoLockIn == 60 * 60) {
                        numberPicker.setValue(3);
                    } else if (UserConfig.autoLockIn == 60 * 60 * 5) {
                        numberPicker.setValue(4);
                    }
                    numberPicker.setFormatter(new NumberPicker.Formatter() {
                        @Override
                        public String format(int value) {
                            if (value == 0) {
                                return LocaleController.getString("Disabled", R.string.Disabled);
                            } else if (value == 1) {
                                return ApplicationLoader.applicationContext.getResources()
                                        .getQuantityString(R.plurals.Minutes, 1, 1);
                            } else if (value == 2) {
                                return ApplicationLoader.applicationContext.getResources()
                                        .getQuantityString(R.plurals.Minutes, 5, 5);
                            } else if (value == 3) {
                                return ApplicationLoader.applicationContext.getResources()
                                        .getQuantityString(R.plurals.Hours, 1, 1);
                            } else if (value == 4) {
                                return ApplicationLoader.applicationContext.getResources()
                                        .getQuantityString(R.plurals.Hours, 5, 5);
                            }
                            return "";
                        }
                    });
                    numberPicker.setWrapSelectorWheel(false);
                    builder.setView(numberPicker);
                    builder.setNegativeButton(LocaleController.getString("Done", R.string.Done),
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    which = numberPicker.getValue();
                                    if (which == 0) {
                                        UserConfig.autoLockIn = 0;
                                    } else if (which == 1) {
                                        UserConfig.autoLockIn = 60;
                                    } else if (which == 2) {
                                        UserConfig.autoLockIn = 60 * 5;
                                    } else if (which == 3) {
                                        UserConfig.autoLockIn = 60 * 60;
                                    } else if (which == 4) {
                                        UserConfig.autoLockIn = 60 * 60 * 5;
                                    }
                                    listView.invalidateViews();
                                    UserConfig.saveConfig(false);
                                }
                            });
                    showDialog(builder.create());
                } else if (i == fingerprintRow) {
                    UserConfig.useFingerprint = !UserConfig.useFingerprint;
                    UserConfig.saveConfig(false);
                    ((TextCheckCell) view).setChecked(UserConfig.useFingerprint);
                }
            }
        });
    }

    return fragmentView;
}

From source file:org.orange.querysystem.content.ListPostsFragment.java

/**
 * <p><strong>Note</strong>{@link Build.VERSION_CODES.HONEYCOMB}?
 * {@link Build.VERSION_CODES.HONEYCOMB HONEYCOMB}</p>
 * {@link Build.VERSION_CODES.HONEYCOMB HONEYCOMB}{@link android.widget.SearchView}
 * ?{@link EditText}//from   w ww.ja v  a 2 s  .com
 *
 * @return ?{@link android.widget.SearchView SearchView}{@link EditText}
 */
private EditText insertSearchEditText() {
    final EditText mSearchEditText = new EditText(getActivity());
    mSearchEditText.setId(SEARCH_EDIT_TEXT);
    mSearchEditText.setHint(R.string.search_hint);
    mSearchEditText.setSingleLine();
    mSearchEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
    mSearchEditText.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            onSearchTextChanged(s.toString());
            if (s.length() == 0) {
                InputMethodManager imm = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(mSearchEditText.getWindowToken(), 0);
                mLinearLayout.removeView(mSearchEditText);
            }
        }
    });
    mLinearLayout.addView(mSearchEditText, 0);
    return mSearchEditText;
}

From source file:org.thoughtcrime.securesms.PassphrasePromptActivity.java

private void initializeResources() {

    ImageButton okButton = findViewById(R.id.ok_button);
    Toolbar toolbar = findViewById(R.id.toolbar);

    showButton = findViewById(R.id.passphrase_visibility);
    hideButton = findViewById(R.id.passphrase_visibility_off);
    visibilityToggle = findViewById(R.id.button_toggle);
    passphraseText = findViewById(R.id.passphrase_edit);
    passphraseAuthContainer = findViewById(R.id.password_auth_container);
    fingerprintPrompt = findViewById(R.id.fingerprint_auth_container);
    lockScreenButton = findViewById(R.id.lock_screen_auth_container);
    fingerprintManager = FingerprintManagerCompat.from(this);
    fingerprintCancellationSignal = new CancellationSignal();
    fingerprintListener = new FingerprintListener();

    setSupportActionBar(toolbar);//from w  ww.j  a  va2s .co m
    getSupportActionBar().setTitle("");

    SpannableString hint = new SpannableString(
            "  " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
    hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
    hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);

    passphraseText.setHint(hint);
    okButton.setOnClickListener(new OkButtonClickListener());
    showButton.setOnClickListener(new ShowButtonOnClickListener());
    hideButton.setOnClickListener(new HideButtonOnClickListener());
    passphraseText.setOnEditorActionListener(new PassphraseActionListener());
    passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
            EditorInfo.IME_ACTION_DONE);

    fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp);
    fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary),
            PorterDuff.Mode.SRC_IN);

    lockScreenButton.setOnClickListener(v -> resumeScreenLock());
}

From source file:com.waz.zclient.newreg.fragments.PhoneRegisterFragment.java

@Override
public void onResume() {
    super.onResume();
    tabIndicatorLayout.setCallback(this);

    changeCountryView.setOnClickListener(this);
    editTextPhone.addTextChangedListener(this);
    buttonSignIn.setOnClickListener(this);
    phoneConfirmationButton.setOnClickListener(this);
    textViewCountryCode.setOnClickListener(this);
    textViewTermsOfService.setOnClickListener(this);
    editTextPhone.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override//from   ww  w  .  jav  a 2s  . c  o  m
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                confirmPhoneNumber();
                return true;
            } else {
                return false;
            }
        }
    });
    getControllerFactory().getGlobalLayoutController().setSoftInputModeForPage(Page.PHONE_REGISTRATION);
    KeyboardUtils.showKeyboard(getActivity());
}

From source file:com.wly.net.PortScannerActivity.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    boolean result = true;
    if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) {
        // the user is done typing.

        switch (v.getId()) {
        case R.id.host_name_text:
            Toast.makeText(this, "In host_name_text case statement.", Toast.LENGTH_SHORT).show();
            host = ((EditText) v).getText().toString();
            if (validateUrl(host))
                Toast.makeText(this, "The url " + host + " is valid.", Toast.LENGTH_SHORT).show();
            if (validateIp(host))
                Toast.makeText(this, "The ip address " + host + " is valid.", Toast.LENGTH_SHORT).show();
            break;
        case R.id.port_range_text:
            parsePorts(((EditText) v).getText().toString());
            BaseAdapter adapter = (BaseAdapter) ((PortListFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.port_list_fragment)).getListAdapter();

            adapter.notifyDataSetInvalidated();
            adapter.notifyDataSetChanged();

            break;
        default://from   w w w  . j  a  va2 s.c o  m
            result = false;
            break;

        }

    }
    return result; // pass on to other listeners. 

}

From source file:org.wikipedia.descriptions.DescriptionEditView.java

@OnEditorAction(R.id.view_description_edit_text)
protected boolean descriptionTextEditorAction(int id) {
    if (id == EditorInfo.IME_ACTION_DONE) {
        if (saveButton.isEnabled() && callback != null) {
            callback.onSaveClick();//from  w  w w  . j av a  2 s.  c om
        }
        return true;
    }
    return false;
}

From source file:com.kyleszombathy.sms_scheduler.AddMessage.java

private void setupPhoneRetvLibrary() {
    phoneRetv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
    phoneRetv.setAdapter(new BaseRecipientAdapter(BaseRecipientAdapter.QUERY_TYPE_PHONE, this));
    phoneRetv.setImeOptions(EditorInfo.IME_ACTION_DONE);
}