xugenyuan

ref |> 按华为沟通结论,调整评论输入框键盘消失方法

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
1 -import { inputMethodEngine } from '@kit.IMEKit' 1 +import { inputMethod, inputMethodEngine } from '@kit.IMEKit'
2 import { commentInfo } from 'wdBean/Index' 2 import { commentInfo } from 'wdBean/Index'
3 import { VoiceRecoginizer } from 'wdHwAbility' 3 import { VoiceRecoginizer } from 'wdHwAbility'
4 import { Logger, ToastUtils } from 'wdKit/Index' 4 import { Logger, ToastUtils } from 'wdKit/Index'
@@ -8,6 +8,7 @@ import { publishCommentModel } from '../model/PublishCommentModel' @@ -8,6 +8,7 @@ import { publishCommentModel } from '../model/PublishCommentModel'
8 import commentViewModel from '../viewmodel/CommentViewModel' 8 import commentViewModel from '../viewmodel/CommentViewModel'
9 import { VoiceInputView } from './VoiceInputView' 9 import { VoiceInputView } from './VoiceInputView'
10 import { common, UIAbility } from '@kit.AbilityKit' 10 import { common, UIAbility } from '@kit.AbilityKit'
  11 +import { BusinessError } from '@kit.BasicServicesKit'
11 12
12 const TAG = "CommentInputDialog" 13 const TAG = "CommentInputDialog"
13 14
@@ -154,7 +155,19 @@ export struct CommentCustomDialog { @@ -154,7 +155,19 @@ export struct CommentCustomDialog {
154 this.voiceSwitch = !this.voiceSwitch 155 this.voiceSwitch = !this.voiceSwitch
155 this.emojiSwitch = false 156 this.emojiSwitch = false
156 if (this.voiceSwitch) { 157 if (this.voiceSwitch) {
157 - this.textInputController.stopEditing() 158 + // 按沟通结果,调整隐藏键盘方法
  159 + // http://192.168.1.3:8080/zentao/bug-view-20473.html
  160 + // this.textInputController.stopEditing()
  161 + inputMethod.getController().hideTextInput((err: BusinessError) => {
  162 + if (err) {
  163 + console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
  164 + return;
  165 + }
  166 + // console.log('Succeeded in hiding text input.');
  167 + })
  168 + // this.showKeyboardOnFocus = false
  169 + // focusControl.requestFocus("textAreaId") // 弹起键盘
  170 +
158 } else { 171 } else {
159 focusControl.requestFocus("textAreaId") // 弹起键盘 172 focusControl.requestFocus("textAreaId") // 弹起键盘
160 // this.textInputController.caretPosition(this.textInputController.getTextContentRect().x) 173 // this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)
@@ -170,7 +183,16 @@ export struct CommentCustomDialog { @@ -170,7 +183,16 @@ export struct CommentCustomDialog {
170 this.emojiSwitch = !this.emojiSwitch 183 this.emojiSwitch = !this.emojiSwitch
171 this.voiceSwitch = false 184 this.voiceSwitch = false
172 if (this.emojiSwitch) { 185 if (this.emojiSwitch) {
173 - this.textInputController.stopEditing() 186 + // 按沟通结果,调整隐藏键盘方法
  187 + // http://192.168.1.3:8080/zentao/bug-view-20473.html
  188 + // this.textInputController.stopEditing()
  189 + inputMethod.getController().hideTextInput((err: BusinessError) => {
  190 + if (err) {
  191 + console.error(`Failed to hideTextInput: ${JSON.stringify(err)}`);
  192 + return;
  193 + }
  194 + // console.log('Succeeded in hiding text input.');
  195 + })
174 } else { 196 } else {
175 focusControl.requestFocus("textAreaId") // 弹起键盘 197 focusControl.requestFocus("textAreaId") // 弹起键盘
176 // this.textInputController.caretPosition(this.textInputController.getTextContentRect().x) 198 // this.textInputController.caretPosition(this.textInputController.getTextContentRect().x)