16e80583aSopenharmony_ci/**
26e80583aSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
36e80583aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
46e80583aSopenharmony_ci * you may not use this file except in compliance with the License.
56e80583aSopenharmony_ci * You may obtain a copy of the License at
66e80583aSopenharmony_ci *
76e80583aSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
86e80583aSopenharmony_ci *
96e80583aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
106e80583aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
116e80583aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126e80583aSopenharmony_ci * See the License for the specific language governing permissions and
136e80583aSopenharmony_ci * limitations under the License.
146e80583aSopenharmony_ci */
156e80583aSopenharmony_ci
166e80583aSopenharmony_ciimport { Log } from '../utils/Log';
176e80583aSopenharmony_ciimport { SettingsModel } from '../model/SettingsModel';
186e80583aSopenharmony_ciimport { StyleConstants } from '../constants/StyleConstants';
196e80583aSopenharmony_ciimport { CommonConstants } from '../constants/CommonConstants';
206e80583aSopenharmony_ciimport { ResourceManager } from '../manager/ResourceManager';
216e80583aSopenharmony_ciimport { PresetStyleConstants } from '../constants/PresetStyleConstants';
226e80583aSopenharmony_ciimport { AppIcon } from './AppIcon';
236e80583aSopenharmony_ciimport { AppName } from './AppName';
246e80583aSopenharmony_ciimport { AppMenu } from './AppMenu';
256e80583aSopenharmony_ciimport { LauncherDragItemInfo } from '../bean/LauncherDragItemInfo';
266e80583aSopenharmony_ciimport { AppItemInfo } from '../bean/AppItemInfo';
276e80583aSopenharmony_ciimport { MenuInfo } from '../bean';
286e80583aSopenharmony_ciimport { FolderData } from '../interface/FolderData';
296e80583aSopenharmony_ci
306e80583aSopenharmony_ciconst TAG = 'FolderComponent';
316e80583aSopenharmony_ci
326e80583aSopenharmony_ciinterface FolderAnimateData {
336e80583aSopenharmony_ci  folderId?: string;
346e80583aSopenharmony_ci  isOpenFolder?: boolean;
356e80583aSopenharmony_ci}
366e80583aSopenharmony_ci
376e80583aSopenharmony_ciclass FolderItem {
386e80583aSopenharmony_ci  public layoutInfo: AppItemInfo[][] = [];
396e80583aSopenharmony_ci  public folderId: string = '';
406e80583aSopenharmony_ci  public folderName: string = '';
416e80583aSopenharmony_ci}
426e80583aSopenharmony_ci
436e80583aSopenharmony_ciclass SuperposeApp extends AppItemInfo {
446e80583aSopenharmony_ci  public isEmpty?: boolean;
456e80583aSopenharmony_ci  public alignContent?: Alignment;
466e80583aSopenharmony_ci}
476e80583aSopenharmony_ci
486e80583aSopenharmony_ci@Component
496e80583aSopenharmony_ciexport struct FolderComponent {
506e80583aSopenharmony_ci  @StorageLink('openFolderStatus') @Watch('updateFolderAnimate') openFolderStatus: number = 1;
516e80583aSopenharmony_ci  @State folderAnimateData: FolderAnimateData = { folderId: '', isOpenFolder: false };
526e80583aSopenharmony_ci  @State folderPositionX: number = 0;
536e80583aSopenharmony_ci  @State folderPositionY: number = 0;
546e80583aSopenharmony_ci  @State folderItemPositionX: number = 0;
556e80583aSopenharmony_ci  @State folderItemPositionY: number = 0;
566e80583aSopenharmony_ci  @State animateFolderPositionX: number = 0;
576e80583aSopenharmony_ci  @State animateFolderPositionY: number = 0;
586e80583aSopenharmony_ci  @State animateOpacity: number = 1.0;
596e80583aSopenharmony_ci  @State animateScale: number = 1.0;
606e80583aSopenharmony_ci  @State showFolderName: boolean = true;
616e80583aSopenharmony_ci  @State folderNameHeight: number = 0;
626e80583aSopenharmony_ci  @State folderNameSize: number = 0;
636e80583aSopenharmony_ci  @State nameFontColor: string = '';
646e80583aSopenharmony_ci  @State appIconSize: number = 0;
656e80583aSopenharmony_ci  @State superposeIconVisible: boolean = false;
666e80583aSopenharmony_ci  @State isHover: boolean = false;
676e80583aSopenharmony_ci  mPaddingTop: number = StyleConstants.DEFAULT_10;
686e80583aSopenharmony_ci  folderGridSize: number = StyleConstants.DEFAULT_FOLDER_GRID_SIZE;
696e80583aSopenharmony_ci  gridMargin: number = StyleConstants.DEFAULT_FOLDER_GRID_MARGIN;
706e80583aSopenharmony_ci  gridGap: number = StyleConstants.DEFAULT_FOLDER_GRID_GAP;
716e80583aSopenharmony_ci  badgeNumber: number = 0;
726e80583aSopenharmony_ci  private mSettingsModel: SettingsModel = SettingsModel.getInstance();
736e80583aSopenharmony_ci  private isPad: boolean = false;
746e80583aSopenharmony_ci  private mFolderItem: LauncherDragItemInfo = new LauncherDragItemInfo();
756e80583aSopenharmony_ci  private mShowAppList: AppItemInfo[] = [];
766e80583aSopenharmony_ci  private mSuperposeAppList: SuperposeApp[] = [];
776e80583aSopenharmony_ci  onAppIconClick: Function = (event: ClickEvent, item: AppItemInfo) => {};
786e80583aSopenharmony_ci  onOpenFolderClick: Function = (event: ClickEvent, folderItem: FolderData) => {};
796e80583aSopenharmony_ci  onFolderTouch: Function = (event: ClickEvent, folderItem: FolderData) => {};
806e80583aSopenharmony_ci  onGetPosition: Function = (callback: (x: number, y: number) => void) => {};
816e80583aSopenharmony_ci  buildMenu: (item: LauncherDragItemInfo) => MenuInfo[] = (item: LauncherDragItemInfo) => [];
826e80583aSopenharmony_ci  folderNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
836e80583aSopenharmony_ci  iconNameMargin: number = PresetStyleConstants.DEFAULT_ICON_NAME_GAP;
846e80583aSopenharmony_ci  isSelect: boolean = false;
856e80583aSopenharmony_ci  dragStart: Function = (event: DragEvent) => {};
866e80583aSopenharmony_ci
876e80583aSopenharmony_ci  aboutToAppear(): void {
886e80583aSopenharmony_ci    Log.showInfo(TAG, 'aboutToAppear start');
896e80583aSopenharmony_ci    this.updateShowList();
906e80583aSopenharmony_ci    this.mSettingsModel = SettingsModel.getInstance();
916e80583aSopenharmony_ci    if (this.mSettingsModel.getDevice() != 'phone') {
926e80583aSopenharmony_ci      this.isPad = true;
936e80583aSopenharmony_ci    }
946e80583aSopenharmony_ci  }
956e80583aSopenharmony_ci
966e80583aSopenharmony_ci  aboutToDisappear(): void {
976e80583aSopenharmony_ci  }
986e80583aSopenharmony_ci
996e80583aSopenharmony_ci  updateShowList(): void {
1006e80583aSopenharmony_ci    if (typeof this.mFolderItem.layoutInfo === 'undefined') {
1016e80583aSopenharmony_ci      return;
1026e80583aSopenharmony_ci    };
1036e80583aSopenharmony_ci    if (this.mFolderItem.layoutInfo[0].length > CommonConstants.FOLDER_STATIC_SHOW_LENGTH) {
1046e80583aSopenharmony_ci      this.mShowAppList = this.mFolderItem.layoutInfo[0].slice(0, CommonConstants.FOLDER_STATIC_SHOW_LENGTH);
1056e80583aSopenharmony_ci    } else {
1066e80583aSopenharmony_ci      this.mShowAppList = this.mFolderItem.layoutInfo[0];
1076e80583aSopenharmony_ci    }
1086e80583aSopenharmony_ci
1096e80583aSopenharmony_ci    let showLength = CommonConstants.FOLDER_STATIC_SHOW_LENGTH - CommonConstants.FOLDER_STATIC_SUPERPOSEAPP_LENGTH;
1106e80583aSopenharmony_ci    if (this.mShowAppList.length > showLength) {
1116e80583aSopenharmony_ci      this.mSuperposeAppList = this.mShowAppList.slice(showLength);
1126e80583aSopenharmony_ci      this.mShowAppList = this.mShowAppList.slice(0, showLength);
1136e80583aSopenharmony_ci      this.superposeIconVisible = true;
1146e80583aSopenharmony_ci    }
1156e80583aSopenharmony_ci
1166e80583aSopenharmony_ci    let length = this.mSuperposeAppList.length;
1176e80583aSopenharmony_ci    let mSuperposeApp = new SuperposeApp();
1186e80583aSopenharmony_ci    if (length > CommonConstants.FOLDER_STATIC_SUPERPOSEAPP_LENGTH) {
1196e80583aSopenharmony_ci      this.mSuperposeAppList = this.mSuperposeAppList.slice(0, CommonConstants.FOLDER_STATIC_SUPERPOSEAPP_LENGTH);
1206e80583aSopenharmony_ci    } else {
1216e80583aSopenharmony_ci      for (let i = 0; i < (CommonConstants.FOLDER_STATIC_SUPERPOSEAPP_LENGTH - length); i++) {
1226e80583aSopenharmony_ci        mSuperposeApp.isEmpty = true;
1236e80583aSopenharmony_ci        this.mSuperposeAppList.push(mSuperposeApp);
1246e80583aSopenharmony_ci      }
1256e80583aSopenharmony_ci    }
1266e80583aSopenharmony_ci    this.mSuperposeAppList = this.mSuperposeAppList.reverse();
1276e80583aSopenharmony_ci    this.mSuperposeAppList[0].alignContent = Alignment.TopStart;
1286e80583aSopenharmony_ci    this.mSuperposeAppList[1].alignContent = Alignment.Center;
1296e80583aSopenharmony_ci    this.mSuperposeAppList[2].alignContent = Alignment.BottomEnd;
1306e80583aSopenharmony_ci
1316e80583aSopenharmony_ci    Log.showInfo(TAG, `superposeIconVisible:${this.superposeIconVisible}`);
1326e80583aSopenharmony_ci    Log.showInfo(TAG, `FolderItem.layoutInfo[0].length:${this.mFolderItem.layoutInfo[0].length}`);
1336e80583aSopenharmony_ci    Log.showInfo(TAG, `mSuperposeAppList length:${this.mSuperposeAppList.length}`);
1346e80583aSopenharmony_ci  }
1356e80583aSopenharmony_ci
1366e80583aSopenharmony_ci  @Builder MenuBuilder() {
1376e80583aSopenharmony_ci    Column() {
1386e80583aSopenharmony_ci      AppMenu({
1396e80583aSopenharmony_ci        menuInfoList: this.buildMenu(this.mFolderItem),
1406e80583aSopenharmony_ci      })
1416e80583aSopenharmony_ci    }
1426e80583aSopenharmony_ci    .alignItems(HorizontalAlign.Center)
1436e80583aSopenharmony_ci    .justifyContent(FlexAlign.Center)
1446e80583aSopenharmony_ci    .width(StyleConstants.CONTEXT_MENU_WIDTH)
1456e80583aSopenharmony_ci  }
1466e80583aSopenharmony_ci
1476e80583aSopenharmony_ci  private updateFolderAnimate() {
1486e80583aSopenharmony_ci    Log.showInfo(TAG, 'updateFolderAnimate start');
1496e80583aSopenharmony_ci    if (this.openFolderStatus == 0) {
1506e80583aSopenharmony_ci      this.folderAnimateData = AppStorage.get('folderAnimateData') as FolderAnimateData;
1516e80583aSopenharmony_ci      if (this.mFolderItem.folderId === this.folderAnimateData.folderId &&
1526e80583aSopenharmony_ci      this.folderAnimateData.isOpenFolder &&
1536e80583aSopenharmony_ci      this.folderAnimateData.folderId != '' &&
1546e80583aSopenharmony_ci      this.animateOpacity != 1.0 &&
1556e80583aSopenharmony_ci      this.animateScale != 1.0) {
1566e80583aSopenharmony_ci        this.folderAnimateData.isOpenFolder = false;
1576e80583aSopenharmony_ci        AppStorage.setOrCreate('folderAnimateData', this.folderAnimateData);
1586e80583aSopenharmony_ci        Log.showInfo(TAG, `updateFolderAnimate show`);
1596e80583aSopenharmony_ci        this.showAnimate(1.0, 1.0, false);
1606e80583aSopenharmony_ci      }
1616e80583aSopenharmony_ci    }
1626e80583aSopenharmony_ci  }
1636e80583aSopenharmony_ci
1646e80583aSopenharmony_ci  private showAnimate(animateScale: number, animateOpacity: number, isMoveFolder: boolean) {
1656e80583aSopenharmony_ci    let positionX = 0;
1666e80583aSopenharmony_ci    let positionY = 0;
1676e80583aSopenharmony_ci    if (this.onGetPosition) {
1686e80583aSopenharmony_ci      this.onGetPosition(this.getPosition);
1696e80583aSopenharmony_ci      if (isMoveFolder) {
1706e80583aSopenharmony_ci        positionX = this.animateFolderPositionX;
1716e80583aSopenharmony_ci        positionY = this.animateFolderPositionY;
1726e80583aSopenharmony_ci      }
1736e80583aSopenharmony_ci    }
1746e80583aSopenharmony_ci    animateTo({
1756e80583aSopenharmony_ci      duration: 250,
1766e80583aSopenharmony_ci      tempo: 0.5,
1776e80583aSopenharmony_ci      curve: Curve.Friction,
1786e80583aSopenharmony_ci      delay: 0,
1796e80583aSopenharmony_ci      iterations: 1,
1806e80583aSopenharmony_ci      playMode: PlayMode.Normal,
1816e80583aSopenharmony_ci      onFinish: () => {
1826e80583aSopenharmony_ci        Log.showInfo(TAG, ` onFinish x: ${this.folderPositionX}, y: ${this.folderPositionY}`);
1836e80583aSopenharmony_ci      }
1846e80583aSopenharmony_ci    }, () => {
1856e80583aSopenharmony_ci      this.animateScale = animateScale;
1866e80583aSopenharmony_ci      this.animateOpacity = animateOpacity;
1876e80583aSopenharmony_ci      this.folderPositionX = positionX;
1886e80583aSopenharmony_ci      this.folderPositionY = positionY;
1896e80583aSopenharmony_ci    })
1906e80583aSopenharmony_ci  }
1916e80583aSopenharmony_ci
1926e80583aSopenharmony_ci  public getPosition = (x: number, y: number): void => {
1936e80583aSopenharmony_ci    this.folderItemPositionX = x;
1946e80583aSopenharmony_ci    this.folderItemPositionY = y;
1956e80583aSopenharmony_ci    let screenWidth: number = AppStorage.get('screenWidth') as number;
1966e80583aSopenharmony_ci    let screenHeight: number = AppStorage.get('screenHeight') as number;
1976e80583aSopenharmony_ci    this.animateFolderPositionX = (screenWidth - this.folderGridSize * 1.5) / 2 - this.folderItemPositionX;
1986e80583aSopenharmony_ci    this.animateFolderPositionY = (screenHeight - this.folderGridSize * 1.5) / 2 - this.folderItemPositionY;
1996e80583aSopenharmony_ci    Log.showInfo(TAG, `getPosition animatePosition x: ${this.animateFolderPositionX}, y: ${this.animateFolderPositionY}`);
2006e80583aSopenharmony_ci  }
2016e80583aSopenharmony_ci
2026e80583aSopenharmony_ci  build() {
2036e80583aSopenharmony_ci    Column() {
2046e80583aSopenharmony_ci      Column() {
2056e80583aSopenharmony_ci        Badge({
2066e80583aSopenharmony_ci          count: this.badgeNumber,
2076e80583aSopenharmony_ci          maxCount: StyleConstants.MAX_BADGE_COUNT,
2086e80583aSopenharmony_ci          style: {
2096e80583aSopenharmony_ci            color: StyleConstants.DEFAULT_FONT_COLOR,
2106e80583aSopenharmony_ci            fontSize: StyleConstants.DEFAULT_BADGE_FONT_SIZE,
2116e80583aSopenharmony_ci            badgeSize: (this.badgeNumber > 0 ? StyleConstants.DEFAULT_BADGE_SIZE : 0),
2126e80583aSopenharmony_ci            badgeColor: Color.Red,
2136e80583aSopenharmony_ci          }
2146e80583aSopenharmony_ci        }) {
2156e80583aSopenharmony_ci          Stack() {
2166e80583aSopenharmony_ci            Column() {
2176e80583aSopenharmony_ci            }
2186e80583aSopenharmony_ci            .backgroundColor(Color.White)
2196e80583aSopenharmony_ci            .borderRadius(24)
2206e80583aSopenharmony_ci            .opacity(0.5)
2216e80583aSopenharmony_ci            .height(this.folderGridSize)
2226e80583aSopenharmony_ci            .width(this.folderGridSize)
2236e80583aSopenharmony_ci
2246e80583aSopenharmony_ci            Grid() {
2256e80583aSopenharmony_ci              ForEach(this.mShowAppList, (item: AppItemInfo) => {
2266e80583aSopenharmony_ci                GridItem() {
2276e80583aSopenharmony_ci                  AppIcon({
2286e80583aSopenharmony_ci                    iconSize: this.appIconSize,
2296e80583aSopenharmony_ci                    iconId: item.appIconId,
2306e80583aSopenharmony_ci                    icon: ResourceManager.getInstance().getCachedAppIcon(
2316e80583aSopenharmony_ci                      item.appIconId, item.bundleName, item.moduleName
2326e80583aSopenharmony_ci                    ),
2336e80583aSopenharmony_ci                    bundleName: item.bundleName,
2346e80583aSopenharmony_ci                    moduleName: item.moduleName,
2356e80583aSopenharmony_ci                    badgeNumber: item.badgeNumber
2366e80583aSopenharmony_ci                  })
2376e80583aSopenharmony_ci                }
2386e80583aSopenharmony_ci                .height(StyleConstants.PERCENTAGE_100)
2396e80583aSopenharmony_ci                .width(StyleConstants.PERCENTAGE_100)
2406e80583aSopenharmony_ci                .onClick((event: ClickEvent) => {
2416e80583aSopenharmony_ci                  if (this.onAppIconClick) {
2426e80583aSopenharmony_ci                    this.onAppIconClick(event, item);
2436e80583aSopenharmony_ci                  }
2446e80583aSopenharmony_ci                })
2456e80583aSopenharmony_ci              }, (item: AppItemInfo) => JSON.stringify(item))
2466e80583aSopenharmony_ci
2476e80583aSopenharmony_ci              if (this.mSuperposeAppList.length > 0) {
2486e80583aSopenharmony_ci                GridItem() {
2496e80583aSopenharmony_ci                  Stack() {
2506e80583aSopenharmony_ci                    ForEach(this.mSuperposeAppList, (item: SuperposeApp) => {
2516e80583aSopenharmony_ci                      Stack({ alignContent: item.alignContent }) {
2526e80583aSopenharmony_ci                        if (item.isEmpty) {
2536e80583aSopenharmony_ci                          Column() {
2546e80583aSopenharmony_ci                            Column() {
2556e80583aSopenharmony_ci                            }
2566e80583aSopenharmony_ci                            .backgroundColor(Color.White)
2576e80583aSopenharmony_ci                            .borderRadius(10)
2586e80583aSopenharmony_ci                            .opacity(0.5)
2596e80583aSopenharmony_ci                            .width(StyleConstants.PERCENTAGE_100)
2606e80583aSopenharmony_ci                            .height(StyleConstants.PERCENTAGE_100)
2616e80583aSopenharmony_ci                          }
2626e80583aSopenharmony_ci                          .alignItems(HorizontalAlign.Start)
2636e80583aSopenharmony_ci                          .width(StyleConstants.PERCENTAGE_80)
2646e80583aSopenharmony_ci                          .height(StyleConstants.PERCENTAGE_80)
2656e80583aSopenharmony_ci                        } else {
2666e80583aSopenharmony_ci                          Column() {
2676e80583aSopenharmony_ci                            AppIcon({
2686e80583aSopenharmony_ci                              iconSize: this.appIconSize * StyleConstants.PERCENTAGE_80_number,
2696e80583aSopenharmony_ci                              iconId: item.appIconId,
2706e80583aSopenharmony_ci                              icon: ResourceManager.getInstance().getCachedAppIcon(
2716e80583aSopenharmony_ci                                item.appIconId, item.bundleName, item.moduleName
2726e80583aSopenharmony_ci                              ),
2736e80583aSopenharmony_ci                              bundleName: item.bundleName,
2746e80583aSopenharmony_ci                              moduleName: item.moduleName,
2756e80583aSopenharmony_ci                              badgeNumber: item.badgeNumber
2766e80583aSopenharmony_ci                            })
2776e80583aSopenharmony_ci                          }
2786e80583aSopenharmony_ci                          .width(StyleConstants.PERCENTAGE_80)
2796e80583aSopenharmony_ci                          .height(StyleConstants.PERCENTAGE_80)
2806e80583aSopenharmony_ci                          .alignItems(HorizontalAlign.Start)
2816e80583aSopenharmony_ci                        }
2826e80583aSopenharmony_ci                      }
2836e80583aSopenharmony_ci                      .width(StyleConstants.PERCENTAGE_100)
2846e80583aSopenharmony_ci                      .height(StyleConstants.PERCENTAGE_100)
2856e80583aSopenharmony_ci                    }, (item: SuperposeApp) => JSON.stringify(item))
2866e80583aSopenharmony_ci                  }
2876e80583aSopenharmony_ci                  .width(this.isPad ?
2886e80583aSopenharmony_ci                    StyleConstants.DEFAULT_FOLDER_APP_ITEM_WIDTH_SMALL :
2896e80583aSopenharmony_ci                    StyleConstants.DEFAULT_FOLDER_APP_ITEM_WIDTH)
2906e80583aSopenharmony_ci                  .height(this.isPad ?
2916e80583aSopenharmony_ci                    StyleConstants.DEFAULT_FOLDER_APP_ITEM_WIDTH_SMALL :
2926e80583aSopenharmony_ci                    StyleConstants.DEFAULT_FOLDER_APP_ITEM_WIDTH)
2936e80583aSopenharmony_ci                }
2946e80583aSopenharmony_ci                .visibility(this.superposeIconVisible ? Visibility.Visible : Visibility.Hidden)
2956e80583aSopenharmony_ci                .width(StyleConstants.PERCENTAGE_100)
2966e80583aSopenharmony_ci                .height(StyleConstants.PERCENTAGE_100)
2976e80583aSopenharmony_ci                .onClick((event: ClickEvent) => {
2986e80583aSopenharmony_ci                  Log.showInfo(TAG, 'last item onClick');
2996e80583aSopenharmony_ci                  this.showAnimate(1.5, 0, true);
3006e80583aSopenharmony_ci                  if (this.onOpenFolderClick) {
3016e80583aSopenharmony_ci                    this.folderAnimateData.folderId = this.mFolderItem.folderId;
3026e80583aSopenharmony_ci                    this.folderAnimateData.isOpenFolder = true;
3036e80583aSopenharmony_ci                    AppStorage.setOrCreate('folderAnimateData', this.folderAnimateData);
3046e80583aSopenharmony_ci                    this.onOpenFolderClick(event, this.mFolderItem);
3056e80583aSopenharmony_ci                  }
3066e80583aSopenharmony_ci                })
3076e80583aSopenharmony_ci              }
3086e80583aSopenharmony_ci            }
3096e80583aSopenharmony_ci            .padding(this.gridMargin)
3106e80583aSopenharmony_ci            .columnsTemplate('1fr 1fr 1fr')
3116e80583aSopenharmony_ci            .rowsTemplate('1fr 1fr 1fr')
3126e80583aSopenharmony_ci            .columnsGap(this.gridGap)
3136e80583aSopenharmony_ci            .rowsGap(this.gridGap)
3146e80583aSopenharmony_ci            .onClick((event: ClickEvent) => {
3156e80583aSopenharmony_ci              Log.showInfo(TAG, 'grid onClick');
3166e80583aSopenharmony_ci              this.showAnimate(1.5, 0, true);
3176e80583aSopenharmony_ci              if (this.onOpenFolderClick) {
3186e80583aSopenharmony_ci                this.folderAnimateData.folderId = this.mFolderItem.folderId;
3196e80583aSopenharmony_ci                this.folderAnimateData.isOpenFolder = true;
3206e80583aSopenharmony_ci                AppStorage.setOrCreate('folderAnimateData', this.folderAnimateData);
3216e80583aSopenharmony_ci                this.onOpenFolderClick(event, this.mFolderItem);
3226e80583aSopenharmony_ci              }
3236e80583aSopenharmony_ci            })
3246e80583aSopenharmony_ci            .onTouch((event: TouchEvent) => {
3256e80583aSopenharmony_ci              Log.showInfo(TAG, 'onTouch start');
3266e80583aSopenharmony_ci              if (this.onFolderTouch) {
3276e80583aSopenharmony_ci                this.onFolderTouch(event, this.mFolderItem);
3286e80583aSopenharmony_ci              }
3296e80583aSopenharmony_ci              Log.showInfo(TAG, 'onTouch end');
3306e80583aSopenharmony_ci            })
3316e80583aSopenharmony_ci          }
3326e80583aSopenharmony_ci          .height(StyleConstants.PERCENTAGE_100)
3336e80583aSopenharmony_ci          .width(StyleConstants.PERCENTAGE_100)
3346e80583aSopenharmony_ci          .onHover((isHover: boolean) => {
3356e80583aSopenharmony_ci            Log.showInfo(TAG, `onHover isHover:${isHover}`);
3366e80583aSopenharmony_ci            this.isHover = isHover;
3376e80583aSopenharmony_ci          })
3386e80583aSopenharmony_ci          .onDragStart((event: DragEvent) => {
3396e80583aSopenharmony_ci            return this.dragStart(event);
3406e80583aSopenharmony_ci          })
3416e80583aSopenharmony_ci          .bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
3426e80583aSopenharmony_ci          .onDragEnd((event: DragEvent, extraParams: string) => {
3436e80583aSopenharmony_ci            Log.showInfo(TAG, `onDragEnd event: [${event.getWindowX()}, ${event.getWindowY()}]` + event.getResult());
3446e80583aSopenharmony_ci            AppStorage.setOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
3456e80583aSopenharmony_ci          })
3466e80583aSopenharmony_ci        }
3476e80583aSopenharmony_ci        .height(this.folderGridSize)
3486e80583aSopenharmony_ci        .width(this.folderGridSize)
3496e80583aSopenharmony_ci
3506e80583aSopenharmony_ci        Column() {
3516e80583aSopenharmony_ci          AppName({
3526e80583aSopenharmony_ci            nameHeight: this.folderNameHeight,
3536e80583aSopenharmony_ci            nameSize: this.folderNameSize,
3546e80583aSopenharmony_ci            nameFontColor: this.nameFontColor,
3556e80583aSopenharmony_ci            appName: this.mFolderItem.folderName,
3566e80583aSopenharmony_ci            nameLines: this.folderNameLines,
3576e80583aSopenharmony_ci            marginTop: this.iconNameMargin
3586e80583aSopenharmony_ci          })
3596e80583aSopenharmony_ci        }
3606e80583aSopenharmony_ci        .visibility(this.showFolderName ? Visibility.Visible : Visibility.Hidden)
3616e80583aSopenharmony_ci      }
3626e80583aSopenharmony_ci      .bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
3636e80583aSopenharmony_ci      .width(StyleConstants.PERCENTAGE_100)
3646e80583aSopenharmony_ci      .height(StyleConstants.PERCENTAGE_100)
3656e80583aSopenharmony_ci      .offset({ x: this.folderPositionX, y: this.folderPositionY })
3666e80583aSopenharmony_ci      .scale({ x: this.isHover ? 1.05 : this.animateScale, y: this.isHover ? 1.05 : this.animateScale })
3676e80583aSopenharmony_ci      .opacity(this.animateOpacity)
3686e80583aSopenharmony_ci    }
3696e80583aSopenharmony_ci    .width(this.isSelect ? this.folderGridSize + StyleConstants.DEFAULT_40 : StyleConstants.PERCENTAGE_100)
3706e80583aSopenharmony_ci    .height(this.isSelect ? this.folderGridSize + StyleConstants.DEFAULT_40 : StyleConstants.PERCENTAGE_100)
3716e80583aSopenharmony_ci    .backgroundColor(this.isSelect ? StyleConstants.DEFAULT_BROAD_COLOR : StyleConstants.DEFAULT_TRANSPARENT_COLOR)
3726e80583aSopenharmony_ci    .borderRadius(this.isSelect ? StyleConstants.DEFAULT_15 : StyleConstants.DEFAULT_0)
3736e80583aSopenharmony_ci    .padding(this.isSelect ? {
3746e80583aSopenharmony_ci      left: StyleConstants.DEFAULT_20,
3756e80583aSopenharmony_ci      right: StyleConstants.DEFAULT_20,
3766e80583aSopenharmony_ci      top: this.mPaddingTop +
3776e80583aSopenharmony_ci      StyleConstants.DEFAULT_10 } :
3786e80583aSopenharmony_ci      { top: this.mPaddingTop }
3796e80583aSopenharmony_ci    )
3806e80583aSopenharmony_ci  }
3816e80583aSopenharmony_ci}