Java Code Examples for android.view.KeyEvent.DispatcherState

The following are top voted examples for showing how to use android.view.KeyEvent.DispatcherState. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: boohee_v5.6   File: SearchView.java   View source code 6 votes vote down vote up
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
    if (keyCode == 4) {
        DispatcherState state;
        if (event.getAction() == 0 && event.getRepeatCount() == 0) {
            state = getKeyDispatcherState();
            if (state == null) {
                return true;
            }
            state.startTracking(event, this);
            return true;
        } else if (event.getAction() == 1) {
            state = getKeyDispatcherState();
            if (state != null) {
                state.handleUpEvent(event);
            }
            if (event.isTracking() && !event.isCanceled()) {
                this.mSearchView.clearFocus();
                this.mSearchView.setImeVisibility(false);
                return true;
            }
        }
    }
    return super.onKeyPreIme(keyCode, event);
}
 
Example 2
Project: boohee_v5.6   File: ListPopupWindow.java   View source code 6 votes vote down vote up
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
    if (keyCode == 4 && isShowing()) {
        View anchorView = this.mDropDownAnchorView;
        DispatcherState state;
        if (event.getAction() == 0 && event.getRepeatCount() == 0) {
            state = anchorView.getKeyDispatcherState();
            if (state == null) {
                return true;
            }
            state.startTracking(event, this);
            return true;
        } else if (event.getAction() == 1) {
            state = anchorView.getKeyDispatcherState();
            if (state != null) {
                state.handleUpEvent(event);
            }
            if (event.isTracking() && !event.isCanceled()) {
                dismiss();
                return true;
            }
        }
    }
    return false;
}
 
Example 3
Project: solved-hacking-problem   File: SearchView.java   View source code 6 votes vote down vote up
public boolean onKeyPreIme(int i, KeyEvent keyEvent) {
    if (i == 4) {
        DispatcherState keyDispatcherState;
        if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
            keyDispatcherState = getKeyDispatcherState();
            if (keyDispatcherState == null) {
                return true;
            }
            keyDispatcherState.startTracking(keyEvent, this);
            return true;
        } else if (keyEvent.getAction() == 1) {
            keyDispatcherState = getKeyDispatcherState();
            if (keyDispatcherState != null) {
                keyDispatcherState.handleUpEvent(keyEvent);
            }
            if (keyEvent.isTracking() && !keyEvent.isCanceled()) {
                this.f1186b.clearFocus();
                this.f1186b.setImeVisibility(false);
                return true;
            }
        }
    }
    return super.onKeyPreIme(i, keyEvent);
}
 
Example 4
Project: solved-hacking-problem   File: SearchView.java   View source code 6 votes vote down vote up
public boolean onKeyPreIme(int i, KeyEvent keyEvent) {
    if (i == 4) {
        DispatcherState keyDispatcherState;
        if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
            keyDispatcherState = getKeyDispatcherState();
            if (keyDispatcherState == null) {
                return true;
            }
            keyDispatcherState.startTracking(keyEvent, this);
            return true;
        } else if (keyEvent.getAction() == 1) {
            keyDispatcherState = getKeyDispatcherState();
            if (keyDispatcherState != null) {
                keyDispatcherState.handleUpEvent(keyEvent);
            }
            if (keyEvent.isTracking() && !keyEvent.isCanceled()) {
                this.f1186b.clearFocus();
                this.f1186b.setImeVisibility(false);
                return true;
            }
        }
    }
    return super.onKeyPreIme(i, keyEvent);
}
 
Example 5
Project: FMTech   File: PlaySearchEditText.java   View source code 6 votes vote down vote up
public boolean onKeyPreIme(int paramInt, KeyEvent paramKeyEvent)
{
  if ((paramInt == 4) && (hasFocus()) && (paramKeyEvent.getAction() == 1))
  {
    KeyEvent.DispatcherState localDispatcherState = getKeyDispatcherState();
    if (localDispatcherState != null) {
      localDispatcherState.handleUpEvent(paramKeyEvent);
    }
    if (!paramKeyEvent.isCanceled())
    {
      clearFocus();
      return true;
    }
  }
  return super.onKeyPreIme(paramInt, paramKeyEvent);
}
 
Example 6
Project: boohee_v5.6   File: MenuDialogHelper.java   View source code 5 votes vote down vote up
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
    if (keyCode == 82 || keyCode == 4) {
        Window win;
        View decor;
        DispatcherState ds;
        if (event.getAction() == 0 && event.getRepeatCount() == 0) {
            win = this.mDialog.getWindow();
            if (win != null) {
                decor = win.getDecorView();
                if (decor != null) {
                    ds = decor.getKeyDispatcherState();
                    if (ds != null) {
                        ds.startTracking(event, this);
                        return true;
                    }
                }
            }
        } else if (event.getAction() == 1 && !event.isCanceled()) {
            win = this.mDialog.getWindow();
            if (win != null) {
                decor = win.getDecorView();
                if (decor != null) {
                    ds = decor.getKeyDispatcherState();
                    if (ds != null && ds.isTracking(event)) {
                        this.mMenu.close(true);
                        dialog.dismiss();
                        return true;
                    }
                }
            }
        }
    }
    return this.mMenu.performShortcut(keyCode, event, 0);
}
 
Example 7
Project: solved-hacking-problem   File: C0271l.java   View source code 5 votes vote down vote up
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
    if (i == 82 || i == 4) {
        Window window;
        View decorView;
        DispatcherState keyDispatcherState;
        if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
            window = this.f1018c.getWindow();
            if (window != null) {
                decorView = window.getDecorView();
                if (decorView != null) {
                    keyDispatcherState = decorView.getKeyDispatcherState();
                    if (keyDispatcherState != null) {
                        keyDispatcherState.startTracking(keyEvent, this);
                        return true;
                    }
                }
            }
        } else if (keyEvent.getAction() == 1 && !keyEvent.isCanceled()) {
            window = this.f1018c.getWindow();
            if (window != null) {
                decorView = window.getDecorView();
                if (decorView != null) {
                    keyDispatcherState = decorView.getKeyDispatcherState();
                    if (keyDispatcherState != null && keyDispatcherState.isTracking(keyEvent)) {
                        this.f1017b.m2115a(true);
                        dialogInterface.dismiss();
                        return true;
                    }
                }
            }
        }
    }
    return this.f1017b.performShortcut(i, keyEvent, 0);
}
 
Example 8
Project: solved-hacking-problem   File: C0271l.java   View source code 5 votes vote down vote up
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
    if (i == 82 || i == 4) {
        Window window;
        View decorView;
        DispatcherState keyDispatcherState;
        if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) {
            window = this.f1018c.getWindow();
            if (window != null) {
                decorView = window.getDecorView();
                if (decorView != null) {
                    keyDispatcherState = decorView.getKeyDispatcherState();
                    if (keyDispatcherState != null) {
                        keyDispatcherState.startTracking(keyEvent, this);
                        return true;
                    }
                }
            }
        } else if (keyEvent.getAction() == 1 && !keyEvent.isCanceled()) {
            window = this.f1018c.getWindow();
            if (window != null) {
                decorView = window.getDecorView();
                if (decorView != null) {
                    keyDispatcherState = decorView.getKeyDispatcherState();
                    if (keyDispatcherState != null && keyDispatcherState.isTracking(keyEvent)) {
                        this.f1017b.m2115a(true);
                        dialogInterface.dismiss();
                        return true;
                    }
                }
            }
        }
    }
    return this.f1017b.performShortcut(i, keyEvent, 0);
}
 
Example 9
Project: FMTech   File: SearchView.java   View source code 5 votes vote down vote up
public boolean onKeyPreIme(int paramInt, KeyEvent paramKeyEvent)
{
  if (paramInt == 4)
  {
    if ((paramKeyEvent.getAction() == 0) && (paramKeyEvent.getRepeatCount() == 0))
    {
      KeyEvent.DispatcherState localDispatcherState2 = getKeyDispatcherState();
      if (localDispatcherState2 != null) {
        localDispatcherState2.startTracking(paramKeyEvent, this);
      }
      return true;
    }
    if (paramKeyEvent.getAction() == 1)
    {
      KeyEvent.DispatcherState localDispatcherState1 = getKeyDispatcherState();
      if (localDispatcherState1 != null) {
        localDispatcherState1.handleUpEvent(paramKeyEvent);
      }
      if ((paramKeyEvent.isTracking()) && (!paramKeyEvent.isCanceled()))
      {
        this.mSearchView.clearFocus();
        this.mSearchView.setImeVisibility(false);
        return true;
      }
    }
  }
  return super.onKeyPreIme(paramInt, paramKeyEvent);
}
 
Example 10
Project: FMTech   File: SearchView$SearchAutoComplete.java   View source code 5 votes vote down vote up
public boolean onKeyPreIme(int paramInt, KeyEvent paramKeyEvent)
{
  if (paramInt == 4)
  {
    if ((paramKeyEvent.getAction() == 0) && (paramKeyEvent.getRepeatCount() == 0))
    {
      KeyEvent.DispatcherState localDispatcherState2 = getKeyDispatcherState();
      if (localDispatcherState2 != null) {
        localDispatcherState2.startTracking(paramKeyEvent, this);
      }
      return true;
    }
    if (paramKeyEvent.getAction() == 1)
    {
      KeyEvent.DispatcherState localDispatcherState1 = getKeyDispatcherState();
      if (localDispatcherState1 != null) {
        localDispatcherState1.handleUpEvent(paramKeyEvent);
      }
      if ((paramKeyEvent.isTracking()) && (!paramKeyEvent.isCanceled()))
      {
        this.a.clearFocus();
        this.a.b(false);
        return true;
      }
    }
  }
  return super.onKeyPreIme(paramInt, paramKeyEvent);
}
 
Example 11
Project: boohee_v5.6   File: KeyEventCompatEclair.java   View source code 4 votes vote down vote up
public static boolean dispatch(KeyEvent event, Callback receiver, Object state, Object target) {
    return event.dispatch(receiver, (DispatcherState) state, target);
}
 
Example 12
Project: FMTech   File: MenuDialogHelper.java   View source code 4 votes vote down vote up
public final boolean onKey(DialogInterface paramDialogInterface, int paramInt, KeyEvent paramKeyEvent)
{
  if ((paramInt == 82) || (paramInt == 4)) {
    if ((paramKeyEvent.getAction() == 0) && (paramKeyEvent.getRepeatCount() == 0))
    {
      Window localWindow2 = this.mDialog.getWindow();
      if (localWindow2 != null)
      {
        View localView2 = localWindow2.getDecorView();
        if (localView2 != null)
        {
          KeyEvent.DispatcherState localDispatcherState2 = localView2.getKeyDispatcherState();
          if (localDispatcherState2 != null)
          {
            localDispatcherState2.startTracking(paramKeyEvent, this);
            return true;
          }
        }
      }
    }
    else if ((paramKeyEvent.getAction() == 1) && (!paramKeyEvent.isCanceled()))
    {
      Window localWindow1 = this.mDialog.getWindow();
      if (localWindow1 != null)
      {
        View localView1 = localWindow1.getDecorView();
        if (localView1 != null)
        {
          KeyEvent.DispatcherState localDispatcherState1 = localView1.getKeyDispatcherState();
          if ((localDispatcherState1 != null) && (localDispatcherState1.isTracking(paramKeyEvent)))
          {
            this.mMenu.close(true);
            paramDialogInterface.dismiss();
            return true;
          }
        }
      }
    }
  }
  return this.mMenu.performShortcut(paramInt, paramKeyEvent, 0);
}