1/** 2 * Copyright (c) 2021-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 */ 15 16import { Log , CheckEmptyUtils } from '@ohos/common'; 17import { Trace } from '@ohos/common'; 18import { EventConstants } from '@ohos/common'; 19import { StyleConstants } from '@ohos/common'; 20import { CommonConstants } from '@ohos/common'; 21import { PresetStyleConstants } from '@ohos/common'; 22import { AppName } from '@ohos/common'; 23import { AppBubble } from '@ohos/common'; 24import { UninstallDialog } from '@ohos/common'; 25import { FormManagerDialog } from '@ohos/common'; 26import { ResourceManager } from '@ohos/common'; 27import { localEventManager } from '@ohos/common'; 28import { InputMethodManager } from '@ohos/common'; 29import { BigFolderModel } from '../model/BigFolderModel'; 30import { BigFolderViewModel } from '../viewmodel/BigFolderViewModel'; 31import { BigFolderStyleConfig } from '../common/BigFolderStyleConfig'; 32import { BigFolderConstants } from '../common/constants/BigFolderConstants'; 33import { BigFolderStyleConstants } from '../common/constants/BigFolderStyleConstants'; 34import FolderAppListDialog from '../common/uicomponents/FolderAppListDialog'; 35import BigFolderStartAppHandler from '../common/BigFolderStartAppHandler'; 36 37const TAG = 'FolderOpenComponent'; 38const DOUBLE_CLICK_COUNT = 2; 39 40const FOLDER_CLOSE_DELAY = 500; 41let mBigFolderViewModel: BigFolderViewModel; 42let mBigFolderStyleConfig: BigFolderStyleConfig; 43let mFolderModel: BigFolderModel; 44let mAppNameHeight = BigFolderStyleConstants.DEFAULT_APP_NAME_HEIGHT; 45let mAppItemWidth = BigFolderStyleConstants.DEFAULT_APP_ITEM_WIDTH; 46let mAppNameSize = BigFolderStyleConstants.DEFAULT_APP_NAME_SIZE; 47let mAppIconSize = BigFolderStyleConstants.DEFAULT_APP_ITEM_WIDTH; 48let mAddIconSize = BigFolderStyleConstants.DEFAULT_ADD_APP_SIZE; 49let mNameLines = PresetStyleConstants.DEFAULT_APP_NAME_LINES; 50let mIconNameMargin = PresetStyleConstants.DEFAULT_ICON_NAME_GAP; 51let mSwiperHeight; 52let mGridWidth; 53let mGridHeight; 54let mGridPadding; 55let mGridMarginTop; 56let mFolderOpenTitle; 57let mGridIconTopPadding; 58let isPad = false; 59let mBigFolderStartAppHandler: BigFolderStartAppHandler; 60 61@Component 62export struct FolderOpenComponent { 63 @State withBlur: boolean = true; 64 @StorageLink('openFolderPageIndex') PageIndex: number = 0; 65 @StorageLink('openFolderStatus') @Watch('updateFolderData') openFolderStatus: number = BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE; 66 @State overLayAlpha: number = 0.3; 67 @State isRenaming: boolean = false; 68 @StorageLink('openFolderData') mFolderInfo: { 69 layoutInfo: [], 70 enterEditing: boolean, 71 folderName: string, 72 folderId: string 73 } = { layoutInfo: [], enterEditing: false, folderName: '', folderId: '' }; 74 @State newFolderName: string = ''; 75 76 aboutToAppear(): void { 77 Log.showInfo(TAG, `aboutToAppear start`); 78 mBigFolderViewModel = BigFolderViewModel.getInstance(); 79 mBigFolderStartAppHandler = BigFolderStartAppHandler.getInstance(); 80 this.updateStyle(); 81 // Folder dialog data preloading 82 mBigFolderViewModel.getFolderAddAppList(this.mFolderInfo.folderId); 83 mBigFolderViewModel.getFolderAppList(this.mFolderInfo.folderId); 84 this.newFolderName = this.mFolderInfo.folderName; 85 Log.showInfo(TAG, `aboutToAppear end`); 86 } 87 88 private updateStyle() { 89 isPad = mBigFolderViewModel.getIsPad(); 90 mBigFolderStyleConfig = mBigFolderViewModel.getFolderStyleConfig(); 91 mAppItemWidth = mBigFolderStyleConfig.mOpenFolderAppSize; 92 mAppIconSize = mBigFolderStyleConfig.mOpenFolderIconSize; 93 mAddIconSize = mBigFolderStyleConfig.mOpenFolderAddIconSize; 94 mAppNameSize = mBigFolderStyleConfig.mOpenFolderAppNameSize; 95 mAppNameHeight = mBigFolderStyleConfig.mOpenFolderAppNameHeight; 96 mGridWidth = mBigFolderStyleConfig.mOpenFolderGridWidth; 97 mGridHeight = mBigFolderStyleConfig.mOpenFolderGridHeight; 98 mSwiperHeight = mBigFolderStyleConfig.mOpenFolderSwiperHeight; 99 mGridPadding = mBigFolderStyleConfig.mOpenFolderGridPadding; 100 mNameLines = mBigFolderStyleConfig.mNameLines; 101 mIconNameMargin = mBigFolderStyleConfig.mIconNameMargin; 102 mGridMarginTop = mBigFolderStyleConfig.mFolderOpenMargin; 103 mFolderOpenTitle = mBigFolderStyleConfig.mFolderOpenTitle; 104 mGridIconTopPadding = mBigFolderStyleConfig.mOpenFolderGridIconTopPadding; 105 } 106 107 private updateFolderData() { 108 Log.showDebug(TAG, `updateFolderData start`); 109 if (this.openFolderStatus == BigFolderConstants.OPEN_FOLDER_STATUS_STATIC) { 110 return; 111 } 112 if (this.openFolderStatus == BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE) { 113 this.hideOpenFolder(); 114 mBigFolderViewModel.delAddIcon(this.mFolderInfo); 115 globalThis.PageDesktopViewModel.pagingFiltering(); 116 this.newFolderName = ''; 117 return; 118 } else { 119 this.isRenaming = this.mFolderInfo.enterEditing; 120 this.newFolderName = this.mFolderInfo.folderName; 121 this.mFolderInfo = mBigFolderViewModel.addAddIcon(this.mFolderInfo); 122 this.showOpenFolder(); 123 } 124 AppStorage.SetOrCreate('openFolderStatus', BigFolderConstants.OPEN_FOLDER_STATUS_STATIC); 125 AppStorage.SetOrCreate('isDraging', false); 126 Log.showDebug(TAG, `updateFolderData end`); 127 } 128 129 private hideOpenFolder() { 130 Log.showDebug(TAG, `hideOpenFolder start`); 131 this.isRenaming = false; 132 this.withBlur = false; 133 this.openFolderStatus = BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE; 134 this.showAnimate(0.3, Curve.EaseOut); 135 Log.showDebug(TAG, `hideOpenFolder end`); 136 } 137 138 private showOpenFolder() { 139 this.updateStyle(); 140 this.withBlur = true; 141 this.showAnimate(1, Curve.EaseIn); 142 } 143 144 private showAnimate(overLayAlpha: number, curveValue: Curve) { 145 animateTo({ 146 duration: 250, 147 tempo: 0.5, 148 curve: curveValue, 149 delay: 0, 150 iterations: 1, 151 playMode: PlayMode.Normal, 152 }, () => { 153 this.overLayAlpha = overLayAlpha; 154 Trace.end(Trace.CORE_METHOD_OPEN_FOLDER); 155 }) 156 } 157 158 build() { 159 Stack() { 160 if (this.withBlur) { 161 Column() 162 .blur(CommonConstants.OVERLAY_BLUR_RADIUS) 163 .width(BigFolderStyleConstants.PERCENTAGE_100) 164 .height(BigFolderStyleConstants.PERCENTAGE_100) 165 } 166 167 Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { 168 Stack({ alignContent: Alignment.Center }) { 169 if (this.isRenaming) { 170 Row() { 171 TextInput({ text: this.newFolderName }) 172 .maxLength(CommonConstants.FOLDER_NAME_MAX_LENGTH) 173 .caretColor(Color.White) 174 .fontColor(Color.White) 175 .fontSize(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_NAME_SIZE) 176 .fontWeight(FontWeight.Normal) 177 .layoutWeight(1) 178 .backgroundColor('rgba(255,255,255,0)') 179 .enterKeyType(EnterKeyType.Done) 180 .onSubmit((enterKey: EnterKeyType) => { 181 Log.showDebug(TAG, `textinput done: ${enterKey} `) 182 this.isRenaming = true; 183 this.saveText(); 184 }) 185 .onChange((text: string) => { 186 Log.showDebug(TAG, `textinput: ` + text); 187 this.newFolderName = text; 188 }) 189 Image(BigFolderStyleConstants.DEFAULT_CANCEL_APP_IMAGE) 190 .width(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_CANCEL_SIZE) 191 .height(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_CANCEL_SIZE) 192 .onClick(() => { 193 this.newFolderName = '' 194 }) 195 } 196 .height(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_TEXTAREA_HEIGHT) 197 .width(BigFolderStyleConstants.PERCENTAGE_100) 198 .borderRadius(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_CANCEL_SIZE) 199 .padding({ 200 left: BigFolderStyleConstants.DEFAULT_BUTTON_HEIGHT, 201 right: BigFolderStyleConstants.DEFAULT_DIALOG_BOTTOM_MARGIN 202 }) 203 .backgroundColor('rgba(255,255,255,0.3)') 204 } else { 205 Text(this.mFolderInfo.folderName) { 206 } 207 .fontSize(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_NAME_SIZE) 208 .fontColor(Color.White) 209 .textAlign(TextAlign.Center) 210 .maxLines(1) 211 .width(BigFolderStyleConstants.PERCENTAGE_100) 212 .onClick(() => { 213 Log.showDebug(TAG, 'title click'); 214 this.isRenaming = true; 215 this.newFolderName = this.mFolderInfo.folderName 216 }) 217 } 218 } 219 .margin({ top: mFolderOpenTitle }) 220 .width(mGridWidth) 221 .height(mGridMarginTop) 222 223 Stack() { 224 Swiper() { 225 ForEach(this.mFolderInfo.layoutInfo, (item) => { 226 FolderSwiperPage({ 227 mAppInfo: item, 228 isRenaming: $isRenaming, 229 newFolderName: this.newFolderName, 230 mFolderInfo: this.mFolderInfo 231 }) 232 }) 233 } 234 .indicatorStyle({ 235 selectedColor: StyleConstants.DEFAULT_FONT_COLOR, 236 bottom: BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_INDICATOR 237 }) 238 .onClick(() => { 239 Log.showDebug(TAG, `Swiper click`); 240 this.saveText(); 241 }) 242 .height(mSwiperHeight) 243 .width(mGridWidth) 244 .index(this.PageIndex) 245 .loop(false) 246 .onChange((index) => { 247 Log.showDebug(TAG, `onChange :${index}`); 248 if (this.PageIndex != index) { 249 this.mFolderInfo = mBigFolderViewModel.addAddIcon(this.mFolderInfo); 250 this.PageIndex = index; 251 } 252 }) 253 } 254 } 255 .width(mGridWidth) 256 } 257 .width(BigFolderStyleConstants.PERCENTAGE_100) 258 .height(BigFolderStyleConstants.PERCENTAGE_100) 259 .visibility(this.openFolderStatus == BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE ? Visibility.Hidden : Visibility.Visible) 260 .opacity(this.overLayAlpha) 261 .backgroundColor('rgba(0,0,0,0.25)') 262 .onClick(() => { 263 Log.showDebug(TAG, 'blank click'); 264 this.saveText(); 265 }) 266 .onMouse((event: MouseEvent) => { 267 if (event.button == MouseButton.Right) { 268 event.stopPropagation(); 269 Log.showDebug(TAG, 'onMouse MouseButton Right'); 270 } 271 }) 272 } 273 274 private saveText() { 275 if (this.isRenaming) { 276 this.isRenaming = false; 277 if (this.newFolderName.trim().length !=0 && this.newFolderName) { 278 this.mFolderInfo.folderName = this.newFolderName; 279 mBigFolderViewModel.modifyFolderName(this.mFolderInfo) 280 } 281 } else { 282 const contextFlag: boolean = AppStorage.Get('contextMenuState'); 283 Log.showInfo(TAG, 'saveText contextFlag: ' + contextFlag); 284 if (contextFlag) { 285 AppStorage.SetOrCreate('contextMenuState', false); 286 } else { 287 mBigFolderViewModel.closeFolder(); 288 } 289 } 290 InputMethodManager.getInstance().stopInput(); 291 } 292} 293 294@Component 295struct FolderSwiperPage { 296 @StorageLink('isDraging') isDraging: boolean = false; 297 @Link isRenaming: boolean; 298 @Prop newFolderName: string; 299 private mFolderInfo: { 300 layoutInfo: [], 301 enterEditing: boolean, 302 folderName: string, 303 folderId: string 304 } = { layoutInfo: [], enterEditing: false, folderName: '', folderId: '' }; 305 private mAppInfo: any = {}; 306 private ColumnsTemplate: string = ''; 307 private RowsTemplate: string = ''; 308 private mGridGap; 309 310 aboutToAppear(): void { 311 mFolderModel = BigFolderModel.getInstance(); 312 this.updateConfig(); 313 } 314 315 private updateConfig() { 316 let styleConfig = mBigFolderViewModel.getFolderStyleConfig(); 317 this.mGridGap = styleConfig.mOpenFolderGridGap; 318 let openFolderConfig = mFolderModel.getFolderOpenLayout(); 319 320 let column = openFolderConfig.column; 321 let row = openFolderConfig.row; 322 this.ColumnsTemplate = ''; 323 this.RowsTemplate = ''; 324 for (let i = 0; i < column; i++) { 325 this.ColumnsTemplate += '1fr ' 326 } 327 for (let i = 0; i < row; i++) { 328 this.RowsTemplate += '1fr ' 329 } 330 } 331 332 folderDialogController: CustomDialogController = new CustomDialogController({ 333 builder: FolderAppListDialog({ 334 cancel: () => { 335 }, 336 confirm: (isDestory) => { 337 if (isDestory) { 338 mBigFolderViewModel.closeFolder(); 339 } 340 }, 341 folderItem: AppStorage.Get('openFolderData') 342 }), 343 customStyle: true, 344 alignment: DialogAlignment.Center, 345 cancel: () => { 346 }, 347 autoCancel: true 348 }) 349 350 build() { 351 Column() { 352 Grid() { 353 ForEach(this.mAppInfo, (item) => { 354 GridItem() { 355 if (item.typeId === CommonConstants.TYPE_ADD) { 356 Column() { 357 Stack({ alignContent: Alignment.Center }) { 358 Column() 359 .width(mAddIconSize) 360 .height(mAddIconSize) 361 .opacity(0.5) 362 .borderRadius(10) 363 .backgroundColor(Color.White) 364 365 Image(BigFolderStyleConstants.DEFAULT_ADD_FOLDER_APP_IMAGE) 366 .width(BigFolderStyleConstants.DEFAULT_ADD_APP_ICON_SIZE) 367 .height(BigFolderStyleConstants.DEFAULT_ADD_APP_ICON_SIZE) 368 }.margin({ top: mGridIconTopPadding }) 369 370 AppName({ 371 nameHeight: mAppNameHeight, 372 nameSize: mAppNameSize, 373 nameFontColor: BigFolderStyleConstants.DEFAULT_FONT_COLOR, 374 appName: item.appName, 375 useCache: false, 376 nameLines: mNameLines, 377 marginTop: mIconNameMargin 378 }) 379 } 380 .width(BigFolderStyleConstants.PERCENTAGE_100) 381 .height(BigFolderStyleConstants.PERCENTAGE_100) 382 .onClick(() => { 383 Log.showDebug(TAG, `add app to this folder`); 384 this.folderDialogController.open(); 385 }) 386 } else { 387 FolderAppItem({ 388 item: item, 389 }) 390 } 391 } 392 }, (item) => JSON.stringify(item)) 393 } 394 .margin(mGridPadding) 395 .width(mGridWidth - 2 * mGridPadding) 396 .height(mGridHeight - 2 * mGridPadding) 397 .columnsGap(this.mGridGap) 398 .rowsGap(this.mGridGap) 399 .onClick(() => { 400 Log.showDebug(TAG, 'Grid click'); 401 this.saveText(); 402 }) 403 .columnsTemplate(this.ColumnsTemplate) 404 .rowsTemplate(this.RowsTemplate) 405 } 406 .width(mGridWidth) 407 .height(mGridHeight) 408 .borderRadius(32) 409 .borderColor(this.isDraging ? 'rgba(255,255,255,0.25)' : 'rgba(0,0,0,0)') 410 .borderWidth(2) 411 .onMouse((event: MouseEvent) => { 412 if (event.button == MouseButton.Right) { 413 event.stopPropagation(); 414 Log.showDebug(TAG, 'Grid onMouse MouseButton Right'); 415 } 416 }) 417 } 418 419 private saveText() { 420 if (this.isRenaming) { 421 this.isRenaming = false; 422 if (this.newFolderName && this.newFolderName != this.mFolderInfo.folderName) { 423 this.mFolderInfo.folderName = this.newFolderName; 424 mBigFolderViewModel.modifyFolderName(this.mFolderInfo); 425 } 426 } else { 427 const contextFlag: boolean = AppStorage.Get('contextMenuState'); 428 Log.showInfo(TAG, 'saveText contextFlag: ' + contextFlag); 429 if (contextFlag) { 430 AppStorage.SetOrCreate('contextMenuState', false); 431 } else { 432 mBigFolderViewModel.closeFolder(); 433 } 434 } 435 InputMethodManager.getInstance().stopInput(); 436 } 437} 438 439@Component 440struct FolderAppItem { 441 @StorageLink('uninstallAppInfo') appInfo: any = {}; 442 @StorageLink('selectDesktopAppItem') selectDesktopAppItem: string = ''; 443 @State item: any = {}; 444 private ColumnsTemplate: string = ''; 445 private RowsTemplate: string = ''; 446 private isSwappingPage = false; 447 private willCloseFolder: boolean = false; 448 private mFolderInfo: any = {}; 449 private mouseClick: number = 0; 450 private dialogName: string = ""; 451 private clearForm: Function = null; 452 453 aboutToAppear(): void { 454 mFolderModel = BigFolderModel.getInstance(); 455 ResourceManager.getInstance().getStringByResource(isPad 456 ? $r('app.string.is_delete_form') : $r('app.string.isUninstall')).then((resName) => { 457 this.dialogName = resName; 458 }); 459 } 460 461 uninstallDialogController: CustomDialogController = new CustomDialogController({ 462 builder: UninstallDialog({ 463 cancel: () => { 464 }, 465 confirm: () => { 466 if (isPad) { 467 this.mFolderInfo = mBigFolderViewModel.deleteAppFromOpenFolder(this.appInfo); 468 } else { 469 mBigFolderViewModel.uninstallApp(this.appInfo.bundleName, this.appInfo.isUninstallAble); 470 if (!this.appInfo.isUninstallAble) { 471 return; 472 } 473 this.mFolderInfo = mBigFolderViewModel.deleteAppFromOpenFolder(this.appInfo); 474 } 475 mBigFolderViewModel.refreshFolder(this.mFolderInfo); 476 localEventManager.sendLocalEventSticky(EventConstants.EVENT_REQUEST_PAGEDESK_ITEM_UPDATE, null); 477 }, 478 dialogName: this.dialogName, 479 dialogContent: this.appInfo.appName + ' ?', 480 }), 481 cancel: () => { 482 }, 483 autoCancel: false, 484 customStyle: true 485 }); 486 487 formManagerDialogController: CustomDialogController = new CustomDialogController({ 488 builder: FormManagerDialog({ 489 cancel: (callback?) => { 490 // delete all form 491 if (callback != undefined) { 492 this.clearForm = callback; 493 } 494 }, 495 confirm: (formCardItem) => { 496 // add form to desktop 497 Log.showDebug(TAG, `createCardToDeskTop formCardItem: ${JSON.stringify(formCardItem)}`); 498 localEventManager.sendLocalEventSticky(EventConstants.EVENT_REQUEST_PAGEDESK_FORM_ITEM_ADD, formCardItem); 499 }, 500 bundleName: this.item.bundleName, 501 appName: globalThis.PageDesktopViewModel.getAppName(this.item.appLabelId + this.item.bundleName + this.item.moduleName), 502 appLabelId: this.item.appLabelId 503 }), 504 cancel: this.cancelFormDialog, 505 autoCancel: false, 506 customStyle: true 507 }); 508 509 cancelFormDialog() { 510 Log.showDebug(TAG, 'form manager cancel dialog'); 511 this.clearForm(); 512 } 513 514 closeFolderDelay() { 515 this.willCloseFolder = false; 516 setTimeout(() => { 517 this.willCloseFolder = true; 518 }, FOLDER_CLOSE_DELAY); 519 } 520 521 removeAppOutOfFolder(appInfo) { 522 mBigFolderViewModel.removeAppOutOfFolder(appInfo); 523 } 524 525 private launchApp() { 526 Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION); 527 this.setStartAppInfo(); 528 globalThis.PageDesktopViewModel.onAppDoubleClick(this.item.abilityName, this.item.bundleName, this.item.moduleName); 529 } 530 531 build() { 532 Column() { 533 Column() { 534 AppBubble({ 535 iconSize: mAppIconSize, 536 nameSize: mAppNameSize, 537 nameHeight: mAppNameHeight, 538 nameFontColor: BigFolderStyleConstants.DEFAULT_FONT_COLOR, 539 appName: this.item.appName, 540 bundleName: this.item.bundleName, 541 abilityName: this.item.abilityName, 542 moduleName: this.item.moduleName, 543 appIconId: this.item.appIconId, 544 appLabelId: this.item.appLabelId, 545 badgeNumber: this.item.badgeNumber, 546 isSelect: this.selectDesktopAppItem == this.item.keyName, 547 mPaddingTop: mGridIconTopPadding, 548 menuInfo: globalThis.PageDesktopViewModel.buildMenuInfoList(this.item, this.uninstallDialogController, 549 this.formManagerDialogController, this.removeAppOutOfFolder.bind(this), () => this.setStartAppInfo()), 550 nameLines: mNameLines, 551 mIconNameMargin: mIconNameMargin, 552 dragStart: () => {} 553 }) 554 } 555 .width(mAppItemWidth) 556 .height(mAppItemWidth) 557 .onClick(() => { 558 Log.showDebug(TAG, 'App click'); 559 this.setStartAppInfo(); 560 globalThis.PageDesktopViewModel.openApplication(this.item.abilityName, this.item.bundleName, this.item.moduleName); 561 }) 562 .onMouse((event: MouseEvent) => { 563 if (event.button == MouseButton.Right) { 564 event.stopPropagation(); 565 Log.showDebug(TAG, `FolderAppItem onMouse MouseButton Right keyName: ${this.item.keyName}`); 566 AppStorage.SetOrCreate('selectDesktopAppItem', this.item.keyName); 567 } 568 }) 569 .gesture( 570 GestureGroup(GestureMode.Exclusive, 571 TapGesture() 572 .onAction((event: GestureEvent) => { 573 Log.showDebug(TAG, `tap action ${JSON.stringify(event)}`) 574 if (event.source == SourceType.Mouse) { 575 this.mouseClick++; 576 if (this.mouseClick == DOUBLE_CLICK_COUNT) { 577 Log.showDebug(TAG, 'mouse double click'); 578 this.mouseClick = 0; 579 this.launchApp(); 580 } else { 581 this.setStartAppInfo(); 582 globalThis.PageDesktopViewModel.onAppClick(this.item.abilityName, this.item.bundleName, this.item.moduleName); 583 setTimeout(() => { 584 this.mouseClick = 0; 585 }, 300) 586 } 587 } else { 588 Log.showDebug(TAG, 'tap click'); 589 this.launchApp(); 590 } 591 }) 592 ) 593 ) 594 } 595 .width(mAppItemWidth) 596 .height(mAppItemWidth) 597 } 598 599 /** 600 * set start app info 601 */ 602 setStartAppInfo() { 603 if (CheckEmptyUtils.isEmpty(this.item)) { 604 Log.showError(TAG, `setStartAppInfo with item`) 605 return; 606 } 607 Log.showInfo(TAG, `app setStartAppInfo`); 608 if (AppStorage.Get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) { 609 AppStorage.SetOrCreate('openFolderStatus', BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE); 610 } 611 AppStorage.SetOrCreate('startAppItemInfo', this.item); 612 mBigFolderStartAppHandler.setAppIconSize(mBigFolderStyleConfig.mOpenFolderIconSize); 613 mBigFolderStartAppHandler.setAppIconInfo(); 614 } 615} 616