modify review

Signed-off-by: zhaojunxia <zhaojunxia@kaihong.com>
This commit is contained in:
zhaojunxia 2024-06-11 14:49:33 +08:00
parent 359be71848
commit ba8b445119
5 changed files with 21 additions and 14 deletions

View File

@ -5,9 +5,9 @@
### 效果预览
| 主键盘 | 菜单 | 编辑 |
| :---------------------------------------: | :---------------------------------------: | :--------------------------------------: |
| ![main](screenshots/devices/main.jpg) | ![util](screenshots/devices/menu.jpg) | ![convertxml](screenshots/devices/edit.jpg) |
| 主键盘 | 菜单 | 编辑 | 预上屏 |
| :---------------------------------------: | :---------------------------------------: | :--------------------------------------: |:--------------------------------------: |
| ![main](screenshots/devices/main.jpg) | ![util](screenshots/devices/menu.jpg) | ![convertxml](screenshots/devices/edit.jpg) | ![preview](screenshots/devices/preview.jpg)
使用说明
@ -23,6 +23,11 @@
6.编辑状态点击选择按钮,进入选择状态,点击方向键可以选中文本。
预上屏应用使用说明
1.安装应用首页点击kikainput切换输入法到当前应用;
2.文本框中输入预上屏触发字符'hel',触发输入法预上屏;
3.点击输入法的回车键,确认预上屏内容'hello world'替换文本框中的'hel';
### 工程目录
```
@ -35,8 +40,11 @@ KikaInput
│ │ ├── common
│ │ │ ├── StyleConfiguration.ets //适配不同设备下的键盘布局
│ │ ├── components //输入法软键盘自定义组件
│ │ ├── entryability //应用入口
│ │ │ ├── EntryAbility.ets //应用入口Ability
│ │ ├── pages
│ │ │ ├── Index.ets //输入法主页
│ │ │ ├── PrivatePreview.ets //预上屏主页
│ │ ├── model
│ │ │ ├── HardKeyUtils.ets //外接键盘KeyCode数据
│ │ │ ├── KeyboardController.ets //输入法键盘控制
@ -72,9 +80,9 @@ KikaInput
1.本示例仅支持标准系统上运行。
2.本示例适配API10版本SDKSDK版本号(API Version 10 Release),镜像版本号(4.0 Release)。
2.本示例适配API12版本SDKSDK版本号(API Version 12 Release),镜像版本号(5.0.0.25及以后版本)。
3.本示例需要使用DevEco Studio 版本号(4.0 Release)及以上版本才可编译运行。
3.本示例需要使用DevEco Studio 版本号(4.1 Release)及以上版本才可编译运行。
5.本示例需要使用@ohos.application.InputMethodExtensionAbility系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取并在DevEco Studio中替换具体操作可参考[替换指南](https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md/)。

View File

@ -103,7 +103,8 @@ export class InputHandler {
this.addLog(`onInputStart sendPrivateCommand begin`);
let record: Record<string, inputMethodEngine.CommandDataType> = {
'previewTextStyle': 'underline'
}
};
this.mTextInputClient.sendPrivateCommand(record).then((err) => {
this.addLog(`insertText sendPrivateCommand success`);
}).catch((err:BusinessError) => {
@ -134,7 +135,7 @@ export class InputHandler {
//调用结束预上屏接口, 预上屏内容将被系统正式上屏
this.mTextInputClient.finishTextPreview().then(() => {
console.log('Succeeded in finishing text preview.');
this.addLog('Succeeded in finishing text preview.');
}).catch((err: BusinessError) => {
console.error(`Failed to finishTextPreview: ${JSON.stringify(err)}`);
});
@ -168,12 +169,10 @@ export class InputHandler {
}
public insertText(text: string): void {
this.addLog(`insertText = ${text}`);
if (this.mTextInputClient !== undefined) {
this.mTextInputClient.insertText(text);
let indexCursor: number = 0;
indexCursor = this.mTextInputClient.getTextIndexAtCursorSync();
this.intputText = this.mTextInputClient.getForwardSync(indexCursor);
@ -202,7 +201,7 @@ export class InputHandler {
} catch (err) {
this.addLog(`insertText preViewText Failed to setPreviewText: ${JSON.stringify(err)}`);
}
} else if (this.intputText.length > length + 1){
} else if (this.intputText.length > length + 1) {
this.addLog('insertText this.intputText ' + this.intputText);
let indexSubStrStart: number = this.intputText.lastIndexOf('hel');

View File

@ -23,8 +23,8 @@ const TAG: string = 'PrivatePreview->';
@Component
struct PrivatePreview {
@State message: string = 'Hello World';
@State accountText: string = ''; //177
@State preViewText: string = ''; //helloworld
@State accountText: string = '';
@State preViewText: string = '';
@StorageLink('isTextPreviewSupported') isTextPreviewSupported: boolean = true;
controllerPrivate: TextInputController = new TextInputController();
controllerPreview: TextInputController = new TextInputController();

View File

@ -197,8 +197,8 @@ export default function abilityTest() {
let arrow_right = await driver.findComponent(ON.id('arrow_right'));
await arrow_right.click();
await driver.delayMs(1000);
// let selectInput1 = await driver.findComponent(ON.id('selectInput'));
// expect(selectInput1).assertNull();
let selectInput1 = await driver.findComponent(ON.id('selectInput'));
expect(selectInput1).assertNull();
logger.info(TAG, `${BUNDLE}Selection_001 end`);
done();
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB