2.11.0 removew 蘑戒对音量键的映射

This commit is contained in:
lianglihui
2022-10-27 16:37:58 +08:00
parent 69b65bcd59
commit b7a5727beb

View File

@@ -212,29 +212,29 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶
long currentTime = System.currentTimeMillis() / (1000);
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0);
// Log.d("liyz", "time = " + (currentTime - oldTime));
if (currentTime - oldTime > 6) {
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000);
// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶");
// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true);
CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
}
return true;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { //下和中间键盘长按,减速为-2
long currentTime = System.currentTimeMillis() / (1000);
long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_down", 0);
if (currentTime - oldTime > 6) {
SharedPrefsMgr.getInstance(getContext()).putLong("old_time_down", System.currentTimeMillis() / 1000);
// ToastUtils.showShort("长按 ↓↓↓ 减速 -2 ");
sendAcc(true, -2);
}
return true;
}
// if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) { //向上长按 开启自动驾驶
// long currentTime = System.currentTimeMillis() / (1000);
// long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_up", 0);
//// Log.d("liyz", "time = " + (currentTime - oldTime));
// if (currentTime - oldTime > 6) {
// SharedPrefsMgr.getInstance(getContext()).putLong("old_time_up", System.currentTimeMillis() / 1000);
//// ToastUtils.showShort("长按 ↑↑↑ 开启自动驾驶");
//// CallerAutoPilotManager.INSTANCE.setControlAutopilotCarAuto(true);
// CallerAutoPilotManager.INSTANCE.startAutoPilot(CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getAutopilotControlParameters());
//
// }
//
// return true;
// } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { //下和中间键盘长按,减速为-2
// long currentTime = System.currentTimeMillis() / (1000);
// long oldTime = SharedPrefsMgr.getInstance(getContext()).getLong("old_time_down", 0);
// if (currentTime - oldTime > 6) {
// SharedPrefsMgr.getInstance(getContext()).putLong("old_time_down", System.currentTimeMillis() / 1000);
//// ToastUtils.showShort("长按 ↓↓↓ 减速 -2 ");
// sendAcc(true, -2);
// }
// return true;
// }
// Log.e("liyz", "onKeyDown keyCode = " + keyCode + "--action = " + event.getAction() + "---" + event);
return super.onKeyDown(keyCode, event);