• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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          })
237          .onClick(() => {
238            Log.showDebug(TAG, `Swiper click`);
239            this.saveText();
240          })
241          .height(mSwiperHeight)
242          .width(mGridWidth)
243          .index(this.PageIndex)
244          .loop(false)
245          .onChange((index) => {
246            Log.showDebug(TAG, `onChange :${index}`);
247            if (this.PageIndex != index) {
248              this.mFolderInfo = mBigFolderViewModel.addAddIcon(this.mFolderInfo);
249              this.PageIndex = index;
250            }
251          })
252        }
253      }
254      .width(mGridWidth)
255    }
256    .width(BigFolderStyleConstants.PERCENTAGE_100)
257    .height(BigFolderStyleConstants.PERCENTAGE_100)
258    .visibility(this.openFolderStatus == BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE ? Visibility.Hidden : Visibility.Visible)
259    .opacity(this.overLayAlpha)
260    .backgroundColor('rgba(0,0,0,0.25)')
261    .onClick(() => {
262      Log.showDebug(TAG, 'blank click');
263      this.saveText();
264    })
265    .onMouse((event: MouseEvent) => {
266      if (event.button == MouseButton.Right) {
267        event.stopPropagation();
268        Log.showDebug(TAG, 'onMouse MouseButton Right');
269      }
270    })
271  }
272
273  private saveText() {
274    if (this.isRenaming) {
275      this.isRenaming = false;
276      if (this.newFolderName.trim().length !=0 && this.newFolderName) {
277        this.mFolderInfo.folderName = this.newFolderName;
278        mBigFolderViewModel.modifyFolderName(this.mFolderInfo)
279      }
280    } else {
281      const contextFlag: boolean = AppStorage.Get('contextMenuState');
282      Log.showInfo(TAG, 'saveText contextFlag: ' + contextFlag);
283      if (contextFlag) {
284        AppStorage.SetOrCreate('contextMenuState', false);
285      } else {
286        mBigFolderViewModel.closeFolder();
287      }
288    }
289    InputMethodManager.getInstance().stopInput();
290  }
291}
292
293@Component
294struct FolderSwiperPage {
295  @StorageLink('isDraging') isDraging: boolean = false;
296  @Link isRenaming: boolean;
297  @Prop newFolderName: string;
298  private mFolderInfo: {
299    layoutInfo: [],
300    enterEditing: boolean,
301    folderName: string,
302    folderId: string
303  } = { layoutInfo: [], enterEditing: false, folderName: '', folderId: '' };
304  private mAppInfo: any = {};
305  private ColumnsTemplate: string = '';
306  private RowsTemplate: string = '';
307  private mGridGap;
308
309  aboutToAppear(): void  {
310    mFolderModel = BigFolderModel.getInstance();
311    this.updateConfig();
312  }
313
314  aboutToDisappear(): void {
315    delete this.folderDialogController;
316    this.folderDialogController = null;
317  }
318
319  private updateConfig() {
320    let styleConfig = mBigFolderViewModel.getFolderStyleConfig();
321    this.mGridGap = styleConfig.mOpenFolderGridGap;
322    let openFolderConfig = mFolderModel.getFolderOpenLayout();
323
324    let column = openFolderConfig.column;
325    let row = openFolderConfig.row;
326    this.ColumnsTemplate = '';
327    this.RowsTemplate = '';
328    for (let i = 0; i < column; i++) {
329      this.ColumnsTemplate += '1fr '
330    }
331    for (let i = 0; i < row; i++) {
332      this.RowsTemplate += '1fr '
333    }
334  }
335
336  folderDialogController: CustomDialogController = new CustomDialogController({
337    builder: FolderAppListDialog({
338      cancel: () => {
339      },
340      confirm: (isDestory) => {
341        if (isDestory) {
342          mBigFolderViewModel.closeFolder();
343        }
344      },
345      folderItem: AppStorage.Get('openFolderData')
346    }),
347    customStyle: true,
348    alignment: DialogAlignment.Center,
349    cancel: () => {
350    },
351    autoCancel: true
352  })
353
354  build() {
355    Column() {
356      Grid() {
357        ForEach(this.mAppInfo, (item) => {
358          GridItem() {
359            if (item.typeId === CommonConstants.TYPE_ADD) {
360              Column() {
361                Stack({ alignContent: Alignment.Center }) {
362                  Column()
363                    .width(mAddIconSize)
364                    .height(mAddIconSize)
365                    .opacity(0.5)
366                    .borderRadius(10)
367                    .backgroundColor(Color.White)
368
369                  Image(BigFolderStyleConstants.DEFAULT_ADD_FOLDER_APP_IMAGE)
370                    .width(BigFolderStyleConstants.DEFAULT_ADD_APP_ICON_SIZE)
371                    .height(BigFolderStyleConstants.DEFAULT_ADD_APP_ICON_SIZE)
372                }.margin({ top: mGridIconTopPadding })
373
374                AppName({
375                  nameHeight: mAppNameHeight,
376                  nameSize: mAppNameSize,
377                  nameFontColor: BigFolderStyleConstants.DEFAULT_FONT_COLOR,
378                  appName: item.appName,
379                  useCache: false,
380                  nameLines: mNameLines,
381                  marginTop: mIconNameMargin
382                })
383              }
384              .width(BigFolderStyleConstants.PERCENTAGE_100)
385              .height(BigFolderStyleConstants.PERCENTAGE_100)
386              .onClick(() => {
387                Log.showDebug(TAG, `add app to this folder`);
388                this.folderDialogController.open();
389              })
390            } else {
391              FolderAppItem({
392                item: item,
393              })
394            }
395          }
396        }, (item) => JSON.stringify(item))
397      }
398      .margin(mGridPadding)
399      .width(mGridWidth - 2 * mGridPadding)
400      .height(mGridHeight - 2 * mGridPadding)
401      .columnsGap(this.mGridGap)
402      .rowsGap(this.mGridGap)
403      .onClick(() => {
404        Log.showDebug(TAG, 'Grid click');
405        this.saveText();
406      })
407      .columnsTemplate(this.ColumnsTemplate)
408      .rowsTemplate(this.RowsTemplate)
409    }
410    .width(mGridWidth)
411    .height(mGridHeight)
412    .borderRadius(32)
413    .borderColor(this.isDraging ? 'rgba(255,255,255,0.25)' : 'rgba(0,0,0,0)')
414    .borderWidth(2)
415    .onMouse((event: MouseEvent) => {
416      if (event.button == MouseButton.Right) {
417        event.stopPropagation();
418        Log.showDebug(TAG, 'Grid onMouse MouseButton Right');
419      }
420    })
421  }
422
423  private saveText() {
424    if (this.isRenaming) {
425      this.isRenaming = false;
426      if (this.newFolderName && this.newFolderName != this.mFolderInfo.folderName) {
427        this.mFolderInfo.folderName = this.newFolderName;
428        mBigFolderViewModel.modifyFolderName(this.mFolderInfo);
429      }
430    } else {
431      const contextFlag: boolean = AppStorage.Get('contextMenuState');
432      Log.showInfo(TAG, 'saveText contextFlag: ' + contextFlag);
433      if (contextFlag) {
434        AppStorage.SetOrCreate('contextMenuState', false);
435      } else {
436        mBigFolderViewModel.closeFolder();
437      }
438    }
439    InputMethodManager.getInstance().stopInput();
440  }
441}
442
443@Component
444struct FolderAppItem {
445  @StorageLink('uninstallAppInfo') appInfo: any = {};
446  @StorageLink('selectDesktopAppItem') selectDesktopAppItem: string = '';
447  @State item: any = {};
448  private ColumnsTemplate: string = '';
449  private RowsTemplate: string = '';
450  private isSwappingPage = false;
451  private willCloseFolder: boolean = false;
452  private mFolderInfo: any = {};
453  private mouseClick: number = 0;
454  private dialogName: string = "";
455  private clearForm: Function = null;
456
457  aboutToAppear(): void  {
458    mFolderModel = BigFolderModel.getInstance();
459    ResourceManager.getInstance().getStringByResource(isPad
460      ? $r('app.string.is_delete_form') : $r('app.string.isUninstall')).then((resName) => {
461      this.dialogName = resName;
462    });
463  }
464
465  aboutToDisappear(): void {
466    delete this.uninstallDialogController;
467    this.uninstallDialogController = null;
468    delete this.formManagerDialogController;
469    this.formManagerDialogController = null;
470    this.clearForm = null;
471  }
472
473  uninstallDialogController: CustomDialogController = new CustomDialogController({
474    builder: UninstallDialog({
475      cancel: () => {
476      },
477      confirm: () => {
478        if (isPad) {
479          this.mFolderInfo = mBigFolderViewModel.deleteAppFromOpenFolder(this.appInfo);
480        } else {
481          mBigFolderViewModel.uninstallApp(this.appInfo.bundleName, this.appInfo.isUninstallAble);
482          if (!this.appInfo.isUninstallAble) {
483            return;
484          }
485          this.mFolderInfo = mBigFolderViewModel.deleteAppFromOpenFolder(this.appInfo);
486        }
487        mBigFolderViewModel.refreshFolder(this.mFolderInfo);
488        localEventManager.sendLocalEventSticky(EventConstants.EVENT_REQUEST_PAGEDESK_ITEM_UPDATE, null);
489      },
490      dialogName: this.dialogName,
491      dialogContent: this.appInfo.appName + ' ?',
492    }),
493    cancel: () => {
494    },
495    autoCancel: false,
496    customStyle: true
497  });
498
499  formManagerDialogController: CustomDialogController = new CustomDialogController({
500    builder: FormManagerDialog({
501      cancel: (callback?) => {
502        // delete all form
503        if (callback != undefined) {
504          this.clearForm = callback;
505        }
506      },
507      confirm: (formCardItem) => {
508        // add form to desktop
509        Log.showDebug(TAG, `createCardToDeskTop formCardItem: ${JSON.stringify(formCardItem)}`);
510        localEventManager.sendLocalEventSticky(EventConstants.EVENT_REQUEST_PAGEDESK_FORM_ITEM_ADD, formCardItem);
511      },
512      bundleName: this.item.bundleName,
513      appName: globalThis.PageDesktopViewModel.getAppName(this.item.appLabelId + this.item.bundleName + this.item.moduleName),
514      appLabelId: this.item.appLabelId
515    }),
516    cancel: this.cancelFormDialog,
517    autoCancel: false,
518    customStyle: true
519  });
520
521  cancelFormDialog() {
522    Log.showDebug(TAG, 'form manager cancel dialog');
523    this.clearForm();
524  }
525
526  closeFolderDelay() {
527    this.willCloseFolder = false;
528    setTimeout(() => {
529      this.willCloseFolder = true;
530    }, FOLDER_CLOSE_DELAY);
531  }
532
533  removeAppOutOfFolder(appInfo) {
534    mBigFolderViewModel.removeAppOutOfFolder(appInfo);
535  }
536
537  private launchApp() {
538    Trace.start(Trace.CORE_METHOD_START_APP_ANIMATION);
539    this.setStartAppInfo();
540    globalThis.PageDesktopViewModel.onAppDoubleClick(this.item.abilityName, this.item.bundleName, this.item.moduleName);
541  }
542
543  build() {
544    Column() {
545      Column() {
546        AppBubble({
547          iconSize: mAppIconSize,
548          nameSize: mAppNameSize,
549          nameHeight: mAppNameHeight,
550          nameFontColor: BigFolderStyleConstants.DEFAULT_FONT_COLOR,
551          appName: this.item.appName,
552          bundleName: this.item.bundleName,
553          abilityName: this.item.abilityName,
554          moduleName: this.item.moduleName,
555          appIconId: this.item.appIconId,
556          appLabelId: this.item.appLabelId,
557          badgeNumber: this.item.badgeNumber,
558          isSelect: this.selectDesktopAppItem == this.item.keyName,
559          mPaddingTop: mGridIconTopPadding,
560          menuInfo: globalThis.PageDesktopViewModel.buildMenuInfoList(this.item, this.uninstallDialogController,
561            this.formManagerDialogController, this.removeAppOutOfFolder.bind(this), () => this.setStartAppInfo()),
562          nameLines: mNameLines,
563          mIconNameMargin: mIconNameMargin,
564          dragStart: () => {}
565        })
566      }
567      .width(mAppItemWidth)
568      .height(mAppItemWidth)
569      .onClick(() => {
570        Log.showDebug(TAG, 'App click');
571        this.setStartAppInfo();
572        globalThis.PageDesktopViewModel.openApplication(this.item.abilityName, this.item.bundleName, this.item.moduleName);
573      })
574      .onMouse((event: MouseEvent) => {
575        if (event.button == MouseButton.Right) {
576          event.stopPropagation();
577          Log.showDebug(TAG, `FolderAppItem onMouse MouseButton Right keyName: ${this.item.keyName}`);
578          AppStorage.SetOrCreate('selectDesktopAppItem', this.item.keyName);
579        }
580      })
581      .gesture(
582      GestureGroup(GestureMode.Exclusive,
583      TapGesture()
584        .onAction((event: GestureEvent) => {
585          Log.showDebug(TAG, `tap action ${JSON.stringify(event)}`)
586          if (event.source == SourceType.Mouse) {
587            this.mouseClick++;
588            if (this.mouseClick == DOUBLE_CLICK_COUNT) {
589              Log.showDebug(TAG, 'mouse double click');
590              this.mouseClick = 0;
591              this.launchApp();
592            } else {
593              this.setStartAppInfo();
594              globalThis.PageDesktopViewModel.onAppClick(this.item.abilityName, this.item.bundleName, this.item.moduleName);
595              setTimeout(() => {
596                this.mouseClick = 0;
597              }, 300)
598            }
599          } else {
600            Log.showDebug(TAG, 'tap click');
601            this.launchApp();
602          }
603        })
604      )
605      )
606    }
607    .width(mAppItemWidth)
608    .height(mAppItemWidth)
609  }
610
611  /**
612   * set start app info
613   */
614  setStartAppInfo() {
615    if (CheckEmptyUtils.isEmpty(this.item)) {
616      Log.showError(TAG, `setStartAppInfo with item`)
617      return;
618    }
619    Log.showInfo(TAG, `app setStartAppInfo`);
620    if (AppStorage.Get('deviceType') === CommonConstants.PAD_DEVICE_TYPE) {
621      AppStorage.SetOrCreate('openFolderStatus', BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE);
622    }
623    AppStorage.SetOrCreate('startAppItemInfo', this.item);
624    mBigFolderStartAppHandler.setAppIconSize(mBigFolderStyleConfig.mOpenFolderIconSize);
625    mBigFolderStartAppHandler.setAppIconInfo();
626  }
627}
628