KeyEvent isTracking - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for KeyEvent isTracking method.

This code example shows how to use the following methods:getAction, getKeyCode, isCanceled, isTracking, handleKeyUp
        getAudioManager().preDispatchKeyEvent(event, AudioManager.USE_DEFAULT_STREAM_TYPE);
    } 
 
    public boolean dispatchKeyEvent(KeyEvent event) {
 
        final int action = event.getAction();
        final int keyCode = event.getKeyCode();
 
        if (action == KeyEvent.ACTION_DOWN) {
            return onKeyDown(keyCode, event);
        } else { 
            return onKeyUp(keyCode, event);
        } 
    } 
     
    boolean onKeyDown(int keyCode, KeyEvent event) {
        /* **************************************************************************** 
         * HOW TO DECIDE WHERE YOUR KEY HANDLING GOES. 
         * See the comment in PhoneWindow.onKeyDown 
         * ****************************************************************************/ 

8
CodeRank
This code example shows how to use the following methods:getAction, getKeyCode, isCanceled, isTracking, handleKeyUp
        getAudioManager().preDispatchKeyEvent(event, AudioManager.USE_DEFAULT_STREAM_TYPE);
    } 
 
    public boolean dispatchKeyEvent(KeyEvent event) {
 
        final int action = event.getAction();
        final int keyCode = event.getKeyCode();
 
        if (action == KeyEvent.ACTION_DOWN) {
            return onKeyDown(keyCode, event);
        } else { 
            return onKeyUp(keyCode, event);
        } 
    } 
     
    boolean onKeyDown(int keyCode, KeyEvent event) {
        /* **************************************************************************** 
         * HOW TO DECIDE WHERE YOUR KEY HANDLING GOES. 
         * See the comment in PhoneWindow.onKeyDown 
         * ****************************************************************************/ 

8
CodeRank
This code example shows how to use the following methods:getAction, getRepeatCount, isCanceled, isTracking
        @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; 

6
CodeRank
This code example shows how to use the following methods:isCanceled, isTracking
  /** 
   * Override back button to carry music on back to the Title activity 
   */ 
  @Override 
  public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
        && !event.isCanceled()) {
      mContinueMusic = true; // Flag to keep music playing
    } 
 
    return super.onKeyUp(keyCode, event);
  } 
 
  /** 
   * Override onPause to prevent activity specific processes from running while 
   * app is in background 
   */ 
  @Override 
  public void onPause() { 
    super.onPause(); 
5
CodeRank
This code example shows how to use the following methods:isCanceled, isTracking
        return super.onKeyDown(keyCode, event);
    } 
 
    @Override 
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK && event.isTracking()
                && !event.isCanceled()) {
            if (getScale() > 1.0f) { 
                // If we're zoomed in, pressing Back jumps out to show the 
                // entire image, otherwise Back returns the user to the gallery. 
                zoomTo(1.0f); 
                return true; 
            } 
        } 
        return super.onKeyUp(keyCode, event);
    } 
 
    protected Handler mHandler = new Handler();
 
    @Override 
5
CodeRank

Related KeyEvent isTracking Questions & Answers:

isTracking Method Overview
For ACTION_UP events, indicates that the event is still being tracked from its initial down event as per FLAG_TRACKING.
See Code Examples for other Android KeyEvent Methods: