本文整理汇总了Java中android.view.KeyEvent.KEYCODE_ENDCALL属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_ENDCALL属性的具体用法?Java KeyEvent.KEYCODE_ENDCALL怎么用?Java KeyEvent.KEYCODE_ENDCALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_ENDCALL属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(THIS_FILE, "Hey you hit the key : " + keyCode);
if (controlMode == MODE_LOCKER) {
switch (keyCode) {
case KeyEvent.KEYCODE_CALL:
dispatchTriggerEvent(IOnCallActionTrigger.TAKE_CALL);
return true;
case KeyEvent.KEYCODE_ENDCALL:
//case KeyEvent.KEYCODE_POWER:
dispatchTriggerEvent(IOnCallActionTrigger.REJECT_CALL);
return true;
default:
break;
}
}
return super.onKeyDown(keyCode, event);
}
示例2: onKeyDown
@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();
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);
}
示例3: onKeyDown
@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_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 || keyCode == KeyEvent.KEYCODE_SPACE) {
if (mMediaPlayer.isPlaying()) {
pause();
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);
}
示例4: onKeyUp
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
Log.d(THIS_FILE, "Key up : " + keyCode);
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_CALL:
case KeyEvent.KEYCODE_SEARCH:
return true;
case KeyEvent.KEYCODE_ENDCALL:
return inCallAnswerControls.onKeyDown(keyCode, event);
}
return super.onKeyUp(keyCode, event);
}
示例5: onKeyDown
@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_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
|| keyCode == KeyEvent.KEYCODE_SPACE) {
if (mMediaPlayer.isPlaying()) {
pause();
mMediaController.show();
} else {
start();
mMediaController.hide();
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP
&& mMediaPlayer.isPlaying()) {
pause();
mMediaController.show();
} else {
toggleMediaControlsVisiblity();
}
}
return super.onKeyDown(keyCode, event);
}
示例6: onEmojiconDeleteEvent
/**
* 表情删除
*/
public void onEmojiconDeleteEvent(){
if (!TextUtils.isEmpty(editText.getText())) {
KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
editText.dispatchKeyEvent(event);
}
}
示例7: onEmojiconDeleteEvent
/**
* delete emojicon
*/
public void onEmojiconDeleteEvent(){
if (!TextUtils.isEmpty(editText.getText())) {
KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
editText.dispatchKeyEvent(event);
}
}
示例8: backspace
/**
* 删除Emoji表情
*
* @param editText
*/
public static void backspace(EditText editText) {
if (editText == null) {
return;
}
KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0,
0, KeyEvent.KEYCODE_ENDCALL);
editText.dispatchKeyEvent(event);
}
示例9: backspace
public static void backspace(EditText editText) {
KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
editText.dispatchKeyEvent(event);
}
示例10: backspace
public void backspace() {
final KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
dispatchKeyEvent(event);
}
示例11: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
Log.d(THIS_FILE, "Key down : " + keyCode);
switch (keyCode) {
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
//
// Volume has been adjusted by the user.
//
Log.d(THIS_FILE, "onKeyDown: Volume button pressed");
int action = AudioManager.ADJUST_RAISE;
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
action = AudioManager.ADJUST_LOWER;
}
// Detect if ringing
SipCallSession currentCallInfo = getActiveCallInfo();
// If not any active call active
if (currentCallInfo == null && serviceConnected) {
break;
}
if (service != null) {
try {
service.adjustVolume(currentCallInfo, action, AudioManager.FLAG_SHOW_UI);
} catch (RemoteException e) {
Log.e(THIS_FILE, "Can't adjust volume", e);
}
}
return true;
case KeyEvent.KEYCODE_CALL:
case KeyEvent.KEYCODE_ENDCALL:
return inCallAnswerControls.onKeyDown(keyCode, event);
case KeyEvent.KEYCODE_SEARCH:
// Prevent search
return true;
default:
// Nothing to do
}
return super.onKeyDown(keyCode, event);
}
示例12: onKeyDown
@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();
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);
}