Esempio n. 1
0
 @Override
 public boolean onKeyPreIme(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
     // special case for the back key, we do not even try to send it
     // to the drop down list but instead, consume it immediately
     if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
       KeyEvent.DispatcherState state = getKeyDispatcherState();
       if (state != null) {
         state.startTracking(event, this);
       }
       return true;
     } else if (event.getAction() == KeyEvent.ACTION_UP) {
       KeyEvent.DispatcherState state = getKeyDispatcherState();
       if (state != null) {
         state.handleUpEvent(event);
       }
       if (event.isTracking() && !event.isCanceled()) {
         mSearchView.clearFocus();
         mSearchView.setImeVisibility(false);
         return true;
       }
     }
   }
   return super.onKeyPreIme(keyCode, event);
 }
Esempio n. 2
0
        /** Called when the input method default action key is pressed. */
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
          clearFocus();
          if (mOnQueryEditorActionListener != null) {
            return mOnQueryEditorActionListener.onEditorAction(v, actionId, event);
          }

          return true;
        }
Esempio n. 3
0
  private void onCancelClicked() {

    boolean hanled = false;
    if (mOnCancelListener != null) {
      hanled = mOnCancelListener.onCancel();
    }

    if (!hanled) {
      mEditorTextView.setText("");
      clearFocus();
    }
  }