List of usage examples for android.view KeyEvent KEYCODE_Y
int KEYCODE_Y
To view the source code for android.view KeyEvent KEYCODE_Y.
Click Source Link
From source file:Main.java
public static int lookupKeycode(boolean shiftDown, int keycode) { switch (keycode) { // case KeyEvent.KEYCODE_SHIFT_LEFT: return 0x00; // case KeyEvent.KEYCODE_SHIFT_RIGHT: return 0x00; case KeyEvent.KEYCODE_0: return shiftDown ? 0x126 : 0x27; case KeyEvent.KEYCODE_1: return 0x30; case KeyEvent.KEYCODE_2: return 0x31; case KeyEvent.KEYCODE_3: return 0x11; case KeyEvent.KEYCODE_4: return 0x12; case KeyEvent.KEYCODE_5: return 0x13; case KeyEvent.KEYCODE_6: return 0x34; case KeyEvent.KEYCODE_7: return shiftDown ? 0x134 : 0x24; case KeyEvent.KEYCODE_8: return 0x15; case KeyEvent.KEYCODE_9: return shiftDown ? 0x115 : 0x26; case KeyEvent.KEYCODE_A: return 0x41; case KeyEvent.KEYCODE_B: return 0x64; case KeyEvent.KEYCODE_C: return 0x52; case KeyEvent.KEYCODE_D: return 0x32; case KeyEvent.KEYCODE_E: return 0x22; case KeyEvent.KEYCODE_F: return 0x43; case KeyEvent.KEYCODE_G: return 0x53; case KeyEvent.KEYCODE_H: return 0x54; case KeyEvent.KEYCODE_I: return 0x25; case KeyEvent.KEYCODE_J: return 0x45; case KeyEvent.KEYCODE_K: return 0x46; case KeyEvent.KEYCODE_L: return 0x56; case KeyEvent.KEYCODE_M: return 0x65; case KeyEvent.KEYCODE_N: return 0x55; case KeyEvent.KEYCODE_O: return 0x36; case KeyEvent.KEYCODE_P: return 0x37; case KeyEvent.KEYCODE_Q: return 0x10; case KeyEvent.KEYCODE_R: return 0x33; case KeyEvent.KEYCODE_S: return 0x51; case KeyEvent.KEYCODE_T: return 0x23; case KeyEvent.KEYCODE_U: return 0x35; case KeyEvent.KEYCODE_V: return 0x63; case KeyEvent.KEYCODE_W: return 0x21; case KeyEvent.KEYCODE_X: return 0x42; case KeyEvent.KEYCODE_Y: return 0x44; case KeyEvent.KEYCODE_Z: return 0x61; case KeyEvent.KEYCODE_SPACE: return 0x62; case KeyEvent.KEYCODE_ENTER: return 0x49; case KeyEvent.KEYCODE_DEL: return 0x59; case KeyEvent.KEYCODE_APOSTROPHE: return shiftDown ? 0x31 : 0x124; case KeyEvent.KEYCODE_POUND: return 0x111; // '#' is Shift+3 case KeyEvent.KEYCODE_MINUS: return shiftDown ? 0x238 : 0x17; case KeyEvent.KEYCODE_EQUALS: return 0x117; case KeyEvent.KEYCODE_AT: return 0x47; case KeyEvent.KEYCODE_STAR: return 0x148; case KeyEvent.KEYCODE_PERIOD: return shiftDown ? 0x248 : 0x67; case KeyEvent.KEYCODE_SEMICOLON: return 0x57; case KeyEvent.KEYCODE_SLASH: return 0x68; case KeyEvent.KEYCODE_PLUS: return 0x157; case KeyEvent.KEYCODE_COMMA: return 0x66; // case KeyEvent.KEYCODE_GRAVE: return 0x??; // case KeyEvent.KEYCODE_LEFT_BRACKET: return 0x??; // case KeyEvent.KEYCODE_RIGHT_BRACKET: return 0x??; }// w w w .j ava 2 s .c om return 0xaa; }
From source file:Main.java
public static String getChar(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_0: return "0"; case KeyEvent.KEYCODE_1: return "1"; case KeyEvent.KEYCODE_2: return "2"; case KeyEvent.KEYCODE_3: return "3"; case KeyEvent.KEYCODE_4: return "4"; case KeyEvent.KEYCODE_5: return "5"; case KeyEvent.KEYCODE_6: return "6"; case KeyEvent.KEYCODE_7: return "7"; case KeyEvent.KEYCODE_8: return "8"; case KeyEvent.KEYCODE_9: return "9"; case KeyEvent.KEYCODE_A: return "a"; case KeyEvent.KEYCODE_B: return "b"; case KeyEvent.KEYCODE_C: return "c"; case KeyEvent.KEYCODE_D: return "d"; case KeyEvent.KEYCODE_E: return "e"; case KeyEvent.KEYCODE_F: return "f"; case KeyEvent.KEYCODE_G: return "g"; case KeyEvent.KEYCODE_H: return "h"; case KeyEvent.KEYCODE_I: return "i"; case KeyEvent.KEYCODE_J: return "j"; case KeyEvent.KEYCODE_K: return "k"; case KeyEvent.KEYCODE_L: return "l"; case KeyEvent.KEYCODE_M: return "m"; case KeyEvent.KEYCODE_N: return "n"; case KeyEvent.KEYCODE_O: return "o"; case KeyEvent.KEYCODE_P: return "p"; case KeyEvent.KEYCODE_Q: return "q"; case KeyEvent.KEYCODE_R: return "r"; case KeyEvent.KEYCODE_S: return "s"; case KeyEvent.KEYCODE_T: return "t"; case KeyEvent.KEYCODE_U: return "u"; case KeyEvent.KEYCODE_V: return "v"; case KeyEvent.KEYCODE_W: return "w"; case KeyEvent.KEYCODE_X: return "x"; case KeyEvent.KEYCODE_Y: return "y"; case KeyEvent.KEYCODE_Z: return "z"; case KeyEvent.KEYCODE_DEL: return "{BKSP}"; case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: return "{ENTER}"; case KeyEvent.KEYCODE_SPACE: return " "; case KeyEvent.KEYCODE_DPAD_DOWN: return "{DOWN}"; case KeyEvent.KEYCODE_DPAD_UP: return "{UP}"; case KeyEvent.KEYCODE_DPAD_LEFT: return "{LEFT}"; case KeyEvent.KEYCODE_DPAD_RIGHT: return "{RIGHT}"; }//from w w w . j av a2s. c om return null; }
From source file:Main.java
public static String getKeyNameByCode(int code) { switch (code) { case KeyEvent.KEYCODE_0: return "<0>"; case KeyEvent.KEYCODE_1: return "<1>"; case KeyEvent.KEYCODE_2: return "<2>"; case KeyEvent.KEYCODE_3: return "<3>"; case KeyEvent.KEYCODE_4: return "<4>"; case KeyEvent.KEYCODE_5: return "<5>"; case KeyEvent.KEYCODE_6: return "<6>"; case KeyEvent.KEYCODE_7: return "<7>"; case KeyEvent.KEYCODE_8: return "<8>"; case KeyEvent.KEYCODE_9: return "<9>"; case KeyEvent.KEYCODE_A: return "<A>"; case KeyEvent.KEYCODE_B: return "<B>"; case KeyEvent.KEYCODE_C: return "<C>"; case KeyEvent.KEYCODE_D: return "<D>"; case KeyEvent.KEYCODE_E: return "<E>"; case KeyEvent.KEYCODE_F: return "<F>"; case KeyEvent.KEYCODE_G: return "<G>"; case KeyEvent.KEYCODE_H: return "<H>"; case KeyEvent.KEYCODE_I: return "<I>"; case KeyEvent.KEYCODE_J: return "<J>"; case KeyEvent.KEYCODE_K: return "<K>"; case KeyEvent.KEYCODE_L: return "<L>"; case KeyEvent.KEYCODE_M: return "<M>"; case KeyEvent.KEYCODE_N: return "<N>"; case KeyEvent.KEYCODE_O: return "<O>"; case KeyEvent.KEYCODE_P: return "<P>"; case KeyEvent.KEYCODE_Q: return "<Q>"; case KeyEvent.KEYCODE_R: return "<R>"; case KeyEvent.KEYCODE_S: return "<S>"; case KeyEvent.KEYCODE_T: return "<T>"; case KeyEvent.KEYCODE_U: return "<U>"; case KeyEvent.KEYCODE_V: return "<V>"; case KeyEvent.KEYCODE_W: return "<W>"; case KeyEvent.KEYCODE_X: return "<X>"; case KeyEvent.KEYCODE_Y: return "<Y>"; case KeyEvent.KEYCODE_Z: return "<Z>"; case KeyEvent.KEYCODE_APOSTROPHE: return "<'>"; case KeyEvent.KEYCODE_AT: return "<@>"; case KeyEvent.KEYCODE_BACK: return "<Back>"; case KeyEvent.KEYCODE_BACKSLASH: return "<\\>"; case KeyEvent.KEYCODE_CALL: return "<Call>"; case KeyEvent.KEYCODE_CAMERA: return "<Camera>"; case KeyEvent.KEYCODE_CLEAR: return "<Clear>"; case KeyEvent.KEYCODE_COMMA: return "<,>"; case KeyEvent.KEYCODE_DEL: return "<Del>"; case KeyEvent.KEYCODE_DPAD_CENTER: return "<PadCenter>"; case KeyEvent.KEYCODE_DPAD_DOWN: return "<PadDown>"; case KeyEvent.KEYCODE_DPAD_LEFT: return "<PadLeft>"; case KeyEvent.KEYCODE_DPAD_RIGHT: return "<PadRight>"; case KeyEvent.KEYCODE_DPAD_UP: return "<PadUp>"; case KeyEvent.KEYCODE_ENDCALL: return "<EndCall>"; case KeyEvent.KEYCODE_ENTER: return "<Enter>"; case KeyEvent.KEYCODE_ENVELOPE: return "<Envelope>"; case KeyEvent.KEYCODE_EQUALS: return "<=>"; case KeyEvent.KEYCODE_EXPLORER: return "<Explorer>"; case KeyEvent.KEYCODE_FOCUS: return "<??? 0>"; case KeyEvent.KEYCODE_GRAVE: return "<??? 1>"; case KeyEvent.KEYCODE_HEADSETHOOK: return "<??? 2>"; case KeyEvent.KEYCODE_HOME: return "<Home>"; case KeyEvent.KEYCODE_LEFT_BRACKET: return "<(>"; case KeyEvent.KEYCODE_MENU: return "<Menu>"; case KeyEvent.KEYCODE_MINUS: return "<->"; case KeyEvent.KEYCODE_NOTIFICATION: return "<??? 3>"; case KeyEvent.KEYCODE_NUM: return "<Num>"; case KeyEvent.KEYCODE_PERIOD: return "<??? 4>"; case KeyEvent.KEYCODE_PLUS: return "<+>"; case KeyEvent.KEYCODE_POUND: return "<??? 5>"; case KeyEvent.KEYCODE_POWER: return "<Power>"; case KeyEvent.KEYCODE_RIGHT_BRACKET: return "<)>"; case KeyEvent.KEYCODE_SEMICOLON: return "<;>"; case KeyEvent.KEYCODE_SLASH: return "</>"; case KeyEvent.KEYCODE_SOFT_LEFT: return "<??? 6>"; case KeyEvent.KEYCODE_SOFT_RIGHT: return "<??? 7>"; case KeyEvent.KEYCODE_SPACE: return "<Space>"; case KeyEvent.KEYCODE_STAR: return "<*>"; case KeyEvent.KEYCODE_SYM: return "<Sym>"; case KeyEvent.KEYCODE_TAB: return "<Tab>"; case KeyEvent.KEYCODE_VOLUME_DOWN: return "<VolumeDown>"; case KeyEvent.KEYCODE_VOLUME_UP: return "<VolumeUp>"; case KeyEvent.KEYCODE_UNKNOWN: default://w ww .jav a2s . c om return "<Unknown>"; } }
From source file:com.vmihalachi.turboeditor.fragment.EditorFragment.java
/** * {@inheritDoc}/*w w w . ja v a 2s.com*/ */ @Override public boolean onOptionsItemSelected(MenuItem item) { int i = item.getItemId(); if (i == R.id.im_save) { new SaveFile().execute(); } else if (i == R.id.im_undo) { this.mEditor.onKeyShortcut(KeyEvent.KEYCODE_Z, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_Z)); } else if (i == R.id.im_redo) { this.mEditor.onKeyShortcut(KeyEvent.KEYCODE_Y, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_Y)); } else if (i == R.id.im_editor_encoding) { EditDialogFragment dialogFrag = EditDialogFragment.newInstance(EditDialogFragment.Actions.Encoding, this.mCurrentEncoding); dialogFrag.setTargetFragment(this, 0); dialogFrag.show(getFragmentManager().beginTransaction(), "dialog"); } else if (i == R.id.im_text_size) { int fontMax = 36; float scaledDensity = getResources().getDisplayMetrics().scaledDensity; int fontCurrent = (int) (mEditor.getTextSize() / scaledDensity); SeekbarDialogFragment dialogFrag = SeekbarDialogFragment .newInstance(SeekbarDialogFragment.Actions.FileSize, fontCurrent, fontMax); dialogFrag.setTargetFragment(this, 0); dialogFrag.show(getFragmentManager().beginTransaction(), "dialog"); } else if (i == R.id.im_syntax_highlight) { item.setChecked(!item.isChecked()); PreferenceHelper.setSyntaxHiglight(getActivity(), item.isChecked()); updateTextEditor(); } else if (i == R.id.im_line_numbers) { item.setChecked(!item.isChecked()); PreferenceHelper.setLineNumbers(getActivity(), item.isChecked()); updateTextEditor(); } else if (i == R.id.im_use_monospace) { item.setChecked(!item.isChecked()); PreferenceHelper.setUseMonospace(getActivity(), item.isChecked()); updateTextEditor(); } return super.onOptionsItemSelected(item); }
From source file:com.bernard.beaconportal.activities.activity.MessageList.java
/** * Handle hotkeys//from w w w . ja v a 2s. c o m * * <p> * This method is called by {@link #dispatchKeyEvent(KeyEvent)} before any * view had the chance to consume this key event. * </p> * * @param keyCode * The value in {@code event.getKeyCode()}. * @param event * Description of the key event. * * @return {@code true} if this event was consumed. */ public boolean onCustomKeyDown(final int keyCode, final KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: { if (mMessageViewFragment != null && mDisplayMode != DisplayMode.MESSAGE_LIST && K9.useVolumeKeysForNavigationEnabled()) { showPreviousMessage(); return true; } else if (mDisplayMode != DisplayMode.MESSAGE_VIEW && K9.useVolumeKeysForListNavigationEnabled()) { mMessageListFragment.onMoveUp(); return true; } break; } case KeyEvent.KEYCODE_VOLUME_DOWN: { if (mMessageViewFragment != null && mDisplayMode != DisplayMode.MESSAGE_LIST && K9.useVolumeKeysForNavigationEnabled()) { showNextMessage(); return true; } else if (mDisplayMode != DisplayMode.MESSAGE_VIEW && K9.useVolumeKeysForListNavigationEnabled()) { mMessageListFragment.onMoveDown(); return true; } break; } case KeyEvent.KEYCODE_C: { mMessageListFragment.onCompose(); return true; } case KeyEvent.KEYCODE_Q: { if (mMessageListFragment != null && mMessageListFragment.isSingleAccountMode()) { onShowFolderList(); } return true; } case KeyEvent.KEYCODE_O: { mMessageListFragment.onCycleSort(); return true; } case KeyEvent.KEYCODE_I: { mMessageListFragment.onReverseSort(); return true; } case KeyEvent.KEYCODE_DEL: case KeyEvent.KEYCODE_D: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onDelete(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onDelete(); } return true; } case KeyEvent.KEYCODE_S: { mMessageListFragment.toggleMessageSelect(); return true; } case KeyEvent.KEYCODE_G: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onToggleFlagged(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onToggleFlagged(); } return true; } case KeyEvent.KEYCODE_M: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onMove(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onMove(); } return true; } case KeyEvent.KEYCODE_V: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onArchive(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onArchive(); } return true; } case KeyEvent.KEYCODE_Y: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onCopy(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onCopy(); } return true; } case KeyEvent.KEYCODE_Z: { if (mDisplayMode == DisplayMode.MESSAGE_LIST) { mMessageListFragment.onToggleRead(); } else if (mMessageViewFragment != null) { mMessageViewFragment.onToggleRead(); } return true; } case KeyEvent.KEYCODE_F: { if (mMessageViewFragment != null) { mMessageViewFragment.onForward(); } return true; } case KeyEvent.KEYCODE_A: { if (mMessageViewFragment != null) { mMessageViewFragment.onReplyAll(); } return true; } case KeyEvent.KEYCODE_R: { if (mMessageViewFragment != null) { mMessageViewFragment.onReply(); } return true; } case KeyEvent.KEYCODE_J: case KeyEvent.KEYCODE_P: { if (mMessageViewFragment != null) { showPreviousMessage(); } return true; } case KeyEvent.KEYCODE_N: case KeyEvent.KEYCODE_K: { if (mMessageViewFragment != null) { showNextMessage(); } return true; } /* * FIXME case KeyEvent.KEYCODE_Z: { mMessageViewFragment.zoom(event); * return true; } */ case KeyEvent.KEYCODE_H: { Toast toast = Toast.makeText(this, R.string.message_list_help_key, Toast.LENGTH_LONG); toast.show(); return true; } } return false; }
From source file:com.android.tv.MainActivity.java
@Override public boolean onKeyUp(int keyCode, KeyEvent event) { /*/*from w w w . j a v a 2s. c o m*/ * The following keyboard keys map to these remote keys or "debug actions" * - -------- * A KEYCODE_MEDIA_AUDIO_TRACK * D debug: show debug options * E updateChannelBannerAndShowIfNeeded * I KEYCODE_TV_INPUT * O debug: show display mode option * P debug: togglePipView * S KEYCODE_CAPTIONS: select subtitle * W debug: toggle screen size * V KEYCODE_MEDIA_RECORD debug: record the current channel for 30 sec * X KEYCODE_BUTTON_X KEYCODE_PROG_BLUE debug: record current channel for a few minutes * Y KEYCODE_BUTTON_Y KEYCODE_PROG_GREEN debug: Play a recording */ if (SystemProperties.LOG_KEYEVENT.getValue()) { Log.d(TAG, "onKeyUp(" + keyCode + ", " + event + ")"); } // If we are in the middle of channel change, finish it before showing overlays. finishChannelChangeIfNeeded(); if (event.getKeyCode() == KeyEvent.KEYCODE_SEARCH) { showSearchActivity(); return true; } switch (mOverlayManager.onKeyUp(keyCode, event)) { case KEY_EVENT_HANDLER_RESULT_DISPATCH_TO_OVERLAY: return super.onKeyUp(keyCode, event); case KEY_EVENT_HANDLER_RESULT_HANDLED: return true; case KEY_EVENT_HANDLER_RESULT_NOT_HANDLED: return false; case KEY_EVENT_HANDLER_RESULT_PASSTHROUGH: default: // pass through } if (mSearchFragment.isVisible()) { if (keyCode == KeyEvent.KEYCODE_BACK) { getFragmentManager().popBackStack(); return true; } return super.onKeyUp(keyCode, event); } if (keyCode == KeyEvent.KEYCODE_BACK) { // When the event is from onUnhandledInputEvent, onBackPressed is not automatically // called. Therefore, we need to explicitly call onBackPressed(). onBackPressed(); return true; } if (!mChannelTuner.areAllChannelsLoaded()) { // Now channel map is under loading. } else if (mChannelTuner.getBrowsableChannelCount() == 0) { switch (keyCode) { case KeyEvent.KEYCODE_CHANNEL_UP: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_CHANNEL_DOWN: case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_NUMPAD_ENTER: case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_E: case KeyEvent.KEYCODE_MENU: showSettingsFragment(); return true; } } else { if (KeypadChannelSwitchView.isChannelNumberKey(keyCode)) { showKeypadChannelSwitchView(keyCode); return true; } switch (keyCode) { case KeyEvent.KEYCODE_DPAD_RIGHT: if (!PermissionUtils.hasModifyParentalControls(this)) { // TODO: support this feature for non-system LC app. b/23939816 return true; } PinDialogFragment dialog = null; if (mTvView.isScreenBlocked()) { dialog = new PinDialogFragment(PinDialogFragment.PIN_DIALOG_TYPE_UNLOCK_CHANNEL, new PinDialogFragment.ResultListener() { @Override public void done(boolean success) { if (success) { unblockScreen(mTvView); mIsCurrentChannelUnblockedByUser = true; } } }); } else if (mTvView.getBlockedContentRating() != null) { final TvContentRating rating = mTvView.getBlockedContentRating(); dialog = new PinDialogFragment(PinDialogFragment.PIN_DIALOG_TYPE_UNLOCK_PROGRAM, new PinDialogFragment.ResultListener() { @Override public void done(boolean success) { if (success) { mLastAllowedRatingForCurrentChannel = rating; mTvView.unblockContent(rating); } } }); } if (dialog != null) { mOverlayManager.showDialogFragment(PinDialogFragment.DIALOG_TAG, dialog, false); } return true; case KeyEvent.KEYCODE_ENTER: case KeyEvent.KEYCODE_NUMPAD_ENTER: case KeyEvent.KEYCODE_E: case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_MENU: if (event.isCanceled()) { // Ignore canceled key. // Note that if there's a TIS granted RECEIVE_INPUT_EVENT, // fallback keys not blacklisted will have FLAG_CANCELED. // See dispatchKeyEvent() for detail. return true; } if (keyCode != KeyEvent.KEYCODE_MENU) { updateChannelBannerAndShowIfNeeded(UPDATE_CHANNEL_BANNER_REASON_FORCE_SHOW); } if (keyCode != KeyEvent.KEYCODE_E) { mOverlayManager.showMenu( mTvView.isRecordingPlayback() ? Menu.REASON_RECORDING_PLAYBACK : Menu.REASON_NONE); } return true; case KeyEvent.KEYCODE_CHANNEL_UP: case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_CHANNEL_DOWN: case KeyEvent.KEYCODE_DPAD_DOWN: // Channel change is already done in the head of this method. return true; case KeyEvent.KEYCODE_S: if (!SystemProperties.USE_DEBUG_KEYS.getValue()) { break; } case KeyEvent.KEYCODE_CAPTIONS: { mOverlayManager.getSideFragmentManager().show(new ClosedCaptionFragment()); return true; } case KeyEvent.KEYCODE_A: if (!SystemProperties.USE_DEBUG_KEYS.getValue()) { break; } case KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK: { mOverlayManager.getSideFragmentManager().show(new MultiAudioFragment()); return true; } case KeyEvent.KEYCODE_GUIDE: { mOverlayManager.showProgramGuide(); return true; } case KeyEvent.KEYCODE_INFO: { mOverlayManager.showBanner(); return true; } } } if (SystemProperties.USE_DEBUG_KEYS.getValue()) { switch (keyCode) { case KeyEvent.KEYCODE_W: { mDebugNonFullSizeScreen = !mDebugNonFullSizeScreen; if (mDebugNonFullSizeScreen) { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mTvView.getLayoutParams(); params.width = 960; params.height = 540; params.gravity = Gravity.START; mTvView.setLayoutParams(params); } else { FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mTvView.getLayoutParams(); params.width = ViewGroup.LayoutParams.MATCH_PARENT; params.height = ViewGroup.LayoutParams.MATCH_PARENT; params.gravity = Gravity.CENTER; mTvView.setLayoutParams(params); } return true; } case KeyEvent.KEYCODE_P: { togglePipView(); return true; } case KeyEvent.KEYCODE_CTRL_LEFT: case KeyEvent.KEYCODE_CTRL_RIGHT: { mUseKeycodeBlacklist = !mUseKeycodeBlacklist; return true; } case KeyEvent.KEYCODE_O: { mOverlayManager.getSideFragmentManager().show(new DisplayModeFragment()); return true; } case KeyEvent.KEYCODE_D: mOverlayManager.getSideFragmentManager().show(new DebugOptionFragment()); return true; case KeyEvent.KEYCODE_MEDIA_RECORD: // TODO(DVR) handle with debug_keys set case KeyEvent.KEYCODE_V: { DvrManager dvrManager = TvApplication.getSingletons(this).getDvrManager(); long startTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(5); long endTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(35); dvrManager.addSchedule(getCurrentChannel(), startTime, endTime); return true; } case KeyEvent.KEYCODE_PROG_BLUE: case KeyEvent.KEYCODE_BUTTON_X: case KeyEvent.KEYCODE_X: { if (CommonFeatures.DVR.isEnabled(this)) { Channel channel = mTvView.getCurrentChannel(); long channelId = channel.getId(); Program p = mProgramDataManager.getCurrentProgram(channelId); if (p == null) { long now = System.currentTimeMillis(); mDvrManager.addSchedule(channel, now, now + TimeUnit.MINUTES.toMillis(1)); } else { mDvrManager.addSchedule(p, mDvrManager.getScheduledRecordingsThatConflict(p)); } return true; } } case KeyEvent.KEYCODE_PROG_YELLOW: case KeyEvent.KEYCODE_BUTTON_Y: case KeyEvent.KEYCODE_Y: { if (CommonFeatures.DVR.isEnabled(this) && BuildCompat.isAtLeastN()) { // TODO(DVR) only get finished recordings. List<RecordedProgram> recordedPrograms = mDvrDataManager.getRecordedPrograms(); Log.d(TAG, "Found " + recordedPrograms.size() + " recordings"); if (recordedPrograms.isEmpty()) { Toast.makeText(this, "No finished recording to play", Toast.LENGTH_LONG).show(); } else { RecordedProgram r = recordedPrograms.get(0); Intent intent = new Intent(this, DvrPlayActivity.class); intent.putExtra(ScheduledRecording.RECORDING_ID_EXTRA, r.getId()); startActivity(intent); } return true; } } } } return super.onKeyUp(keyCode, event); }