Example usage for android.view.inputmethod EditorInfo IME_ACTION_SEND

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

Introduction

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

Prototype

int IME_ACTION_SEND

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

Click Source Link

Document

Bits of #IME_MASK_ACTION : the action key performs a "send" operation, delivering the text to its target.

Usage

From source file:de.stadtrallye.rallyesoft.fragments.AssistantAuthFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.assistant_auth_fragment, container, false);
    edit_name = (EditText) v.findViewById(R.id.name);
    edit_pass = (EditText) v.findViewById(R.id.pass);
    btn_next = (Button) v.findViewById(R.id.next);

    btn_next.setOnClickListener(new View.OnClickListener() {
        @Override//from   w  ww  . jav a 2s  . c o m
        public void onClick(View v) {
            View focus = getActivity().getCurrentFocus();
            if (focus != null) {
                InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                inputMethodManager.hideSoftInputFromWindow(focus.getWindowToken(),
                        InputMethodManager.HIDE_NOT_ALWAYS);
            }
            onNext();
        }
    });

    edit_pass.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                onNext();
            }
            return false;
        }
    });
    return v;
}

From source file:com.vk.sdk.VKCaptchaDialog.java

/**
 * Prepare, create and show dialog for displaying captcha
 *//*from  www . j  ava 2s  .c  om*/
public void show() {
    Context context = VKUIHelper.getTopActivity();
    View innerView = LayoutInflater.from(context).inflate(R.layout.dialog_vkcaptcha, null);
    assert innerView != null;
    mCaptchaAnswer = (EditText) innerView.findViewById(R.id.captchaAnswer);
    mCaptchaImage = (ImageView) innerView.findViewById(R.id.imageView);
    mProgressBar = (ProgressBar) innerView.findViewById(R.id.progressBar);

    mDensity = context.getResources().getDisplayMetrics().density;
    final AlertDialog dialog = new AlertDialog.Builder(context).setView(innerView).create();
    mCaptchaAnswer.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
        }
    });
    mCaptchaAnswer.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                sendAnswer();
                return true;
            }
            return false;
        }
    });

    dialog.setButton(AlertDialog.BUTTON_NEGATIVE, context.getString(android.R.string.ok),
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    sendAnswer();
                }
            });
    dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override
        public void onCancel(DialogInterface dialogInterface) {
            mCaptchaError.request.cancel();
        }
    });
    loadImage();
    dialog.show();
}

From source file:ca.psiphon.ploggy.FragmentComposeMessage.java

@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent event) {
    if (textView.equals(mContentEdit) && actionId == EditorInfo.IME_ACTION_SEND) {
        addNewMessage();/*from   w w w. ja va2  s  .  c o  m*/
        return true;
    }
    return false;
}

From source file:org.videolan.vlc.gui.dialogs.SavePlaylist.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEND) {
        savePlaylist();// w w  w.ja  v a 2 s.  c o m
    }
    return false;
}

From source file:com.google.reviewit.AddReviewerFragment.java

private void initInputField(final Change change) {
    AutoCompleteTextView editText = (AutoCompleteTextView) v(R.id.reviewerInput);
    editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override/*from   ww w. ja v  a 2s. c  o  m*/
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                addReviewer(change, v.getText().toString());
                handled = true;
            }
            return handled;
        }
    });
    editText.setAdapter(new SuggestReviewerAdapter(getContext()));
}

From source file:com.acceleratedio.pac_n_zoom.SaveAnmActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_save_anm);
    EventBus.getDefault().register(this);
    crt_ctx = this;
    tagText = (EditText) findViewById(R.id.sav_tags);

    tagText.addTextChangedListener(new TextWatcher() {

        @Override//w  w  w  . j  a  va  2  s  . c  o m
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

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

            final StringBuilder strBldr = new StringBuilder(key_sqnc.length());
            strBldr.append(key_sqnc);
            srch_str = strBldr.toString();
            dsply_tags();
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });

    tagText.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

            boolean handled = false;
            tags_str = tagText.getText().toString();

            if (actionId == EditorInfo.IME_ACTION_SEND) {

                progress = ProgressDialog.show(crt_ctx, "Saving the animation", "dialog message", true);
                MakePostRequest savAnimation = new MakePostRequest();
                savAnimation.execute();
                handled = true;
            }

            return handled;
        }
    });

    fil_tags = PickAnmActivity.orgnl_tags.split("(\\s*,\\s*)|(\\s* \\s*)");
    Arrays.sort(fil_tags, String.CASE_INSENSITIVE_ORDER);
    dsply_tags();
}

From source file:net.niyonkuru.koodroid.LoginActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login_activity);

    mReceiver = new DetachableResultReceiver(new Handler());
    mReceiver.setReceiver(this);

    String email;//  w  w w.jav a 2  s  .c  o  m
    String password;
    if (savedInstanceState == null) { /* activity created for the first time */
        Settings settings = App.getSettings();

        email = settings.email();
        password = settings.password();

        if (email != null && password != null) {
            /* login automatically using saved credentials */
            login(email, password);
        }
    } else {
        email = savedInstanceState.getString("email");
        password = savedInstanceState.getString("password");
    }

    mEmailEditText = (EditText) findViewById(R.id.login_email);
    mEmailEditText.setText(email);

    mPasswordEditText = (EditText) findViewById(R.id.login_password);
    mPasswordEditText.setText(password);
    mPasswordEditText.setOnEditorActionListener(new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                login(v);
            }
            return true;
        }
    });

    //        IntentUtils.actionOpenAccount(this);
}

From source file:pw.dedominic.airc.fragment.ChatFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
    View v = inflater.inflate(R.layout.fragment_chat, null);

    if (callback != null && callback.getSettings() != null && chatAdapter != null)
        chatAdapter.setFontSize(callback.getSettings().getFontSize());
    chatList = (ListView) v.findViewById(R.id.chat_list);
    chatList.setAdapter(chatAdapter);//from   ww  w .  ja va2 s.c o m
    chatList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (chatAdapter.getItem(position) == null)
                return;
            String nick = chatAdapter.getItem(position).getNick();
            int inputpos = chatInput.getSelectionStart();
            if (inputpos < 1)
                nick = nick + ":";
            chatInput.setText(chatInput.getText().insert(inputpos, nick + " "));
            chatInput.setSelection(inputpos + nick.length() + 1);
            chatInput.requestFocus();
        }
    });
    chatList.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            if (chatAdapter.getItem(position) == null)
                return true;
            String body = chatAdapter.getItem(position).toString() + " <--";
            chatInput.setText(body);
            chatInput.setSelection(body.length() + 1);
            chatInput.requestFocus();
            return true;
        }
    });
    chatInput = (EditText) v.findViewById(R.id.chat_input);
    chatInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {
                if (v.getText().toString().equals(""))
                    return true;
                IrcMessage msg = new IrcMessage(v.getText().toString(), callback.getNickname(),
                        System.currentTimeMillis());
                callback.sendMessage(msg);
                chatAdapter.notifyDataSetChanged();
                chatInput.setText("");
            }
            return true;
        }
    });
    return v;
}

From source file:org.alfresco.mobile.android.application.fragments.node.comment.CommentsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setRetainInstance(false);/*from   w  w w . j  a v  a 2 s . co m*/
    setRootView(inflater.inflate(R.layout.app_comments, container, false));

    init(getRootView(), R.string.empty_comment);

    commentText = (EditText) viewById(R.id.comment_value);
    bAdd = (ImageButton) viewById(R.id.send_comment);
    bAdd.setEnabled(false);

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

    commentText.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
            activateSend();
        }

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

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

    commentText.setImeOptions(EditorInfo.IME_ACTION_SEND);
    commentText.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (event != null && (event.getAction() == KeyEvent.ACTION_DOWN)
                    && ((actionId == EditorInfo.IME_ACTION_SEND))) {
                addcomment();
                return true;
            }
            return false;
        }
    });

    gv.setSelector(android.R.color.transparent);
    gv.setCacheColorHint(getResources().getColor(android.R.color.transparent));

    return getRootView();
}

From source file:org.awesomeapp.messenger.ui.AddContactActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    super.onCreate(savedInstanceState);

    setTitle("");

    mApp = (ImApp) getApplication();/*from  w w w .  j av a2 s .c om*/

    mHandler = new SimpleAlertHandler(this);

    setContentView(R.layout.add_contact_activity);

    TextView label = (TextView) findViewById(R.id.input_contact_label);

    mNewAddress = (EditText) findViewById(R.id.email);
    mNewAddress.addTextChangedListener(mTextWatcher);

    mNewAddress.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_ACTION_SEND) {

                inviteBuddies();
            }
            return false;
        }
    });

    Intent intent = getIntent();
    String scheme = intent.getScheme();
    if (TextUtils.equals(scheme, "xmpp")) {
        addContactFromUri(intent.getData());
    }

    setupActions();

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

}