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:io.romain.passport.ui.LoginActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTheme(R.style.Passport_Login);/*from  ww  w  .ja v a2s . com*/
    setContentView(R.layout.activity_login);

    setSupportActionBar(mActionBar);
    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mEmail.addTextChangedListener(mLoginFieldWatcher);
    mPassword.addTextChangedListener(mLoginFieldWatcher);
    mPassword.setOnEditorActionListener((v, actionId, event) -> {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            onLoginClicked();
            return true;
        }
        return false;
    });

    if (isSaving) {
        showSavingDialog();
    }

    setProfileAutocomplete();
}

From source file:com.lambdasoup.quickfit.ui.LabelDialogFragment.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
        onDone();//from w w w .  j ava 2  s . co m
        dismiss();
        return true;
    }
    return false;
}

From source file:com.fusionx.lightirc.ui.IRCFragment.java

@Override
public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) {
    final CharSequence text = mMessageBox.getText();
    if ((event == null || actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE
            || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)
            && StringUtils.isNotEmpty(text)) {
        final String message = text.toString();
        mMessageBox.setText("");
        onSendMessage(message);/*from  w  w  w  .ja va2s .c  o  m*/
        return true;
    }
    return false;
}

From source file:org.protocoder.fragments.NewProjectDialogFragment.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (EditorInfo.IME_ACTION_DONE == actionId) {
        // Return input text to activity
        doOK();//w  ww .j  ava  2s . c o m
        this.dismiss();
        return true;
    }
    return false;
}

From source file:com.hiqes.android.demopermissionsm.ui.EchoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root;/*w  ww .  ja  v  a 2s .  c  o  m*/

    // Inflate the layout for this fragment
    root = inflater.inflate(R.layout.fragment_echo, container, false);
    mEchoText = (EditText) root.findViewById(R.id.echo_text);
    mEchoText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                mSubmitListener.onClick(mSubmitBtn);
            }

            return false;
        }
    });

    mProgLogText = (TextView) root.findViewById(R.id.progress_log);
    mProgLogText.setMovementMethod(ScrollingMovementMethod.getInstance());
    mSaveProgLog = (CheckBox) root.findViewById(R.id.save_log);
    mSaveProgLog.setOnCheckedChangeListener(mCheckChangeListener);
    mTvLogWriter = new TextViewLogWriter(mProgLogText);

    mSubmitBtn = (Button) root.findViewById(R.id.echo_submit);
    mSubmitBtn.setOnClickListener(mSubmitListener);
    return root;
}

From source file:org.videolan.vlc.gui.MRLPanelFragment.java

@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
    if (keyCode == EditorInfo.IME_ACTION_DONE || keyCode == EditorInfo.IME_ACTION_GO
            || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
        return processUri();
    }//from   www  .  ja  v a 2s . com
    return false;
}

From source file:com.shalzz.attendance.activity.LoginActivity.java

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

    // set toolbar as actionbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from  w w w  . jav a2s.co m

    // Reference to the layout components
    etSapid = (EditText) findViewById(R.id.etSapid);
    etPass = (EditText) findViewById(R.id.etPass);
    bLogin = (Button) findViewById(R.id.bLogin);

    myTag = getLocalClassName();

    getHiddenData();

    // Shows the CaptchaDialog when user presses 'Done' on keyboard.
    etPass.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                if (isValid()) {
                    showCaptchaDialog();
                }
                return true;
            }
            return false;
        }
    });

    // OnClickListener event for the Login Button
    bLogin.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (isValid()) {
                showCaptchaDialog();
            }
        }
    });

    showcaseView();
}

From source file:net.mceoin.cominghome.oauth.OAuthFlowApp.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from ww  w  .j a  v  a 2  s.c  om*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.oauth);
    this.prefs = PreferenceManager.getDefaultSharedPreferences(this);

    EditText editPincode = (EditText) findViewById(R.id.editPincode);
    editPincode.addTextChangedListener(new TextWatcher() {
        public void afterTextChanged(Editable s) {
            Button usePincode = (Button) findViewById(R.id.btn_use_pincode);
            if (s.length() == 8) {
                usePincode.setEnabled(true);
            } else {
                usePincode.setEnabled(false);
            }
        }

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

        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }
    });
    editPincode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                if (v.length() == 8) {
                    usePincode();
                    return true;
                }
            }
            return false;
        }
    });

    Button usePincode = (Button) findViewById(R.id.btn_use_pincode);
    usePincode.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            usePincode();
        }
    });

    WebView webView = (WebView) findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setLoadWithOverviewMode(true);
    webView.getSettings().setUseWideViewPort(false);

    try {
        webView.loadUrl(Constants.AUTHORIZE_URL);
    } catch (Exception e) {
        e.printStackTrace();
        Toast.makeText(this, "Failed", Toast.LENGTH_LONG).show();
    }

}

From source file:org.openintents.historify.ui.fragments.ContactsListFragment.java

/** Called to have the fragment instantiate its user interface view. */
@Override/*w w  w . jav  a2 s.c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.fragment_contacts_list, container, false);

    // init search panel
    mSearchBar = (ViewGroup) layout.findViewById(R.id.searchBar);
    mEditSearch = (EditText) mSearchBar.findViewById(R.id.searchBar_editSearch);
    mEditSearch.setHint(R.string.searchbar_contacts_hint);

    if (savedInstanceState != null) {
        mSearchBar.setVisibility(savedInstanceState.getInt(STATE_SEARCH_VISIBILITY));
        mEditSearch.setText(savedInstanceState.getString(STATE_SEARCH_CONTENT));
    }

    mEditSearch.addTextChangedListener(new TextWatcher() {

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

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

        public void afterTextChanged(Editable s) {
            notifySearchTextChanged();
        }
    });

    mEditSearch.setOnEditorActionListener(new OnEditorActionListener() {
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NONE) {
                if (v.getText().toString().trim().equals(""))
                    //empty search field -- so we hide it
                    onSearchSelected();
            }
            return false;
        }
    });

    // init listview
    mLstContacts = (ListView) layout.findViewById(R.id.contacts_lstContacts);
    mLstContacts.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Contact selected = (Contact) parent.getItemAtPosition(position);
            onContactSelected(selected);
        }
    });

    // init list empty view
    View lstContactsEmptyView = inflater.inflate(R.layout.list_empty_view, null);
    ((TextView) lstContactsEmptyView).setText(R.string.contacts_no_contacts);
    ((ViewGroup) mLstContacts.getParent()).addView(lstContactsEmptyView);
    mLstContacts.setEmptyView(lstContactsEmptyView);

    return layout;

}

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/*  w w w.  j a va  2s . c  o 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;
}