public T input ( final BooleanRunnable runnable ) { if ( view != null && view instanceof EditText ) { EditText editText = ( EditText ) view ; if ( ( editText . getInputType ( ) & TYPE_TEXT_FLAG_MULTI_LINE ) == 0 ) editText . setOnKeyListener ( new View . OnKeyListener ( ) { public boolean onKey ( View v , int keyCode , KeyEvent event ) { if ( keyCode != KEYCODE_ENTER ) return false ; if ( event == null ) return false ; if ( event . getAction ( ) != ACTION_DOWN ) return false ; return runnable . run ( ) ; } } ) ; editText . setOnEditorActionListener ( new TextView . OnEditorActionListener ( ) { public boolean onEditorAction ( TextView v , int actionId , KeyEvent event ) { if ( actionId == IME_ACTION_DONE ) return runnable . run ( ) ; else return false ; } } ) ; } return self ( ) ; }
input event for editText