适配ark拖动新改动

Signed-off-by: gengzhengxing <gengzhengxing1@h-partners.com>
This commit is contained in:
gengzhengxing 2023-06-19 16:13:35 +08:00
parent 090e1c3317
commit 3d3b05d5a8
69 changed files with 291 additions and 1908 deletions

3
.gitignore vendored
View File

@ -7,3 +7,6 @@ local.properties
tsconfig.json
node_modules
.hvigor
package-lock.json
oh_modules
oh-package-lock.json5

View File

@ -1,14 +0,0 @@
{
"totalTime": 23082695000,
"moduleNum": 12,
"taskTime": {
"compileArkTS": 20882815800,
"compileJS": 5937000,
"compileResource": 0,
"packageHap": 650291700,
"signHap": 1595300
},
"isIncremental": true,
"hasIncremental": true,
"isParallel": true
}

View File

@ -1,27 +1,5 @@
# 应用子系统/Launcher
- [应用子系统/Launcher](#应用子系统launcher)
- [简介](#简介)
- [目录](#目录)
- [目录结构](#目录结构)
- [约束](#约束)
- [说明](#说明)
- [使用说明](#使用说明)
- [开发调试](#开发调试)
- [IDE下载](#IDE下载)
- [SDK使用说明及下载地址](SDK使用说明及下载地址)
- [代码下载](#代码下载)
- [签名配置](#签名配置)
- [调试编译](#调试编译)
- [部件更新](#部件更新)
- [相关仓](#相关仓)
## 简介
Launcher 作为系统人机交互的首要入口,提供应用图标的显示、点击启动、卸载应用,并提供桌面布局设置以及最近任务管理等功能。
Launcher 采用 扩展的TS语言ArkTS开发主要的结构如下

5
UPDATE_TTERATION.md Normal file
View File

@ -0,0 +1,5 @@
# 应用子系统/Launcher更新说明
## 2023/06/17更新说明
1. 简化签名配置
2. 部分any类型的变量变更为明确的指定约束类型

View File

@ -4,7 +4,22 @@
"compatibleSdkVersion": 10,
"products": [
{
"name": "default"
"name": "default",
"signingConfig": "default"
}
],
"signingConfigs": [
{
"name": "default",
"material": {
"storePassword": "00000016898B7E4E76E6E7089591AB3ECEC5C68F194BBD0C6E6C17446516E8FBDA0E8657F0A8",
"certpath": "signature/OpenHarmonyApplication.cer",
"keyAlias": "OpenHarmony Application Release",
"keyPassword": "0000001607C1E3DE9D968380A780032F24E0099F93A67F346F8C51189010440B5BF58E8E0147",
"profile": "signature/launcher.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "signature/OpenHarmony.p12"
}
}
]
},

View File

@ -22,6 +22,8 @@ export { MissionInfo } from './src/main/ets/default/bean/MissionInfo'
export { AppItemInfo } from './src/main/ets/default/bean/AppItemInfo'
export { DockItemInfo } from './src/main/ets/default/bean/DockItemInfo'
export { CardItemInfo } from './src/main/ets/default/bean/CardItemInfo'
export { LauncherDragItemInfo } from './src/main/ets/default/bean/LauncherDragItemInfo'
export { FolderItemInfo } from './src/main/ets/default/bean/FolderItemInfo'
export { SnapShotInfo } from './src/main/ets/default/bean/SnapShotInfo'
export { SettingItemInfo } from './src/main/ets/default/bean/SettingItemInfo'
export { RecentMissionInfo } from './src/main/ets/default/bean/RecentMissionInfo'

View File

@ -1,5 +0,0 @@
{
"name": "@ohos/common",
"version": "1.0.0",
"lockfileVersion": 1
}

View File

@ -16,6 +16,7 @@
import { Log } from '../utils/Log';
import { DragArea } from '../interface/DragArea';
import { CommonConstants } from '../constants/CommonConstants';
import { LauncherDragItemInfo } from '../bean/LauncherDragItemInfo';
const TAG = 'BaseDragHandler';
@ -76,9 +77,9 @@ export abstract class BaseDragHandler {
*
* @param dragItemInfo
*/
protected setDragItemInfo(dragItemInfo): void {
protected setDragItemInfo(dragItemInfo: LauncherDragItemInfo): void {
Log.showDebug(TAG, `setDragItemInfo dragItemInfo: ${JSON.stringify(dragItemInfo)}`);
AppStorage.SetOrCreate('dragItemInfo', dragItemInfo);
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', dragItemInfo);
}
/**
@ -87,9 +88,9 @@ export abstract class BaseDragHandler {
* @return dragItemInfo
*/
protected getDragItemInfo() {
const dragItemInfo: any = AppStorage.Get('dragItemInfo');
const dragItemInfo: LauncherDragItemInfo = AppStorage.Get<LauncherDragItemInfo>('dragItemInfo');
// avoid dragItemInfo from AppStorage is undefined
return dragItemInfo ? dragItemInfo : {};
return dragItemInfo;
}
/**

View File

@ -35,7 +35,7 @@ export class AppItemInfo {
/**
* Indicates appLabelId.
*/
appLabelId: string | undefined;
appLabelId: number | undefined;
/**
* Indicates bundleName.

View File

@ -16,7 +16,7 @@
/**
* Item info of folders.
*/
export default class FolderItemInfo {
export class FolderItemInfo {
/**
* folder id.
@ -32,4 +32,6 @@ export default class FolderItemInfo {
* Application list of this folder.
*/
appList: string[] | undefined;
[key: string]: any;
}

View File

@ -0,0 +1,29 @@
/**
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AppItemInfo } from './AppItemInfo';
/**
* drag item info
*/
export class LauncherDragItemInfo extends AppItemInfo {
isDragging: boolean = false;
constructor(isDragging?: boolean) {
super();
this.isDragging = isDragging ? isDragging : false;
}
[key: string]: any;
}

View File

@ -35,7 +35,7 @@ export class RecentMissionInfo {
/**
* Recent mission: app label Id
*/
appLabelId: string | undefined;
appLabelId: number | undefined;
/**
* Recent mission: bundle name

View File

@ -29,7 +29,7 @@ export struct AppBubble {
@State abilityName: string = '';
@State moduleName: string = '';
@State appIconId: string = '';
@State appLabelId: string = '';
@State appLabelId: number = undefined;
iconSize: number = 0;
nameHeight: number = 0;
nameSize: number = 0;
@ -74,6 +74,11 @@ export struct AppBubble {
badgeNumber: this.badgeNumber,
useCache: this.useCache
})
.onDragStart((event: DragEvent, extraParams: string) => {
return this.dragStart(event);
})
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
AppName({
nameHeight: this.nameHeight,
nameSize: this.nameSize,
@ -87,11 +92,6 @@ export struct AppBubble {
marginTop: this.mIconNameMargin
})
}
.onDragStart((event: DragEvent, extraParams: string) => {
return this.dragStart(event);
})
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
.width(this.isSelect ? this.iconSize + StyleConstants.DEFAULT_40 : StyleConstants.PERCENTAGE_100)
.height(StyleConstants.PERCENTAGE_100)
.backgroundColor(this.isSelect ? StyleConstants.DEFAULT_BROAD_COLOR : StyleConstants.DEFAULT_TRANSPARENT_COLOR)

View File

@ -22,7 +22,7 @@ export struct AppName {
nameHeight: number;
bundleName: string;
moduleName: string;
labelId: string;
labelId: number;
nameFontColor: string;
@State @Watch("updateName") appName: string = '';
useCache: boolean = true;

View File

@ -277,11 +277,6 @@ export struct FolderComponent {
})
}
}
.onDragStart((event: DragEvent) => {
return this.dragStart(event);
})
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
.padding(this.gridMargin)
.columnsTemplate('1fr 1fr 1fr')
.rowsTemplate('1fr 1fr 1fr')
@ -311,6 +306,11 @@ export struct FolderComponent {
Log.showInfo(TAG, `onHover isHover:${isHover}`);
this.isHover = isHover;
})
.onDragStart((event: DragEvent) => {
return this.dragStart(event);
})
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
}
.height(this.folderGridSize)
.width(this.folderGridSize)

View File

@ -96,6 +96,11 @@ export struct FormItemComponent {
this.clickForm(event, this.formItem);
}
})
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
.onDragStart((event: DragEvent, extraParams: string) => {
return this.dragStart(event);
})
Column() {
AppName({
@ -122,10 +127,5 @@ export struct FormItemComponent {
.padding({top : this.mPaddingTop})
.height(StyleConstants.PERCENTAGE_100)
.width(StyleConstants.PERCENTAGE_100)
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.bindContextMenu(this.MenuBuilder, ResponseType.RightClick)
.onDragStart((event: DragEvent, extraParams: string) => {
return this.dragStart(event);
})
}
}

View File

@ -24,7 +24,7 @@ const TAG = 'FormManagerDialog';
*/
@CustomDialog
export struct FormManagerDialog {
@StorageLink('formMgrItem') formItem: any = [];
@StorageLink('formMgrItem') formItem: Array<CardItemInfo> = [];
@State mAllowUpdate: boolean = false;
private mSwiperController: SwiperController = new SwiperController()
private mFormModel: FormModel;
@ -46,7 +46,7 @@ export struct FormManagerDialog {
confirm: (formCardItem) => void;
bundleName: string;
appName: string;
appLabelId: string;
appLabelId: number;
aboutToAppear(): void {
this.mFormModel = FormModel.getInstance();
@ -54,6 +54,12 @@ export struct FormManagerDialog {
this.getCurrentFormInfo();
}
aboutToDisappear(): void {
this.cancel = null;
this.confirm = null;
this.mFormDialogController = null;
}
/**
* Get current form information by bundle name.
*/
@ -67,19 +73,19 @@ export struct FormManagerDialog {
* @return <any> formCardItem
*/
private getChooseCard() {
let formCardItem: any = {};
formCardItem.id = this.mFormIdList[this.mSwiperIndex];
let formCardItem: CardItemInfo = new CardItemInfo();
formCardItem.cardId = this.mFormIdList[this.mSwiperIndex];
let count = 0;
let isStop = false;
for (let i = 0; i < this.formItem.length; i++) {
if (isStop) break;
for (let j = 0; j < this.formItem[i].supportDimensions.length; j++) {
if (count === this.mSwiperIndex) {
formCardItem.name = this.formItem[i].cardName;
formCardItem.cardName = this.formItem[i].cardName;
formCardItem.bundleName = this.formItem[i].bundleName;
formCardItem.abilityName = this.formItem[i].abilityName;
formCardItem.moduleName = this.formItem[i].moduleName;
formCardItem.dimension = this.formItem[i].supportDimensions[j];
formCardItem.cardDimension = this.formItem[i].supportDimensions[j];
formCardItem.formConfigAbility = this.formItem[i].formConfigAbility;
formCardItem.appLabelId = this.appLabelId;
isStop = true;

View File

@ -17,11 +17,11 @@ import { StyleConstants } from '../constants/StyleConstants';
import { CheckEmptyUtils } from '../utils/CheckEmptyUtils';
import { ResourceManager } from '../manager/ResourceManager';
import { LayoutViewModel } from '../viewmodel/LayoutViewModel';
import { AppItemInfo } from '../bean/AppItemInfo';
@CustomDialog
export struct UninstallDialog {
@StorageLink('uninstallAppInfo') appInfo: any = {};
@StorageLink('uninstallAppInfo') appInfo: AppItemInfo = new AppItemInfo();
@StorageLink('isPad') isPad: boolean = false;
@StorageLink('NavigationBarStatusValue') navigationBarStatusValue: boolean = false;
controller: CustomDialogController;
@ -57,6 +57,12 @@ export struct UninstallDialog {
}
}
aboutToDisappear(): void {
this.cancel = null;
this.confirm = null;
this.controller = null;
}
public iconLoadCallback(image) {
this.icon = image;
}

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/appcenter",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/bigfolder",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { AppItemInfo, Log } from '@ohos/common';
import { AppIcon } from '@ohos/common';
import { AppName } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
@ -32,8 +32,8 @@ export default struct FolderAppListDialog {
@StorageLink('isPad') isPad: boolean = false;
@StorageLink('allAppListForFolder') allAppInfoList: [] = [];
@StorageLink('folderAppList') folderAppList: [] = [];
@StorageLink('appListChecked') @Watch('onAppListChecked') appListChecked: any = [];
@StorageLink('titleDescription') titleDescription: any = '';
@StorageLink('appListChecked') @Watch('onAppListChecked') appListChecked: Array<AppItemInfo> = [];
@StorageLink('titleDescription') titleDescription: string = '';
@State mNameFontColor: string = BigFolderStyleConstants.FOLDER_ADD_APP_FONT_COLOR;
private mBigFolderViewModel: BigFolderViewModel;
private mFolderStyleConfig: BigFolderStyleConfig;

View File

@ -17,7 +17,7 @@ import { BigFolderStyleConstants } from '../constants/BigFolderStyleConstants';
@Component
export default struct TitleDescriptionComponent {
@StorageLink('titleDescription') titleDescription: any = '';
@StorageLink('titleDescription') titleDescription: string = '';
@State mTextSize: number = BigFolderStyleConstants.DEFAULT_APP_GRID_TEXT_FONT_SIZE;
build() {

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log , CheckEmptyUtils } from '@ohos/common';
import { Log , CheckEmptyUtils, AppItemInfo, FolderItemInfo } from '@ohos/common';
import { Trace } from '@ohos/common';
import { EventConstants } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
@ -231,10 +231,9 @@ export struct FolderOpenComponent {
})
})
}
.indicatorStyle({
selectedColor: StyleConstants.DEFAULT_FONT_COLOR,
bottom: BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_INDICATOR
})
.indicator(new DotIndicator()
.selectedColor(StyleConstants.DEFAULT_FONT_COLOR)
.bottom(BigFolderStyleConstants.DEFAULT_OPEN_FOLDER_INDICATOR))
.onClick(() => {
Log.showDebug(TAG, `Swiper click`);
this.saveText();
@ -438,14 +437,14 @@ struct FolderSwiperPage {
@Component
struct FolderAppItem {
@StorageLink('uninstallAppInfo') appInfo: any = {};
@StorageLink('uninstallAppInfo') appInfo: AppItemInfo = new AppItemInfo();
@StorageLink('selectDesktopAppItem') selectDesktopAppItem: string = '';
@State item: any = {};
@State item: AppItemInfo = new AppItemInfo();
private ColumnsTemplate: string = '';
private RowsTemplate: string = '';
private isSwappingPage = false;
private willCloseFolder: boolean = false;
private mFolderInfo: any = {};
private mFolderInfo: FolderItemInfo = new FolderItemInfo();
private mouseClick: number = 0;
private dialogName: string = "";
private clearForm: Function = null;

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/form",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { CardItemInfo, Log } from '@ohos/common';
import { FormModel } from '@ohos/common';
import { windowManager } from '@ohos/common';
import { localEventManager } from '@ohos/common';
@ -27,8 +27,8 @@ const TAG = 'FormManagerComponent';
*/
@Component
export struct FormManagerComponent {
@StorageLink('formAppInfo') formAppInfo: any = {};
@StorageLink('formMgrItem') formItem: any = [];
@StorageLink('formAppInfo') formAppInfo: CardItemInfo = new CardItemInfo();
@StorageLink('formMgrItem') formItem: Array<CardItemInfo> = [];
@State allowUpdate: boolean = false;
private mSwiperController: SwiperController = new SwiperController();
private mFormModel: FormModel;
@ -64,19 +64,19 @@ export struct FormManagerComponent {
* @return {any} formCardItem
*/
private getChooseCard() {
let formCardItem: any = {};
formCardItem.id = this.mFormIdList[this.mSwiperIndex];
let formCardItem: CardItemInfo = new CardItemInfo();
formCardItem.cardId = this.mFormIdList[this.mSwiperIndex];
let count = 0;
let isStop = false;
for (let i = 0; i < this.formItem.length; i++) {
if (isStop) break;
for (let j = 0; j < this.formItem[i].supportDimensions.length; j++) {
if (count === this.mSwiperIndex) {
formCardItem.name = this.formItem[i].cardName;
formCardItem.cardName = this.formItem[i].cardName;
formCardItem.bundleName = this.formItem[i].bundleName;
formCardItem.abilityName = this.formItem[i].abilityName;
formCardItem.moduleName = this.formItem[i].moduleName;
formCardItem.dimension = this.formItem[i].supportDimensions[j];
formCardItem.cardDimension = this.formItem[i].supportDimensions[j];
formCardItem.formConfigAbility = this.formItem[i].formConfigAbility;
formCardItem.appLabelId = this.formAppInfo.appLabelId;
isStop = true;

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/gesturenavigation",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -208,7 +208,7 @@ export default class GestureNavigationExecutors {
}
private isRecentsViewShowOfSpeedLimit(curTime: number, acceleration: number, curSpeed: number) {
return (acceleration > 0.05 && curSpeed > -2.0) || ((curSpeed > -1.0) && (curTime - this.preEventTime) / 1000 > 80.0);
return (acceleration > 0.05 && curSpeed > -5.0) || ((curSpeed > -1.0) && (curTime - this.preEventTime) / 1000 > 10.0);
}
private isSpecifiesRegion(startXPosition: number, startYPosition: number) {

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/numbadge",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,33 +0,0 @@
{
"name": "@ohos/pagedesktop",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/bigfolder": {
"version": "file:../bigfolder",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/form": {
"version": "file:../form",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}
}
}

View File

@ -13,17 +13,20 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { DragArea } from '@ohos/common';
import { BaseDragHandler } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
import { CheckEmptyUtils } from '@ohos/common';
import { SettingsModel } from '@ohos/common';
import { EventConstants } from '@ohos/common';
import { localEventManager } from '@ohos/common';
import { layoutConfigManager } from '@ohos/common';
import { PageDesktopModel } from '@ohos/common';
import { DragItemPosition } from '@ohos/common';
import {
Log,
LauncherDragItemInfo,
DragArea,
BaseDragHandler,
CommonConstants,
CheckEmptyUtils,
SettingsModel,
EventConstants,
localEventManager,
layoutConfigManager,
PageDesktopModel,
DragItemPosition
} from '@ohos/common';
import { FormViewModel } from '@ohos/form';
import { BigFolderViewModel } from '@ohos/bigfolder';
import { PageDesktopGridStyleConfig } from './PageDesktopGridStyleConfig';
@ -222,8 +225,8 @@ export class PageDesktopDragHandler extends BaseDragHandler {
}
onDragDrop(x: number, y: number): boolean {
const dragItemInfo: any = AppStorage.Get('dragItemInfo');
if (JSON.stringify(dragItemInfo) == '{}') {
const dragItemInfo: LauncherDragItemInfo = AppStorage.Get<LauncherDragItemInfo>('dragItemInfo');
if (!dragItemInfo.isDragging) {
return false;
}
const dragItemType: number = AppStorage.Get('dragItemType');
@ -243,10 +246,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
endPosition = this.copyPosition(this.mEndPosition);
const info = this.mSettingsModel.getLayoutInfo();
const layoutInfo = info.layoutInfo;
if (dragItemInfo.typeId == CommonConstants.TYPE_FOLDER || dragItemInfo.typeId == CommonConstants.TYPE_CARD ) {
this.updateEndPosition(dragItemInfo);
AppStorage.SetOrCreate('positionOffset', []);
} else {
if (dragItemInfo.typeId === CommonConstants.TYPE_APP) {
if (this.isMoveToSamePosition(dragItemInfo)) {
this.deleteBlankPageAfterDragging(startPosition, endPosition);
return false;
@ -394,7 +394,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
}
}
private isMoveToSamePosition(dragItemInfo): boolean {
private isMoveToSamePosition(dragItemInfo: LauncherDragItemInfo): boolean {
if (this.mEndPosition.page == dragItemInfo.page &&
this.mEndPosition.row == dragItemInfo.row && this.mEndPosition.column == dragItemInfo.column) {
return true;
@ -402,24 +402,6 @@ export class PageDesktopDragHandler extends BaseDragHandler {
return false;
}
private updateEndPosition(dragItemInfo): void {
const positionOffset = AppStorage.Get('positionOffset');
this.mEndPosition.row = this.mEndPosition.row - positionOffset[1];
this.mEndPosition.column = this.mEndPosition.column - positionOffset[0];
this.mGridConfig = this.mSettingsModel.getGridConfig();
if (this.mEndPosition.row < 0) {
this.mEndPosition.row = 0;
} else if (this.mEndPosition.row + dragItemInfo.area[1] > this.mGridConfig.row) {
this.mEndPosition.row = this.mGridConfig.row - dragItemInfo.area[1];
}
if (this.mEndPosition.column < 0) {
this.mEndPosition.column = 0;
} else if (this.mEndPosition.column + dragItemInfo.area[0] > this.mGridConfig.column ) {
this.mEndPosition.column = this.mGridConfig.column - dragItemInfo.area[0];
}
}
private getEndLayoutInfo(layoutInfo) {
const endLayoutInfo = layoutInfo.find(item => {
if (item.typeId == CommonConstants.TYPE_FOLDER || item.typeId == CommonConstants.TYPE_CARD) {
@ -431,7 +413,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
return endLayoutInfo;
}
private getStartLayoutInfo(layoutInfo, dragItemInfo) {
private getStartLayoutInfo(layoutInfo, dragItemInfo: LauncherDragItemInfo) {
const startLayoutInfo = layoutInfo.find(item => {
return item.page === dragItemInfo.page && item.row === dragItemInfo.row && item.column === dragItemInfo.column;
});
@ -445,7 +427,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
* @param layoutInfo
* @param dragItemInfo
*/
private checkAndMove(source, destination, layoutInfo, dragItemInfo): boolean {
private checkAndMove(source, destination, layoutInfo, dragItemInfo: LauncherDragItemInfo): boolean {
Log.showDebug(TAG, 'checkAndMove start');
const allPositions = this.getAllPositions(destination, layoutInfo);
@ -593,7 +575,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
* @param allPositions
* @param dragItemInfo
*/
private getPressedObjects(destination, allPositions, dragItemInfo) {
private getPressedObjects(destination, allPositions, dragItemInfo: LauncherDragItemInfo) {
Log.showDebug(TAG, 'getPressedObjects start');
const row = destination.row;
const column = destination.column;
@ -631,7 +613,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
* @param objectPositionCount
* @param dragItemInfo
*/
private checkCanMoveInSamePage(pressedPositions, objectPositionCount, dragItemInfo): boolean {
private checkCanMoveInSamePage(pressedPositions, objectPositionCount, dragItemInfo: LauncherDragItemInfo): boolean {
Log.showDebug(TAG, 'checkCanMoveInSamePage start');
const foldersAndForms = pressedPositions.foldersAndForms;
if (foldersAndForms.length == 0) {
@ -744,7 +726,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
* @param allPositions
* @param dragItemInfo
*/
private moveFoldersAndForms(foldersAndForms, destination, allPositions, dragItemInfo): boolean {
private moveFoldersAndForms(foldersAndForms, destination, allPositions, dragItemInfo: LauncherDragItemInfo): boolean {
Log.showDebug(TAG, 'moveFoldersAndForms start');
const movedFoldersAndForms = [];
for (let i = 0; i < foldersAndForms.length; i++) {
@ -813,7 +795,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
* @param row
* @param column
*/
private updateDestinationToNull(dragItemInfo, destination, allPositions, row, column): void {
private updateDestinationToNull(dragItemInfo: LauncherDragItemInfo, destination, allPositions, row, column): void {
let destinationFlag = false;
for (let j = 0; j < dragItemInfo.area[1]; j++) {
if (destinationFlag) {
@ -843,7 +825,7 @@ export class PageDesktopDragHandler extends BaseDragHandler {
* @param destination
* @param allPositions
*/
private updateDestinationByDragItem(dragItemInfo, destination, allPositions): void {
private updateDestinationByDragItem(dragItemInfo: LauncherDragItemInfo, destination, allPositions): void {
let keyName = '';
if (dragItemInfo.typeId == CommonConstants.TYPE_FOLDER) {
keyName = dragItemInfo.folderId;

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { AppItemInfo, CardItemInfo, LauncherDragItemInfo, Log } from '@ohos/common';
import { Trace } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { PresetStyleConstants } from '@ohos/common';
@ -33,10 +33,10 @@ const TAG = "AppItem";
@Component
export default struct AppItem {
@StorageLink('dragItemInfo') pageDesktopDragItemInfo: any = {};
@StorageLink('dragItemInfo') pageDesktopDragItemInfo: LauncherDragItemInfo = new LauncherDragItemInfo();
@StorageLink('dragItemType') dragItemType: number = CommonConstants.DRAG_FROM_DESKTOP;
@StorageLink('uninstallAppInfo') appInfo: any = {};
@StorageLink('formAppInfo') formAppInfo: any = {};
@StorageLink('uninstallAppInfo') appInfo: AppItemInfo = new AppItemInfo();
@StorageLink('formAppInfo') formAppInfo: CardItemInfo = new CardItemInfo();
@StorageLink('selectDesktopAppItem') selectDesktopAppItem: string = '';
@State mAppNameHeight: number = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
@State mAppItemWidth: number = StyleConstants.DEFAULT_APP_ITEM_WIDTH;
@ -105,19 +105,6 @@ export default struct AppItem {
customStyle: true
});
@Builder dragLayerBuilder() {
Column() {
AppIcon({
iconSize: this.mIconSize * 1.05,
iconId: this.item.appIconId,
bundleName: this.item.bundleName,
moduleName: this.item.moduleName,
icon: ResourceManager.getInstance().getCachedAppIcon(this.item.appIconId, this.item.bundleName, this.item.moduleName),
badgeNumber: this.item.badgeNumber
})
}
}
/**
* When click cancel dialog, this function will be called.
*/
@ -211,13 +198,12 @@ export default struct AppItem {
})
.onTouch((event: TouchEvent) => {
Log.showDebug(TAG, `onTouch event type: ${event.type}, x: ${event.touches[0].screenX}, y: ${event.touches[0].screenY}`);
if (event.type === CommonConstants.TOUCH_TYPE_UP && AppStorage.Get('isDrag')) {
if (event.type === CommonConstants.TOUCH_TYPE_UP && this.pageDesktopDragItemInfo.isDragging) {
let mIsDragEffectArea = globalThis.PageDesktopDragHandler.isDragEffectArea(event.touches[0].screenX, event.touches[0].screenY);
Log.showInfo(TAG, `onTouch mIsDragEffectArea: ${mIsDragEffectArea}`);
if (!mIsDragEffectArea) {
this.pageDesktopDragItemInfo = {};
this.pageDesktopDragItemInfo = new LauncherDragItemInfo();
AppStorage.SetOrCreate('selectAppIndex', null);
AppStorage.SetOrCreate('isDrag', false);
}
}
})
@ -235,13 +221,11 @@ export default struct AppItem {
}
dragStart(event: DragEvent): CustomBuilder {
AppStorage.SetOrCreate('isDrag', true);
ContextMenu.close();
this.dragItemType = CommonConstants.DRAG_FROM_DESKTOP;
this.pageDesktopDragItemInfo = this.item;
this.pageDesktopDragItemInfo = Object.assign(new LauncherDragItemInfo(true), this.item);
Log.showInfo(TAG, `pageDesktopDragItemInfo: ${JSON.stringify(this.pageDesktopDragItemInfo)}`);
globalThis.PageDesktopDragHandler.onDragStart(event.getX(), event.getY());
return this.dragLayerBuilder();
}
/**

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { LauncherDragItemInfo, Log } from '@ohos/common';
import { Trace } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
@ -33,7 +33,7 @@ const TAG = 'FolderItem';
*/
@Component
export default struct FolderItem {
@StorageLink('dragItemInfo') pageDesktopDragItemInfo: any = {};
@StorageLink('dragItemInfo') pageDesktopDragItemInfo: LauncherDragItemInfo = new LauncherDragItemInfo();
@StorageLink('dragItemType') dragItemType: number = CommonConstants.DRAG_FROM_DESKTOP;
@StorageLink('openFolderStatus') openFolderStatus: number = BigFolderConstants.OPEN_FOLDER_STATUS_CLOSE;
@StorageLink('selectDesktopAppItem') selectDesktopAppItem: string = '';
@ -53,27 +53,6 @@ export default struct FolderItem {
private mFolderStyleConfig: BigFolderStyleConfig;
mNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
@Builder dragLayerBuilder() {
Column() {
FolderComponent({
showFolderName: false,
nameFontColor: this.mPageDesktopViewModel.getPageDesktopStyleConfig().mNameFontColor,
folderNameHeight: 0,
folderNameSize: 0,
mFolderItem: this.folderItem,
folderGridSize: this.mFolderStyleConfig.mGridSize * 1.05,
appIconSize: this.mFolderStyleConfig.mFolderAppSize * 1.05,
gridMargin: this.mFolderStyleConfig.mGridMargin * 1.05,
gridGap: this.mFolderStyleConfig.mFolderGridGap * 1.05,
buildMenu: (folderItem) => {
return [];
}
})
}
.height(this.mFolderStyleConfig.mGridSize * 1.05 + StyleConstants.DEFAULT_40)
.width(this.mFolderStyleConfig.mGridSize * 1.05)
}
aboutToAppear(): void {
this.mPageDesktopDragHandler = PageDesktopDragHandler.getInstance();
this.mPageDesktopStartAppHandler = PageDesktopStartAppHandler.getInstance();
@ -134,20 +113,14 @@ export default struct FolderItem {
}
dragStart(event: DragEvent): CustomBuilder {
AppStorage.SetOrCreate('isDrag', true);
ContextMenu.close();
this.dragItemType = CommonConstants.DRAG_FROM_DESKTOP;
this.pageDesktopDragItemInfo = this.folderItem;
this.pageDesktopDragItemInfo = Object.assign(new LauncherDragItemInfo(true), this.folderItem);
const selectAppIndex = globalThis.PageDesktopDragHandler.getItemIndex(event.getX(), event.getY());
const startPosition = globalThis.PageDesktopDragHandler.getTouchPosition(event.getX(), event.getY())
globalThis.PageDesktopDragHandler.mStartPosition = startPosition;
AppStorage.SetOrCreate('selectAppIndex', selectAppIndex);
Log.showInfo(TAG, `onDragStart event: [${event.getX()}, ${event.getY()}], selectAppIndex: ${selectAppIndex}`);
const rowOffset = startPosition.row - this.pageDesktopDragItemInfo.row;
const columnOffset = startPosition.column - this.pageDesktopDragItemInfo.column;
const positionOffset = [columnOffset, rowOffset];
AppStorage.SetOrCreate('positionOffset', positionOffset);
return this.dragLayerBuilder();
}
build() {
@ -184,14 +157,13 @@ export default struct FolderItem {
this.mBigFolderViewModel.openFolder(false, folderItem);
},
onFolderTouch: (event, folderItem) => {
if (event.type === CommonConstants.TOUCH_TYPE_UP && AppStorage.Get('isDrag')) {
if (event.type === CommonConstants.TOUCH_TYPE_UP && this.pageDesktopDragItemInfo.isDragging) {
let mIsDragEffectArea = globalThis.PageDesktopDragHandler.isDragEffectArea(event.touches[0].screenX, event.touches[0].screenY);
Log.showInfo(TAG, `onTouch mIsDragEffectArea: ${mIsDragEffectArea}`);
if (!mIsDragEffectArea) {
globalThis.PageDesktopDragHandler.deleteBlankPageOutsideEffect();
AppStorage.SetOrCreate('dragItemInfo', {});
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
AppStorage.SetOrCreate('selectAppIndex', null);
AppStorage.SetOrCreate('isDrag', false);
}
}
},

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { CardItemInfo, LauncherDragItemInfo, Log } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { PresetStyleConstants } from '@ohos/common';
import { ResourceManager } from '@ohos/common';
@ -34,7 +34,7 @@ const TAG = 'FormItem';
*/
@Component
export default struct FormItem {
@StorageLink('dragItemInfo') pageDesktopDragItemInfo: any = {};
@StorageLink('dragItemInfo') pageDesktopDragItemInfo: LauncherDragItemInfo = new LauncherDragItemInfo();
@StorageLink('isRemoveForm') @Watch('removeFormAnimate') isRemoveForm: boolean = false;
@StorageLink('dragItemType') dragItemType: number = CommonConstants.DRAG_FROM_DESKTOP;
@StorageLink('formAnimateData') formAnimateData: {
@ -45,7 +45,7 @@ export default struct FormItem {
@State animateOpacity: number = 1.0;
@State allowUpdate: boolean = true;
@State isShow: boolean = true;
private formItem: any = {};
private formItem: CardItemInfo = new CardItemInfo();
private mPageDesktopViewModel: PageDesktopViewModel = PageDesktopViewModel.getInstance();
private mFormViewModel: FormViewModel;
private mFormStyleConfig: FormStyleConfig;
@ -66,20 +66,6 @@ export default struct FormItem {
private mForm: string = '';
private clearForm: Function = null;
@Builder dragLayerBuilder() {
Column() {
FormItemComponent({
formItem: this.formItem,
formItemWidth: this.mFormItemWidth * 1.05,
formItemHeight: this.mFormItemHeight * 1.05,
formNameHeight: 0,
formNameSize: 0
})
}
.height(this.mFormItemWidth * 1.05 + StyleConstants.DEFAULT_10 )
.width(this.mFormItemWidth * 1.05)
}
aboutToAppear(): void {
this.mPageDesktopDragHandler = PageDesktopDragHandler.getInstance();
this.mFormViewModel = FormViewModel.getInstance();
@ -94,8 +80,10 @@ export default struct FormItem {
this.mFormNameSize = styleConfig.mNameSize;
this.mGridSpaceWidth = Number(this.mPageDesktopViewModel.getWorkSpaceWidth()) - this.mMargin;
this.mGridSpaceHeight = Number(this.mPageDesktopViewModel.getWorkSpaceHeight());
this.mFormItemWidth = this.mFormStyleConfig.mFormWidth.get(this.formItem.cardDimension.toString());
this.mFormItemHeight = this.mFormStyleConfig.mFormHeight.get(this.formItem.cardDimension.toString());
if (this.formItem.cardDimension) {
this.mFormItemWidth = this.mFormStyleConfig.mFormWidth.get(this.formItem.cardDimension.toString());
this.mFormItemHeight = this.mFormStyleConfig.mFormHeight.get(this.formItem.cardDimension.toString());
}
const resourceManager = ResourceManager.getInstance();
resourceManager.getStringById($r('app.string.is_delete_form').id, this.getDialogNamePre.bind(this));
resourceManager.getStringById($r('app.string.form').id, this.getDialogNameAft.bind(this));
@ -208,20 +196,14 @@ export default struct FormItem {
}
dragStart(event: DragEvent): CustomBuilder {
AppStorage.SetOrCreate('isDrag', true);
ContextMenu.close();
this.dragItemType = CommonConstants.DRAG_FROM_DESKTOP;
this.pageDesktopDragItemInfo = this.formItem;
this.pageDesktopDragItemInfo = Object.assign(new LauncherDragItemInfo(true), this.formItem);
const selectAppIndex = globalThis.PageDesktopDragHandler.getItemIndex(event.getX(), event.getY());
const startPosition = globalThis.PageDesktopDragHandler.getTouchPosition(event.getX(), event.getY())
globalThis.PageDesktopDragHandler.mStartPosition = startPosition;
AppStorage.SetOrCreate('selectAppIndex', selectAppIndex);
Log.showInfo(TAG, `onDragStart event: [${event.getX()}, ${event.getY()}], selectAppIndex: ${selectAppIndex}`);
const rowOffset = startPosition.row - this.pageDesktopDragItemInfo.row;
const columnOffset = startPosition.column - this.pageDesktopDragItemInfo.column;
const positionOffset = [columnOffset, rowOffset];
AppStorage.SetOrCreate('positionOffset', positionOffset);
return this.dragLayerBuilder();
}
build() {
@ -246,7 +228,7 @@ export default struct FormItem {
},
})
}
.visibility(this.pageDesktopDragItemInfo.cardId === this.formItem.cardId ? Visibility.None : Visibility.Visible)
.visibility(this.pageDesktopDragItemInfo.cardId === this.formItem.cardId && this.pageDesktopDragItemInfo.isDragging ? Visibility.None : Visibility.Visible)
.scale({ x: this.animateScale, y: this.animateScale })
.opacity(this.animateOpacity)
.onMouse((event: MouseEvent) => {
@ -266,14 +248,13 @@ export default struct FormItem {
)
)
.onTouch((event: TouchEvent) => {
if (event.type === CommonConstants.TOUCH_TYPE_UP && AppStorage.Get('isDrag')) {
if (event.type === CommonConstants.TOUCH_TYPE_UP && this.pageDesktopDragItemInfo.isDragging) {
let mIsDragEffectArea = globalThis.PageDesktopDragHandler.isDragEffectArea(event.touches[0].screenX, event.touches[0].screenY);
Log.showInfo(TAG, `onTouch mIsDragEffectArea: ${mIsDragEffectArea}`);
if (!mIsDragEffectArea) {
globalThis.PageDesktopDragHandler.deleteBlankPageOutsideEffect();
this.pageDesktopDragItemInfo = {};
this.pageDesktopDragItemInfo = new LauncherDragItemInfo();
AppStorage.SetOrCreate('selectAppIndex', null);
AppStorage.SetOrCreate('isDrag', false);
}
}
})

View File

@ -13,7 +13,8 @@
* limitations under the License.
*/
import { Log, Trace, StyleConstants, CommonConstants, AppMenu, MenuInfo, localEventManager, EventConstants } from '@ohos/common';
import { Log, Trace, StyleConstants, CommonConstants, AppMenu, MenuInfo, localEventManager, EventConstants,
LauncherDragItemInfo } from '@ohos/common';
import SwiperPage from './SwiperPage';
const TAG = "GridSwiper";
@ -152,9 +153,7 @@ export default struct GridSwiper {
})
.height(StyleConstants.PERCENTAGE_100)
.width(StyleConstants.PERCENTAGE_100)
.indicatorStyle({
selectedColor: StyleConstants.DEFAULT_FONT_COLOR
})
.indicator(new DotIndicator().selectedColor(StyleConstants.DEFAULT_FONT_COLOR))
.loop(false)
.index(this.pageIndex)
.onChange((index) => {
@ -170,7 +169,8 @@ export default struct GridSwiper {
.width(StyleConstants.PERCENTAGE_100)
.onDragMove((event: DragEvent, extraParams: string) => {
Log.showInfo(TAG, `onDragMove event: [${event.getX()}, ${event.getY()}]`);
if (!AppStorage.Get('isDrag')) return;
const dragItemInfo: LauncherDragItemInfo = AppStorage.Get<LauncherDragItemInfo>('dragItemInfo');
if (!dragItemInfo.isDragging) return;
if (AppStorage.Get('deviceType') === CommonConstants.DEFAULT_DEVICE_TYPE
|| (AppStorage.Get('deviceType') !== CommonConstants.DEFAULT_DEVICE_TYPE
&& AppStorage.Get('dragItemType') === CommonConstants.DRAG_FROM_DESKTOP)) {

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { Log } from '@ohos/common';
import { LauncherDragItemInfo, Log } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
import { PresetStyleConstants } from '@ohos/common';
import { localEventManager } from '@ohos/common';
@ -159,13 +159,12 @@ export default struct SwiperPage {
const dragResult = globalThis.PageDesktopDragHandler.onDragDrop(event.getX(), event.getY());
Log.showInfo(TAG, `onDrop dragResult: ${dragResult}`);
AppStorage.SetOrCreate('selectAppIndex', null);
AppStorage.SetOrCreate('isDrag', false);
if (!dragResult) {
AppStorage.SetOrCreate('dragItemInfo', {});
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
} else {
// Wait for the UI rendering to end.
setTimeout(() => {
AppStorage.SetOrCreate('dragItemInfo', {});
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
}, 50);
}
}

View File

@ -1257,7 +1257,7 @@ export default class PageDesktopViewModel extends BaseViewModel {
* @param appInfo
*/
async createCardToDeskTop(formCardItem) {
Log.showDebug(TAG, `createCardToDeskTop formCardItem id: ${formCardItem.id}`);
Log.showDebug(TAG, `createCardToDeskTop formCardItem id: ${formCardItem.cardId}`);
const cardItemInfo = this.createNewCardItemInfo(formCardItem);
let formInfoList: any = this.mFormListInfoCacheManager.getCache(KEY_FORM_LIST);
@ -1307,14 +1307,14 @@ export default class PageDesktopViewModel extends BaseViewModel {
*/
private createNewCardItemInfo(formCardItem): CardItemInfo {
const cardItemInfo = new CardItemInfo();
cardItemInfo.cardId = formCardItem.id;
cardItemInfo.cardName = formCardItem.name;
cardItemInfo.cardId = formCardItem.cardId;
cardItemInfo.cardName = formCardItem.cardName;
cardItemInfo.bundleName = formCardItem.bundleName;
cardItemInfo.abilityName = formCardItem.abilityName;
cardItemInfo.moduleName = formCardItem.moduleName;
cardItemInfo.formConfigAbility = formCardItem.formConfigAbility;
cardItemInfo.appLabelId = formCardItem.appLabelId;
cardItemInfo.cardDimension = formCardItem.dimension;
cardItemInfo.cardDimension = formCardItem.cardDimension;
return cardItemInfo;
}

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/recents",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -28,7 +28,7 @@ export default struct RecentMissionAppIcon {
@State @Watch("updateIcon") appIcon: string = '';
@State bundleName: string = '';
@State moduleName: string = '';
@State labelId: string = '';
@State labelId: number = undefined;
@State icon: string = ' ';
@State useCache: boolean = true;
private mIsSingleLayout: boolean = true;

View File

@ -28,7 +28,7 @@ export default struct RecentMissionAppName {
@State name: string = ''
@Prop bundleName: string;
@Prop moduleName: string;
@Prop labelId: string;
@Prop labelId: number;
private mResourceManager;
aboutToAppear(): void {

View File

@ -35,7 +35,7 @@ export default struct RecentMissionCard {
@Link isClickSubComponent: boolean;
@State missionId: number = 0;
@State appIconId: string = '';
@State appLabelId: string = '';
@State appLabelId: number = undefined;
@State appName: string = '';
@State bundleName: string = '';
@State moduleName: string = '';
@ -44,7 +44,7 @@ export default struct RecentMissionCard {
@State cardMargin: number = RecentsStyleConstants.SINGLE_LIST_LAYOUT_MARGIN;
@State cardLayoutWeight: number = RecentsStyleConstants.SINGLE_LIST_APP_INFO_LAYOUT_WEIGHT;
// recentImage default is Resource type, to avoid toolchain typeCheck
@State recentImage: any = RecentsStyleConstants.DEFAULT_APP_IMAGE;
@State recentImage: image.PixelMap = undefined;
private mIsSingleLayout: boolean = true;
private snapShotTime: string = '';
private mRecentMissionsViewModel: RecentMissionsViewModel;

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

View File

@ -1,11 +0,0 @@
{
"name": "launcher_settings",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -2,7 +2,7 @@
"module": {
"name": "launcher_settings",
"type": "feature",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"srcEntry": "./ets/Application/AbilityStage.ts",
"description": "$string:mainability_description",
"mainElement": "com.ohos.launcher.settings.MainAbility",
"deviceTypes": [
@ -18,18 +18,17 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"abilities": [
{
"name": "com.ohos.launcher.settings.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"startWindowIcon": "$media:startWindowIcon",
"startWindowBackground": "$color:startWindowBackground",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:settings_MainAbility",
"launchType": "singleton",
"visible": false
"exported": false
}
],
"requestPermissions": [

View File

@ -1,11 +0,0 @@
{
"name": "@ohos/smartdock",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}

View File

@ -23,6 +23,7 @@ import { CheckEmptyUtils } from '@ohos/common';
import { SmartDockStyleConfig } from '../config/SmartDockStyleConfig';
import SmartDockModel from '../model/SmartDockModel';
import SmartDockConstants from '../common/constants/SmartDockConstants';
import { LauncherDragItemInfo } from '@ohos/common/src/main/ets/default/bean/LauncherDragItemInfo';
const TAG = 'SmartDockDragHandler';
@ -147,8 +148,8 @@ export default class SmartDockDragHandler extends BaseDragHandler {
}
protected onDragDrop(x: number, y: number): boolean {
const dragItemInfo: any = AppStorage.Get('dragItemInfo');
if (JSON.stringify(dragItemInfo) == '{}') {
const dragItemInfo: LauncherDragItemInfo = AppStorage.Get<LauncherDragItemInfo>('dragItemInfo');
if (!dragItemInfo.isDragging) {
return false;
}
const dragItemType: number = AppStorage.Get('dragItemType');
@ -167,7 +168,7 @@ export default class SmartDockDragHandler extends BaseDragHandler {
return false;
}
addItemToSmartDock(dragItemInfo: any, insertIndex: number): boolean {
addItemToSmartDock(dragItemInfo: LauncherDragItemInfo, insertIndex: number): boolean {
let addToDockRes = this.mSmartDockModel.addToSmartdock(dragItemInfo, insertIndex);
if (addToDockRes) {
localEventManager.sendLocalEventSticky(EventConstants.EVENT_REQUEST_PAGEDESK_ITEM_DELETE, {

View File

@ -13,14 +13,17 @@
* limitations under the License.
*/
import { AppMenu } from '@ohos/common';
import { AppIcon } from '@ohos/common';
import { DockItemInfo } from '@ohos/common';
import { ScrollerComponent } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { ResourceManager } from '@ohos/common';
import { Log } from '@ohos/common';
import {
AppMenu,
LauncherDragItemInfo,
AppIcon,
DockItemInfo,
ScrollerComponent,
CommonConstants,
StyleConstants,
ResourceManager,
Log
} from '@ohos/common';
import { SmartDockStyleConfig } from '../config/SmartDockStyleConfig';
let mSmartDockStyleConfig: SmartDockStyleConfig = null;
@ -270,7 +273,8 @@ struct AppItem {
if (event.type == CommonConstants.TOUCH_TYPE_UP) {
AppStorage.SetOrCreate('isLongPress', false);
}
if (AppStorage.Get('isDrag')) {
const dragItemInfo: LauncherDragItemInfo = AppStorage.Get<LauncherDragItemInfo>('dragItemInfo');
if (dragItemInfo.isDragging) {
this.isShow = false;
}
})

View File

@ -14,13 +14,16 @@
* limitations under the License.
*/
import { AppMenu } from '@ohos/common';
import { AppIcon } from '@ohos/common';
import { DockItemInfo } from '@ohos/common';
import { CommonConstants } from '@ohos/common';
import { StyleConstants } from '@ohos/common';
import { ResourceManager } from '@ohos/common';
import { Log } from '@ohos/common';
import {
AppMenu,
AppIcon,
DockItemInfo,
LauncherDragItemInfo,
CommonConstants,
StyleConstants,
ResourceManager,
Log
} from '@ohos/common';
import { SmartDockStyleConfig } from '../config/SmartDockStyleConfig';
let mSmartDockStyleConfig: SmartDockStyleConfig = null;
@ -110,13 +113,12 @@ export default struct ResidentLayout {
Log.showInfo(TAG, `onDrop event: [${event.getX()}, ${event.getY()}]`);
const dragResult = globalThis.SmartDockDragHandler.onDragDrop(event.getX(), event.getY());
AppStorage.SetOrCreate('selectAppIndex', null);
AppStorage.SetOrCreate('isDrag', false);
if (!dragResult) {
AppStorage.SetOrCreate('dragItemInfo', {});
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
} else {
// Wait for the UI rendering to end.
setTimeout(() => {
AppStorage.SetOrCreate('dragItemInfo', {});
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
}, 50);
}
})
@ -126,7 +128,7 @@ export default struct ResidentLayout {
@Component
struct AppItem {
@StorageLink('dragItemInfo') smartDragItemInfo: any = {};
@StorageLink('dragItemInfo') smartDragItemInfo: LauncherDragItemInfo = new LauncherDragItemInfo();
@StorageLink('dragItemType') dragItemType: number = CommonConstants.DRAG_FROM_DOCK;
@State isShow: boolean = false;
onItemClick: Function = null;
@ -134,20 +136,6 @@ struct AppItem {
buildMenu: Function = null;
private menuInfo;
@Builder dragLayerBuilder() {
Column() {
AppIcon({
iconSize: mSmartDockStyleConfig.mIconSize * 1.05,
iconId: this.appInfo.appIconId,
bundleName: this.appInfo.bundleName,
moduleName: this.appInfo.moduleName,
icon: ResourceManager.getInstance().getCachedAppIcon(this.appInfo.appIconId,
this.appInfo.bundleName, this.appInfo.moduleName),
badgeNumber: CommonConstants.BADGE_DISPLAY_HIDE
})
}
}
aboutToAppear(): void {
this.menuInfo = this.buildMenu(this.appInfo);
}
@ -212,19 +200,18 @@ struct AppItem {
})
.onTouch((event: TouchEvent) => {
Log.showInfo(TAG, `onTouch event type: ${event.type}`);
if (event.type === CommonConstants.TOUCH_TYPE_UP && AppStorage.Get('isDrag')) {
if (event.type === CommonConstants.TOUCH_TYPE_UP && this.smartDragItemInfo.isDragging) {
let mIsDragEffectArea = globalThis.SmartDockDragHandler.isDragEffectArea(event.touches[0].screenX, event.touches[0].screenY);
if (!mIsDragEffectArea) {
AppStorage.SetOrCreate('dragItemInfo', {});
AppStorage.SetOrCreate<LauncherDragItemInfo>('dragItemInfo', new LauncherDragItemInfo());
AppStorage.SetOrCreate('selectAppIndex', null);
AppStorage.SetOrCreate('isDrag', false);
}
AppStorage.SetOrCreate('isLongPress', false);
}
if (AppStorage.Get('isDrag')) {
if (this.smartDragItemInfo.isDragging) {
this.isShow = false;
}
if (event.type === CommonConstants.TOUCH_TYPE_UP && !AppStorage.Get('isDrag') && !this.isShow) {
if (event.type === CommonConstants.TOUCH_TYPE_UP && !this.smartDragItemInfo.isDragging && !this.isShow) {
this.onItemClick(event, this.appInfo);
}
})
@ -238,13 +225,11 @@ struct AppItem {
})
.onDragStart((event: DragEvent, extraParams: string) => {
Log.showInfo(TAG, `DragStart`);
AppStorage.SetOrCreate('isDrag', true);
this.dragItemType = CommonConstants.DRAG_FROM_DOCK;
this.smartDragItemInfo = this.appInfo;
this.smartDragItemInfo = Object.assign(new LauncherDragItemInfo(true), this.appInfo);
Log.showInfo(TAG, `smartDragItemInfo: ${JSON.stringify(this.smartDragItemInfo)}`);
const selectAppIndex = globalThis.SmartDockDragHandler.getDragItemIndexByCoordinates(event.getX(), event.getY());
AppStorage.SetOrCreate('selectAppIndex', selectAppIndex);
return this.dragLayerBuilder();
})
}
}

View File

@ -17,7 +17,8 @@ import {
Log,
CommonConstants,
ResourceManager,
UninstallDialog } from '@ohos/common';
UninstallDialog, RecentBundleMissionInfo
} from '@ohos/common';
import RecentLayout from './RecentLayout';
import ResidentLayout from './ResidentLayout';
import SmartDockViewModel from '../viewmodel/SmartDockViewModel';
@ -34,8 +35,8 @@ export struct SmartDock {
} = { show: false, showItem: '', popup: null };
showAppCenter: Function = () => {};
@StorageLink('showDock') showDock: boolean = false;
@StorageLink('recentList') recentList: any = [];
@StorageLink('missionInfoList') missionInfoList: any = [];
@StorageLink('recentList') recentList: Array<RecentBundleMissionInfo> = [];
@StorageLink('missionInfoList') missionInfoList: Array<RecentBundleMissionInfo> = [];
private deviceType: string = CommonConstants.DEFAULT_DEVICE_TYPE;
private mSmartDockViewModel: SmartDockViewModel;
private mSelectedItem = null;

View File

@ -5,7 +5,6 @@
"deviceTypes": [
"default",
"tablet"
],
"uiSyntax": "ets"
]
}
}

1232
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,6 @@
"version": "1.0.0",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "1.3.1",
"hypium": "^1.0.0",
"@ohos/hvigor": "1.3.1",
"@ohos/hypium": "1.0.3"
}

View File

@ -1,123 +0,0 @@
{
"name": "launcher",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/appcenter": {
"version": "file:../../feature/appcenter",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/bigfolder": {
"version": "file:../../feature/bigfolder",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/form": {
"version": "file:../../feature/form",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/gesturenavigation": {
"version": "file:../../feature/gesturenavigation",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/numbadge": {
"version": "file:../../feature/numbadge",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/pagedesktop": {
"version": "file:../../feature/pagedesktop",
"requires": {
"@ohos/bigfolder": "file:../../feature/bigfolder",
"@ohos/common": "file:../../common",
"@ohos/form": "file:../../feature/form"
},
"dependencies": {
"@ohos/bigfolder": {
"version": "file:../../feature/bigfolder",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/form": {
"version": "file:../../feature/form",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}
}
},
"@ohos/recents": {
"version": "file:../../feature/recents",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/smartdock": {
"version": "file:../../feature/smartdock",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}
}
}

View File

@ -2,7 +2,7 @@
"module": {
"name": "pad-launcher",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"srcEntry": "./ets/Application/AbilityStage.ts",
"description": "$string:mainability_description",
"mainElement": "com.ohos.launcher.MainAbility",
"deviceTypes": [
@ -18,7 +18,6 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"extensionAbilities": [
{
"priority": 2,
@ -35,12 +34,12 @@
]
}
],
"visible": false,
"exported": false,
"name": "com.ohos.launcher.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"type": "service"
}
],

View File

@ -1,112 +0,0 @@
{
"name": "launcher",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@ohos/bigfolder": {
"version": "file:../../feature/bigfolder",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/form": {
"version": "file:../../feature/form",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/gesturenavigation": {
"version": "file:../../feature/gesturenavigation",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/numbadge": {
"version": "file:../../feature/numbadge",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/pagedesktop": {
"version": "file:../../feature/pagedesktop",
"requires": {
"@ohos/bigfolder": "file:../../feature/bigfolder",
"@ohos/common": "file:../../common",
"@ohos/form": "file:../../feature/form"
},
"dependencies": {
"@ohos/bigfolder": {
"version": "file:../../feature/bigfolder",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/common": {
"version": "file:../../common"
},
"@ohos/form": {
"version": "file:../../feature/form",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}
}
},
"@ohos/recents": {
"version": "file:../../feature/recents",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
},
"@ohos/smartdock": {
"version": "file:../../feature/smartdock",
"requires": {
"@ohos/common": "file:../../common"
},
"dependencies": {
"@ohos/common": {
"version": "file:../../common"
}
}
}
}
}

View File

@ -2,7 +2,7 @@
"module": {
"name": "phone-launcher",
"type": "entry",
"srcEntrance": "./ets/Application/AbilityStage.ts",
"srcEntry": "./ets/Application/AbilityStage.ts",
"description": "$string:mainability_description",
"mainElement": "com.ohos.launcher.MainAbility",
"deviceTypes": [
@ -18,7 +18,6 @@
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"uiSyntax": "ets",
"extensionAbilities": [
{
"priority": 2,
@ -35,12 +34,12 @@
]
}
],
"visible": false,
"exported": false,
"name": "com.ohos.launcher.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"srcEntry": "./ets/MainAbility/MainAbility.ts",
"type": "service"
}
],

BIN
signature/OpenHarmony.p12 Normal file

Binary file not shown.

View File

@ -0,0 +1,44 @@
-----BEGIN CERTIFICATE-----
MIICRDCCAcmgAwIBAgIED+E4izAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE0MThaFw00OTEyMzExMjE0MThaMGgxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEoMCYG
A1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTB2MBAGByqGSM49
AgEGBSuBBAAiA2IABE023XmRaw2DnO8NSsb+KG/uY0FtS3u5LQucdr3qWVnRW5ui
QIL6ttNZBEeLTUeYcJZCpayg9Llf+1SmDA7dY4iP2EcRo4UN3rilovtfFfsmH4ty
3SApHVFzWUl+NwdH8KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AQYwHQYDVR0OBBYEFBc6EKGrGXzlAE+s0Zgnsphadw7NMAwGCCqGSM49BAMDBQAD
ZwAwZAIwd1p3JzHN93eoPped1li0j64npgqNzwy4OrkehYAqNXpcpaEcLZ7UxW8E
I2lZJ3SbAjAkqySHb12sIwdSFKSN9KCMMEo/eUT5dUXlcKR2nZz0MJdxT5F51qcX
1CumzkcYhgU=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICMzCCAbegAwIBAgIEaOC/zDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy
MTIxOTMxWhcNNDkxMjMxMTIxOTMxWjBoMQswCQYDVQQGEwJDTjEUMBIGA1UEChML
T3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xKDAmBgNVBAMT
H09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFJlbGVhc2UwWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAATbYOCQQpW5fdkYHN45v0X3AHax12jPBdEDosFRIZ1eXmxOYzSG
JwMfsHhUU90E8lI0TXYZnNmgM1sovubeQqATo1IwUDAfBgNVHSMEGDAWgBTbhrci
FtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFPtxruhl
cRBQsJdwcZqLu9oNUVgaMAwGCCqGSM49BAMDBQADaAAwZQIxAJta0PQ2p4DIu/ps
LMdLCDgQ5UH1l0B4PGhBlMgdi2zf8nk9spazEQI/0XNwpft8QAIwHSuA2WelVi/o
zAlF08DnbJrOOtOnQq5wHOPlDYB4OtUzOYJk9scotrEnJxJzGsh/
-----END CERTIFICATE-----

View File

@ -0,0 +1 @@
¸Å[§x4s<34>îï¢%b5-

Binary file not shown.

View File

@ -0,0 +1 @@
<EFBFBD><EFBFBD>/<2F><><EFBFBD>,<2C>D<EFBFBD>M-<2D>K)<29>

View File

@ -0,0 +1 @@
<EFBFBD>ױײ <0C>¥מת³ ¯><3E>ב

View File

@ -0,0 +1 @@
褒!髦wI滣<49>遇4