Java Code Examples for android.view.KeyEvent#KEYCODE_R

The following examples show how to use android.view.KeyEvent#KEYCODE_R . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoubleTapReloadRecognizer.java    From react-native-GPay with MIT License 6 votes vote down vote up
public boolean didDoubleTapR(int keyCode, View view) {
  if (keyCode == KeyEvent.KEYCODE_R && !(view instanceof EditText)) {
    if (mDoRefresh) {
      mDoRefresh = false;
      return true;
    } else {
      mDoRefresh = true;
      new Handler().postDelayed(
        new Runnable() {
          @Override
          public void run() {
            mDoRefresh = false;
          }
        },
        DOUBLE_TAP_DELAY);
    }
  }
  return false;
}
 
Example 2
Source File: EditorActivity.java    From PHONK with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onKeyShortcut(int keyCode, KeyEvent event) {
    if (event.isCtrlPressed()) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_R:
                saveAndRun();
                break;

            case KeyEvent.KEYCODE_S:
                onlySave();
                break;

            case KeyEvent.KEYCODE_F:
                toggleApiDrawer();

                break;
        }
    }
    return super.onKeyShortcut(keyCode, event);
}
 
Example 3
Source File: JsDevReloadHandler.java    From react-native-navigation with MIT License 6 votes vote down vote up
public boolean onKeyUp(int keyCode) {
	if (!devSupportManager.getDevSupportEnabled()) {
		return false;
	}

	if (keyCode == KeyEvent.KEYCODE_MENU) {
		devSupportManager.showDevOptionsDialog();
		return true;
	}

	if (keyCode == KeyEvent.KEYCODE_R) {
		if (lessThan500MillisSinceLastR()) {
			reloadReactNative();
			return true;
		}
		firstRTimestamp = System.currentTimeMillis();
	}
	return false;
}
 
Example 4
Source File: UndoRedoSupportEditText.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (DLog.DEBUG) {
        Log.w(TAG, "onKeyUp " + event);
    }
    if (handleControlKey(keyCode, event, false)) {
        return true;
    }
    if (event.isCtrlPressed() || mKeyListener.mControlKey.isActive()) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_A:
            case KeyEvent.KEYCODE_X:
            case KeyEvent.KEYCODE_C:
            case KeyEvent.KEYCODE_V:
            case KeyEvent.KEYCODE_Z:
            case KeyEvent.KEYCODE_Y:
            case KeyEvent.KEYCODE_S:
            case KeyEvent.KEYCODE_R:
            case KeyEvent.KEYCODE_F:
            case KeyEvent.KEYCODE_L:
                return true;
        }
    } else {
        switch (keyCode) {
            case KeyEvent.KEYCODE_TAB:
                return true;
        }
    }
    return super.onKeyUp(keyCode, event);

}
 
Example 5
Source File: EditorActivity.java    From spline with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    switch (keyCode) {
        case KeyEvent.KEYCODE_R:
            mViewModel.addRectLayer();
            return true;
        case KeyEvent.KEYCODE_T:
            mViewModel.addTriangleLayer();
            return true;
        case KeyEvent.KEYCODE_O:
            mViewModel.addOvalLayer();
            return true;
    }

    if (mBinding.documentView.hasFocus()) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_DEL:
            case KeyEvent.KEYCODE_FORWARD_DEL:
                return onContextMenuAction(DELETE);
        }

        if (event.isCtrlPressed()) {
            switch (keyCode) {
                case KeyEvent.KEYCODE_X:
                    return onContextMenuAction(CUT);
                case KeyEvent.KEYCODE_C:
                    return onContextMenuAction(COPY);
                case KeyEvent.KEYCODE_V:
                    return onContextMenuAction(PASTE);
                case KeyEvent.KEYCODE_D:
                    return onContextMenuAction(DUPLICATE);
                case KeyEvent.KEYCODE_G:
                    return onContextMenuAction(GROUP);
            }
        }
    }

    return super.onKeyDown(keyCode, event);
}
 
Example 6
Source File: AppRunnerActivity.java    From PHONK with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onKeyShortcut(int keyCode, KeyEvent event) {
    if (event.isCtrlPressed()) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_R:
                finish();
                break;
        }
    }
    return super.onKeyShortcut(keyCode, event);
}
 
Example 7
Source File: AudioPlayerActivity.java    From VCL-Android with Apache License 2.0 4 votes vote down vote up
public boolean onKeyDown(int keyCode, KeyEvent event){
    switch (keyCode){
        /*
         * Playback control
         */
        case KeyEvent.KEYCODE_MEDIA_PLAY:
        case KeyEvent.KEYCODE_MEDIA_PAUSE:
        case KeyEvent.KEYCODE_SPACE:
            togglePlayPause();
            return true;
        case KeyEvent.KEYCODE_MEDIA_STOP:
            mService.stop();
            finish();
            return true;
        case KeyEvent.KEYCODE_F:
        case KeyEvent.KEYCODE_BUTTON_R1:
            goNext();
            return true;
        case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
            seek(10000);
            return true;
        case KeyEvent.KEYCODE_MEDIA_REWIND:
            seek(-10000);
            return true;
        case KeyEvent.KEYCODE_R:
        case KeyEvent.KEYCODE_BUTTON_L1:
            goPrevious();
            return true;
        /*
         * Playlist navigation
         */
        case KeyEvent.KEYCODE_DPAD_UP:
            selectPrevious();
            mRecyclerView.requestFocus();
            return true;
        case KeyEvent.KEYCODE_DPAD_DOWN:
            selectNext();
            mRecyclerView.requestFocus();
            return true;
        case KeyEvent.KEYCODE_DPAD_CENTER:
            if (mRecyclerView.hasFocus()) {
                playSelection();
                return true;
            } else
            return false;
        default:
            return super.onKeyDown(keyCode, event);
    }
}
 
Example 8
Source File: VideoPlayerActivity.java    From VCL-Android with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_BUTTON_B)
        return super.onKeyDown(keyCode, event);
    if (mIsLoading) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_S:
            case KeyEvent.KEYCODE_MEDIA_STOP:
                exitOK();
                return true;
        }
        return false;
    }
    showOverlayTimeout(OVERLAY_TIMEOUT);
    switch (keyCode) {
    case KeyEvent.KEYCODE_F:
    case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
    case KeyEvent.KEYCODE_MEDIA_NEXT:
        seekDelta(10000);
        return true;
    case KeyEvent.KEYCODE_R:
    case KeyEvent.KEYCODE_MEDIA_REWIND:
    case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
        seekDelta(-10000);
        return true;
    case KeyEvent.KEYCODE_BUTTON_R1:
        seekDelta(60000);
        return true;
    case KeyEvent.KEYCODE_BUTTON_L1:
        seekDelta(-60000);
        return true;
    case KeyEvent.KEYCODE_BUTTON_A:
        if (mOverlayProgress.getVisibility() == View.VISIBLE)
            return false;
    case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
    case KeyEvent.KEYCODE_MEDIA_PLAY:
    case KeyEvent.KEYCODE_MEDIA_PAUSE:
    case KeyEvent.KEYCODE_SPACE:
        if (mIsNavMenu)
            return navigateDvdMenu(keyCode);
        else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) //prevent conflict with remote control
            return super.onKeyDown(keyCode, event);
        else
            doPlayPause();
        return true;
    case KeyEvent.KEYCODE_O:
    case KeyEvent.KEYCODE_BUTTON_Y:
    case KeyEvent.KEYCODE_MENU:
        showAdvancedOptions(mAdvOptions);
        return true;
    case KeyEvent.KEYCODE_V:
    case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK:
    case KeyEvent.KEYCODE_BUTTON_X:
        onAudioSubClick(mTracks);
        return true;
    case KeyEvent.KEYCODE_N:
        showNavMenu();
        return true;
    case KeyEvent.KEYCODE_A:
        resizeVideo();
        return true;
    case KeyEvent.KEYCODE_M:
    case KeyEvent.KEYCODE_VOLUME_MUTE:
        updateMute();
        return true;
    case KeyEvent.KEYCODE_S:
    case KeyEvent.KEYCODE_MEDIA_STOP:
        exitOK();
        return true;
    case KeyEvent.KEYCODE_DPAD_UP:
    case KeyEvent.KEYCODE_DPAD_DOWN:
    case KeyEvent.KEYCODE_DPAD_LEFT:
    case KeyEvent.KEYCODE_DPAD_RIGHT:
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_ENTER:
        if (mIsNavMenu)
            return navigateDvdMenu(keyCode);
        else
            return super.onKeyDown(keyCode, event);
    case KeyEvent.KEYCODE_J:
        delayAudio(-50000l);
        return true;
    case KeyEvent.KEYCODE_K:
        delayAudio(50000l);
        return true;
    case KeyEvent.KEYCODE_G:
        delaySubs(-50000l);
        return true;
    case KeyEvent.KEYCODE_H:
        delaySubs(50000l);
        return true;
    case KeyEvent.KEYCODE_VOLUME_DOWN:
    case KeyEvent.KEYCODE_VOLUME_UP:
        if (mMute) {
            updateMute();
            return true;
        } else
            return false;
    }
    return super.onKeyDown(keyCode, event);
}