本文整理汇总了Java中android.view.KeyEvent.KEYCODE_HOME属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.KEYCODE_HOME属性的具体用法?Java KeyEvent.KEYCODE_HOME怎么用?Java KeyEvent.KEYCODE_HOME使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.KEYCODE_HOME属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onReceive
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) {
String reason = intent.getStringExtra(SYSTEM_REASON);
if (TextUtils.equals(reason, SYSTEM_HOME_KEY)) {
//表示按了home键,程序到了后台
if (currentKeyCode==KeyEvent.KEYCODE_HOME && isLongPressedHome){
isLongPressedHome=false;
return;
}
}else if(TextUtils.equals(reason, SYSTEM_HOME_KEY_LONG)){
//表示长按home键,显示最近使用的程序列表
if (currentKeyCode==KeyEvent.KEYCODE_APP_SWITCH && isLongPressedRecent){
isLongPressedRecent=false;
return;
}
}else {
return;
}
refreshViewState(false);
}
}
示例2: run
@Override
public void run() {
Vibrator vibrator= (Vibrator)mContext.getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(10);
if (currentKeyCode == KeyEvent.KEYCODE_BACK){
isLongPressedCancel = true;
}else {
isLongPressedCancel = false;
}
if (currentKeyCode==KeyEvent.KEYCODE_HOME){
isLongPressedHome = true;
}
if (currentKeyCode==KeyEvent.KEYCODE_APP_SWITCH){
isLongPressedRecent = true;
}
KeyPressedTipViewController.getInstance().show(null);
}
示例3: dispatchKeyEvent
/**
* 屏蔽按键 然而并没什么用。。。
* @param keyEvent 按键事件
* @return 是否已经处理过按键
*/
@Override
public boolean dispatchKeyEvent(@NonNull KeyEvent keyEvent) {
switch (keyEvent.getKeyCode()) {
case KeyEvent.KEYCODE_POWER:
case KeyEvent.KEYCODE_HOME:
case KeyEvent.KEYCODE_BACK:
case KeyEvent.KEYCODE_CALL:
case KeyEvent.KEYCODE_SYM:
case KeyEvent.KEYCODE_VOLUME_DOWN:
case KeyEvent.KEYCODE_VOLUME_UP:
case KeyEvent.KEYCODE_STAR:
return true;
}
return super.dispatchKeyEvent(keyEvent);
}
示例4: dispatchKeyEvent
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_HOME:
return true;
case KeyEvent.KEYCODE_VOLUME_DOWN:
if (Utilities.isPropertyEnabled(DUMP_STATE_PROPERTY)) {
dumpState();
return true;
}
break;
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_HOME:
return true;
}
}
return super.dispatchKeyEvent(event);
}
示例5: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (LinphoneManager.isInstanciated() && (keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_HOME)) {
LinphoneManager.getLc().terminateCall(mCall);
finish();
}
return super.onKeyDown(keyCode, event);
}
示例6: dispatchKeyEvent
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK || event.getKeyCode() == KeyEvent.KEYCODE_HOME) {
backKeyPress.onNext(null);
}
return super.dispatchKeyEvent(event);
}
示例7: dispatchKeyEvent
public boolean dispatchKeyEvent(KeyEvent paramKeyEvent)
{
if (((paramKeyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK) || (paramKeyEvent.getKeyCode() == KeyEvent.KEYCODE_HOME)) && (this.a != null)) {
this.a.onKey(this, paramKeyEvent.getKeyCode(), paramKeyEvent);
}
return super.dispatchKeyEvent(paramKeyEvent);
}
示例8: updateTriggerType
public void updateTriggerType(){
keyPressIndex=SPHelper.getInt(ConstantUtil.LONG_PRESS_KEY_INDEX,0);
switch (keyPressIndex){
case 1:
currentKeyCode=KeyEvent.KEYCODE_BACK;
break;
case 2:
currentKeyCode=KeyEvent.KEYCODE_HOME;
break;
case 3:
currentKeyCode=KeyEvent.KEYCODE_APP_SWITCH;
break;
case 4:
currentKeyCode=KeyEvent.KEYCODE_MENU;
break;
case 5:
currentKeyCode=KeyEvent.KEYCODE_VOLUME_UP;
break;
case 6:
currentKeyCode=KeyEvent.KEYCODE_VOLUME_DOWN;
break;
case 7:
default:
currentKeyCode=0;
}
lastKeyEvent=null;
}
示例9: onKeyDown
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if(KeyEvent.KEYCODE_HOME == keyCode)
{
DLog.e(TT, "Home key pressed");
}
return super.onKeyDown(keyCode, event);
}
示例10: dispatchKeyEvent
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
mBackDown = true;
return true;
case KeyEvent.KEYCODE_HOME:
mHomeDown = true;
return true;
}
} else if (event.getAction() == KeyEvent.ACTION_UP) {
switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK:
if (!event.isCanceled()) {
// Do BACK behavior.
}
mBackDown = true;
return true;
case KeyEvent.KEYCODE_HOME:
if (!event.isCanceled()) {
// Do HOME behavior.
}
mHomeDown = true;
return true;
}
}
return super.dispatchKeyEvent(event);
}
示例11: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_HOME) {
Intent home = new Intent(this, MainActivity.class);
startActivity(home);
finish();
} else if (keyCode==KeyEvent.KEYCODE_MENU) {
Intent sett = new Intent(this, SettingsActivity.class);
startActivity(sett);
finish();
}
return super.onKeyDown(keyCode, event);
}
示例12: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_HOME) {
setResult(RESULT_OK);
Intent home = new Intent(this, MainActivity.class);
startActivity(home);
finish();
} else if (keyCode==KeyEvent.KEYCODE_MENU) {
Intent sett = new Intent(this, SettingsActivity.class);
startActivity(sett);
finish();
}
return super.onKeyDown(keyCode, event);
}
示例13: onKeyDown
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_HOME || keyCode==KeyEvent.KEYCODE_MENU) {
Intent main = new Intent(this, MainActivity.class);
startActivity(main);
setResult(RESULT_OK);
finish();
}
return super.onKeyDown(keyCode, event);
}
示例14: onKeyUp
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_HOME) {
dismiss();
}
return super.onKeyUp(keyCode, event);
}
示例15: dispatchKeyEvent
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
return (event.getKeyCode() == KeyEvent.KEYCODE_HOME) || super.dispatchKeyEvent(event);
}