Java Code Examples for android.view.View.OnKeyListener

The following are Jave code examples for showing how to use OnKeyListener of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: iroha-demo-android   File: AccountRegisterPresenter.java   Source Code and License Vote up 5 votes
public View.OnKeyListener onKeyEventOnUserName() {
    return new View.OnKeyListener() {
        @Override
        public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
            if (keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_ENTER) {
                InputMethodManager inputMethodManager =
                        (InputMethodManager) accountRegisterView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
                return true;
            }
            return false;
        }
    };
}
 
Example 2
Project: android-util2   File: BaseWindow.java   Source Code and License Vote up 5 votes
@Override
public IWindow setOnKeyListener(View.OnKeyListener l) {
    if(mWindowView == null){
        throw new IllegalStateException("you must call #layout(...) first!");
    }
    mWindowView.setOnKeyListener(l);
    return this;
}
 
Example 3
Project: android-util2   File: GuideHelper.java   Source Code and License Vote up 5 votes
@Override
public void setOnKeyListener(View.OnKeyListener l) {
    if (l != null) {
        //this window default is clickable. so needn't reset
        ViewUtil.obtainFocus(mWindow.getWindowView());
    }
    mWindow.setOnKeyListener(l);
}
 
Example 4
Project: Bigbang   File: KeyRelativeLayout.java   Source Code and License Vote up 4 votes
public void setOnKeyListener(View.OnKeyListener paramOnKeyListener)
{
    super.setOnKeyListener(paramOnKeyListener);
    this.a = paramOnKeyListener;
}
 
Example 5
Project: leoapp-sources   File: InfoButton.java   Source Code and License Vote up 2 votes
/**
 * Delegiert von android.widget.Button
 *
 * @param l siehe {@link Button}
 */
public void setOnKeyListener(View.OnKeyListener l) {
    b.setOnKeyListener(l);
}