未验证 提交 c91373f5 编写于 作者: O openharmony_ci 提交者: Gitee

!4869 多模示例修改

Merge pull request !4869 from mayunteng/myt
......@@ -38,10 +38,10 @@ inputDevice.on("change", (data) => {
console.log("type: " + data.type + ", deviceId: " + data.deviceId);
inputDevice.getKeyboardType(data.deviceId, (ret) => {
console.log("The keyboard type of the device is: " + ret);
if (ret == 2 && data.type == 'add') {
if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') {
// 监听物理键盘已连接。
isPhysicalKeyboardExist = true;
} else if (ret == 2 && data.type == 'remove') {
} else if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') {
// 监听物理键盘已断开。
isPhysicalKeyboardExist = false;
}
......@@ -382,4 +382,4 @@ inputDevice.getKeyboardType().then((ret)=>{
| ALPHABETIC_KEYBOARD | number | 2 | 表示全键盘设备。 |
| DIGITAL_KEYBOARD | number | 3 | 表示小键盘设备。 |
| HANDWRITING_PEN | number | 4 | 表示手写笔设备。 |
| REMOTE_CONTROL | number | 5 | 表示遥控器设备。 |
\ No newline at end of file
| REMOTE_CONTROL | number | 5 | 表示遥控器设备。 |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册