List of usage examples for android.view KeyEvent KEYCODE_ENDCALL
int KEYCODE_ENDCALL
To view the source code for android.view KeyEvent KEYCODE_ENDCALL.
Click Source Link
From source file:com.lybeat.lilyplayer.widget.media.IjkVideoView.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_VOLUME_MUTE && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL; if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { if (mMediaPlayer.isPlaying()) { pause();// w ww. j a v a 2 s . c o m mMediaController.show(); } else { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) { if (!mMediaPlayer.isPlaying()) { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { if (mMediaPlayer.isPlaying()) { pause(); mMediaController.show(); } return true; } else { toggleMediaControlsVisibility(); } } return super.onKeyDown(keyCode, event); }
From source file:com.xnxs.mediaplayer.widget.media.VRVideoView.java
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { boolean isKeyCodeSupported = keyCode != KeyEvent.KEYCODE_BACK && keyCode != KeyEvent.KEYCODE_VOLUME_UP && keyCode != KeyEvent.KEYCODE_VOLUME_DOWN && keyCode != KeyEvent.KEYCODE_VOLUME_MUTE && keyCode != KeyEvent.KEYCODE_MENU && keyCode != KeyEvent.KEYCODE_CALL && keyCode != KeyEvent.KEYCODE_ENDCALL; if (isInPlaybackState() && isKeyCodeSupported && mMediaController != null) { if (keyCode == KeyEvent.KEYCODE_HEADSETHOOK || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) { if (mMediaPlayer.isPlaying()) { pause();/*from w ww.j a v a2 s . c om*/ mMediaController.show(); } else { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_PLAY) { if (!mMediaPlayer.isPlaying()) { start(); mMediaController.hide(); } return true; } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { if (mMediaPlayer.isPlaying()) { pause(); mMediaController.show(); } return true; } else { toggleMediaControlsVisiblity(); } } return super.onKeyDown(keyCode, event); }
From source file:com.raspi.chatapp.ui.chatting.ChatFragment.java
/** * initialize the emojiconKeyboard/*from w w w . jav a2 s . co m*/ */ private void initEmoji() { // save the views I will use final EmojiconEditText emojiconEditText = (EmojiconEditText) getActivity().findViewById(R.id.chat_in); final ImageButton emojiBtn = (ImageButton) getActivity().findViewById(R.id.emoti_switch); final EmojiconPopup popup = new EmojiconPopup(getActivity().findViewById(R.id.root_view), getContext(), new EmojiconGridView.OnEmojiconClickedListener() { @Override public void OnEmojiconClicked(Emojicon emojicon) { if (emojiconEditText == null || emojicon == null) return; int start = emojiconEditText.getSelectionStart(); int end = emojiconEditText.getSelectionEnd(); if (start < 0) emojiconEditText.append(emojicon.getEmoji()); else emojiconEditText.getText().replace(Math.min(start, end), Math.max(start, end), emojicon.getEmoji(), 0, emojicon.getEmoji().length()); } }); popup.setSoftKeyboardSize(); popup.setOnSoftKeyboardOpenCloseListener(new EmojiconPopup.OnSoftKeyboardOpenCloseListener() { @Override public void onKeyboardOpen(int keyboardHeight) { } @Override public void onKeyboardClose() { if (popup.isShowing()) popup.dismiss(); } }); // open/close the emojicon keyboard when pressing the button emojiBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!popup.isShowing()) { if (popup.isKeyboardOpen()) popup.showAtBottom(); else { emojiconEditText.setFocusableInTouchMode(true); emojiconEditText.requestFocus(); popup.showAtBottomPending(); InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(emojiconEditText, InputMethodManager.SHOW_IMPLICIT); } } else popup.dismiss(); } }); popup.setOnEmojiconBackspaceClickedListener(new EmojiconPopup.OnEmojiconBackspaceClickedListener() { @Override public void onEmojiconBackspaceClicked(View view) { emojiconEditText.dispatchKeyEvent( new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL)); } }); }