1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import inputmethodengine from '@ohos.inputMethodEngine'; 16import display from '@ohos.display'; 17import windowManager from '@ohos.window'; 18import commoneventmanager from '@ohos.commonEventManager'; 19import prompt from '@ohos.prompt'; 20 21let inputMethodAbility = inputmethodengine.getInputMethodAbility(); 22const TAG = "keyboardController"; 23const SOFT_KEYBOARD = 0; 24const STATUS_BAR = 1; 25const FLG_FIXED = 0; 26const FLG_FLOATING = 1; 27 28let panelInfo = { 29 type: SOFT_KEYBOARD, 30 flag: FLG_FLOATING 31}; 32 33export class KeyboardController { 34 mContext; 35 storage: LocalStorage; 36 WINDOW_TYPE_INPUT_METHOD_FLOAT = 2105; 37 windowName = 'inputApp'; 38 private softKeyboardPanel: any = null; 39 private windowHeight: number = 0; 40 private windowWidth: number = 0; 41 private nonBarPosition: number = 0; 42 43 constructor(context) { 44 this.storage = new LocalStorage(); 45 this.storage.setOrCreate('storageSimplePorp', 121); 46 this.mContext = context; 47 let display_info = display.getDefaultDisplaySync(); 48 this.windowWidth = display_info.width * 0.3; 49 this.windowHeight = display_info.height * 0.35; 50 } 51 52 public onCreate(): void { 53 this.initWindow(); 54 let that = this; 55 inputMethodAbility.on("inputStop", () => { 56 this.mContext.destroy((err, data) => { 57 console.info(TAG + '====>inputMethodEngine destorey err:' + JSON.stringify(err)); 58 console.info(TAG + '====>inputMethodEngine destorey data:' + JSON.stringify(data)); 59 }); 60 }); 61 62 inputMethodAbility.createPanel(this.mContext, panelInfo, (err, panel) => { 63 if (err !== undefined) { 64 console.info('Failed to create panel, err: ' + JSON.stringify(err)); 65 return; 66 } 67 this.softKeyboardPanel = panel; 68 console.info('Succeed in creating panel.' + JSON.stringify(panel)); 69 }); 70 71 function subscriberCallback(err, data) { 72 console.debug(TAG + '====>receive event err: ' + JSON.stringify(err)); 73 console.debug(TAG + '====>receive event data ' + JSON.stringify(data)); 74 switch (data.code) { 75 case 10: 76 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 event:' + data.event); 77 that.Sub_Misc_inputMethod_Panel_createPanelCallback_0010(); 78 break; 79 case 20: 80 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 event:' + data.event); 81 that.Sub_Misc_inputMethod_Panel_createPanelPromise_0020(); 82 break; 83 case 30: 84 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 event:' + data.event); 85 that.Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030(); 86 break; 87 case 40: 88 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 event:' + data.event); 89 that.Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040(); 90 break; 91 case 50: 92 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 event:' + data.event); 93 that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0050(); 94 break; 95 case 60: 96 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 event:' + data.event); 97 that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0060(); 98 break; 99 case 70: 100 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 event:' + data.event); 101 that.Sub_Misc_inputMethod_Panel_setUiContentCallback_0070(); 102 break; 103 case 80: 104 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 event:' + data.event); 105 that.Sub_Misc_inputMethod_Panel_setUiContentPromise_0080(); 106 break; 107 case 90: 108 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 event:' + data.event); 109 that.Sub_Misc_inputMethod_Panel_resizeCallback_0090(); 110 break; 111 case 100: 112 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_resizePromise_0100 event:' + data.event); 113 that.Sub_Misc_inputMethod_Panel_resizePromise_0100(); 114 break; 115 case 110: 116 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 event:' + data.event); 117 that.Sub_Misc_inputMethod_Panel_moveToCallback_0110(); 118 break; 119 case 120: 120 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 event:' + data.event); 121 that.Sub_Misc_inputMethod_Panel_moveToPromise_0120(); 122 break; 123 case 130: 124 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_showCallback_0130 event:' + data.event); 125 that.Sub_Misc_inputMethod_Panel_showCallback_0130(); 126 break; 127 case 140: 128 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_showPromise_0140 event:' + data.event); 129 that.Sub_Misc_inputMethod_Panel_showPromise_0140(); 130 break; 131 case 150: 132 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_hideCallback_0150 event:' + data.event); 133 that.Sub_Misc_inputMethod_Panel_hideCallback_0150(); 134 break; 135 case 160: 136 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_hidePromise_0160 event:' + data.event); 137 that.Sub_Misc_inputMethod_Panel_hidePromise_0160(); 138 break; 139 case 170: 140 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onShow_0170 event:' + data.event); 141 that.Sub_Misc_inputMethod_Panel_onShow_0170(); 142 break; 143 case 180: 144 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_onHide_0180 event:' + data.event); 145 that.Sub_Misc_inputMethod_Panel_onHide_0180(); 146 break; 147 case 190: 148 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_offShow_0190 event:' + data.event); 149 that.Sub_Misc_inputMethod_Panel_offShow_0190(); 150 break; 151 case 200: 152 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_offHide_0200 event:' + data.event); 153 that.Sub_Misc_inputMethod_Panel_offHide_0200(); 154 break; 155 case 201: 156 console.debug(TAG + '====>Sub_Misc_inputMethod_onImeShow_0201 event:' + data.event); 157 that.Sub_Misc_inputMethod_onImeShow_0201(); 158 break; 159 case 202: 160 console.debug(TAG + '====>Sub_Misc_inputMethod_onImeHide_0202 event:' + data.event); 161 that.Sub_Misc_inputMethod_onImeHide_0202(); 162 break; 163 case 203: 164 console.debug(TAG + '====>Sub_Misc_inputMethod_offImeShow_0203 event:' + data.event); 165 that.Sub_Misc_inputMethod_offImeShow_0203(); 166 break; 167 case 204: 168 console.debug(TAG + '====>Sub_Misc_inputMethod_offImeHide_0204 event:' + data.event); 169 that.Sub_Misc_inputMethod_offImeHide_0204(); 170 break; 171 case 210: 172 console.debug(TAG + '====>Sub_Misc_inputMethod_Panel_changeFlag_0210 event:' + data.event); 173 that.Sub_Misc_inputMethod_Panel_changeFlag_0210(); 174 break; 175 176 } 177 } 178 179 var commonEventSubscribeInfo = { 180 events: ["test"] 181 }; 182 183 var subscriber 184 commoneventmanager.createSubscriber(commonEventSubscribeInfo).then(function (data) { 185 subscriber = data; 186 commoneventmanager.subscribe(subscriber, subscriberCallback) 187 console.debug(TAG + '====>scene subscribe finish===='); 188 }) 189 } 190 191 public onDestroy(): void { 192 console.log('imsakitjsapp onDestroy'); 193 globalThis.textInputClient.getTextIndexAtCursor().then((index) => { 194 console.log('imsakitjsapp getTextIndexAtCursor: index = ' + index); 195 prompt.showToast({ message: 'getTextIndexAtCursor success' + index, duration: 200, bottom: 500 }) 196 var win = windowManager.findWindow(this.windowName) 197 win.destroyWindow() 198 this.mContext.terminateSelf(); 199 return true; 200 }).catch((err) => { 201 prompt.showToast({ message: 'getTextIndexAtCursor failed', duration: 200, bottom: 500 }) 202 }) 203 } 204 205 private initWindow(): void { 206 display.getDefaultDisplay().then(dis => { 207 var dWidth = dis.width; 208 var dHeight = dis.height; 209 var keyHeightRate = 0.47; 210 var keyHeight = dHeight * keyHeightRate; 211 this.windowWidth = dWidth; 212 this.windowHeight = keyHeight; 213 this.nonBarPosition = dHeight - keyHeight 214 215 var config = { 216 name: this.windowName, 217 windowType: this.WINDOW_TYPE_INPUT_METHOD_FLOAT, 218 ctx: this.mContext 219 }; 220 windowManager.createWindow(config).then((win) => { 221 win.resize(dWidth, keyHeight).then(() => { 222 win.moveWindowTo(0, this.nonBarPosition).then(() => { 223 win.setUIContent('pages/service/index').then(() => { 224 }); 225 }); 226 }); 227 }); 228 }); 229 } 230 231 private publishCallback(err): void { 232 if (err) { 233 console.error(TAG + '====>publish failed: ' + JSON.stringify(err)); 234 } else { 235 console.log(TAG + '====>publish'); 236 } 237 } 238 239 240 private Sub_Misc_inputMethod_Panel_createPanelCallback_0010(): void { 241 let commonEventPublishData; 242 let panelInfo1 = { 243 type: STATUS_BAR, 244 flag: FLG_FLOATING 245 }; 246 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 success'); 247 try{ 248 inputMethodAbility.createPanel(this.mContext, panelInfo1, async (err, panel) => { 249 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 createPanel'); 250 if (err) { 251 commonEventPublishData = { 252 data: "FAILED" 253 }; 254 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 createPanel error: ' + JSON.stringify(err)); 255 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelCallback_0010", commonEventPublishData, this.publishCallback); 256 }else{ 257 commonEventPublishData = { 258 data: "SUCCESS" 259 }; 260 console.info('====>Sub_Misc_inputMethod_Panel_createPanelCallback_0010 Succeed in creating panel.' + JSON.stringify(panel)); 261 } 262 await inputMethodAbility.destroyPanel(panel); 263 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelCallback_0010", commonEventPublishData, this.publishCallback); 264 }) 265 }catch(error){ 266 commonEventPublishData = { 267 data: "FAILED" 268 }; 269 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelCallback_0010 catch error: ' + JSON.stringify(error)); 270 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelCallback_0010", commonEventPublishData, this.publishCallback); 271 } 272 } 273 274 private Sub_Misc_inputMethod_Panel_createPanelPromise_0020(): void { 275 let commonEventPublishData; 276 let panelInfo1 = { 277 type: STATUS_BAR, 278 flag: FLG_FLOATING 279 }; 280 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 success'); 281 try{ 282 inputMethodAbility.createPanel(this.mContext, panelInfo1).then(async (panel) => { 283 commonEventPublishData = { 284 data: "SUCCESS" 285 }; 286 console.info('====>Sub_Misc_inputMethod_Panel_createPanelPromise_0020 Succeed in creating panel.' + JSON.stringify(panel)); 287 await inputMethodAbility.destroyPanel(panel); 288 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelPromise_0020", commonEventPublishData, this.publishCallback); 289 }).catch(async (err) => { 290 commonEventPublishData = { 291 data: "FAILED" 292 }; 293 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 createPanel error: ' + JSON.stringify(err)); 294 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelPromise_0020", commonEventPublishData, this.publishCallback); 295 }); 296 }catch(error){ 297 commonEventPublishData = { 298 data: "FAILED" 299 }; 300 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_createPanelPromise_0020 catch error: ' + JSON.stringify(error)); 301 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_createPanelPromise_0020", commonEventPublishData, this.publishCallback); 302 } 303 } 304 305 private async Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030(): Promise<void> { 306 let commonEventPublishData; 307 let panelInfo1 = { 308 type: STATUS_BAR, 309 flag: FLG_FIXED 310 }; 311 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 success'); 312 try{ 313 let panel = await inputMethodAbility.createPanel(this.mContext, panelInfo1); 314 inputMethodAbility.destroyPanel(panel, async (err, panel) => { 315 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 destroyPanel'); 316 if (err) { 317 commonEventPublishData = { 318 data: "FAILED" 319 }; 320 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 destroyPanel error: ' + JSON.stringify(err)); 321 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); 322 }else{ 323 commonEventPublishData = { 324 data: "SUCCESS" 325 }; 326 console.info('====>Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 Succeed in destroying panel.' + JSON.stringify(panel)); 327 } 328 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); 329 }); 330 }catch(error){ 331 commonEventPublishData = { 332 data: "FAILED" 333 }; 334 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030 catch error: ' + JSON.stringify(error)); 335 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelCallback_0030", commonEventPublishData, this.publishCallback); 336 } 337 } 338 339 private async Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040(): Promise<void> { 340 let commonEventPublishData; 341 let panelInfo1 = { 342 type: STATUS_BAR, 343 flag: FLG_FIXED 344 }; 345 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 success'); 346 try{ 347 let panel = await inputMethodAbility.createPanel(this.mContext, panelInfo1); 348 inputMethodAbility.destroyPanel(panel).then(async () => { 349 commonEventPublishData = { 350 data: "SUCCESS" 351 }; 352 console.info('====>Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 Succeed in destroyPanel panel.' + JSON.stringify(panel)); 353 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040", commonEventPublishData, this.publishCallback); 354 }).catch(async (err) => { 355 commonEventPublishData = { 356 data: "FAILED" 357 }; 358 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 destroyPanel error: ' + JSON.stringify(err)); 359 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040", commonEventPublishData, this.publishCallback); 360 }); 361 }catch(error){ 362 commonEventPublishData = { 363 data: "FAILED" 364 }; 365 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040 catch error: ' + JSON.stringify(error)); 366 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_destroyPanelPromise_0040", commonEventPublishData, this.publishCallback); 367 } 368 } 369 370 private Sub_Misc_inputMethod_Panel_setUiContentCallback_0050(): void { 371 let commonEventPublishData; 372 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 success'); 373 try{ 374 if (this.softKeyboardPanel !== null){ 375 this.softKeyboardPanel.setUiContent("pages/Index", async (err, data) => { 376 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 setUiContent'); 377 if (err) { 378 commonEventPublishData = { 379 data: "FAILED" 380 }; 381 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 setUiContent error: ' + JSON.stringify(err)); 382 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); 383 }else{ 384 commonEventPublishData = { 385 data: "SUCCESS" 386 }; 387 console.info('====>Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 Succeed setUiContent: ' + JSON.stringify(data)); 388 } 389 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); 390 }); 391 }else{ 392 commonEventPublishData = { 393 data: "FAILED" 394 }; 395 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 this.softKeyboardPanel is null'); 396 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); 397 } 398 }catch(error){ 399 commonEventPublishData = { 400 data: "FAILED" 401 }; 402 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0050 catch error: ' + JSON.stringify(error)); 403 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0050", commonEventPublishData, this.publishCallback); 404 } 405 } 406 407 private Sub_Misc_inputMethod_Panel_setUiContentPromise_0060(): void { 408 let commonEventPublishData; 409 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 success'); 410 try{ 411 if (this.softKeyboardPanel !== null){ 412 this.softKeyboardPanel.setUiContent("pages/Index").then(async (data) => { 413 commonEventPublishData = { 414 data: "SUCCESS" 415 }; 416 console.info('====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 Succeed in setUiContent.' + JSON.stringify(data)); 417 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); 418 }).catch(async (err) => { 419 commonEventPublishData = { 420 data: "FAILED" 421 }; 422 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 setUiContent error: ' + JSON.stringify(err)); 423 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); 424 }); 425 }else{ 426 commonEventPublishData = { 427 data: "FAILED" 428 }; 429 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 this.softKeyboardPanel is null'); 430 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); 431 } 432 }catch(error){ 433 commonEventPublishData = { 434 data: "FAILED" 435 }; 436 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0060 catch error: ' + JSON.stringify(error)); 437 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0060", commonEventPublishData, this.publishCallback); 438 } 439 } 440 441 private Sub_Misc_inputMethod_Panel_setUiContentCallback_0070(): void { 442 let commonEventPublishData; 443 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 success'); 444 try{ 445 if (this.softKeyboardPanel !== null){ 446 this.softKeyboardPanel.setUiContent("pages/Index", this.storage, async (err, data) => { 447 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 setUiContent'); 448 if (err) { 449 commonEventPublishData = { 450 data: "FAILED" 451 }; 452 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 setUiContent error: ' + JSON.stringify(err)); 453 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0070", commonEventPublishData, this.publishCallback); 454 }else{ 455 commonEventPublishData = { 456 data: "SUCCESS" 457 }; 458 console.info('Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 Succeed setUiContent: ' + JSON.stringify(data)); 459 } 460 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0070", commonEventPublishData, this.publishCallback); 461 }) 462 }else{ 463 commonEventPublishData = { 464 data: "FAILED" 465 }; 466 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 this.softKeyboardPanel is null'); 467 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0070", commonEventPublishData, this.publishCallback); 468 } 469 }catch(error){ 470 commonEventPublishData = { 471 data: "FAILED" 472 }; 473 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentCallback_0070 catch error: ' + JSON.stringify(error)); 474 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentCallback_0070", commonEventPublishData, this.publishCallback); 475 } 476 } 477 478 private Sub_Misc_inputMethod_Panel_setUiContentPromise_0080(): void { 479 let commonEventPublishData; 480 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 success'); 481 try{ 482 if (this.softKeyboardPanel !== null){ 483 this.softKeyboardPanel.setUiContent("pages/Index", this.storage).then(async (data) => { 484 commonEventPublishData = { 485 data: "SUCCESS" 486 }; 487 console.info('====>Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 Succeed in setUiContent: ' + JSON.stringify(data)); 488 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); 489 }).catch(async (err) => { 490 commonEventPublishData = { 491 data: "FAILED" 492 }; 493 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 setUiContent error: ' + JSON.stringify(err)); 494 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); 495 }); 496 }else{ 497 commonEventPublishData = { 498 data: "FAILED" 499 }; 500 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 this.softKeyboardPanel is null'); 501 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); 502 } 503 }catch(error){ 504 commonEventPublishData = { 505 data: "FAILED" 506 }; 507 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_setUiContentPromise_0080 catch error: ' + JSON.stringify(error)); 508 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_setUiContentPromise_0080", commonEventPublishData, this.publishCallback); 509 } 510 } 511 512 private Sub_Misc_inputMethod_Panel_resizeCallback_0090(): void { 513 let commonEventPublishData; 514 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 success'); 515 try{ 516 if (this.softKeyboardPanel !== null){ 517 this.softKeyboardPanel.resize(this.windowWidth, this.windowHeight, async (err, data) => { 518 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 resize'); 519 if (err) { 520 commonEventPublishData = { 521 data: "FAILED" 522 }; 523 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 resize error: ' + JSON.stringify(err)); 524 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); 525 }else{ 526 commonEventPublishData = { 527 data: "SUCCESS" 528 }; 529 console.info('====>Sub_Misc_inputMethod_Panel_resizeCallback_0090 Succeeded in changing the panel size: ' + JSON.stringify(data)); 530 } 531 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); 532 }) 533 }else{ 534 commonEventPublishData = { 535 data: "FAILED" 536 }; 537 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 this.softKeyboardPanel is null'); 538 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); 539 } 540 }catch(error){ 541 commonEventPublishData = { 542 data: "FAILED" 543 }; 544 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizeCallback_0090 catch error: ' + JSON.stringify(error)); 545 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizeCallback_0090", commonEventPublishData, this.publishCallback); 546 } 547 } 548 549 private Sub_Misc_inputMethod_Panel_resizePromise_0100(): void { 550 let commonEventPublishData; 551 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 success'); 552 try{ 553 if (this.softKeyboardPanel !== null){ 554 this.softKeyboardPanel.resize(this.windowWidth, this.windowHeight).then(async (data) => { 555 commonEventPublishData = { 556 data: "SUCCESS" 557 }; 558 console.info('====>Sub_Misc_inputMethod_Panel_resizePromise_0100 Succeed in changing the panel size: ' + JSON.stringify(data)); 559 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); 560 }).catch(async (err) => { 561 commonEventPublishData = { 562 data: "FAILED" 563 }; 564 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 resize error: ' + JSON.stringify(err)); 565 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); 566 }); 567 }else{ 568 commonEventPublishData = { 569 data: "FAILED" 570 }; 571 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 this.softKeyboardPanel is null'); 572 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); 573 } 574 }catch(error){ 575 commonEventPublishData = { 576 data: "FAILED" 577 }; 578 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_resizePromise_0100 catch error: ' + JSON.stringify(error)); 579 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_resizePromise_0100", commonEventPublishData, this.publishCallback); 580 } 581 } 582 583 private Sub_Misc_inputMethod_Panel_moveToCallback_0110(): void { 584 let commonEventPublishData; 585 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 success'); 586 try{ 587 if (this.softKeyboardPanel !== null){ 588 this.softKeyboardPanel.moveTo(100, 100, async (err, data) => { 589 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 moveTo'); 590 if (err) { 591 commonEventPublishData = { 592 data: "FAILED" 593 }; 594 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 moveTo error: ' + JSON.stringify(err)); 595 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); 596 }else{ 597 commonEventPublishData = { 598 data: "SUCCESS" 599 }; 600 console.info('====>Sub_Misc_inputMethod_Panel_moveToCallback_0110 Succeed in moving the panel: ' + JSON.stringify(data)); 601 } 602 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); 603 }); 604 }else{ 605 commonEventPublishData = { 606 data: "FAILED" 607 }; 608 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 this.softKeyboardPanel is null'); 609 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); 610 } 611 }catch(error){ 612 commonEventPublishData = { 613 data: "FAILED" 614 }; 615 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToCallback_0110 catch error: ' + JSON.stringify(error)); 616 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToCallback_0110", commonEventPublishData, this.publishCallback); 617 } 618 } 619 620 private Sub_Misc_inputMethod_Panel_moveToPromise_0120(): void { 621 let commonEventPublishData; 622 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 success'); 623 try{ 624 if (this.softKeyboardPanel !== null){ 625 this.softKeyboardPanel.moveTo(100, 100).then(async (data) => { 626 commonEventPublishData = { 627 data: "SUCCESS" 628 }; 629 console.info('====>Sub_Misc_inputMethod_Panel_moveToPromise_0120 Succeed in moving the panel: ' + JSON.stringify(data)); 630 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); 631 }).catch(async (err) => { 632 commonEventPublishData = { 633 data: "FAILED" 634 }; 635 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 moveTo error: ' + JSON.stringify(err)); 636 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); 637 }); 638 }else{ 639 commonEventPublishData = { 640 data: "FAILED" 641 }; 642 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 this.softKeyboardPanel is null'); 643 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); 644 } 645 }catch(error){ 646 commonEventPublishData = { 647 data: "FAILED" 648 }; 649 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_moveToPromise_0120 catch error: ' + JSON.stringify(error)); 650 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_moveToPromise_0120", commonEventPublishData, this.publishCallback); 651 } 652 } 653 654 private Sub_Misc_inputMethod_Panel_showCallback_0130(): void { 655 let commonEventPublishData; 656 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 success'); 657 try{ 658 if (this.softKeyboardPanel !== null){ 659 this.softKeyboardPanel.show(async (err, data) => { 660 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 show'); 661 if (err) { 662 commonEventPublishData = { 663 data: "FAILED" 664 }; 665 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 show error: ' + JSON.stringify(err)); 666 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); 667 }else{ 668 commonEventPublishData = { 669 data: "SUCCESS" 670 }; 671 console.info('====>Sub_Misc_inputMethod_Panel_showCallback_0130 Succeed in showing the panel: ' + JSON.stringify(data)); 672 } 673 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); 674 }); 675 }else{ 676 commonEventPublishData = { 677 data: "FAILED" 678 }; 679 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 this.softKeyboardPanel is null'); 680 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); 681 } 682 }catch(error){ 683 commonEventPublishData = { 684 data: "FAILED" 685 }; 686 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showCallback_0130 catch error: ' + JSON.stringify(error)); 687 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showCallback_0130", commonEventPublishData, this.publishCallback); 688 } 689 } 690 691 private Sub_Misc_inputMethod_Panel_showPromise_0140(): void { 692 let commonEventPublishData; 693 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 success'); 694 try{ 695 if (this.softKeyboardPanel !== null){ 696 this.softKeyboardPanel.show().then(async (data) => { 697 commonEventPublishData = { 698 data: "SUCCESS" 699 }; 700 console.info('====>Sub_Misc_inputMethod_Panel_showPromise_0140 Succeed in showing the panel: ' + JSON.stringify(data)); 701 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); 702 }).catch(async (err) => { 703 commonEventPublishData = { 704 data: "FAILED" 705 }; 706 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 show error: ' + JSON.stringify(err)); 707 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); 708 }); 709 }else{ 710 commonEventPublishData = { 711 data: "FAILED" 712 }; 713 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 this.softKeyboardPanel is null'); 714 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); 715 } 716 }catch(error){ 717 commonEventPublishData = { 718 data: "FAILED" 719 }; 720 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_showPromise_0140 catch error: ' + JSON.stringify(error)); 721 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_showPromise_0140", commonEventPublishData, this.publishCallback); 722 } 723 } 724 725 private Sub_Misc_inputMethod_Panel_hideCallback_0150(): void { 726 let commonEventPublishData; 727 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 success'); 728 try{ 729 if (this.softKeyboardPanel !== null){ 730 this.softKeyboardPanel.hide(async (err, data) => { 731 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 hide'); 732 if (err) { 733 commonEventPublishData = { 734 data: "FAILED" 735 }; 736 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 hide error: ' + JSON.stringify(err)); 737 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); 738 }else{ 739 commonEventPublishData = { 740 data: "SUCCESS" 741 }; 742 console.info('====>Sub_Misc_inputMethod_Panel_hideCallback_0150 Succeed in hiding the panel: ' + JSON.stringify(data)); 743 } 744 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); 745 }); 746 }else{ 747 commonEventPublishData = { 748 data: "FAILED" 749 }; 750 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 this.softKeyboardPanel is null'); 751 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); 752 } 753 }catch(error){ 754 commonEventPublishData = { 755 data: "FAILED" 756 }; 757 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hideCallback_0150 catch error: ' + JSON.stringify(error)); 758 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hideCallback_0150", commonEventPublishData, this.publishCallback); 759 } 760 } 761 762 private Sub_Misc_inputMethod_Panel_hidePromise_0160(): void { 763 let commonEventPublishData; 764 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 success'); 765 try{ 766 if (this.softKeyboardPanel !== null){ 767 this.softKeyboardPanel.hide().then(async (data) => { 768 commonEventPublishData = { 769 data: "SUCCESS" 770 }; 771 console.info('====>Sub_Misc_inputMethod_Panel_hidePromise_0160 Succeed in hiding the panel: ' + JSON.stringify(data)); 772 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); 773 }).catch(async (err) => { 774 commonEventPublishData = { 775 data: "FAILED" 776 }; 777 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 hide error: ' + JSON.stringify(err)); 778 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); 779 }); 780 }else{ 781 commonEventPublishData = { 782 data: "FAILED" 783 }; 784 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 this.softKeyboardPanel is null'); 785 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); 786 } 787 }catch(error){ 788 commonEventPublishData = { 789 data: "FAILED" 790 }; 791 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_hidePromise_0160 catch error: ' + JSON.stringify(error)); 792 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_hidePromise_0160", commonEventPublishData, this.publishCallback); 793 } 794 } 795 796 private async Sub_Misc_inputMethod_Panel_onShow_0170(): Promise<void> { 797 let commonEventPublishData; 798 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 success'); 799 try{ 800 if (this.softKeyboardPanel !== null){ 801 this.softKeyboardPanel.on("show", async () => { 802 commonEventPublishData = { 803 data: "SUCCESS" 804 }; 805 this.softKeyboardPanel.off("show"); 806 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 onShow error: '); 807 console.info('====>Sub_Misc_inputMethod_Panel_onShow_0170 Succeed onShow: '); 808 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onShow_0170", commonEventPublishData, this.publishCallback); 809 }); 810 await this.softKeyboardPanel.show(); 811 }else{ 812 commonEventPublishData = { 813 data: "FAILED" 814 }; 815 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 this.softKeyboardPanel is null'); 816 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onShow_0170", commonEventPublishData, this.publishCallback); 817 } 818 }catch(error){ 819 commonEventPublishData = { 820 data: "FAILED" 821 }; 822 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onShow_0170 catch error: ' + JSON.stringify(error)); 823 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onShow_0170", commonEventPublishData, this.publishCallback); 824 } 825 } 826 827 private async Sub_Misc_inputMethod_Panel_onHide_0180(): Promise<void> { 828 let commonEventPublishData; 829 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 success'); 830 try{ 831 if (this.softKeyboardPanel !== null){ 832 this.softKeyboardPanel.on("hide", async () => { 833 commonEventPublishData = { 834 data: "SUCCESS" 835 }; 836 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 onHide'); 837 this.softKeyboardPanel.off("hide"); 838 console.info('====>Sub_Misc_inputMethod_Panel_onHide_0180 Succeed onHide:'); 839 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onHide_0180", commonEventPublishData, this.publishCallback); 840 }); 841 await this.softKeyboardPanel.hide(); 842 }else{ 843 commonEventPublishData = { 844 data: "FAILED" 845 }; 846 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 this.softKeyboardPanel is null'); 847 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onHide_0180", commonEventPublishData, this.publishCallback); 848 } 849 }catch(error){ 850 commonEventPublishData = { 851 data: "FAILED" 852 }; 853 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_onHide_0180 catch error: ' + JSON.stringify(error)); 854 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_onHide_0180", commonEventPublishData, this.publishCallback); 855 } 856 } 857 858 private Sub_Misc_inputMethod_Panel_offShow_0190(): void { 859 let commonEventPublishData = { 860 data: "FAILED" 861 }; 862 let count = 0; 863 let timeCount = 0; 864 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 success'); 865 try{ 866 if (this.softKeyboardPanel !== null){ 867 this.softKeyboardPanel.on("show", async (err, data) => { 868 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 offShow if success: ' + JSON.stringify(err)); 869 this.softKeyboardPanel.off("show"); 870 count += 1; 871 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 off Show count: ' + count); 872 }); 873 let t1 = setInterval(async () => { 874 await this.softKeyboardPanel.show(); 875 await this.softKeyboardPanel.hide(); 876 timeCount += 1; 877 console.info(TAG + '====>this.softKeyboardPanel.show setInterval timeCount: ' + timeCount); 878 if(timeCount === 2){ 879 clearInterval(t1); 880 } 881 },100); 882 883 let t2 = setTimeout(() => { 884 console.info(TAG + '====>setTimeout count: ' + count); 885 if(count === 1){ 886 commonEventPublishData = { 887 data: "SUCCESS" 888 }; 889 } 890 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offShow_0190", commonEventPublishData, this.publishCallback); 891 clearTimeout(t2); 892 },500); 893 894 }else{ 895 commonEventPublishData = { 896 data: "FAILED" 897 }; 898 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 this.softKeyboardPanel is null'); 899 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offShow_0190", commonEventPublishData, this.publishCallback); 900 } 901 }catch(error){ 902 commonEventPublishData = { 903 data: "FAILED" 904 }; 905 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offShow_0190 catch error: ' + JSON.stringify(error)); 906 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offShow_0190", commonEventPublishData, this.publishCallback); 907 } 908 } 909 910 private Sub_Misc_inputMethod_Panel_offHide_0200(): void { 911 let commonEventPublishData = { 912 data: "FAILED" 913 }; 914 let count = 0; 915 let timeCount = 0; 916 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 success'); 917 try{ 918 if (this.softKeyboardPanel !== null){ 919 this.softKeyboardPanel.on("hide", async (err, data) => { 920 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 offHide if success: ' + JSON.stringify(err)); 921 this.softKeyboardPanel.off("hide"); 922 count += 1; 923 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 off hide count: ' + count); 924 }); 925 926 let t1 = setInterval(async () => {; 927 await this.softKeyboardPanel.show(); 928 await this.softKeyboardPanel.hide(); 929 timeCount += 1; 930 console.info(TAG + '====>this.softKeyboardPanel.hide setInterval timeCount: ' + timeCount); 931 if(timeCount === 2){ 932 clearInterval(t1); 933 } 934 },100); 935 936 let t2 = setTimeout(() => { 937 console.info(TAG + '====>setTimeout count: ' + count); 938 if(count === 1){ 939 commonEventPublishData = { 940 data: "SUCCESS" 941 }; 942 } 943 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offHide_0200", commonEventPublishData, this.publishCallback); 944 clearTimeout(t2); 945 },500); 946 947 }else{ 948 commonEventPublishData = { 949 data: "FAILED" 950 }; 951 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 this.softKeyboardPanel is null'); 952 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offHide_0200", commonEventPublishData, this.publishCallback); 953 } 954 }catch(error){ 955 commonEventPublishData = { 956 data: "FAILED" 957 }; 958 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_offHide_0200 catch error: ' + JSON.stringify(error)); 959 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_offHide_0200", commonEventPublishData, this.publishCallback); 960 } 961 } 962 963 private async Sub_Misc_inputMethod_onImeShow_0201(): Promise<void> { 964 console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeShow_0201 success'); 965 try{ 966 if (this.softKeyboardPanel !== null){ 967 let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED; 968 let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING; 969 this.softKeyboardPanel.changeFlag(fla_fixed); 970 await this.softKeyboardPanel.hide(); 971 console.info('====>Sub_Misc_inputMethod_onImeShow_0201 show panel'); 972 await this.softKeyboardPanel.show(); 973 console.info('====>Sub_Misc_inputMethod_onImeShow_0201 hide panel'); 974 this.softKeyboardPanel.changeFlag(fla_floating); 975 }else{ 976 console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeShow_0201 this.softKeyboardPanel is null'); 977 } 978 }catch(error){ 979 console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeShow_0201 catch error: ' + JSON.stringify(error)); 980 } 981 } 982 983 private async Sub_Misc_inputMethod_onImeHide_0202(): Promise<void> { 984 console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeHide_0202 success'); 985 try{ 986 if (this.softKeyboardPanel !== null){ 987 let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED; 988 let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING; 989 this.softKeyboardPanel.changeFlag(fla_fixed); 990 await this.softKeyboardPanel.show(); 991 console.info('====>Sub_Misc_inputMethod_onImeHide_0202 show panel'); 992 await this.softKeyboardPanel.hide(); 993 console.info('====>Sub_Misc_inputMethod_onImeHide_0202 hide panel'); 994 this.softKeyboardPanel.changeFlag(fla_floating); 995 }else{ 996 console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeHide_0202 this.softKeyboardPanel is null'); 997 } 998 }catch(error){ 999 console.info(TAG + '====>receive Sub_Misc_inputMethod_onImeHide_0202 catch error: ' + JSON.stringify(error)); 1000 } 1001 } 1002 1003 private async Sub_Misc_inputMethod_offImeShow_0203(): Promise<void> { 1004 console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeShow_0203 success'); 1005 try{ 1006 if (this.softKeyboardPanel !== null){ 1007 let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED; 1008 let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING; 1009 this.softKeyboardPanel.changeFlag(fla_fixed); 1010 await this.softKeyboardPanel.hide(); 1011 console.info('====>Sub_Misc_inputMethod_offImeShow_0203 show panel'); 1012 await this.softKeyboardPanel.show(); 1013 console.info('====>Sub_Misc_inputMethod_offImeShow_0203 hide panel'); 1014 this.softKeyboardPanel.changeFlag(fla_floating); 1015 }else{ 1016 console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeShow_0203 this.softKeyboardPanel is null'); 1017 } 1018 }catch(error){ 1019 console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeShow_0203 catch error: ' + JSON.stringify(error)); 1020 } 1021 } 1022 1023 private async Sub_Misc_inputMethod_offImeHide_0204(): Promise<void> { 1024 console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeHide_0204 success'); 1025 try{ 1026 if (this.softKeyboardPanel !== null){ 1027 let fla_fixed = inputmethodengine.PanelFlag.FLG_FIXED; 1028 let fla_floating = inputmethodengine.PanelFlag.FLG_FLOATING; 1029 this.softKeyboardPanel.changeFlag(fla_fixed); 1030 await this.softKeyboardPanel.show(); 1031 console.info('====>Sub_Misc_inputMethod_offImeHide_0204 show panel'); 1032 await this.softKeyboardPanel.hide(); 1033 console.info('====>Sub_Misc_inputMethod_offImeHide_0204 hide panel'); 1034 this.softKeyboardPanel.changeFlag(fla_floating); 1035 }else{ 1036 console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeHide_0204 this.softKeyboardPanel is null'); 1037 } 1038 }catch(error){ 1039 console.info(TAG + '====>receive Sub_Misc_inputMethod_offImeHide_0204 catch error: ' + JSON.stringify(error)); 1040 } 1041 } 1042 1043 private Sub_Misc_inputMethod_Panel_changeFlag_0210(): void { 1044 let commonEventPublishData = { 1045 data: "FAILED" 1046 }; 1047 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 success'); 1048 try{ 1049 if (this.softKeyboardPanel !== null){ 1050 try{ 1051 this.softKeyboardPanel.changeFlag(1); 1052 commonEventPublishData = { 1053 data: "SUCCESS" 1054 }; 1055 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_changeFlag_0210", commonEventPublishData, this.publishCallback); 1056 }catch(err){ 1057 console.error("====>SUB_REQUEST_UPLOAD_API_CALLBACK_0001 throw_error: " + err); 1058 } 1059 1060 }else{ 1061 commonEventPublishData = { 1062 data: "FAILED" 1063 }; 1064 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 this.softKeyboardPanel is null'); 1065 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_changeFlag_0210", commonEventPublishData, this.publishCallback); 1066 } 1067 }catch(error){ 1068 commonEventPublishData = { 1069 data: "FAILED" 1070 }; 1071 console.info(TAG + '====>receive Sub_Misc_inputMethod_Panel_changeFlag_0210 catch error: ' + JSON.stringify(error)); 1072 commoneventmanager.publish("Sub_Misc_inputMethod_Panel_changeFlag_0210", commonEventPublishData, this.publishCallback); 1073 } 1074 } 1075 1076 1077 1078}