当前位置: 首页>>代码示例>>Java>>正文


Java KeyEvent.KEYCODE_HOME属性代码示例

本文整理汇总了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);
    }
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:23,代码来源:KeyPressedTipViewController.java

示例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);
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:17,代码来源:KeyPressedTipViewController.java

示例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);
}
 
开发者ID:mainh,项目名称:MainCalendar,代码行数:21,代码来源:AlarmNoticeActivity.java

示例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);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:22,代码来源:Launcher.java

示例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);
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:8,代码来源:CallIncomingActivity.java

示例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);
}
 
开发者ID:shivamsingh,项目名称:lockit,代码行数:7,代码来源:LockView.java

示例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);
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:7,代码来源:KeyRelativeLayout.java

示例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;
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:27,代码来源:KeyPressedTipViewController.java

示例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);
}
 
开发者ID:atarek92,项目名称:Intelligent_Indoor_Localization_System,代码行数:8,代码来源:J2xxHyperTerm.java

示例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);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:30,代码来源:Home.java

示例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);
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:13,代码来源:FeedbackActivity.java

示例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);
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:14,代码来源:BackupActivity.java

示例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);
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:10,代码来源:SettingsActivity.java

示例14: onKeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_HOME) {
        dismiss();
    }

    return super.onKeyUp(keyCode, event);
}
 
开发者ID:vitaviva,项目名称:QRCodeScanner,代码行数:8,代码来源:CustomDialog.java

示例15: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
    return (event.getKeyCode() == KeyEvent.KEYCODE_HOME) || super.dispatchKeyEvent(event);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:4,代码来源:Launcher.java


注:本文中的android.view.KeyEvent.KEYCODE_HOME属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。