19
feature/pagedesktop/build.gradle
Normal file
@ -0,0 +1,19 @@
|
||||
apply plugin: 'com.huawei.ohos.library'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion 8
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 8
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
}
|
22
feature/pagedesktop/src/main/config.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.launcher",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"package": "com.ohos.launcher",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "pagedesktop",
|
||||
"moduleType": "har"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,976 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 BaseDragHandler from '../../../../../../../common/src/main/ets/default/base/BaseDragHandler';
|
||||
import CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import StyleConstants from '../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import PageDesktopViewModel from './viewmodel/PageDesktopViewModel';
|
||||
import FolderViewModel from '../../../../../../bigfolder/src/main/ets/default/viewmodel/FolderViewModel';
|
||||
import FormViewModel from '../../../../../../form/src/main/ets/default/viewmodel/FormViewModel';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
|
||||
const TAG = 'PageDesktopDragHandler';
|
||||
|
||||
/**
|
||||
* 桌面工作区拖拽处理类
|
||||
*/
|
||||
export default class PageDesktopDragHandler extends BaseDragHandler {
|
||||
private static sInstance: PageDesktopDragHandler = null;
|
||||
private readonly mPageDesktopViewModel: PageDesktopViewModel;
|
||||
private readonly mFolderViewModel: FolderViewModel;
|
||||
private readonly mFormViewModel: FormViewModel;
|
||||
private mGridConfig;
|
||||
private mPageCoordinateData = {
|
||||
gridXAxis: [],
|
||||
gridYAxis: []
|
||||
};
|
||||
private mStartPosition: any = null;
|
||||
private mEndPosition: any = null;
|
||||
private readonly styleConfig;
|
||||
private mGridItemHeight: any = null;
|
||||
private mGridItemWidth: any = null;
|
||||
private constructor() {
|
||||
super();
|
||||
this.mPageDesktopViewModel = PageDesktopViewModel.getInstance();
|
||||
this.mFolderViewModel = FolderViewModel.getInstance();
|
||||
this.mFormViewModel = FormViewModel.getInstance();
|
||||
this.styleConfig = this.mPageDesktopViewModel.getPageDesktopStyleConfig();
|
||||
}
|
||||
|
||||
static getInstance(): PageDesktopDragHandler {
|
||||
if (PageDesktopDragHandler.sInstance == null) {
|
||||
PageDesktopDragHandler.sInstance = new PageDesktopDragHandler();
|
||||
}
|
||||
return PageDesktopDragHandler.sInstance;
|
||||
}
|
||||
|
||||
setDragEffectArea(effectArea): void {
|
||||
super.setDragEffectArea(effectArea);
|
||||
this.updateGridParam(effectArea);
|
||||
}
|
||||
|
||||
private updateGridParam(effectArea) {
|
||||
const gridWidth = effectArea.right - effectArea.left;
|
||||
const gridHeight = effectArea.bottom - effectArea.top;
|
||||
console.info('Launcher PageDesktop updateGridParam gridWidth: ' + gridWidth + ', gridHeight: ' + gridHeight);
|
||||
this.mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
const column = this.mGridConfig.column;
|
||||
const row = this.mGridConfig.row;
|
||||
const columnsGap = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mColumnsGap;
|
||||
const rowGap = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mRowsGap;
|
||||
this.mGridItemHeight = row > 0 ? (gridHeight + columnsGap) / row : 0;
|
||||
this.mGridItemWidth = column > 0 ? (gridWidth + rowGap) / column : 0;
|
||||
console.info('Launcher PageDesktop updateGridParam column: ' + column + ', row: ' + row);
|
||||
this.mPageCoordinateData.gridYAxis = [];
|
||||
for (let i = 1; i <= row; i++) {
|
||||
const touchPositioningY = (gridHeight / row) * i + effectArea.top;
|
||||
this.mPageCoordinateData.gridYAxis.push(touchPositioningY);
|
||||
}
|
||||
|
||||
this.mPageCoordinateData.gridXAxis = [];
|
||||
for (let i = 1; i <= column; i++) {
|
||||
const touchPositioningX = (gridWidth / column) * i + effectArea.left;
|
||||
this.mPageCoordinateData.gridXAxis.push(touchPositioningX);
|
||||
}
|
||||
}
|
||||
|
||||
protected getDragRelativeData(): any {
|
||||
const desktopDataInfo: {
|
||||
appGridInfo: [[]]
|
||||
} = AppStorage.Get('appListInfo');
|
||||
return desktopDataInfo.appGridInfo;
|
||||
}
|
||||
|
||||
protected getItemIndex(event: any): number {
|
||||
const x = event.touches[0].screenX;
|
||||
const y = event.touches[0].screenY;
|
||||
let rowVal = CommonConstants.INVALID_VALUE;
|
||||
for (let index = 0; index < this.mPageCoordinateData.gridYAxis.length; index++) {
|
||||
if (this.mPageCoordinateData.gridYAxis[index] > y) {
|
||||
rowVal = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
let columnVal = CommonConstants.INVALID_VALUE;
|
||||
for (let index = 0; index < this.mPageCoordinateData.gridXAxis.length; index++) {
|
||||
if (this.mPageCoordinateData.gridXAxis[index] > x) {
|
||||
columnVal = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const column = this.mGridConfig.column;
|
||||
if (rowVal != CommonConstants.INVALID_VALUE && columnVal != CommonConstants.INVALID_VALUE) {
|
||||
return rowVal * column + columnVal;
|
||||
}
|
||||
return CommonConstants.INVALID_VALUE;
|
||||
}
|
||||
|
||||
protected getItemByIndex(index: number): any {
|
||||
const column = index % this.mGridConfig.column;
|
||||
const row = Math.floor(index / this.mGridConfig.column);
|
||||
console.info('Launcher PageDesktop getItemByIndex column: ' + column + ', row: ' + row);
|
||||
const pageIndex: number = this.mPageDesktopViewModel.getIndex();
|
||||
const appGridInfo = this.getDragRelativeData();
|
||||
console.info('Launcher PageDesktop getItemByIndex pageIndex: ' + pageIndex + ', appGridInfo length: ' + appGridInfo.length);
|
||||
|
||||
const itemInfo = appGridInfo[pageIndex].find(item => {
|
||||
if (item.type == CommonConstants.TYPE_APP) {
|
||||
return item.column == column && item.row == row;
|
||||
} else if (item.type == CommonConstants.TYPE_FOLDER || item.type == CommonConstants.TYPE_CARD) {
|
||||
return this.isItemInRowColumn(row, column, item);
|
||||
}
|
||||
});
|
||||
return itemInfo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* judge the item is at target row and column
|
||||
* @param row
|
||||
* @param column
|
||||
* @param item
|
||||
*/
|
||||
private isItemInRowColumn(row, column, item) {
|
||||
return item.column <= column && column < item.column + item.area[0] && item.row <= row && row < item.row + item.area[1];
|
||||
}
|
||||
|
||||
getCalPosition(x, y): any{
|
||||
return this.getTouchPosition(x, y);
|
||||
}
|
||||
|
||||
private getTouchPosition(x, y): any {
|
||||
const pageIndex =this.mPageDesktopViewModel.getIndex();
|
||||
console.info('getTouchPosition pageIndex: ' + pageIndex);
|
||||
const position = {
|
||||
page: pageIndex,
|
||||
row: 0,
|
||||
column: 0,
|
||||
X: x,
|
||||
Y: y,
|
||||
};
|
||||
for (let i = 0; i < this.mPageCoordinateData.gridXAxis.length; i++) {
|
||||
if (x < this.mPageCoordinateData.gridXAxis[i]) {
|
||||
position.column = i;
|
||||
break;
|
||||
} else {
|
||||
position.column = this.mPageCoordinateData.gridXAxis.length - 1;
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.mPageCoordinateData.gridYAxis.length; i++) {
|
||||
if (y < this.mPageCoordinateData.gridYAxis[i]) {
|
||||
position.row = i;
|
||||
break;
|
||||
} else {
|
||||
position.row = this.mPageCoordinateData.gridYAxis.length - 1;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
protected onDragStart(event: any, itemIndex: number): void {
|
||||
Log.showInfo(TAG, 'onDragStart itemIndex: ' + itemIndex);
|
||||
super.onDragStart(event, itemIndex);
|
||||
const moveAppX = event.touches[0].screenX;
|
||||
const moveAppY = event.touches[0].screenY;
|
||||
const dragItemInfo = this.getDragItemInfo();
|
||||
|
||||
this.mStartPosition = this.getTouchPosition(moveAppX, moveAppY);
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_FOLDER || dragItemInfo.type == CommonConstants.TYPE_CARD) {
|
||||
const rowOffset = this.mStartPosition.row - dragItemInfo.row;
|
||||
const columnOffset = this.mStartPosition.column - dragItemInfo.column;
|
||||
const positionOffset = [columnOffset, rowOffset];
|
||||
AppStorage.SetOrCreate('positionOffset', positionOffset);
|
||||
|
||||
const desktopMarginTop = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mDesktopMarginTop;
|
||||
const margin = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mMargin;
|
||||
const dragItemx = dragItemInfo.column * this.mGridItemWidth + margin;
|
||||
const dragItemy = dragItemInfo.row * this.mGridItemHeight + desktopMarginTop;
|
||||
const moveOffset = [moveAppX - dragItemx, moveAppY - dragItemy];
|
||||
AppStorage.SetOrCreate('moveOffset', moveOffset);
|
||||
|
||||
this.mStartPosition.row = dragItemInfo.row;
|
||||
this.mStartPosition.column = dragItemInfo.column;
|
||||
}
|
||||
|
||||
AppStorage.SetOrCreate('overlayPositionX', moveAppX);
|
||||
AppStorage.SetOrCreate('overlayPositionY', moveAppY);
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_APP){
|
||||
AppStorage.SetOrCreate('overlayData', {
|
||||
iconSize: this.styleConfig.mIconSize * 1.15,
|
||||
nameSize: this.styleConfig.mNameSize * 1.15,
|
||||
nameHeight: this.styleConfig.mNameHeight * 1.15,
|
||||
appInfo: this.getDragItemInfo(),
|
||||
});
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_APP_ICON);
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_FOLDER) {
|
||||
const folderStyleConfig = this.mFolderViewModel.getFolderStyleConfig();
|
||||
|
||||
const folderSize = folderStyleConfig.mGridSize * 1.15;
|
||||
const iconSize = folderStyleConfig.mFolderAppSize * 1.15;
|
||||
const gridMargin = folderStyleConfig.mGridMargin * 1.15;
|
||||
const gridGap = folderStyleConfig.mFolderGridGap * 1.15;
|
||||
AppStorage.SetOrCreate('overlayData', {
|
||||
folderHeight: folderSize,
|
||||
folderWidth: folderSize,
|
||||
folderGridSize: folderSize,
|
||||
appIconSize: iconSize,
|
||||
gridMargin: gridGap,
|
||||
folderInfo: this.getDragItemInfo()
|
||||
});
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_FOLDER);
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_CARD) {
|
||||
const formStyleConfig = this.mFormViewModel.getFormStyleConfig();
|
||||
const cardDimension = dragItemInfo.cardDimension.toString();
|
||||
const formHeight = formStyleConfig.mFormHeight.get(cardDimension) * 1.15;
|
||||
const formWidth = formStyleConfig.mFormWidth.get(cardDimension) * 1.15;
|
||||
AppStorage.SetOrCreate('overlayData', {
|
||||
formHeight: formHeight,
|
||||
formWidth: formWidth,
|
||||
formInfo: this.getDragItemInfo()
|
||||
});
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_CARD);
|
||||
}
|
||||
|
||||
AppStorage.SetOrCreate('withBlur', false);
|
||||
}
|
||||
|
||||
reset(): void {
|
||||
super.reset();
|
||||
}
|
||||
|
||||
protected onDragMove(event: any, insertIndex: number, itemIndex: number): void {
|
||||
super.onDragMove(event, insertIndex, itemIndex);
|
||||
console.info('Launcher PageDesktop onDragMove insertIndex: ' + insertIndex);
|
||||
const moveAppX = event.touches[0].screenX;
|
||||
const moveAppY = event.touches[0].screenY;
|
||||
const dragItemInfo = this.getDragItemInfo();
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_FOLDER || dragItemInfo.type == CommonConstants.TYPE_CARD) {
|
||||
const moveOffset = AppStorage.Get('moveOffset');
|
||||
AppStorage.SetOrCreate('overlayPositionX', moveAppX - moveOffset[0]);
|
||||
AppStorage.SetOrCreate('overlayPositionY', moveAppY - moveOffset[1]);
|
||||
} else {
|
||||
AppStorage.SetOrCreate('overlayPositionX', moveAppX - (this.styleConfig.mIconSize/2));
|
||||
AppStorage.SetOrCreate('overlayPositionY', moveAppY - (this.styleConfig.mIconSize/2));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected onDragDrop(event: any, insertIndex: number, itemIndex: number): boolean {
|
||||
super.onDragDrop(event, insertIndex, itemIndex);
|
||||
console.info('Launcher PageDesktop onDragDrop insertIndex: ' + insertIndex + ' ,mIsInEffectArea: ' + this.mIsInEffectArea);
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_HIDE);
|
||||
let isDragSuccess = false;
|
||||
if (this.mIsInEffectArea) {
|
||||
const moveAppX = event.touches[0].screenX;
|
||||
const moveAppY = event.touches[0].screenY;
|
||||
this.mEndPosition = this.getTouchPosition(moveAppX, moveAppY);
|
||||
const dragItemInfo = this.getDragItemInfo();
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_FOLDER || dragItemInfo.type == CommonConstants.TYPE_CARD ) {
|
||||
const positionOffset = AppStorage.Get('positionOffset');
|
||||
|
||||
this.mEndPosition.row = this.mEndPosition.row - positionOffset[1];
|
||||
this.mEndPosition.column = this.mEndPosition.column - positionOffset[0];
|
||||
this.mGridConfig = this.mPageDesktopViewModel.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];
|
||||
}
|
||||
|
||||
AppStorage.SetOrCreate('positionOffset', []);
|
||||
AppStorage.SetOrCreate('moveOffset', []);
|
||||
|
||||
} else if(dragItemInfo.type === CommonConstants.TYPE_APP) {
|
||||
if (this.mEndPosition.page == dragItemInfo.page &&
|
||||
this.mEndPosition.row == dragItemInfo.row &&
|
||||
this.mEndPosition.column == dragItemInfo.column) {
|
||||
isDragSuccess = true;
|
||||
return isDragSuccess;
|
||||
}
|
||||
|
||||
const info = this.mPageDesktopViewModel.getLayoutInfo();
|
||||
const layoutInfo = info.layoutInfo;
|
||||
const endLayoutInfo = layoutInfo.find(item => {
|
||||
if (item.type == CommonConstants.TYPE_FOLDER || item.type == CommonConstants.TYPE_CARD) {
|
||||
return item.page === this.mEndPosition.page && this.isItemInRowColumn(this.mEndPosition.row, this.mEndPosition.column, item);
|
||||
} else if (item.type == CommonConstants.TYPE_APP) {
|
||||
return item.page === this.mEndPosition.page && item.row === this.mEndPosition.row && item.column === this.mEndPosition.column;
|
||||
}
|
||||
});
|
||||
|
||||
if (endLayoutInfo != undefined) {
|
||||
if (endLayoutInfo.type === CommonConstants.TYPE_FOLDER) {
|
||||
const appInfo = {
|
||||
appName: '',
|
||||
bundleName: dragItemInfo.bundleName,
|
||||
type: dragItemInfo.type,
|
||||
area: dragItemInfo.area,
|
||||
page: dragItemInfo.page,
|
||||
column: dragItemInfo.column,
|
||||
row: dragItemInfo.row,
|
||||
isSystemApp: '',
|
||||
isUninstallAble: '',
|
||||
appIconId: '',
|
||||
appLabelId: '',
|
||||
abilityName: '',
|
||||
x: '',
|
||||
badgeNumber: dragItemInfo.badgeNumber
|
||||
};
|
||||
|
||||
// add app to folder
|
||||
this.mFolderViewModel.addOneAppToFolder(appInfo, endLayoutInfo.folderId);
|
||||
|
||||
isDragSuccess = true;
|
||||
return isDragSuccess;
|
||||
|
||||
} else if (endLayoutInfo.type === CommonConstants.TYPE_APP) {
|
||||
// create a new folder
|
||||
const appListInfo = [];
|
||||
if (endLayoutInfo != undefined) {
|
||||
appListInfo.push(endLayoutInfo);
|
||||
}
|
||||
const startLayoutInfo = layoutInfo.find(item => {
|
||||
return item.page === dragItemInfo.page && item.row === dragItemInfo.row && item.column === dragItemInfo.column;
|
||||
});
|
||||
if (startLayoutInfo != undefined) {
|
||||
appListInfo.push(startLayoutInfo);
|
||||
}
|
||||
// add apps to new folder
|
||||
this.mFolderViewModel.addNewFolder(appListInfo);
|
||||
|
||||
isDragSuccess = true;
|
||||
return isDragSuccess;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.isSelfDrag()) {
|
||||
const info = this.mPageDesktopViewModel.getLayoutInfo();
|
||||
const layoutInfo = info.layoutInfo;
|
||||
this.checkAndMove(this.mStartPosition, this.mEndPosition, layoutInfo, dragItemInfo);
|
||||
info.layoutInfo = layoutInfo;
|
||||
this.mPageDesktopViewModel.setLayoutInfo(info);
|
||||
this.mPageDesktopViewModel.pagingFiltering();
|
||||
|
||||
isDragSuccess = true;
|
||||
} else {
|
||||
this.addItemToDeskTop(dragItemInfo, this.mEndPosition);
|
||||
}
|
||||
}
|
||||
return isDragSuccess;
|
||||
}
|
||||
|
||||
protected onDragEnd(isSuccess: boolean): void {
|
||||
super.onDragEnd(isSuccess);
|
||||
console.info('Launcher PageDesktop onDragEnd isSuccess: ' + isSuccess);
|
||||
if (this.isDropOutSide() && isSuccess) {
|
||||
console.info('Launcher PageDesktop onDragEnd remove item');
|
||||
this.removeItemFromDeskTop(this.mStartPosition);
|
||||
}
|
||||
this.mStartPosition = null;
|
||||
this.mEndPosition = null;
|
||||
AppStorage.SetOrCreate('dragFocus', '');
|
||||
}
|
||||
|
||||
private layoutAdjustment(startInfo, endInfo) {
|
||||
const info = this.mPageDesktopViewModel.getLayoutInfo();
|
||||
const layoutInfo = info.layoutInfo;
|
||||
this.moveLayout(startInfo, endInfo, layoutInfo, startInfo);
|
||||
info.layoutInfo = layoutInfo;
|
||||
console.info('Launcher PageDesktop layoutAdjustment setLayoutInfo');
|
||||
this.mPageDesktopViewModel.setLayoutInfo(info);
|
||||
this.mPageDesktopViewModel.pagingFiltering();
|
||||
}
|
||||
|
||||
private addItemToDeskTop(itemInfo, endInfo) {
|
||||
const info = this.mPageDesktopViewModel.getLayoutInfo();
|
||||
const layoutInfo = info.layoutInfo;
|
||||
if (!this.isValidShortcut(layoutInfo, itemInfo)) {
|
||||
console.info('Launcher PageDesktop layoutAdjustment isInvalidShortcut');
|
||||
return;
|
||||
}
|
||||
const moveItem = {
|
||||
bundleName: itemInfo.bundleName,
|
||||
type: CommonConstants.TYPE_APP,
|
||||
page: -1,
|
||||
row: -1,
|
||||
column: -1
|
||||
};
|
||||
layoutInfo.push(moveItem);
|
||||
this.moveLayout(moveItem, endInfo, layoutInfo, moveItem);
|
||||
for (let i = layoutInfo.length - 1; i >= 0; i--) {
|
||||
if (layoutInfo[i].page == -1 && layoutInfo[i].column == -1 && layoutInfo[i].row == -1) {
|
||||
layoutInfo.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
info.layoutInfo = layoutInfo;
|
||||
console.info('Launcher PageDesktop addItemToDeskTop setLayoutInfo');
|
||||
this.mPageDesktopViewModel.setLayoutInfo(info);
|
||||
this.mPageDesktopViewModel.pagingFiltering();
|
||||
}
|
||||
|
||||
private isValidShortcut(layoutInfo, itemInfo): boolean {
|
||||
for (let i = 0; i < layoutInfo.length; i++) {
|
||||
if (layoutInfo[i].bundleName === itemInfo.bundleName) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return itemInfo != [] && itemInfo != undefined && itemInfo != null;
|
||||
}
|
||||
|
||||
removeItemFromDeskTop(startInfo) {
|
||||
const info = this.mPageDesktopViewModel.getLayoutInfo();
|
||||
const layoutInfo = info.layoutInfo;
|
||||
for (let i = layoutInfo.length - 1; i >= 0; i--) {
|
||||
if (layoutInfo[i].page == startInfo.page && layoutInfo[i].row == startInfo.row && layoutInfo[i].column == startInfo.column) {
|
||||
layoutInfo.splice(i, 1);
|
||||
}
|
||||
}
|
||||
info.layoutInfo = layoutInfo;
|
||||
console.info('Launcher PageDesktop removeItemFromDeskTop setLayoutInfo');
|
||||
this.mPageDesktopViewModel.setLayoutInfo(info);
|
||||
this.mPageDesktopViewModel.pagingFiltering();
|
||||
}
|
||||
|
||||
private moveLayout(source, destination, layoutInfo, startInfo) {
|
||||
const couldMoveForward = this.moveLayoutForward(source, destination, layoutInfo, startInfo);
|
||||
if (couldMoveForward) return;
|
||||
this.moveLayoutBackward(source, destination, layoutInfo, startInfo);
|
||||
}
|
||||
|
||||
private moveLayoutForward(source, destination, layoutInfo, startInfo) {
|
||||
this.mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
const startLayoutInfo = layoutInfo.find(item => {
|
||||
return item.page == source.page && item.row == source.row && item.column == source.column;
|
||||
});
|
||||
const endLayoutInfo = layoutInfo.find(item => {
|
||||
return item.page == destination.page && item.row == destination.row && item.column == destination.column;
|
||||
});
|
||||
|
||||
if (endLayoutInfo != undefined
|
||||
&& !(endLayoutInfo.page == startInfo.page && endLayoutInfo.row == startInfo.row && endLayoutInfo.column == startInfo.column)) {
|
||||
if (endLayoutInfo.row == this.mGridConfig.row - 1 && endLayoutInfo.column == this.mGridConfig.column - 1) {
|
||||
return false;
|
||||
}
|
||||
const nextPosition = {
|
||||
page: destination.page,
|
||||
row: destination.column == this.mGridConfig.column - 1 ? destination.row + 1 : destination.row,
|
||||
column: destination.column == this.mGridConfig.column - 1 ? 0 : destination.column + 1
|
||||
};
|
||||
const couldMoveForward = this.moveLayoutForward(destination, nextPosition, layoutInfo, startInfo);
|
||||
if (!couldMoveForward) return false;
|
||||
}
|
||||
startLayoutInfo.page = destination.page;
|
||||
startLayoutInfo.row = destination.row;
|
||||
startLayoutInfo.column = destination.column;
|
||||
return true;
|
||||
}
|
||||
|
||||
private moveLayoutBackward(source, destination, layoutInfo, startInfo) {
|
||||
this.mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
const startLayoutInfo = layoutInfo.find(item => {
|
||||
return item.page == source.page && item.row == source.row && item.column == source.column;
|
||||
});
|
||||
const endLayoutInfo = layoutInfo.find(item => {
|
||||
return item.page == destination.page && item.row == destination.row && item.column == destination.column;
|
||||
});
|
||||
|
||||
if (endLayoutInfo != undefined &&
|
||||
!(endLayoutInfo.page == startInfo.page && endLayoutInfo.row == startInfo.row && endLayoutInfo.column == startInfo.column)) {
|
||||
if (endLayoutInfo.row == 0 && endLayoutInfo.column == 0) {
|
||||
return false;
|
||||
}
|
||||
const nextPosition = {
|
||||
page: destination.page,
|
||||
row: (destination.column == 0 && destination.row > 0) ? destination.row - 1 : destination.row,
|
||||
column: destination.column == 0 ? this.mGridConfig.column - 1 : destination.column - 1
|
||||
};
|
||||
const couldMoveBackward = this.moveLayoutBackward(destination, nextPosition, layoutInfo, startInfo);
|
||||
if (!couldMoveBackward) return false;
|
||||
}
|
||||
startLayoutInfo.page = destination.page;
|
||||
startLayoutInfo.row = destination.row;
|
||||
startLayoutInfo.column = destination.column;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* folder squeeze handle
|
||||
* @param source
|
||||
* @param destination
|
||||
* @param layoutInfo
|
||||
* @param dragItemInfo
|
||||
*/
|
||||
private checkAndMove(source, destination, layoutInfo, dragItemInfo) {
|
||||
Log.showInfo(TAG, 'checkAndMove start');
|
||||
|
||||
const allPositions = this.getAllPositions(destination, layoutInfo);
|
||||
|
||||
const objectPositionCount = this.getObjectPositionCount(destination, layoutInfo);
|
||||
|
||||
const pressedPositions = this.getPressedObjects(destination, allPositions, dragItemInfo);
|
||||
|
||||
// source and destination is in the same page
|
||||
if (source.page == destination.page && !this.checkCanMoveInSamePage(pressedPositions, objectPositionCount, dragItemInfo)) {
|
||||
return false;
|
||||
}
|
||||
// source and destination is in diff page
|
||||
if (source.page != destination.page && !this.checkCanMoveInDiffPage(allPositions, dragItemInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source.page == destination.page) {
|
||||
this.setSourcePositionToNull(dragItemInfo, allPositions);
|
||||
}
|
||||
this.setDestinationPosition(destination, allPositions, dragItemInfo);
|
||||
|
||||
Log.showInfo(TAG, `checkAndMove pressedPositions.foldersAndForms: ${pressedPositions.foldersAndForms.length}`);
|
||||
if (pressedPositions.foldersAndForms.length != 0) {
|
||||
if (!this.moveFoldersAndForms(pressedPositions.foldersAndForms, destination, allPositions, dragItemInfo)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Log.showInfo(TAG, `checkAndMove pressedPositions.apps.length: ${pressedPositions.apps.length}`);
|
||||
if (pressedPositions.apps.length != 0) {
|
||||
this.moveApps(pressedPositions.apps, allPositions);
|
||||
}
|
||||
|
||||
Log.showInfo(TAG, 'checkAndMove update destination ');
|
||||
let bundleName = '';
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_FOLDER) {
|
||||
bundleName = dragItemInfo.folderId;
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_CARD) {
|
||||
bundleName = dragItemInfo.cardId;
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_APP) {
|
||||
bundleName = dragItemInfo.bundleName;
|
||||
}
|
||||
|
||||
for (let j = 0; j < dragItemInfo.area[1]; j++) {
|
||||
for (let i = 0; i < dragItemInfo.area[0]; i++) {
|
||||
const destinationPosition = {
|
||||
type: dragItemInfo.type,
|
||||
bundleName: bundleName
|
||||
};
|
||||
allPositions[destination.row + j][destination.column + i] = destinationPosition;
|
||||
}
|
||||
}
|
||||
|
||||
Log.showInfo(TAG, 'checkAndMove update layoutInfo ');
|
||||
for (let index = 0; index < layoutInfo.length; index++) {
|
||||
for (let row = allPositions.length - 1; row >= 0 ; row--) {
|
||||
for (let column = allPositions[row].length - 1; column >= 0 ; column--) {
|
||||
if (layoutInfo[index].type == CommonConstants.TYPE_APP && layoutInfo[index].bundleName == allPositions[row][column].bundleName ||
|
||||
layoutInfo[index].type == CommonConstants.TYPE_FOLDER && layoutInfo[index].folderId == allPositions[row][column].bundleName ||
|
||||
layoutInfo[index].type == CommonConstants.TYPE_CARD && layoutInfo[index].cardId == allPositions[row][column].bundleName) {
|
||||
layoutInfo[index].row = row;
|
||||
layoutInfo[index].column = column;
|
||||
layoutInfo[index].page = destination.page;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.showInfo(TAG, 'checkAndMove end');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* get desktop's position info
|
||||
* @param destination
|
||||
* @param layoutInfo
|
||||
*/
|
||||
private getAllPositions(destination, layoutInfo) {
|
||||
Log.showInfo(TAG, 'getAllPositions start');
|
||||
const mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
const pageRow = mGridConfig.row;
|
||||
const pageColumn = mGridConfig.column;
|
||||
const allPositions = [];
|
||||
|
||||
// set null to all positions in current page
|
||||
for (let row = 0; row < pageRow; row++) {
|
||||
const rowPositions = [];
|
||||
for (let column = 0; column < pageColumn; column++) {
|
||||
const position = {
|
||||
type: -1,
|
||||
bundleName: 'null',
|
||||
area: []
|
||||
};
|
||||
rowPositions.push(position);
|
||||
}
|
||||
allPositions.push(rowPositions);
|
||||
}
|
||||
|
||||
// set position in layoutInfo to all positions
|
||||
for (let i = 0; i < layoutInfo.length; i++) {
|
||||
if (layoutInfo[i].page == destination.page) {
|
||||
if (layoutInfo[i].type == CommonConstants.TYPE_FOLDER || layoutInfo[i].type == CommonConstants.TYPE_CARD) {
|
||||
let bundleName = '';
|
||||
if (layoutInfo[i].type == CommonConstants.TYPE_FOLDER) {
|
||||
bundleName = layoutInfo[i].folderId;
|
||||
} else if (layoutInfo[i].type == CommonConstants.TYPE_CARD) {
|
||||
bundleName = layoutInfo[i].cardId;
|
||||
}
|
||||
|
||||
const positionInLayoutInfo = {
|
||||
type: layoutInfo[i].type,
|
||||
bundleName: bundleName,
|
||||
area: layoutInfo[i].area
|
||||
};
|
||||
for (let k = 0; k < layoutInfo[i].area[1]; k++) {
|
||||
for (let j = 0; j < layoutInfo[i].area[0]; j++) {
|
||||
allPositions[layoutInfo[i].row + k][layoutInfo[i].column + j] = positionInLayoutInfo;
|
||||
}
|
||||
}
|
||||
} else if (layoutInfo[i].type == CommonConstants.TYPE_APP) {
|
||||
const positionInLayoutInfo = {
|
||||
type: layoutInfo[i].type,
|
||||
bundleName: layoutInfo[i].bundleName,
|
||||
area: layoutInfo[i].area
|
||||
};
|
||||
allPositions[layoutInfo[i].row][layoutInfo[i].column] = positionInLayoutInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.showInfo(TAG, 'getAllPositions end');
|
||||
return allPositions;
|
||||
}
|
||||
|
||||
/**
|
||||
* get desktop's position count by Object
|
||||
* @param destination
|
||||
* @param layoutInfo
|
||||
*/
|
||||
private getObjectPositionCount(destination, layoutInfo): Map<string, number> {
|
||||
Log.showInfo(TAG, 'getObjectPositionCount start');
|
||||
|
||||
const objectPositionCount = new Map<string, number>();
|
||||
// set position in layoutInfo to all positions
|
||||
for (let i = 0; i < layoutInfo.length; i++) {
|
||||
if (layoutInfo[i].page == destination.page) {
|
||||
const count = layoutInfo[i].area[0] * layoutInfo[i].area[1];
|
||||
let bundleName = '';
|
||||
if (layoutInfo[i].type == CommonConstants.TYPE_FOLDER) {
|
||||
bundleName = layoutInfo[i].folderId;
|
||||
} else if (layoutInfo[i].type == CommonConstants.TYPE_CARD) {
|
||||
bundleName = layoutInfo[i].cardId;
|
||||
} else if (layoutInfo[i].type == CommonConstants.TYPE_APP) {
|
||||
bundleName = layoutInfo[i].bundleName;
|
||||
}
|
||||
objectPositionCount.set(bundleName, count);
|
||||
}
|
||||
}
|
||||
Log.showInfo(TAG, 'getObjectPositionCount end');
|
||||
return objectPositionCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Object under pressed big folder or form
|
||||
* @param destination
|
||||
* @param allPositions
|
||||
* @param dragItemInfo
|
||||
*/
|
||||
private getPressedObjects(destination, allPositions, dragItemInfo) {
|
||||
Log.showInfo(TAG, 'getPressedObjects start');
|
||||
const row = destination.row;
|
||||
const column = destination.column;
|
||||
const apps = [];
|
||||
const foldersAndForms = [];
|
||||
|
||||
Log.showInfo(TAG, `getPressedObjects destination.row: ${row},destination.column:${column}`);
|
||||
|
||||
for (let j = 0; j < dragItemInfo.area[1]; j++) {
|
||||
for (let i = 0; i < dragItemInfo.area[0]; i++) {
|
||||
if (allPositions[row + j][column + i].type == CommonConstants.TYPE_APP) {
|
||||
apps.push(allPositions[row + j][column + i]);
|
||||
} else if (allPositions[row + j][column + i].type == CommonConstants.TYPE_FOLDER &&
|
||||
allPositions[row + j][column + i].bundleName != dragItemInfo.folderId) {
|
||||
foldersAndForms.push(allPositions[row + j][column + i]);
|
||||
} else if (allPositions[row + j][column + i].type == CommonConstants.TYPE_CARD &&
|
||||
allPositions[row + j][column + i].bundleName != dragItemInfo.cardId) {
|
||||
foldersAndForms.push(allPositions[row + j][column + i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log.showInfo(TAG, `getPressedObjects foldersAndForms.length: ${foldersAndForms.length}`);
|
||||
Log.showInfo(TAG, `getPressedObjects apps.length: ${apps.length}`);
|
||||
const pressedObjects = {
|
||||
apps,
|
||||
foldersAndForms
|
||||
};
|
||||
Log.showInfo(TAG, 'getPressedObjects end');
|
||||
return pressedObjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* check of canMove in same page
|
||||
* @param pressedPositions
|
||||
* @param objectPositionCount
|
||||
* @param dragItemInfo
|
||||
*/
|
||||
private checkCanMoveInSamePage(pressedPositions, objectPositionCount, dragItemInfo) {
|
||||
Log.showInfo(TAG, 'checkCanMoveInSamePage start');
|
||||
const foldersAndForms = pressedPositions.foldersAndForms;
|
||||
if (foldersAndForms.length == 0) {
|
||||
Log.showInfo(TAG, 'checkCanMoveInSamePage return true');
|
||||
return true;
|
||||
}
|
||||
|
||||
if (foldersAndForms.length == 1) {
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_APP && foldersAndForms[0].type == CommonConstants.TYPE_CARD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const coverPositionCount = new Map<string, number>();
|
||||
Log.showInfo(TAG, `checkCanMoveInSamePage foldersAndForms.length: ${foldersAndForms.length}`);
|
||||
for (let i = 0; i < foldersAndForms.length; i++) {
|
||||
const tmp = coverPositionCount.get(foldersAndForms[i].bundleName);
|
||||
Log.showInfo(TAG, `checkCanMoveInSamePage tmp: ${tmp}`);
|
||||
if (tmp != undefined) {
|
||||
coverPositionCount.set(foldersAndForms[i].bundleName, tmp + 1);
|
||||
} else {
|
||||
coverPositionCount.set(foldersAndForms[i].bundleName, 1);
|
||||
}
|
||||
}
|
||||
|
||||
for (const bundleName of coverPositionCount.keys()) {
|
||||
if (coverPositionCount.get(bundleName) < objectPositionCount.get(bundleName) / 2) {
|
||||
Log.showInfo(TAG, 'checkCanMoveInSamePage end false');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Log.showInfo(TAG, 'checkCanMoveInSamePage end true');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* check of canMove in diff page
|
||||
* @param allPositions
|
||||
*/
|
||||
private checkCanMoveInDiffPage(allPositions, dragItemInfo) {
|
||||
Log.showInfo(TAG, 'checkCanMoveInDiffPage start');
|
||||
let count = 0;
|
||||
for (let i = 0; i < allPositions.length; i++) {
|
||||
for (let j = 0; j < allPositions[i].length; j++) {
|
||||
if (allPositions[i][j].type == -1) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
const minCount = dragItemInfo.area[0] * dragItemInfo.area[1];
|
||||
// target page empty position min is dragItemInfo's need position
|
||||
if (count < minCount) {
|
||||
Log.showInfo(TAG, 'checkCanMoveInDiffPage end false');
|
||||
return false;
|
||||
}
|
||||
Log.showInfo(TAG, 'checkCanMoveInDiffPage end true');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* set source‘s position to null
|
||||
* @param source
|
||||
* @param allPositions
|
||||
*/
|
||||
private setSourcePositionToNull(dragItemInfo, allPositions) {
|
||||
Log.showInfo(TAG, 'setSourcePositionToNull start');
|
||||
for (let j = 0; j < dragItemInfo.area[1]; j++) {
|
||||
for (let i = 0; i < dragItemInfo.area[0]; i++) {
|
||||
const nullPosition = {
|
||||
type: -1,
|
||||
bundleName: 'null',
|
||||
area: []
|
||||
};
|
||||
allPositions[dragItemInfo.row + j][dragItemInfo.column + i] = nullPosition;
|
||||
}
|
||||
}
|
||||
|
||||
Log.showInfo(TAG, 'setSourcePositionToNull end');
|
||||
}
|
||||
|
||||
/**
|
||||
* set direction‘s position to null
|
||||
* @param destination
|
||||
* @param allPositions
|
||||
* @param dragItemInfo
|
||||
*/
|
||||
private setDestinationPosition(destination, allPositions, dragItemInfo) {
|
||||
Log.showInfo(TAG, 'setDestinationPosition start');
|
||||
let bundleName = '';
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_FOLDER) {
|
||||
bundleName = dragItemInfo.folderId;
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_CARD) {
|
||||
bundleName = dragItemInfo.cardId;
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_APP) {
|
||||
bundleName = dragItemInfo.bundleName;
|
||||
}
|
||||
|
||||
for (let j = 0; j < dragItemInfo.area[1]; j++) {
|
||||
for (let i = 0; i < dragItemInfo.area[0]; i++) {
|
||||
if (allPositions[destination.row + j][destination.column+ i].type == -1) {
|
||||
const destinationPosition = {
|
||||
type: dragItemInfo.type,
|
||||
bundleName: bundleName,
|
||||
area: dragItemInfo.area
|
||||
};
|
||||
allPositions[destination.row + j][destination.column+ i] = destinationPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.showInfo(TAG, 'setDestinationPosition end');
|
||||
}
|
||||
|
||||
/**
|
||||
* move folders and forms to target position
|
||||
* @param foldersAndForms
|
||||
* @param destination
|
||||
* @param allPositions
|
||||
* @param dragItemInfo
|
||||
*/
|
||||
private moveFoldersAndForms(foldersAndForms, destination, allPositions, dragItemInfo) {
|
||||
Log.showInfo(TAG, 'moveFoldersAndForms start');
|
||||
const movedFoldersAndForms = [];
|
||||
for (let i = 0; i < foldersAndForms.length; i++) {
|
||||
const moveFolderOrForm = foldersAndForms[i];
|
||||
if (movedFoldersAndForms.indexOf(moveFolderOrForm.bundleName) != -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (let row = 0; row < allPositions.length; row++) {
|
||||
for (let column = 0; column < allPositions[row].length; column++) {
|
||||
if (moveFolderOrForm.bundleName == allPositions[row][column].bundleName) {
|
||||
let destinationFlag = false;
|
||||
for (let j = 0; j < dragItemInfo.area[1]; j++) {
|
||||
if (destinationFlag) {
|
||||
break;
|
||||
}
|
||||
for (let i = 0; i < dragItemInfo.area[0]; i++) {
|
||||
if (destination.row + j == row && destination.column + i == column) {
|
||||
destinationFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!destinationFlag) {
|
||||
const nullPosition = {
|
||||
type: -1,
|
||||
bundleName: 'null',
|
||||
area: []
|
||||
};
|
||||
allPositions[row][column] = nullPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let isUsablePosition = false;
|
||||
for (let row = 0; row < allPositions.length; row++) {
|
||||
if (isUsablePosition) {
|
||||
break;
|
||||
}
|
||||
for (let column = 0; column < allPositions[row].length; column++) {
|
||||
let usedPosition = 0;
|
||||
for (let j = 0; j < moveFolderOrForm.area[1]; j++) {
|
||||
for (let i = 0; i < moveFolderOrForm.area[0]; i++) {
|
||||
if (row + j < allPositions.length && column + i < allPositions[row].length && allPositions[row + j][column + i].type == -1) {
|
||||
usedPosition++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (usedPosition == moveFolderOrForm.area[1] * moveFolderOrForm.area[0]) {
|
||||
isUsablePosition = true;
|
||||
for (let j = 0; j < moveFolderOrForm.area[1]; j++) {
|
||||
for (let i = 0; i < moveFolderOrForm.area[0]; i++) {
|
||||
const movePosition = {
|
||||
type: moveFolderOrForm.type,
|
||||
bundleName: moveFolderOrForm.bundleName,
|
||||
area: moveFolderOrForm.area
|
||||
};
|
||||
allPositions[row + j][column + i] = movePosition;
|
||||
}
|
||||
}
|
||||
movedFoldersAndForms.push(moveFolderOrForm.bundleName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isUsablePosition) {
|
||||
Log.showInfo(TAG, 'moveFoldersAndForms return false');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let bundleName = '';
|
||||
if (dragItemInfo.type == CommonConstants.TYPE_FOLDER) {
|
||||
bundleName = dragItemInfo.folderId;
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_CARD) {
|
||||
bundleName = dragItemInfo.cardId;
|
||||
} else if (dragItemInfo.type == CommonConstants.TYPE_APP) {
|
||||
bundleName = dragItemInfo.bundleName;
|
||||
}
|
||||
|
||||
for (let j = 0; j < dragItemInfo.area[1]; j++) {
|
||||
for (let i = 0; i < dragItemInfo.area[0]; i++) {
|
||||
const dragItemPosition = {
|
||||
type: dragItemInfo.type,
|
||||
bundleName: bundleName,
|
||||
area: dragItemInfo.area
|
||||
};
|
||||
allPositions[destination.row + j][destination.column + i] = dragItemPosition;
|
||||
}
|
||||
}
|
||||
|
||||
Log.showInfo(TAG, 'moveFoldersAndForms end');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* move apps to target position
|
||||
* @param apps
|
||||
* @param allPositions
|
||||
*/
|
||||
private moveApps(apps, allPositions) {
|
||||
Log.showInfo(TAG, 'moveApps start');
|
||||
for (let i = 0; i < apps.length; i++) {
|
||||
const app = apps[i];
|
||||
let isUsable = false;
|
||||
for (let row = 0; row < allPositions.length; row++) {
|
||||
if (isUsable) {
|
||||
break;
|
||||
}
|
||||
for (let column = 0; column < allPositions[row].length; column++) {
|
||||
if (allPositions[row][column].type == -1) {
|
||||
const appPosition = {
|
||||
type: app.type,
|
||||
bundleName: app.bundleName,
|
||||
area: app.area
|
||||
};
|
||||
allPositions[row][column] = appPosition;
|
||||
isUsable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Log.showInfo(TAG, 'moveApps end');
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PresetStyleConstants from '../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
import FeatureConstants from './constants/FeatureConstants';
|
||||
import AppGridStyleConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/AppGridStyleConfig';
|
||||
|
||||
/**
|
||||
* 工作控件网格样式配置类
|
||||
*/
|
||||
export default class PageDesktopGridStyleConfig extends AppGridStyleConfig {
|
||||
/**
|
||||
* 样式配置索引
|
||||
*/
|
||||
private static sFeatureInstance: PageDesktopGridStyleConfig = null;
|
||||
|
||||
/**
|
||||
* margin
|
||||
*/
|
||||
mMargin = PresetStyleConstants.DEFAULT_LAYOUT_MARGIN;
|
||||
|
||||
mDesktopMarginTop = PresetStyleConstants.DEFAULT_ICON_PADDING_TOP;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工作空间样式实例
|
||||
*/
|
||||
static getInstance() {
|
||||
if (PageDesktopGridStyleConfig.sFeatureInstance == null) {
|
||||
PageDesktopGridStyleConfig.sFeatureInstance = new PageDesktopGridStyleConfig();
|
||||
PageDesktopGridStyleConfig.sFeatureInstance.initConfig();
|
||||
}
|
||||
return PageDesktopGridStyleConfig.sFeatureInstance;
|
||||
}
|
||||
|
||||
initConfig(): void {
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_FEATURE;
|
||||
}
|
||||
|
||||
getFeatureName() {
|
||||
return FeatureConstants.FEATURE_NAME;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 BaseModulePreLoader from '../../../../../../../common/src/main/ets/default/base/BaseModulePreLoader';
|
||||
import LayoutConfigManager from '../../../../../../../common/src/main/ets/default/layoutconfig/LayoutConfigManager';
|
||||
import PageDesktopLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/PageDesktopLayoutConfig';
|
||||
import PageDesktopModeConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/PageDesktopModeConfig';
|
||||
import PageDesktopAppModeConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/PageDesktopAppModeConfig';
|
||||
import PageDesktopGridStyleConfig from './PageDesktopGridStyleConfig';
|
||||
|
||||
/**
|
||||
* 公共层初始化加载器
|
||||
*/
|
||||
class PageDesktopPreLoader extends BaseModulePreLoader {
|
||||
protected loadConfig(): void {
|
||||
LayoutConfigManager.addConfigToManager(PageDesktopLayoutConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PageDesktopModeConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PageDesktopAppModeConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PageDesktopGridStyleConfig.getInstance());
|
||||
}
|
||||
|
||||
protected loadData(): void {
|
||||
}
|
||||
|
||||
releaseConfigAndData(): void {
|
||||
LayoutConfigManager.removeConfigFromManager();
|
||||
}
|
||||
}
|
||||
|
||||
const pageDesktopPreLoader: BaseModulePreLoader = new PageDesktopPreLoader();
|
||||
|
||||
export default pageDesktopPreLoader;
|
@ -0,0 +1,223 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 AppBubble from '../../../../../../../../common/src/main/ets/default/uicomponents/AppBubble.ets';
|
||||
import StyleConstants from '../../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import PresetStyleConstants from '../../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
import UninstallDialog from '../../../../../../../../common/src/main/ets/default/uicomponents/UninstallDialog.ets';
|
||||
import PageDesktopDragHandler from '../PageDesktopDragHandler';
|
||||
import FormManagerDialog from '../../../../../../../form/src/main/ets/default/common/uicomponents/FormManagerDialog.ets';
|
||||
import FeatureConstants from '../constants/FeatureConstants';
|
||||
import Trace from '../../../../../../../../common/src/main/ets/default/utils/Trace';
|
||||
import Log from '../../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
|
||||
const APP_INFO_REFRESH_DELAY = 500;
|
||||
const DOUBLE_CLICK_COUNT = 2
|
||||
|
||||
const TAG = "AppItem";
|
||||
|
||||
@Component
|
||||
export default struct AppItem {
|
||||
@StorageLink('uninstallAppInfo') appInfo: any = {};
|
||||
@StorageLink('formAppInfo') formAppInfo: any = {};
|
||||
@StorageLink('selectDesktopAppItem') selectDesktopAppItem: string = '';
|
||||
@State isDraging: boolean = false;
|
||||
@State mAppNameHeight: number = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
|
||||
@State mAppItemWidth: number = StyleConstants.DEFAULT_APP_ITEM_WIDTH;
|
||||
@State mAppNameSize: number = StyleConstants.DEFAULT_APP_NAME_SIZE;
|
||||
@State mNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
|
||||
@State mIconSize: number = StyleConstants.DEFAULT_APP_ICON_SIZE_WIDTH;
|
||||
mIconNameMargin: number = PresetStyleConstants.DEFAULT_ICON_NAME_GAP;
|
||||
private mMargin: number = 0;
|
||||
private mMarginVertical: number = 0;
|
||||
private mGridSpaceWidth : number;
|
||||
private mGridSpaceHeight : number;
|
||||
private isSwappingPage = false;
|
||||
private item: any;
|
||||
private mPageDesktopViewModel;
|
||||
private isPad: boolean = false;
|
||||
private mPageDesktopDragHandler : PageDesktopDragHandler;
|
||||
private mouseClick: number = 0;
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: UninstallDialog({
|
||||
cancel: () => {},
|
||||
confirm: () => {
|
||||
if (this.isPad) {
|
||||
this.mPageDesktopViewModel.deleteAppItem(this.appInfo.bundleName);
|
||||
} else {
|
||||
this.mPageDesktopViewModel.uninstallApp(this.appInfo.bundleName, this.appInfo.isUninstallAble);
|
||||
}
|
||||
},
|
||||
dialogName: this.isPad ? $r('app.string.delete_app') : $r('app.string.uninstall'),
|
||||
dialogContent: this.appInfo.appName + ' ?',
|
||||
}),
|
||||
cancel: this.cancelDialog,
|
||||
autoCancel: true,
|
||||
customStyle: true
|
||||
});
|
||||
|
||||
formManagerDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: FormManagerDialog({
|
||||
cancel: () => {
|
||||
// delete all form
|
||||
},
|
||||
confirm: (formCardItem) => {
|
||||
// add form to desktop
|
||||
Log.showInfo(TAG, "createCardToDeskTop formCardItem: " + JSON.stringify(formCardItem));
|
||||
this.mPageDesktopViewModel.createCardToDeskTop(formCardItem);
|
||||
// delete other form
|
||||
},
|
||||
bundleName: this.formAppInfo.bundleName,
|
||||
appName: this.formAppInfo.appName,
|
||||
appLabelId: this.formAppInfo.appLabelId
|
||||
}),
|
||||
cancel: this.cancelFormDialog,
|
||||
autoCancel: true,
|
||||
customStyle: true
|
||||
});
|
||||
|
||||
cancelFormDialog() {
|
||||
console.info('Launcher form manager cancel dialog');
|
||||
}
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mPageDesktopDragHandler = PageDesktopDragHandler.getInstance();
|
||||
this.isPad = this.mPageDesktopViewModel.getDevice();
|
||||
let styleConfig = this.mPageDesktopViewModel.getPageDesktopStyleConfig();
|
||||
this.mAppNameHeight = styleConfig.mNameHeight;
|
||||
this.mAppItemWidth = styleConfig.mAppWidth;
|
||||
this.mAppNameSize = styleConfig.mNameSize;
|
||||
this.mMargin = styleConfig.mMargin;
|
||||
this.mIconSize = styleConfig.mIconSize;
|
||||
this.mMarginVertical = styleConfig.mIconMarginVertical;
|
||||
this.mIconNameMargin = styleConfig.mIconNameMargin;
|
||||
this.mGridSpaceWidth = Number(this.mPageDesktopViewModel.getWorkSpaceWidth()) - this.mMargin;
|
||||
this.mGridSpaceHeight = Number(this.mPageDesktopViewModel.getWorkSpaceHeight());
|
||||
}
|
||||
|
||||
private mDragStateListener = {
|
||||
onItemDragStart: (event: any, itemIndex: number) => {
|
||||
this.dialogController.close();
|
||||
this.formManagerDialogController.close();
|
||||
this.isDraging = true;
|
||||
},
|
||||
onItemDragMove: (event: any, insertIndex: number, itemIndex: number) => {
|
||||
if (this.isSwappingPage) {
|
||||
return;
|
||||
}
|
||||
let moveX = event.touches[0].screenX;
|
||||
let moveY = event.touches[0].screenY;
|
||||
let curPageIndex = this.mPageDesktopViewModel.getIndex();
|
||||
if ((moveX - this.mIconSize / 2) < this.mMargin && curPageIndex > 0 && moveY < this.mGridSpaceHeight) {
|
||||
this.mPageDesktopViewModel.changeIndex(curPageIndex - 1);
|
||||
this.movingIconSwapPageDelay();
|
||||
} else if ((moveX + this.mIconSize / 2) > this.mGridSpaceWidth && moveY < this.mGridSpaceHeight) {
|
||||
let cachePageIndex = this.mPageDesktopViewModel.getLayoutInfo().layoutDescription.pageCount;
|
||||
if (curPageIndex == cachePageIndex - 1 && !this.mPageDesktopViewModel.isBlankPage()) {
|
||||
this.mPageDesktopViewModel.addBlankPage();
|
||||
} else if(curPageIndex < cachePageIndex - 1){
|
||||
this.mPageDesktopViewModel.changeIndex(curPageIndex + 1);
|
||||
}
|
||||
this.movingIconSwapPageDelay();
|
||||
}
|
||||
},
|
||||
onItemDragEnd: () => {
|
||||
this.isDraging = false;
|
||||
}
|
||||
};
|
||||
|
||||
cancelDialog() {
|
||||
console.info('Launcher Grid Cancel Dialog');
|
||||
}
|
||||
|
||||
movingIconSwapPageDelay() {
|
||||
this.isSwappingPage = true;
|
||||
setTimeout(() => {
|
||||
this.isSwappingPage = false;
|
||||
}, APP_INFO_REFRESH_DELAY);
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Center,
|
||||
justifyContent: FlexAlign.SpaceAround
|
||||
}) {
|
||||
Column() {
|
||||
AppBubble({
|
||||
iconSize: this.mIconSize,
|
||||
nameSize: this.mAppNameSize,
|
||||
nameHeight: this.mAppNameHeight,
|
||||
nameFontColor: this.mPageDesktopViewModel.getPageDesktopStyleConfig().mNameFontColor,
|
||||
appName: this.item.appName,
|
||||
bundleName: this.item.bundleName,
|
||||
appIconId: this.item.appIconId,
|
||||
appLabelId: this.item.appLabelId,
|
||||
badgeNumber: this.item.badgeNumber,
|
||||
isSelect: this.selectDesktopAppItem === this.item.bundleName,
|
||||
menuInfo:this.mPageDesktopViewModel.buildMenuInfoList(this.item, this.dialogController, this.formManagerDialogController),
|
||||
mPaddingTop: this.mMarginVertical,
|
||||
nameLines: this.mNameLines,
|
||||
mIconNameMargin: this.mIconNameMargin
|
||||
})
|
||||
}
|
||||
.visibility(this.isDraging ? Visibility.Hidden : Visibility.Visible)
|
||||
.onMouse((event: MouseEvent) => {
|
||||
if (event.button == MouseButton.Right) {
|
||||
event.stopPropagation();
|
||||
console.info('Launcher AppItem onMouse MouseButton Right');
|
||||
AppStorage.SetOrCreate('selectDesktopAppItem', this.item.bundleName);
|
||||
}
|
||||
})
|
||||
.gesture(
|
||||
GestureGroup(GestureMode.Exclusive,
|
||||
TapGesture()
|
||||
.onAction((event: GestureEvent) => {
|
||||
Log.showInfo(TAG, `tap action ${JSON.stringify(event)}`)
|
||||
if (event.source == SourceType.Mouse) {
|
||||
this.mouseClick++;
|
||||
if (this.mouseClick == DOUBLE_CLICK_COUNT) {
|
||||
Log.showInfo(TAG, 'mouse double click')
|
||||
this.mouseClick = 0;
|
||||
this.launchApp();
|
||||
} else {
|
||||
this.mPageDesktopViewModel.onAppClick(this.item.abilityName, this.item.bundleName);
|
||||
setTimeout(() => {
|
||||
this.mouseClick = 0;
|
||||
}, 300)
|
||||
}
|
||||
} else {
|
||||
Log.showInfo(TAG, 'tap click')
|
||||
this.launchApp();
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
.onTouch((event: TouchEvent) => {
|
||||
AppStorage.SetOrCreate('dragFocus', FeatureConstants.FEATURE_NAME);
|
||||
this.mPageDesktopDragHandler.setDragStateListener(this.mDragStateListener);
|
||||
this.mPageDesktopDragHandler.notifyTouchEventUpdate(event);
|
||||
})
|
||||
}
|
||||
.width(this.mAppItemWidth)
|
||||
.height(this.mAppItemWidth)
|
||||
}
|
||||
|
||||
private launchApp() {
|
||||
Trace.start(Trace.CORE_METHOD_LAUNCH_APP);
|
||||
this.mPageDesktopViewModel.onAppDoubleClick(this.item.abilityName, this.item.bundleName);
|
||||
}
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 FolderComponent from '../../../../../../../../common/src/main/ets/default/uicomponents/FolderComponent.ets'
|
||||
import StyleConstants from '../../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import CommonConstants from '../../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PresetStyleConstants from '../../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
import FolderViewModel from '../../../../../../../bigfolder/src/main/ets/default/viewmodel/FolderViewModel';
|
||||
import BigFolderStyleConfig from '../../../../../../../bigfolder/src/main/ets/default/common/BigFolderStyleConfig';
|
||||
import PageDesktopViewModel from '../../../../../../../pagedesktop/src/main/ets/default/common/viewmodel/PageDesktopViewModel'
|
||||
import PageDesktopDragHandler from '../PageDesktopDragHandler';
|
||||
import Log from '../../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import Trace from '../../../../../../../../common/src/main/ets/default/utils/Trace';
|
||||
import FeatureConstants from '../constants/FeatureConstants';
|
||||
|
||||
const FOLDER_INFO_REFRESH_DELAY = 500;
|
||||
const TAG = 'FolderItem';
|
||||
|
||||
@Component
|
||||
export default struct FolderItem {
|
||||
@State isDraging: boolean = false;
|
||||
@State mAppNameHeight: number = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
|
||||
@State mAppNameSize: number = StyleConstants.DEFAULT_APP_NAME_SIZE;
|
||||
private folderItem: any;
|
||||
private isSwappingPage = false;
|
||||
private mAppItemWidth: number = 0;
|
||||
private mPageDesktopViewModel: PageDesktopViewModel;
|
||||
private mFolderViewModel: FolderViewModel;
|
||||
private mMargin: number = 0;
|
||||
private mGridSpaceWidth: number = 0;
|
||||
private mGridSpaceHeight: number = 0;
|
||||
private mIconMarginVertical: number = StyleConstants.DEFAULT_10;
|
||||
private mPageDesktopDragHandler: PageDesktopDragHandler;
|
||||
private mFolderStyleConfig: BigFolderStyleConfig;
|
||||
mNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mPageDesktopDragHandler = PageDesktopDragHandler.getInstance();
|
||||
this.mFolderViewModel = FolderViewModel.getInstance();
|
||||
this.mFolderStyleConfig = this.mFolderViewModel.getFolderStyleConfig();
|
||||
this.mPageDesktopViewModel = PageDesktopViewModel.getInstance();
|
||||
let mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
let styleConfig = this.mPageDesktopViewModel.getPageDesktopStyleConfig();
|
||||
this.mAppItemWidth = styleConfig.mIconSize;
|
||||
this.mAppNameHeight = styleConfig.mNameHeight;
|
||||
this.mAppNameSize = styleConfig.mNameSize;
|
||||
this.mIconMarginVertical = styleConfig.mIconMarginVertical;
|
||||
this.mMargin = styleConfig.mMargin;
|
||||
this.mGridSpaceWidth = Number(this.mPageDesktopViewModel.getWorkSpaceWidth()) - this.mMargin;
|
||||
this.mGridSpaceHeight = Number(this.mPageDesktopViewModel.getWorkSpaceHeight());
|
||||
}
|
||||
|
||||
private mDragStateListener = {
|
||||
onItemDragStart: (event: any, itemIndex: number) => {
|
||||
this.isDraging = true;
|
||||
},
|
||||
onItemDragMove: (event: any, insertIndex: number, itemIndex: number) => {
|
||||
if (this.isSwappingPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
let moveX = event.touches[0].screenX;
|
||||
let moveY = event.touches[0].screenY;
|
||||
if ((moveX - this.mAppItemWidth / 2) < this.mMargin
|
||||
&& this.mPageDesktopViewModel.getIndex() > 0 && moveY < this.mGridSpaceHeight) {
|
||||
this.mPageDesktopViewModel.changeIndex(this.mPageDesktopViewModel.getIndex() - 1);
|
||||
this.movingFolderSwapPageDelay();
|
||||
} else if ((moveX + this.mAppItemWidth / 2) > this.mGridSpaceWidth && moveY < this.mGridSpaceHeight) {
|
||||
if (this.mPageDesktopViewModel.getIndex() == this.mPageDesktopViewModel.getGridPageCount() - 1
|
||||
&& !this.mPageDesktopViewModel.isBlankPage()) {
|
||||
this.mPageDesktopViewModel.addBlankPage();
|
||||
} else if (this.mPageDesktopViewModel.getIndex() < this.mPageDesktopViewModel.getGridPageCount() - 1) {
|
||||
this.mPageDesktopViewModel.changeIndex(this.mPageDesktopViewModel.getIndex() + 1);
|
||||
}
|
||||
this.movingFolderSwapPageDelay();
|
||||
}
|
||||
},
|
||||
onItemDragEnd: () => {
|
||||
this.isDraging = false;
|
||||
}
|
||||
};
|
||||
|
||||
private renameClick() {
|
||||
console.info("Launcher click menu folder rename ");
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_HIDE);
|
||||
this.mFolderViewModel.openFolder(true, this.folderItem);
|
||||
}
|
||||
|
||||
movingFolderSwapPageDelay() {
|
||||
this.isSwappingPage = true;
|
||||
setTimeout(() => {
|
||||
this.isSwappingPage = false;
|
||||
}, FOLDER_INFO_REFRESH_DELAY);
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({
|
||||
direction: FlexDirection.Column,
|
||||
alignItems: ItemAlign.Center,
|
||||
justifyContent: FlexAlign.SpaceAround
|
||||
}) {
|
||||
Column() {
|
||||
FolderComponent({
|
||||
showFolderName: true,
|
||||
mFolderItem: this.folderItem,
|
||||
badgeNumber: this.folderItem.badgeNumber,
|
||||
folderNameHeight: this.mAppNameHeight,
|
||||
folderNameLines: this.mNameLines,
|
||||
folderNameSize: this.mAppNameSize,
|
||||
folderGridSize:this.mFolderStyleConfig.mGridSize,
|
||||
appIconSize: this.mFolderStyleConfig.mFolderAppSize,
|
||||
gridMargin:this.mFolderStyleConfig.mGridMargin,
|
||||
mPaddingTop: this.mIconMarginVertical,
|
||||
gridGap:this.mFolderStyleConfig.mFolderGridGap,
|
||||
iconNameMargin: this.mFolderStyleConfig.mIconNameMargin,
|
||||
nameFontColor: this.mPageDesktopViewModel.getPageDesktopStyleConfig().mNameFontColor,
|
||||
onAppIconClick: (event, appItem) => {
|
||||
Log.showInfo(TAG, "onAppIconClick");
|
||||
this.mPageDesktopViewModel.openApplication(appItem.abilityName, appItem.bundleName);
|
||||
},
|
||||
onOpenFolderClick: (event, folderItem) => {
|
||||
Log.showInfo(TAG, "onOpenFolderClick");
|
||||
Trace.start(Trace.CORE_METHOD_OPEN_FOLDER);
|
||||
this.mFolderViewModel.openFolder(false, folderItem);
|
||||
},
|
||||
onFolderTouch: (event, folderItem) => {
|
||||
Log.showInfo(TAG, "onFolderTouch");
|
||||
AppStorage.SetOrCreate('dragFocus', FeatureConstants.FEATURE_NAME);
|
||||
this.mPageDesktopDragHandler.setDragStateListener(this.mDragStateListener);
|
||||
this.mPageDesktopDragHandler.notifyTouchEventUpdate(event);
|
||||
},
|
||||
onGetPosition: (getPosition: Function) => {
|
||||
Log.showInfo(TAG, "onGetPosition");
|
||||
let styleConfig = this.mPageDesktopViewModel.getPageDesktopStyleConfig();
|
||||
let row = this.folderItem.row;
|
||||
let column = this.folderItem.column;
|
||||
Log.showInfo(TAG, `onGetPosition currentFolderPosition row: ${row}, column: ${column}`);
|
||||
let x = styleConfig.mAppItemSize * column
|
||||
+ styleConfig.mColumnsGap * column + styleConfig.mMargin + styleConfig.mIconMarginHorizontal;
|
||||
let y = styleConfig.mAppItemSize * row
|
||||
+ styleConfig.mRowsGap * row + styleConfig.mDesktopMarginTop + styleConfig.mIconMarginVertical;
|
||||
Log.showInfo(TAG, `onGetPosition currentFolderPosition x: ${x}, y: ${y}`);
|
||||
getPosition(x, y);
|
||||
},
|
||||
buildMenu: (folderItem) =>
|
||||
this.mPageDesktopViewModel.buildRenameMenuInfoList(folderItem, this.renameClick.bind(this))
|
||||
})
|
||||
}
|
||||
.visibility(this.isDraging ? Visibility.Hidden : Visibility.Visible)
|
||||
}
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 StyleConstants from '../../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import PresetStyleConstants from '../../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
import PageDesktopViewModel from '../../../../../../../pagedesktop/src/main/ets/default/common/viewmodel/PageDesktopViewModel';
|
||||
import FormViewModel from '../../../../../../../form/src/main/ets/default/viewmodel/FormViewModel';
|
||||
import FormStyleConfig from '../../../../../../../form/src/main/ets/default/common/FormStyleConfig';
|
||||
import PageDesktopDragHandler from '../PageDesktopDragHandler';
|
||||
import RemoveFormDialog from '../../../../../../../../common/src/main/ets/default/uicomponents/RemoveFormDialog.ets';
|
||||
import FormManagerDialog from '../../../../../../../form/src/main/ets/default/common/uicomponents/FormManagerDialog.ets';
|
||||
import FormItemComponent from '../../../../../../../../common/src/main/ets/default/uicomponents/FormItemComponent.ets';
|
||||
import Log from '../../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import FeatureConstants from '../constants/FeatureConstants';
|
||||
|
||||
const FORM_INFO_REFRESH_DELAY = 500;
|
||||
const TAG = 'FormItem';
|
||||
|
||||
@Component
|
||||
export default struct FormItem {
|
||||
@StorageLink('isRemoveForm') @Watch('removeFormAnimate') isRemoveForm: boolean = false;
|
||||
@StorageLink('formAnimateData') formAnimateData: {
|
||||
cardId: number,
|
||||
isOpenRemoveFormDialog: boolean,
|
||||
} = { cardId: 0, isOpenRemoveFormDialog: false };
|
||||
@State animateScale: number = 1.0;
|
||||
@State animateOpacity: number = 1.0;
|
||||
@State allowUpdate: boolean = true;
|
||||
@State isShow: boolean = true;
|
||||
private formItem: any = {};
|
||||
private mPageDesktopViewModel: PageDesktopViewModel = PageDesktopViewModel.getInstance();
|
||||
private mFormViewModel: FormViewModel;
|
||||
private mFormStyleConfig: FormStyleConfig;
|
||||
private mPageDesktopDragHandler: PageDesktopDragHandler;
|
||||
@State isDraging: boolean = false;
|
||||
@State mFormNameHeight: number = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
|
||||
@State mAppItemWidth: number = StyleConstants.DEFAULT_APP_ITEM_WIDTH;
|
||||
@State mFormNameSize: number = StyleConstants.DEFAULT_APP_NAME_SIZE;
|
||||
private mIconMarginVertical: number = StyleConstants.DEFAULT_10;
|
||||
private isSwappingPage = false;
|
||||
private mMargin: number = 0;
|
||||
private mGridSpaceWidth: number = 0;
|
||||
private mGridSpaceHeight: number = 0;
|
||||
private mFormItemWidth: number = 0;
|
||||
private mFormItemHeight: number = 0;
|
||||
private mNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mPageDesktopDragHandler = PageDesktopDragHandler.getInstance();
|
||||
this.mFormViewModel = FormViewModel.getInstance();
|
||||
this.mFormStyleConfig = this.mFormViewModel.getFormStyleConfig();
|
||||
let mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
let styleConfig = this.mPageDesktopViewModel.getPageDesktopStyleConfig();
|
||||
this.mFormNameHeight = styleConfig.mNameHeight;
|
||||
this.mAppItemWidth = styleConfig.mIconSize;
|
||||
this.mIconMarginVertical = styleConfig.mIconMarginVertical;
|
||||
this.mMargin = styleConfig.mMargin;
|
||||
this.mNameLines = styleConfig.mNameLines;
|
||||
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());
|
||||
}
|
||||
|
||||
private removeFormAnimate() {
|
||||
Log.showInfo(TAG, `removeFormAnimate start`);
|
||||
if (this.isRemoveForm &&
|
||||
this.formAnimateData.isOpenRemoveFormDialog &&
|
||||
this.formAnimateData.cardId === this.formItem.cardId) {
|
||||
animateTo({
|
||||
duration: 250,
|
||||
tempo: 0.5,
|
||||
curve: '(0.3,0,0.9,1)',
|
||||
delay: 0,
|
||||
iterations: 1,
|
||||
playMode: PlayMode.Normal,
|
||||
onFinish: () => {
|
||||
Log.showInfo(TAG, `showAnimate onFinish`);
|
||||
AppStorage.SetOrCreate('isRemoveForm', false);
|
||||
this.formAnimateData.cardId = 0;
|
||||
this.formAnimateData.isOpenRemoveFormDialog = false;
|
||||
this.mFormViewModel.deleteForm(this.formItem.cardId);
|
||||
this.mPageDesktopViewModel.getGridList();
|
||||
}
|
||||
}, () => {
|
||||
this.animateScale = 0;
|
||||
this.animateOpacity = 0;
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: RemoveFormDialog({
|
||||
cancel: () => {},
|
||||
confirm: () => {
|
||||
// delete form
|
||||
AppStorage.SetOrCreate('isRemoveForm', true);
|
||||
},
|
||||
dialogName: this.mPageDesktopViewModel.getAppName(this.formItem.appLabelId + this.formItem.bundleName),
|
||||
}),
|
||||
cancel: this.cancelDialog,
|
||||
autoCancel: true,
|
||||
customStyle: true
|
||||
});
|
||||
|
||||
cancelDialog() {
|
||||
console.info('Launcher delete form cancel dialog');
|
||||
}
|
||||
|
||||
formManagerDialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: FormManagerDialog({
|
||||
cancel: () => {
|
||||
// delete all form
|
||||
},
|
||||
confirm: (formCardItem) => {
|
||||
// add form to desktop
|
||||
Log.showInfo(TAG, "createCardToDeskTop formCardItem: " + JSON.stringify(formCardItem));
|
||||
this.mPageDesktopViewModel.createCardToDeskTop(formCardItem);
|
||||
// delete other form
|
||||
|
||||
},
|
||||
bundleName: this.formItem.bundleName,
|
||||
appName: this.mPageDesktopViewModel.getAppName(this.formItem.appLabelId + this.formItem.bundleName),
|
||||
appLabelId: this.formItem.appLabelId
|
||||
}),
|
||||
cancel: this.cancelFormDialog,
|
||||
autoCancel: true,
|
||||
customStyle: true
|
||||
});
|
||||
|
||||
cancelFormDialog() {
|
||||
console.info('Launcher form manager cancel dialog');
|
||||
}
|
||||
|
||||
|
||||
private mDragStateListener = {
|
||||
onItemDragStart: (event: any, itemIndex: number) => {
|
||||
this.isDraging = true;
|
||||
},
|
||||
onItemDragMove: (event: any, insertIndex: number, itemIndex: number) => {
|
||||
if (this.isSwappingPage) {
|
||||
return;
|
||||
}
|
||||
|
||||
let moveX = event.touches[0].screenX;
|
||||
let moveY = event.touches[0].screenY;
|
||||
if ((moveX - this.mAppItemWidth / 2) < this.mMargin
|
||||
&& this.mPageDesktopViewModel.getIndex() > 0 && moveY < this.mGridSpaceHeight) {
|
||||
this.mPageDesktopViewModel.changeIndex(this.mPageDesktopViewModel.getIndex() - 1);
|
||||
this.movingFormSwapPageDelay();
|
||||
} else if ((moveX + this.mAppItemWidth / 2) > this.mGridSpaceWidth && moveY < this.mGridSpaceHeight) {
|
||||
if (this.mPageDesktopViewModel.getIndex() == this.mPageDesktopViewModel.getGridPageCount() - 1
|
||||
&& !this.mPageDesktopViewModel.isBlankPage()) {
|
||||
this.mPageDesktopViewModel.addBlankPage();
|
||||
} else if (this.mPageDesktopViewModel.getIndex() < this.mPageDesktopViewModel.getGridPageCount() - 1) {
|
||||
this.mPageDesktopViewModel.changeIndex(this.mPageDesktopViewModel.getIndex() + 1);
|
||||
}
|
||||
this.movingFormSwapPageDelay();
|
||||
}
|
||||
|
||||
},
|
||||
onItemDragEnd: (event: any, insertIndex: number, itemIndex: number) => {
|
||||
this.isDraging = false;
|
||||
}
|
||||
};
|
||||
|
||||
movingFormSwapPageDelay() {
|
||||
this.isSwappingPage = true;
|
||||
setTimeout(() => {
|
||||
this.isSwappingPage = false;
|
||||
}, FORM_INFO_REFRESH_DELAY);
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
|
||||
if (!this.isDraging) {
|
||||
Column() {
|
||||
FormItemComponent({
|
||||
formItemWidth: this.mFormItemWidth,
|
||||
formItemHeight: this.mFormItemHeight,
|
||||
formNameHeight: this.mFormNameHeight,
|
||||
formNameSize: this.mFormNameSize,
|
||||
nameFontColor: this.mPageDesktopViewModel.getPageDesktopStyleConfig().mNameFontColor,
|
||||
formItem: this.formItem,
|
||||
nameLines: this.mNameLines,
|
||||
mPaddingTop: this.mIconMarginVertical,
|
||||
iconNameMargin: this.mPageDesktopViewModel.getPageDesktopStyleConfig().mIconNameMargin,
|
||||
menuInfo: this.mPageDesktopViewModel.buildCardMenuInfoList(this.formItem, this.dialogController, this.formManagerDialogController),
|
||||
clickForm: (event, formItem) => {
|
||||
this.mPageDesktopViewModel.openApplication(this.formItem.abilityName, this.formItem.bundleName);
|
||||
}
|
||||
})
|
||||
}
|
||||
.scale({ x: this.animateScale, y: this.animateScale })
|
||||
.opacity(this.animateOpacity)
|
||||
.onMouse((event: MouseEvent) => {
|
||||
if (event.button == MouseButton.Right) {
|
||||
event.stopPropagation();
|
||||
console.info('Launcher FormItem onMouse MouseButton Right');
|
||||
}
|
||||
})
|
||||
.gesture(
|
||||
GestureGroup(GestureMode.Exclusive,
|
||||
TapGesture({ count: 2 })
|
||||
.onAction((event: GestureEvent) => {
|
||||
console.info('Launcher FormItem TapGesture double click');
|
||||
this.mPageDesktopViewModel.onAppDoubleClick(this.formItem.abilityName, this.formItem.bundleName);
|
||||
})
|
||||
)
|
||||
)
|
||||
.onTouch((event: TouchEvent) => {
|
||||
AppStorage.SetOrCreate('dragFocus', FeatureConstants.FEATURE_NAME);
|
||||
this.mPageDesktopDragHandler.setDragStateListener(this.mDragStateListener);
|
||||
this.mPageDesktopDragHandler.notifyTouchEventUpdate(event);
|
||||
})
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
}
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 StyleConstants from '../../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import SwiperPage from './SwiperPage.ets';
|
||||
|
||||
@Component
|
||||
export default struct GridSwiper {
|
||||
@Prop gridConfig: string;
|
||||
@StorageLink('pageIndex') PageIndex: number = 0;
|
||||
private mPageDesktopViewModel;
|
||||
private mAppGridInfo;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
}
|
||||
|
||||
private aboutToDisappear(): void {
|
||||
console.info("Launcher GridSwiper aboutToDisappear");
|
||||
this.mPageDesktopViewModel.setPageIndex();
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Swiper() {
|
||||
ForEach(this.mAppGridInfo, (item) => {
|
||||
SwiperPage({
|
||||
mAppListInfo: item,
|
||||
gridConfig: this.gridConfig,
|
||||
mPageDesktopViewModel: this.mPageDesktopViewModel
|
||||
})
|
||||
}, (item) => JSON.stringify(item))
|
||||
}
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.indicatorStyle({
|
||||
selectedColor: StyleConstants.DEFAULT_FONT_COLOR
|
||||
})
|
||||
.loop(false)
|
||||
.index(this.PageIndex)
|
||||
.onChange((index) => {
|
||||
this.mPageDesktopViewModel.changeIndexOnly(index);
|
||||
})
|
||||
}
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PresetStyleConstants from '../../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
import AppItem from './AppItem.ets';
|
||||
import FolderItem from './FolderItem.ets';
|
||||
import FormItem from './FormItem.ets';
|
||||
import PageDesktopGridStyleConfig from '../PageDesktopGridStyleConfig';
|
||||
|
||||
@Component
|
||||
export default struct SwiperPage {
|
||||
@StorageLink('workSpaceWidth') workSpaceWidth: number = 0;
|
||||
@State ColumnsTemplate: string = '';
|
||||
@State RowsTemplate: string = ''
|
||||
@Prop @Watch('changeColumnAndRow') gridConfig: string;
|
||||
@State mMargin: number = 0;
|
||||
@State mColumnsGap: number = 0;
|
||||
@State mRowsGap: number = 0;
|
||||
@State mNameLines: number = PresetStyleConstants.DEFAULT_APP_NAME_LINES;
|
||||
@State mMarginTop: number = 0;
|
||||
private mAppListInfo;
|
||||
private mPageDesktopViewModel;
|
||||
private mPageDesktopStyleConfig:PageDesktopGridStyleConfig;
|
||||
private mGridWidth : number;
|
||||
private mGridHeight: number;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mPageDesktopStyleConfig = this.mPageDesktopViewModel.getPageDesktopStyleConfig();
|
||||
this.mMargin = this.mPageDesktopStyleConfig.mMargin;
|
||||
this.mColumnsGap = this.mPageDesktopStyleConfig.mColumnsGap;
|
||||
this.mRowsGap = this.mPageDesktopStyleConfig.mRowsGap;
|
||||
this.mNameLines = this.mPageDesktopStyleConfig.mNameLines;
|
||||
this.mMarginTop = this.mPageDesktopStyleConfig.mDesktopMarginTop;
|
||||
this.mGridWidth = this.mPageDesktopStyleConfig.mGridWidth;
|
||||
this.mGridHeight = this.mPageDesktopStyleConfig.mGridHeight;
|
||||
this.changeConfig();
|
||||
}
|
||||
|
||||
public changeColumnAndRow() {
|
||||
this.changeConfig();
|
||||
}
|
||||
|
||||
public changeConfig() {
|
||||
let mGridConfig = this.mPageDesktopViewModel.getGridConfig();
|
||||
let column = mGridConfig.column;
|
||||
let row = mGridConfig.row;
|
||||
this.ColumnsTemplate = '';
|
||||
this.RowsTemplate = '';
|
||||
for (let i = 0;i < column; i++) {
|
||||
this.ColumnsTemplate += '1fr '
|
||||
}
|
||||
for (let i = 0;i < row; i++) {
|
||||
this.RowsTemplate += '1fr '
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Grid() {
|
||||
ForEach(this.mAppListInfo, (item) => {
|
||||
GridItem() {
|
||||
if (item.type == CommonConstants.TYPE_APP) {
|
||||
AppItem({
|
||||
item: item,
|
||||
mPageDesktopViewModel: this.mPageDesktopViewModel,
|
||||
mNameLines: this.mNameLines
|
||||
})
|
||||
} else if (item.type == CommonConstants.TYPE_FOLDER) {
|
||||
FolderItem({
|
||||
folderItem: item,
|
||||
mNameLines: this.mNameLines
|
||||
})
|
||||
} else {
|
||||
FormItem({
|
||||
formItem: item
|
||||
})
|
||||
}
|
||||
}
|
||||
.rowStart(item.row)
|
||||
.columnStart(item.column)
|
||||
.rowEnd(item.row + item.area[1] - 1)
|
||||
.columnEnd(item.column + item.area[0] - 1)
|
||||
},(item) => JSON.stringify(item))
|
||||
}
|
||||
.columnsTemplate(this.ColumnsTemplate)
|
||||
.rowsTemplate(this.RowsTemplate)
|
||||
.columnsGap(this.mColumnsGap)
|
||||
.rowsGap(this.mRowsGap)
|
||||
.width(this.mGridWidth)
|
||||
.height(this.mGridHeight)
|
||||
.margin({ right: this.mMargin, left: this.mMargin, top : this.mMarginTop})
|
||||
}
|
||||
}
|
@ -13,6 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
public static DEFAULT_BACKGROUND_IMAGE: string = '/common/pics/img_wallpaper_default.jpg'
|
||||
export default class FeatureConstants {
|
||||
static readonly FEATURE_NAME = 'pageDesktop';
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 LocalEventManager from '../../../../../../../../common/src/main/ets/default/manager/LocalEventManager';
|
||||
import EventConstants from '../../../../../../../../common/src/main/ets/default/constants/EventConstants';
|
||||
|
||||
/**
|
||||
* PageDesktop Model
|
||||
*/
|
||||
|
||||
export default class PageDesktopModel {
|
||||
private static sPageDesktopModel: PageDesktopModel = null;
|
||||
|
||||
private constructor() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the pageDesktop data model object.
|
||||
*
|
||||
* @return PageDesktopModel
|
||||
*/
|
||||
static getInstance(): PageDesktopModel {
|
||||
if (PageDesktopModel.sPageDesktopModel == null) {
|
||||
PageDesktopModel.sPageDesktopModel = new PageDesktopModel();
|
||||
}
|
||||
return PageDesktopModel.sPageDesktopModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册PageDesktop应用列表添加事件.
|
||||
*
|
||||
* @param listener 监听对象
|
||||
*/
|
||||
registerPageDesktopItemAddEvent(listener) {
|
||||
LocalEventManager.registerEventListener(listener, [
|
||||
EventConstants.EVENT_REQUEST_PAGEDESK_ITEM_ADD
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* register badge update event.
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
registerPageDesktopBadgeUpdateEvent(listener) {
|
||||
LocalEventManager.registerEventListener(listener, [
|
||||
EventConstants.EVENT_BADGE_UPDATE
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解注册应用列表改变监听.
|
||||
*
|
||||
* @param listener 监听对象
|
||||
*/
|
||||
unregisterEventListener(listener) {
|
||||
LocalEventManager.unregisterEventListener(listener);
|
||||
}
|
||||
|
||||
sendDockItemChangeEvent(appInfo) {
|
||||
LocalEventManager.sendLocalEventSticky(EventConstants.EVENT_REQUEST_DOCK_ITEM_ADD, appInfo);
|
||||
}
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 StyleConstants from '../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PageDesktopViewModel from '../common/viewmodel/PageDesktopViewModel';
|
||||
import PageDesktopDragHandler from '../common/PageDesktopDragHandler';
|
||||
import GridSwiper from '../common/components/GridSwiper.ets';
|
||||
import FeatureConstants from '../common/constants/FeatureConstants';
|
||||
import Trace from '../../../../../../../common/src/main/ets/default/utils/Trace';
|
||||
|
||||
let mPageDesktopViewModel: PageDesktopViewModel = null;
|
||||
|
||||
@Component
|
||||
export default struct PageDesktopLayout {
|
||||
@StorageLink('appListInfo') AppListInfo: {
|
||||
appGridInfo: [[]]
|
||||
} = { appGridInfo: [[]] };
|
||||
@StorageLink('dragLocation') @Watch('onTouchEventUpdate') dragLocation: string = '';
|
||||
@StorageLink('workSpaceWidth') @Watch('updateDeskTopParams') workSpaceWidth: number = 0;
|
||||
@StorageLink('workSpaceHeight') @Watch('updateDeskTopParams') workSpaceHeight: number = 0;
|
||||
@StorageLink('dialogControllerStatus') @Watch('updateDialogControllerStatus') dialogControllerStatus: boolean = false;
|
||||
@State device: string = 'phone';
|
||||
@State @Watch('updateDeskTopParams') mMargin: number = 0;
|
||||
@State mTop: number = 0;
|
||||
@State @Watch('changeGridConfig') gridConfig: string = '';
|
||||
private mPageDesktopDragHandler : PageDesktopDragHandler = null;
|
||||
private isPad: boolean = false;
|
||||
dialogController: CustomDialogController = new CustomDialogController({
|
||||
builder: ShowDialog(),
|
||||
cancel: this.cancelDialog,
|
||||
autoCancel: true,
|
||||
customStyle : true
|
||||
});
|
||||
|
||||
updateDialogControllerStatus() {
|
||||
this.dialogController.close();
|
||||
}
|
||||
|
||||
cancelDialog() {
|
||||
console.info('Launcher Grid Cancel Dialog');
|
||||
}
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mPageDesktopDragHandler = PageDesktopDragHandler.getInstance();
|
||||
mPageDesktopViewModel = PageDesktopViewModel.getInstance();
|
||||
this.gridConfig = mPageDesktopViewModel.getGridConfig().layout;
|
||||
this.updateStyle();
|
||||
mPageDesktopViewModel.getGridList();
|
||||
if (this.device != CommonConstants.PAD_DEVICE_TYPE) {
|
||||
mPageDesktopViewModel.registerAppListChangeCallback();
|
||||
}
|
||||
}
|
||||
|
||||
private updateStyle() {
|
||||
mPageDesktopViewModel.setDevice(this.device);
|
||||
this.isPad = mPageDesktopViewModel.getDevice();
|
||||
console.log("Launcher PageDesktopLayout updateStyle isPad:" + this.isPad);
|
||||
}
|
||||
|
||||
private updateDeskTopParams() {
|
||||
this.mMargin = mPageDesktopViewModel.getPageDesktopStyleConfig().mMargin;
|
||||
this.mTop = mPageDesktopViewModel.getPageDesktopStyleConfig().mDesktopMarginTop;
|
||||
console.log("Launcher PageDesktopLayout updateDeskTopParams mMargin:" + this.mMargin + ", this.mTop: " + this.mTop);
|
||||
if (this.mPageDesktopDragHandler != null) {
|
||||
this.mPageDesktopDragHandler.setDragEffectArea({
|
||||
left: this.mMargin,
|
||||
top: this.mTop,
|
||||
right: this.workSpaceWidth - this.mMargin,
|
||||
bottom: this.workSpaceHeight
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private onTouchEventUpdate() {
|
||||
if (AppStorage.Get('dragFocus') == FeatureConstants.FEATURE_NAME) {
|
||||
this.mPageDesktopDragHandler.onTouchEventUpdate(AppStorage.Get('dragEvent'));
|
||||
}
|
||||
}
|
||||
|
||||
public changeGridConfig() {
|
||||
console.log("Launcher PageDesktopLayout changeGridConfig GridConfig:"+this.gridConfig)
|
||||
this.updateDeskTopParams();
|
||||
mPageDesktopViewModel.getGridList();
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
Column() {
|
||||
GridSwiper({
|
||||
mAppGridInfo: this.AppListInfo.appGridInfo,
|
||||
gridConfig: this.gridConfig,
|
||||
mPageDesktopViewModel: mPageDesktopViewModel
|
||||
})
|
||||
}
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
}
|
||||
.gesture(
|
||||
LongPressGesture({ repeat: false })
|
||||
.onAction((event: GestureEvent) => {
|
||||
mPageDesktopViewModel.onPageLongPress();
|
||||
this.dialogController.open();
|
||||
})
|
||||
)
|
||||
.onMouse((event: MouseEvent) => {
|
||||
if (event.button == MouseButton.Right) {
|
||||
event.stopPropagation();
|
||||
console.info('Launcher PageDesktopLayout onMouse MouseButton Right');
|
||||
mPageDesktopViewModel.onPageLongPress();
|
||||
this.dialogController.open();
|
||||
}
|
||||
})
|
||||
.width(StyleConstants.PERCENTAGE_100)
|
||||
.height(StyleConstants.PERCENTAGE_100)
|
||||
.onClick(() => {
|
||||
AppStorage.SetOrCreate('selectDesktopAppItem', null)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@CustomDialog
|
||||
struct ShowDialog {
|
||||
controller: CustomDialogController;
|
||||
cancel: () => void;
|
||||
action: () => void;
|
||||
@StorageLink('blankPageBtnText') buttonText: string = '';
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Text($r('app.string.launcher_edit'))
|
||||
.fontSize(StyleConstants.DEFAULT_BADGE_FONT_SIZE)
|
||||
.fontColor(StyleConstants.TEXT_COLOR_PRIMARY)
|
||||
.margin({top : StyleConstants.DEFAULT_DIALOG_RADIUS, bottom: StyleConstants.DEFAULT_DIALOG_BOTTOM_MARGIN})
|
||||
|
||||
Flex({justifyContent: FlexAlign.SpaceEvenly}) {
|
||||
Button() {
|
||||
Text($r('app.string.into_settings'))
|
||||
.fontSize(StyleConstants.DEFAULT_BADGE_FONT_SIZE)
|
||||
.fontColor(StyleConstants.BUTTON_FONT_COLOR)
|
||||
}
|
||||
.backgroundColor(StyleConstants.DEFAULT_BG_COLOR)
|
||||
.height(StyleConstants.DEFAULT_BUTTON_HEIGHT)
|
||||
.onClick(() => {
|
||||
Trace.start(Trace.CORE_METHOD_START_SETTINGS);
|
||||
mPageDesktopViewModel.intoSetting();
|
||||
this.controller.close();
|
||||
})
|
||||
|
||||
Divider()
|
||||
.vertical(true)
|
||||
.color(StyleConstants.DEFAULT_DIVIDER_COLOR)
|
||||
.height(StyleConstants.DEFAULT_BUTTON_HEIGHT)
|
||||
|
||||
Button() {
|
||||
Text(this.buttonText)
|
||||
.fontSize(StyleConstants.DEFAULT_BADGE_FONT_SIZE)
|
||||
.fontColor(StyleConstants.BUTTON_FONT_COLOR)
|
||||
}
|
||||
.backgroundColor(StyleConstants.DEFAULT_BG_COLOR)
|
||||
.height(StyleConstants.DEFAULT_BUTTON_HEIGHT)
|
||||
.onClick(() => {
|
||||
mPageDesktopViewModel.addOrDeleteBlankPage();
|
||||
this.controller.close();
|
||||
})
|
||||
}
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.padding({
|
||||
bottom: StyleConstants.DEFAULT_DIALOG_BOTTOM_MARGIN
|
||||
})
|
||||
.border({
|
||||
radius: StyleConstants.DEFAULT_DIALOG_RADIUS
|
||||
})
|
||||
.width(StyleConstants.DEFAULT_DIALOG_WIDTH)
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "layoutmanager_MainAbility",
|
||||
"value": "layoutmanager_MainAbility"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "into_settings",
|
||||
"value": "Launcher settings"
|
||||
},
|
||||
{
|
||||
"name": "add_blank_page",
|
||||
"value": "Add Blank Page"
|
||||
},
|
||||
{
|
||||
"name": "delete_blank_page",
|
||||
"value": "Delete Blank Page"
|
||||
},
|
||||
{
|
||||
"name": "uninstall",
|
||||
"value": "Uninstall"
|
||||
},
|
||||
{
|
||||
"name": "submit",
|
||||
"value": "Submit"
|
||||
},
|
||||
{
|
||||
"name": "cancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "launcher_edit",
|
||||
"value": "Launcher Edit"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "Rename"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "Delete application"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "add service widget to desktop"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "edit service widget"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "add service widget to desktop more"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "layoutmanager_MainAbility",
|
||||
"value": "layoutmanager_MainAbility"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "into_settings",
|
||||
"value": "Launcher settings"
|
||||
},
|
||||
{
|
||||
"name": "add_blank_page",
|
||||
"value": "Add Blank Page"
|
||||
},
|
||||
{
|
||||
"name": "delete_blank_page",
|
||||
"value": "Delete Blank Page"
|
||||
},
|
||||
{
|
||||
"name": "uninstall",
|
||||
"value": "Uninstall"
|
||||
},
|
||||
{
|
||||
"name": "submit",
|
||||
"value": "Submit"
|
||||
},
|
||||
{
|
||||
"name": "cancel",
|
||||
"value": "Cancel"
|
||||
},
|
||||
{
|
||||
"name": "launcher_edit",
|
||||
"value": "Launcher Edit"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "Rename"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "Delete application"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "add service widget to desktop"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "edit service widget"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "add service widget to desktop more"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "layoutmanager_MainAbility",
|
||||
"value": "layoutmanager_MainAbility"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "into_settings",
|
||||
"value": "桌面设置"
|
||||
},
|
||||
{
|
||||
"name": "add_blank_page",
|
||||
"value": "添加空白页"
|
||||
},
|
||||
{
|
||||
"name": "delete_blank_page",
|
||||
"value": "删除空白页"
|
||||
},
|
||||
{
|
||||
"name": "uninstall",
|
||||
"value": "卸载"
|
||||
},
|
||||
{
|
||||
"name": "submit",
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "cancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "launcher_edit",
|
||||
"value": "桌面编辑"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "重命名"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "移除"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "服务卡片"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "编辑"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "添加到桌面"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "更多服务卡片"
|
||||
}
|
||||
]
|
||||
}
|
20
product/pad/build.gradle
Normal file
@ -0,0 +1,20 @@
|
||||
apply plugin: 'com.huawei.ohos.hap'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion 8
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 8
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
proguardEnabled false
|
||||
rulesFiles 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
}
|
116
product/pad/src/main/config.json
Normal file
@ -0,0 +1,116 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.ohos.launcher",
|
||||
"vendor": "ohos",
|
||||
"version": {
|
||||
"code": 1000000,
|
||||
"name": "1.0.0"
|
||||
}
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"srcPath": "",
|
||||
"package": "com.ohos.launcher",
|
||||
"name": ".MyApplication",
|
||||
"mainAbility": ".MainAbility",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
"distro": {
|
||||
"deliveryWithInstall": true,
|
||||
"moduleName": "pad",
|
||||
"moduleType": "entry",
|
||||
"installationFree": true
|
||||
},
|
||||
"abilities": [
|
||||
{
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home",
|
||||
"flag.home.intent.from.system"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home",
|
||||
"com.ohos.action.main"
|
||||
]
|
||||
}
|
||||
],
|
||||
"visible": false,
|
||||
"name": ".MainAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:entry_MainAbility",
|
||||
"type": "service",
|
||||
"launchType": "singleton",
|
||||
"srcPath": "MainAbility",
|
||||
"srcLanguage": "ets",
|
||||
"metaData": {
|
||||
"customizeData": [
|
||||
{
|
||||
"name": "hwc-theme"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"visible": false,
|
||||
"srcPath": "CalleeAbility",
|
||||
"name": ".CalleeAbility",
|
||||
"srcLanguage": "ets",
|
||||
"description": "$string:calleeability_description",
|
||||
"label": "$string:entry_CalleeAbility",
|
||||
"type": "page",
|
||||
"launchType": "standard"
|
||||
}
|
||||
],
|
||||
"js": [
|
||||
{
|
||||
"mode": {
|
||||
"syntax": "ets",
|
||||
"type": "pageAbility"
|
||||
},
|
||||
"pages": [
|
||||
"pages/EntryView",
|
||||
"pages/RecentView"
|
||||
],
|
||||
"name": ".MainAbility",
|
||||
"window": {
|
||||
"designWidth": 1280,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"mode": {
|
||||
"syntax": "ets",
|
||||
"type": "pageAbility"
|
||||
},
|
||||
"pages": [
|
||||
"pages/EmptyPage"
|
||||
],
|
||||
"name": ".CalleeAbility",
|
||||
"window": {
|
||||
"designWidth": 1280,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"reqPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.INSTALL_BUNDLE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_MISSIONS"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.REQUIRE_FORM"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -13,24 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import BaseStage from '../../../../../../../common/src/main/ets/default/base/BaseStage.ets';
|
||||
import layoutManagerPreLoader from '../../../../../../../feature/layoutmanager/src/main/ets/default/common/LayoutManagerPreLoader.ets';
|
||||
import AbilityStage from '@ohos.application.AbilityStage';
|
||||
|
||||
/**
|
||||
* phone产品形态Stage
|
||||
*/
|
||||
export default class PhoneStage extends BaseStage {
|
||||
/**
|
||||
* Stage启动时的回调
|
||||
*/
|
||||
public onCreate(): void {
|
||||
layoutManagerPreLoader.load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage退出时的回调
|
||||
*/
|
||||
public onDestroy(): void {
|
||||
layoutManagerPreLoader.releaseConfigAndData();
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate(): void {
|
||||
console.log('MyAbilityStage onCreate is called');
|
||||
}
|
||||
}
|
43
product/pad/src/main/ets/CalleeAbility/CalleeAbility.ts
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 Ability from '@ohos.application.Ability'
|
||||
|
||||
export default class CalleeAbility extends Ability {
|
||||
onCreate(want, launchParam) {
|
||||
console.log(`CalleeAbility onCreate is called ${want} and ${launchParam}`)
|
||||
globalThis.callee = this.callee;
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
console.log("CalleeAbility onDestroy is called")
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage) {
|
||||
console.log("CalleeAbility onWindowStageCreate is called")
|
||||
globalThis.CalleeAbilityContext = this.context
|
||||
}
|
||||
|
||||
onWindowStageDestroy() {
|
||||
console.log("CalleeAbility onWindowStageDestroy is called")
|
||||
}
|
||||
|
||||
onForeground() {
|
||||
console.log("CalleeAbility onForeground is called")
|
||||
}
|
||||
|
||||
onBackground() {
|
||||
console.log("CalleeAbility onBackground is called")
|
||||
}
|
||||
}
|
23
product/pad/src/main/ets/CalleeAbility/app.ets
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('CalleAbility Application onCreate')
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('CalleAbility Application onDestroy')
|
||||
},
|
||||
}
|
42
product/pad/src/main/ets/CalleeAbility/pages/EmptyPage.ets
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 AppBadgeMessage from '../../../../../../../common/src/main/ets/default/bean/AppBadgeMessage';
|
||||
import BadgeManager from '../../../../../../../common/src/main/ets/default/manager/BadgeManager';
|
||||
import CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import RdbStoreManager from '../../../../../../../common/src/main/ets/default/manager/RdbStoreManager';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct EmptyPage {
|
||||
|
||||
private aboutToAppear(): void {
|
||||
console.log('Launcher CalleeAbility aboutToAppear');
|
||||
let dbStore = RdbStoreManager.getInstance();
|
||||
dbStore.initRdbConfig();
|
||||
globalThis.callee.on(BadgeManager.UPDATE_BADGE, this.updateBadge);
|
||||
}
|
||||
|
||||
private updateBadge(badgeData) {
|
||||
console.log('Launcher CalleeAbility updateBadge is called');
|
||||
let badgeMsg = new AppBadgeMessage(CommonConstants.INVALID_VALUE, '');
|
||||
badgeData.readSequenceable(badgeMsg);
|
||||
console.log(`updateBadge is called, badgeMsg.badge:${badgeMsg.badge}, badgeMsg.bundleName:${badgeMsg.bundleName}`);
|
||||
BadgeManager.getInstance().updateBadgeNumber(badgeMsg.bundleName, badgeMsg.badge);
|
||||
return new AppBadgeMessage(0, "update badge success");
|
||||
}
|
||||
|
||||
build() {
|
||||
}
|
||||
}
|
61
product/pad/src/main/ets/MainAbility/MainAbility.ts
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility';
|
||||
import display from '@ohos.display';
|
||||
import Want from '@ohos.application.Want';
|
||||
import windowManager from '../../../../../../common/src/main/ets/default/manager/WindowManager';
|
||||
import Log from '../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import GestureNavigationManage from '../../../../../../feature/gesturenavigation/src/main/ets/default/common/GestureNavigationManage';
|
||||
|
||||
const TAG = 'LauncherMainAbility';
|
||||
|
||||
export default class MainAbility extends ServiceExtension {
|
||||
onCreate(want: Want): void {
|
||||
Log.showInfo(TAG,'onCreate start');
|
||||
this.initGlobalConst();
|
||||
windowManager.createWindow(this.context, windowManager.DESKTOP_WINDOW_NAME, 2001, 'pages/EntryView');
|
||||
}
|
||||
|
||||
private initGlobalConst(): void {
|
||||
globalThis.desktopContext = this.context;
|
||||
globalThis.createRecentWindow = (() => {
|
||||
Log.showInfo(TAG, 'createRecentWindow Begin');
|
||||
windowManager.createWindowIfAbsent(this.context, windowManager.RECENT_WINDOW_NAME, 2115, 'pages/RecentView');
|
||||
});
|
||||
this.startGestureNavigation();
|
||||
}
|
||||
|
||||
private startGestureNavigation(): void {
|
||||
const gestureNavigationManage = GestureNavigationManage.getInstance();
|
||||
display.getDefaultDisplay()
|
||||
.then((dis: { id: number, width: number, height: number, refreshRate: number }) => {
|
||||
Log.showInfo(TAG, `startGestureNavigation display: ${JSON.stringify(dis)}`);
|
||||
gestureNavigationManage.initWindowSize(dis);
|
||||
});
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
windowManager.destroyWindow(windowManager.DESKTOP_WINDOW_NAME);
|
||||
windowManager.destroyWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
Log.showInfo(TAG, 'onDestroy success');
|
||||
}
|
||||
|
||||
onRequest(want: Want, startId: number): void {
|
||||
Log.showInfo(TAG,`onRequest, want: ${want.abilityName}`);
|
||||
windowManager.minimizeAllApps();
|
||||
windowManager.hideWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
}
|
||||
}
|
23
product/pad/src/main/ets/MainAbility/app.ets
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('Application onDestroy')
|
||||
},
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import padFolderLayoutInfo from './configs/PadFolderLayoutInfo';
|
||||
import FolderLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/FolderLayoutConfig';
|
||||
|
||||
/**
|
||||
* Pad Folder layout configuration
|
||||
*/
|
||||
export default class PadFolderLayoutConfig extends FolderLayoutConfig {
|
||||
|
||||
private static sProductInstance: PadFolderLayoutConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
this.mFolderLayoutInfo = padFolderLayoutInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get folder layout configuration instance
|
||||
*/
|
||||
static getInstance(): PadFolderLayoutConfig {
|
||||
if (PadFolderLayoutConfig.sProductInstance == undefined) {
|
||||
PadFolderLayoutConfig.sProductInstance = new PadFolderLayoutConfig();
|
||||
PadFolderLayoutConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PadFolderLayoutConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import padFormLayoutInfo from './configs/PadFormLayoutInfo';
|
||||
import FormLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/FormLayoutConfig';
|
||||
|
||||
/**
|
||||
* Pad form layout configuration
|
||||
*/
|
||||
export default class PadFormLayoutConfig extends FormLayoutConfig {
|
||||
|
||||
private static sProductInstance: PadFormLayoutConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
this.mFormLayoutInfo = padFormLayoutInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get form layout configuration instance
|
||||
*/
|
||||
static getInstance(): PadFormLayoutConfig {
|
||||
if (PadFormLayoutConfig.sProductInstance == undefined) {
|
||||
PadFormLayoutConfig.sProductInstance = new PadFormLayoutConfig();
|
||||
PadFormLayoutConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PadFormLayoutConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,216 @@
|
||||
/*
|
||||
* Copyright (c) 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PadPresetStyleConstants from './constants/PadPresentConstants';
|
||||
import PresetStyleConstants from '../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
import LauncherLayoutStyleConfig from '../../../../../../../feature/launcherlayout/src/main/ets/default/common/LauncherLayoutStyleConfig';
|
||||
|
||||
/**
|
||||
* Pad launcher config
|
||||
*/
|
||||
export default class PadLauncherLayoutStyleConfig extends LauncherLayoutStyleConfig {
|
||||
|
||||
mSystemUIHeight = PresetStyleConstants.DEFAULT_PAD_SYSTEM_UI;
|
||||
|
||||
mIndicatorHeight = PresetStyleConstants.DEFAULT_PAD_INDICATOR_HEIGHT;
|
||||
/**
|
||||
* desktop item Size
|
||||
*/
|
||||
mAppItemSize = PadPresetStyleConstants.DEFAULT_APP_LAYOUT_SIZE;
|
||||
|
||||
/**
|
||||
* desktop space margin
|
||||
*/
|
||||
mMargin = PadPresetStyleConstants.DEFAULT_LAYOUT_MARGIN;
|
||||
|
||||
/**
|
||||
* desktop grid gap
|
||||
*/
|
||||
mGridGutter = PadPresetStyleConstants.DEFAULT_APP_LAYOUT_MIN_GUTTER;
|
||||
|
||||
/**
|
||||
* icon name lines
|
||||
*/
|
||||
mNameLines: number = PadPresetStyleConstants.DEFAULT_APP_NAME_LINES;
|
||||
/**
|
||||
* icon ratio
|
||||
*/
|
||||
mIconRatio: number = PadPresetStyleConstants.DEFAULT_APP_TOP_RATIO;
|
||||
|
||||
/**
|
||||
* icon name margin
|
||||
*/
|
||||
mIconNameGap: number = PadPresetStyleConstants.DEFAULT_ICON_NAME_GAP;
|
||||
|
||||
/**
|
||||
* icon name text size
|
||||
*/
|
||||
mNameSize: number = PadPresetStyleConstants.DEFAULT_APP_NAME_TEXT_SIZE;
|
||||
|
||||
/**
|
||||
* name height
|
||||
*/
|
||||
mNameHeight: number = PadPresetStyleConstants.DEFAULT_DESKTOP_NAME_HEIGHT;
|
||||
//folder
|
||||
/**
|
||||
* ratio of gutter with folder
|
||||
*/
|
||||
mFolderGutterRatio: number = PadPresetStyleConstants.DEFAULT_FOLDER_GUTTER_RATIO;
|
||||
|
||||
/**
|
||||
* ratio of margin with folder
|
||||
*/
|
||||
mFolderMarginRatio: number = PadPresetStyleConstants.DEFAULT_FOLDER_PADDING_RATIO;
|
||||
|
||||
/**
|
||||
* gutter of open folder
|
||||
*/
|
||||
mFolderOpenGutter: number = PadPresetStyleConstants.DEFAULT_OPEN_FOLDER_GUTTER;
|
||||
|
||||
/**
|
||||
* padding of open folder
|
||||
*/
|
||||
mFolderOpenPADDING: number = PadPresetStyleConstants.DEFAULT_OPEN_FOLDER_PADDING;
|
||||
|
||||
/**
|
||||
* margin of open folder
|
||||
*/
|
||||
mFolderOpenMargin: number = PadPresetStyleConstants.DEFAULT_OPEN_FOLDER_MARGIN_TOP;
|
||||
|
||||
/**
|
||||
* gutter of add app
|
||||
*/
|
||||
mFolderAddGridGap: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_GAP;
|
||||
|
||||
/**
|
||||
* margin of add app and padding of add app
|
||||
*/
|
||||
mFolderAddGridMargin: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_MARGIN;
|
||||
|
||||
/**
|
||||
* max height of add app
|
||||
*/
|
||||
mFolderAddMaxHeight: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_MAX_HEIGHT;
|
||||
|
||||
/**
|
||||
* toggle size of add app
|
||||
*/
|
||||
mFolderToggleSize: number = PadPresetStyleConstants.DEFAULT_APP_GRID_TOGGLE_SIZE;
|
||||
|
||||
/**
|
||||
* name lines of add app
|
||||
*/
|
||||
mFolderAddTextLines: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_TEXT_LINES;
|
||||
|
||||
/**
|
||||
* text size of add app
|
||||
*/
|
||||
mFolderAddTextSize: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_GRID_TEXT_SIZE;
|
||||
|
||||
/**
|
||||
* title size of add app
|
||||
*/
|
||||
mFolderAddTitleSize: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_TITLE_TEXT_SIZE;
|
||||
|
||||
/**
|
||||
* ratio of padding top with icon in add app
|
||||
*/
|
||||
mFolderAddICONRATIO: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_ICON_TOP_RATIO;
|
||||
|
||||
/**
|
||||
* button size of add app
|
||||
*/
|
||||
mFolderAddButtonSize: number = PadPresetStyleConstants.DEFAULT_FOLDER_ADD_BUTTON_SIZE;
|
||||
|
||||
//App Center
|
||||
/**
|
||||
* margin of app center
|
||||
*/
|
||||
mAppCenterMargin: number = PadPresetStyleConstants.DEFAULT_APP_CENTER_MARGIN;
|
||||
|
||||
/**
|
||||
* gutter of app center
|
||||
*/
|
||||
mAppCenterGutter: number = PadPresetStyleConstants.DEFAULT_APP_CENTER_GUTTER;
|
||||
|
||||
/**
|
||||
* size of app center container
|
||||
*/
|
||||
mAppCenterSize: number = PadPresetStyleConstants.DEFAULT_APP_CENTER_SIZE;
|
||||
|
||||
/**
|
||||
* ratio of padding top with icon in app center
|
||||
*/
|
||||
mAppCenterRatio: number = PadPresetStyleConstants.DEFAULT_APP_CENTER_TOP_RATIO;
|
||||
|
||||
/**
|
||||
* name lines of app center
|
||||
*/
|
||||
mAppCenterNameLines: number = PadPresetStyleConstants.DEFAULT_APP_CENTER_NAME_LINES;
|
||||
|
||||
/**
|
||||
* name size of app center
|
||||
*/
|
||||
mAppCenterNameSize: number = PadPresetStyleConstants.DEFAULT_APP_CENTER_NAME_TEXT_SIZE;
|
||||
|
||||
//dock
|
||||
/**
|
||||
* padding of dock
|
||||
*/
|
||||
mDockPadding: number = PadPresetStyleConstants.DEFAULT_DOCK_PADDING;
|
||||
|
||||
/**
|
||||
* icon size of dock
|
||||
*/
|
||||
mDockIconSize: number = PadPresetStyleConstants.DEFAULT_DOCK_ICON_SIZE;
|
||||
|
||||
/**
|
||||
* gap of icon and icon
|
||||
*/
|
||||
mDockItemGap: number = PadPresetStyleConstants.DEFAULT_DOCK_ITEM_GAP;
|
||||
|
||||
/**
|
||||
* gap of dock and dock
|
||||
*/
|
||||
mDockGutter: number = PadPresetStyleConstants.DEFAULT_DOCK_GUTTER;
|
||||
|
||||
/**
|
||||
* save margin of dock
|
||||
*/
|
||||
mDockSaveMargin: number = PadPresetStyleConstants.DEFAULT_DOCK_SAVE_MARGIN;
|
||||
|
||||
/**
|
||||
* margin bottom of dock
|
||||
*/
|
||||
mDockMarginBottom: number = PadPresetStyleConstants.DEFAULT_DOCK_MARGIN_BOTTOM;
|
||||
|
||||
private constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* PadLauncherLayoutStyleConfig of instance
|
||||
*/
|
||||
static getInstance(): PadLauncherLayoutStyleConfig {
|
||||
if (globalThis.PadLauncherLayoutStyleConfigInstance == null) {
|
||||
globalThis.PadLauncherLayoutStyleConfigInstance = new PadLauncherLayoutStyleConfig();
|
||||
}
|
||||
return globalThis.PadLauncherLayoutStyleConfigInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import StyleConstants from './constants/StyleConstants';
|
||||
import PageDesktopGridStyleConfig from '../../../../../../../feature/pagedesktop/src/main/ets/default/common/PageDesktopGridStyleConfig';
|
||||
|
||||
/**
|
||||
* Pad定制网格样式配置类
|
||||
*/
|
||||
export default class PadPageDesktopGridStyleConfig extends PageDesktopGridStyleConfig {
|
||||
/**
|
||||
* 样式配置索引
|
||||
*/
|
||||
private static sProductInstance: PadPageDesktopGridStyleConfig | undefined;
|
||||
|
||||
/**
|
||||
* 图标大小
|
||||
*/
|
||||
mIconSize = StyleConstants.DEFAULT_APP_ICON_SIZE_WIDTH;
|
||||
|
||||
/**
|
||||
* 名称大小
|
||||
*/
|
||||
mNameSize = StyleConstants.DEFAULT_APP_NAME_SIZE;
|
||||
|
||||
/**
|
||||
* margin
|
||||
*/
|
||||
mMargin = StyleConstants.DEFAULT_MARGIN_SIZE;
|
||||
|
||||
/**
|
||||
* 名称高度
|
||||
*/
|
||||
mNameHeight = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工作空间样式实例
|
||||
*/
|
||||
static getInstance(): PadPageDesktopGridStyleConfig {
|
||||
if (PadPageDesktopGridStyleConfig.sProductInstance == undefined) {
|
||||
PadPageDesktopGridStyleConfig.sProductInstance = new PadPageDesktopGridStyleConfig();
|
||||
PadPageDesktopGridStyleConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PadPageDesktopGridStyleConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import SmartDockLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/SmartDockLayoutConfig';
|
||||
import presetDockItem from './PresetDockItem';
|
||||
|
||||
/**
|
||||
* 桌面Dock功能布局配置
|
||||
*/
|
||||
export default class PadSmartDockLayoutConfig extends SmartDockLayoutConfig {
|
||||
private static sProductInstance: PadSmartDockLayoutConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
this.mDockLayoutInfo = presetDockItem;
|
||||
}
|
||||
|
||||
static getInstance(): PadSmartDockLayoutConfig {
|
||||
if (PadSmartDockLayoutConfig.sProductInstance == undefined) {
|
||||
PadSmartDockLayoutConfig.sProductInstance = new PadSmartDockLayoutConfig();
|
||||
PadSmartDockLayoutConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PadSmartDockLayoutConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
65
product/pad/src/main/ets/MainAbility/common/PadStage.ts
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 BaseStage from '../../../../../../../common/src/main/ets/default/base/BaseStage';
|
||||
import LayoutConfigManager from '../../../../../../../common/src/main/ets/default/layoutconfig/LayoutConfigManager';
|
||||
import smartDockPreLoader from '../../../../../../../feature/smartdock/src/main/ets/default/common/SmartDockPreLoader';
|
||||
import appCenterPreLoader from '../../../../../../../feature/appcenter/src/main/ets/default/common/AppCenterPreLoader';
|
||||
import bigFolderPreLoader from '../../../../../../../feature/bigfolder/src/main/ets/default/common/BigFolderPreLoader';
|
||||
import pageDesktopPreLoader from '../../../../../../../feature/pagedesktop/src/main/ets/default/common/PageDesktopPreLoader';
|
||||
import PadSmartDockLayoutConfig from './PadSmartDockLayoutConfig';
|
||||
import PadPageDesktopGridStyleConfig from './PadPageDesktopGridStyleConfig';
|
||||
import PadFolderLayoutConfig from './PadFolderLayoutConfig';
|
||||
import launcherLayoutPreLoader from '../../../../../../../feature/launcherlayout/src/main/ets/default/common/LauncherLayoutPreLoader';
|
||||
import formPreLoader from '../../../../../../../feature/form/src/main/ets/default/common/FormPreLoader';
|
||||
import PadLauncherLayoutConfig from './PadLauncherLayoutStyleConfig';
|
||||
|
||||
/**
|
||||
* pad产品形态Stage
|
||||
*/
|
||||
export default class PadStage extends BaseStage {
|
||||
/**
|
||||
* Stage启动时的回调
|
||||
*/
|
||||
onCreate(): void {
|
||||
smartDockPreLoader.load();
|
||||
appCenterPreLoader.load();
|
||||
pageDesktopPreLoader.load();
|
||||
bigFolderPreLoader.load();
|
||||
formPreLoader.load();
|
||||
launcherLayoutPreLoader.load();
|
||||
this.initPadConfig();
|
||||
}
|
||||
|
||||
private initPadConfig(): void {
|
||||
LayoutConfigManager.addConfigToManager(PadSmartDockLayoutConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PadPageDesktopGridStyleConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PadFolderLayoutConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PadFolderLayoutConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PadLauncherLayoutConfig.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage退出时回调
|
||||
*/
|
||||
onDestroy(): void {
|
||||
smartDockPreLoader.releaseConfigAndData();
|
||||
appCenterPreLoader.releaseConfigAndData();
|
||||
pageDesktopPreLoader.releaseConfigAndData();
|
||||
bigFolderPreLoader.releaseConfigAndData();
|
||||
launcherLayoutPreLoader.releaseConfigAndData();
|
||||
formPreLoader.releaseConfigAndData();
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
|
||||
const presetDockItem = [
|
||||
{
|
||||
itemType: CommonConstants.TYPE_FUNCTION,
|
||||
iconId: $r('app.media.ic_allapps'),
|
||||
labelId: $r('app.string.dock_all_app_entry'),
|
||||
bundleName: CommonConstants.LAUNCHER_BUNDLE,
|
||||
abilityName: CommonConstants.APPCENTER_ABILITY,
|
||||
editable: false
|
||||
},
|
||||
{
|
||||
itemType: CommonConstants.TYPE_FUNCTION,
|
||||
iconId: $r('app.media.ic_multitask'),
|
||||
labelId: $r('app.string.dock_recents_entry'),
|
||||
bundleName: CommonConstants.LAUNCHER_BUNDLE,
|
||||
abilityName: CommonConstants.RECENT_ABILITY,
|
||||
editable: false
|
||||
},
|
||||
{
|
||||
itemType: CommonConstants.TYPE_APP,
|
||||
bundleName: 'com.ohos.photos',
|
||||
abilityName: 'com.ohos.photos.MainAbility',
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
itemType: CommonConstants.TYPE_APP,
|
||||
bundleName: 'com.ohos.settings',
|
||||
abilityName: 'com.ohos.settings.MainAbility',
|
||||
editable: false
|
||||
}
|
||||
];
|
||||
|
||||
export default presetDockItem;
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
const padFolderLayoutInfo = {
|
||||
folderLayoutTable:
|
||||
{
|
||||
id: 0,
|
||||
layout: '3X3',
|
||||
name: '3X3',
|
||||
row: 3,
|
||||
column: 3,
|
||||
area: [2, 2],
|
||||
checked: false
|
||||
},
|
||||
folderOpenLayoutTable:
|
||||
{
|
||||
id: 1,
|
||||
layout: '4X4',
|
||||
name: '4X4',
|
||||
row: 4,
|
||||
column: 4,
|
||||
checked: false
|
||||
},
|
||||
folderAddAppLayoutTable:
|
||||
{
|
||||
id: 2,
|
||||
layout: '6X4',
|
||||
name: '6X4',
|
||||
row: 6,
|
||||
column: 4,
|
||||
checked: false
|
||||
}
|
||||
};
|
||||
|
||||
export default padFolderLayoutInfo;
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
const padFormLayoutInfo = {
|
||||
formLayoutDimension1X2:
|
||||
{
|
||||
id: 0,
|
||||
layout: '1X2',
|
||||
name: '1X2',
|
||||
row: 1,
|
||||
column: 2,
|
||||
area: [1, 2],
|
||||
checked: false
|
||||
},
|
||||
formLayoutDimension2X2:
|
||||
{
|
||||
id: 1,
|
||||
layout: '2X2',
|
||||
name: '2X2',
|
||||
row: 2,
|
||||
column: 2,
|
||||
checked: false
|
||||
},
|
||||
formLayoutDimension2X4:
|
||||
{
|
||||
id: 2,
|
||||
layout: '2X4',
|
||||
name: '2X4',
|
||||
row: 2,
|
||||
column: 4,
|
||||
checked: false
|
||||
},
|
||||
formLayoutDimension4X4:
|
||||
{
|
||||
id: 3,
|
||||
layout: '4X4',
|
||||
name: '4X4',
|
||||
row: 4,
|
||||
column: 4,
|
||||
checked: false
|
||||
}
|
||||
};
|
||||
|
||||
export default padFormLayoutInfo;
|
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
export default class PadPresetStyleConstants {
|
||||
//----------- desktop layout-------------
|
||||
/**
|
||||
* desktop item size
|
||||
*/
|
||||
static readonly DEFAULT_APP_LAYOUT_SIZE = 96;
|
||||
/**
|
||||
* desktop container margin
|
||||
*/
|
||||
static readonly DEFAULT_LAYOUT_MARGIN = 82;
|
||||
/**
|
||||
* desktop container minimum gutter
|
||||
*/
|
||||
static readonly DEFAULT_APP_LAYOUT_MIN_GUTTER = 6;
|
||||
//----------- desktop icon-------------
|
||||
/**
|
||||
* desktop item padding top
|
||||
*/
|
||||
static readonly DEFAULT_APP_TOP_RATIO = 0.01;
|
||||
/**
|
||||
* desktop item name lines
|
||||
*/
|
||||
static readonly DEFAULT_APP_NAME_LINES = 2;
|
||||
/**
|
||||
* desktop item name size
|
||||
*/
|
||||
static readonly DEFAULT_APP_NAME_TEXT_SIZE = 14;
|
||||
/**
|
||||
* desktop item icon and name gap
|
||||
*/
|
||||
static readonly DEFAULT_ICON_NAME_GAP = 4;
|
||||
/**
|
||||
* desktop icon name height
|
||||
*/
|
||||
static readonly DEFAULT_DESKTOP_NAME_HEIGHT = 36;
|
||||
//----------- desktop folder-----------
|
||||
/**
|
||||
* folder gutter with container size
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_GUTTER_RATIO = 0.038;
|
||||
/**
|
||||
* folder padding with container size
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_PADDING_RATIO = 0.077;
|
||||
//----------- desktop open --------------
|
||||
/**
|
||||
* gutter of open folder
|
||||
*/
|
||||
static readonly DEFAULT_OPEN_FOLDER_GUTTER = 12;
|
||||
/**
|
||||
* padding of open folder
|
||||
*/
|
||||
static readonly DEFAULT_OPEN_FOLDER_PADDING = 12;
|
||||
/**
|
||||
* margin top of open folder
|
||||
*/
|
||||
static readonly DEFAULT_OPEN_FOLDER_MARGIN_TOP = 166;
|
||||
//----------- folder add list ------------------
|
||||
/**
|
||||
* max height of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_MAX_HEIGHT = 0.8;
|
||||
/**
|
||||
* margin of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_MARGIN = 12;
|
||||
/**
|
||||
* gutter of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_GAP = 24;
|
||||
/**
|
||||
* toggle of item
|
||||
*/
|
||||
static readonly DEFAULT_APP_GRID_TOGGLE_SIZE = 20;
|
||||
/**
|
||||
* icon padding of item with item size
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_ICON_TOP_RATIO = 0.075;
|
||||
/**
|
||||
* name size of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_GRID_TEXT_SIZE = 12;
|
||||
/**
|
||||
* title size of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_TITLE_TEXT_SIZE = 20;
|
||||
/**
|
||||
* name lines of item
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_TEXT_LINES = 1;
|
||||
/**
|
||||
* button size of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_BUTTON_SIZE = 16;
|
||||
//----------- app center--------------
|
||||
/**
|
||||
* margin left of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_MARGIN = 215;
|
||||
/**
|
||||
* gutter of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_GUTTER = 18;
|
||||
/**
|
||||
* item size of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_SIZE = 106;
|
||||
/**
|
||||
* icon padding top with item size
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_TOP_RATIO = 0.01;
|
||||
/**
|
||||
* name lines of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_NAME_LINES = 2;
|
||||
/**
|
||||
* name size of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_NAME_TEXT_SIZE = 12;
|
||||
|
||||
static readonly DEFAULT_APP_CENTER_NAME_HEIGHT = 32;
|
||||
|
||||
//----------- dock----------------
|
||||
/**
|
||||
* icon size of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_ICON_SIZE = 54;
|
||||
/**
|
||||
* padding of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_PADDING = 12;
|
||||
/**
|
||||
* gap of dock container
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_ITEM_GAP = 8;
|
||||
/**
|
||||
* gap with resident and recent
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_GUTTER = 12;
|
||||
/**
|
||||
* save margin of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_SAVE_MARGIN = 24;
|
||||
/**
|
||||
* margin bottom of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_MARGIN_BOTTOM = 10;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
static readonly DEFAULT_BACKGROUND_IMAGE = '';
|
||||
static readonly DEFAULT_APP_ICON_SIZE_WIDTH = 54;
|
||||
static readonly DEFAULT_APP_NAME_SIZE = 14;
|
||||
static readonly DEFAULT_APP_NAME_HEIGHT = 36;
|
||||
static readonly DEFAULT_MARGIN_SIZE = 82;
|
||||
}
|
After Width: | Height: | Size: 3.7 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_add</title>
|
||||
<defs>
|
||||
<path d="M12.75,21.25 C12.75,21.6642136 12.4142136,22 12,22 C11.5857864,22 11.25,21.6642136 11.25,21.25 L11.25,12.75 L2.75,12.75 C2.33578644,12.75 2,12.4142136 2,12 C2,11.5857864 2.33578644,11.25 2.75,11.25 L11.25,11.25 L11.25,2.75 C11.25,2.33578644 11.5857864,2 12,2 C12.4142136,2 12.75,2.33578644 12.75,2.75 L12.75,21.25 Z M21.25,11.25 C21.6642136,11.25 22,11.5857864 22,12 C22,12.4142136 21.6642136,12.75 21.25,12.75 L13.75,12.75 L13.75,11.25 L21.25,11.25 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_add" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 9.2 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_copy</title>
|
||||
<defs>
|
||||
<path d="M15.0132009,4.5 C16.5733587,4.5 17.1391096,4.66244482 17.70948,4.96748223 C18.2798504,5.27251964 18.7274804,5.72014965 19.0325178,6.29052002 L19.1342249,6.49326214 C19.3735291,7.00777167 19.5,7.61018928 19.5,8.9867991 L19.5,17.5132009 C19.5,19.0733587 19.3375552,19.6391096 19.0325178,20.20948 C18.7274804,20.7798504 18.2798504,21.2274804 17.70948,21.5325178 L17.5067379,21.6342249 C16.9922283,21.8735291 16.3898107,22 15.0132009,22 L6.4867991,22 C4.92664131,22 4.36089039,21.8375552 3.79052002,21.5325178 C3.22014965,21.2274804 2.77251964,20.7798504 2.46748223,20.20948 L2.36577509,20.0067379 C2.12647088,19.4922283 2,18.8898107 2,17.5132009 L2,8.9867991 C2,7.42664131 2.16244482,6.86089039 2.46748223,6.29052002 C2.77251964,5.72014965 3.22014965,5.27251964 3.79052002,4.96748223 L3.99326214,4.86577509 C4.47347103,4.64242449 5.03025764,4.51736427 6.22159636,4.50168224 L15.0132009,4.5 Z M6.4867991,6 C5.29081707,6 4.8991107,6.07564199 4.49791831,6.29020203 C4.18895065,6.45543974 3.95543974,6.68895065 3.79020203,6.99791831 L3.71163699,7.15981826 C3.56872488,7.49032199 3.50932077,7.88419566 3.50102731,8.75808525 L3.5,17.5132009 C3.5,18.7091829 3.57564199,19.1008893 3.79020203,19.5020817 C3.95543974,19.8110494 4.18895065,20.0445603 4.49791831,20.209798 L4.65981826,20.288363 C4.99032199,20.4312751 5.38419566,20.4906792 6.25808525,20.4989727 L6.4867991,20.5 L15.0132009,20.5 L15.4506279,20.4958158 C16.3138066,20.4773591 16.6543816,20.39575 17.0020817,20.209798 C17.3110494,20.0445603 17.5445603,19.8110494 17.709798,19.5020817 L17.788363,19.3401817 C17.9312751,19.009678 17.9906792,18.6158043 17.9989727,17.7419147 L18,17.5132009 L18,8.9867991 L17.9958158,8.54937207 C17.9773591,7.6861934 17.89575,7.34561838 17.709798,6.99791831 C17.5445603,6.68895065 17.3110494,6.45543974 17.0020817,6.29020203 L16.8401817,6.21163699 C16.509678,6.06872488 16.1158043,6.00932077 15.2419147,6.00102731 L6.4867991,6 Z M15.590287,2 C17.8190838,2 18.6272994,2.23206403 19.4421143,2.66783176 C20.2569291,3.10359949 20.8964005,3.74307093 21.3321682,4.55788574 C21.767936,5.37270056 22,6.18091615 22,8.409713 L22,14.3722296 C22,16.1552671 21.8143488,16.8018396 21.4657346,17.4536914 C21.2202776,17.9126561 20.8940321,18.3020799 20.4949174,18.6140435 C20.4981214,18.4695118 20.5,18.316606 20.5,18.1541722 L20.5,8.3458278 C20.5,6.97563815 20.3663256,6.28341544 19.9811141,5.56313259 C19.6264537,4.89997522 19.1000248,4.3735463 18.4368674,4.01888586 C17.7646034,3.65935514 17.1167829,3.51894119 15.9193798,3.50181725 L5.8458278,3.5 C5.68310622,3.5 5.5299464,3.50188529 5.38516578,3.50585327 C5.69792007,3.10596794 6.0873439,2.77972241 6.54630859,2.53426541 C7.19816044,2.18565122 7.84473292,2 9.6277704,2 L15.590287,2 Z M10.75,8.25 C11.1642136,8.25 11.5,8.58578644 11.5,9 L11.5,17.5 C11.5,17.9142136 11.1642136,18.25 10.75,18.25 C10.3357864,18.25 10,17.9142136 10,17.5 L10,14 L6.5,14 C6.08578644,14 5.75,13.6642136 5.75,13.25 C5.75,12.8357864 6.08578644,12.5 6.5,12.5 L10,12.5 L10,9 C10,8.58578644 10.3357864,8.25 10.75,8.25 Z M15,12.5 C15.4142136,12.5 15.75,12.8357864 15.75,13.25 C15.75,13.6642136 15.4142136,14 15,14 L12.5,14 L12.5,12.5 L15,12.5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_copy" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_delete</title>
|
||||
<defs>
|
||||
<path d="M5.629,7.5 L6.72612901,18.4738834 C6.83893748,19.6019681 7.77211147,20.4662096 8.89848718,20.4990325 L8.96496269,20.5 L15.0342282,20.5 C16.1681898,20.5 17.1211231,19.6570911 17.2655686,18.5392856 L17.2731282,18.4732196 L18.1924161,9.2527383 L18.369,7.5 L19.877,7.5 L19.6849078,9.40262938 L18.7657282,18.6220326 C18.5772847,20.512127 17.0070268,21.9581787 15.1166184,21.9991088 L15.0342282,22 L8.96496269,22 C7.06591715,22 5.47142703,20.5815579 5.24265599,18.7050136 L5.23357322,18.6231389 L4.121,7.5 L5.629,7.5 Z M10.25,11.75 C10.6642136,11.75 11,12.0857864 11,12.5 L11,18.5 C11,18.9142136 10.6642136,19.25 10.25,19.25 C9.83578644,19.25 9.5,18.9142136 9.5,18.5 L9.5,12.5 C9.5,12.0857864 9.83578644,11.75 10.25,11.75 Z M13.75,11.75 C14.1642136,11.75 14.5,12.0857864 14.5,12.5 L14.5,18.5 C14.5,18.9142136 14.1642136,19.25 13.75,19.25 C13.3357864,19.25 13,18.9142136 13,18.5 L13,12.5 C13,12.0857864 13.3357864,11.75 13.75,11.75 Z M12,1.75 C13.7692836,1.75 15.2083571,3.16379796 15.2491124,4.92328595 L15.25,5 L21,5 C21.4142136,5 21.75,5.33578644 21.75,5.75 C21.75,6.14942022 21.43777,6.47591522 21.0440682,6.49872683 L21,6.5 L14.5,6.5 C14.1005798,6.5 13.7740848,6.18777001 13.7512732,5.7940682 L13.75,5.75 L13.75,5 C13.75,4.03350169 12.9664983,3.25 12,3.25 C11.0536371,3.25 10.2827253,4.00119585 10.2510148,4.93983756 L10.25,5 L10.25,5.75 C10.25,6.14942022 9.93777001,6.47591522 9.5440682,6.49872683 L9.5,6.5 L2.75,6.5 C2.33578644,6.5 2,6.16421356 2,5.75 C2,5.35057978 2.31222999,5.02408478 2.7059318,5.00127317 L2.75,5 L8.75,5 C8.75,3.20507456 10.2050746,1.75 12,1.75 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_delete" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_edit</title>
|
||||
<defs>
|
||||
<path d="M16.8722296,2 C17.8721999,2 18.5147251,2.05839169 19.0012003,2.17117304 L17.6599443,3.51379911 C17.4862664,3.50652642 17.2928183,3.5022817 17.0753381,3.50070655 L7.02453833,3.50017541 L6.82305804,3.501658 C5.6550816,3.5151767 5.20981608,3.61305534 4.75370688,3.8569852 C4.36325774,4.06579969 4.06579969,4.36325774 3.8569852,4.75370688 C3.59290159,5.24750032 3.5,5.72858421 3.5,7.1277704 L3.50017541,16.9754617 L3.501658,17.176942 C3.5151767,18.3449184 3.61305534,18.7901839 3.8569852,19.2462931 C4.06579969,19.6367423 4.36325774,19.9342003 4.75370688,20.1430148 C5.22281064,20.3938942 5.68044405,20.4902819 6.92466189,20.4992935 L16.8722296,20.5 C18.2714158,20.5 18.7524997,20.4070984 19.2462931,20.1430148 C19.6367423,19.9342003 19.9342003,19.6367423 20.1430148,19.2462931 C20.3938942,18.7771894 20.4902819,18.319556 20.4992935,17.0753381 L20.5,16.8722296 L20.5,7.1277704 C20.5,6.82616011 20.4956832,6.56721095 20.4862654,6.34159954 L21.8289375,4.9992768 C21.9416465,5.48569497 22,6.12812696 22,7.1277704 L22,16.8722296 L21.9989932,17.0937657 C21.9842401,18.674381 21.8076257,19.3015622 21.487765,19.91208 L21.4657346,19.9536914 C21.1337211,20.5745027 20.6538954,21.0680807 20.0458564,21.4148264 L19.9536914,21.4657346 C19.3018396,21.8143488 18.6552671,22 16.8722296,22 L7.1277704,22 L6.90623426,21.9989932 C5.32561899,21.9842401 4.69843783,21.8076257 4.08791999,21.487765 L4.04630859,21.4657346 C3.42549731,21.1337211 2.93191931,20.6538954 2.58517358,20.0458564 L2.53426541,19.9536914 C2.18565122,19.3018396 2,18.6552671 2,16.8722296 L2,7.1277704 C2,5.38266989 2.17783521,4.72618864 2.51223497,4.08791999 L2.53426541,4.04630859 C2.86627892,3.42549731 3.34610464,2.93191931 3.9541436,2.58517358 L4.04630859,2.53426541 C4.69816044,2.18565122 5.34473292,2 7.1277704,2 L16.8722296,2 Z M22.2300776,1.76992245 C22.6206018,2.16044674 22.6206018,2.79361172 22.2300776,3.18413601 L12.684136,12.7300776 C12.2936117,13.1206018 11.6604467,13.1206018 11.2699224,12.7300776 C10.8793982,12.3395533 10.8793982,11.7063883 11.2699224,11.315864 L20.815864,1.76992245 C21.2063883,1.37939815 21.8395533,1.37939815 22.2300776,1.76992245 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_edit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_lock</title>
|
||||
<defs>
|
||||
<path d="M12,2 C14.3202308,2 16.206199,3.85929891 16.249248,6.16924008 L16.25,6.25 L16.25,9 L16.5,9 C18.1568542,9 19.5,10.3431458 19.5,12 L19.5,18.5 C19.5,20.1568542 18.1568542,21.5 16.5,21.5 L7.5,21.5 C5.84314575,21.5 4.5,20.1568542 4.5,18.5 L4.5,12 C4.5,10.3431458 5.84314575,9 7.5,9 L7.75,9 L7.75,6.25 C7.75,3.90278981 9.65278981,2 12,2 Z M16.5,10.5 L7.5,10.5 C6.69040076,10.5 6.03060706,11.1413937 6.00103462,11.9437654 L6,12 L6,18.5 C6,19.3095992 6.64139372,19.9693929 7.44376543,19.9989654 L7.5,20 L16.5,20 C17.3095992,20 17.9693929,19.3586063 17.9989654,18.5562346 L18,18.5 L18,12 C18,11.1904008 17.3586063,10.5306071 16.5562346,10.5010346 L16.5,10.5 Z M12,13.25 C13.1045695,13.25 14,14.1454305 14,15.25 C14,16.3545695 13.1045695,17.25 12,17.25 C10.8954305,17.25 10,16.3545695 10,15.25 C10,14.1454305 10.8954305,13.25 12,13.25 Z M12,3.5 C10.5053246,3.5 9.28915871,4.69244089 9.25092685,6.17789813 L9.25,9 L14.75,9 L14.75,6.25 C14.75,4.73121694 13.5187831,3.5 12,3.5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_lock" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="none">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#ffffff" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_remove</title>
|
||||
<defs>
|
||||
<path d="M12,1 C18.0751322,1 23,5.92486775 23,12 C23,18.0751322 18.0751322,23 12,23 C5.92486775,23 1,18.0751322 1,12 C1,5.92486775 5.92486775,1 12,1 Z M12,2.5 C6.75329488,2.5 2.5,6.75329488 2.5,12 C2.5,17.2467051 6.75329488,21.5 12,21.5 C17.2467051,21.5 21.5,17.2467051 21.5,12 C21.5,6.75329488 17.2467051,2.5 12,2.5 Z M17.25,11.25 C17.6642136,11.25 18,11.5857864 18,12 C18,12.4142136 17.6642136,12.75 17.25,12.75 L6.75,12.75 C6.33578644,12.75 6,12.4142136 6,12 C6,11.5857864 6.33578644,11.25 6.75,11.25 L17.25,11.25 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_remove" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>ic_rename</title>
|
||||
<defs>
|
||||
<path d="M10,21.75 C9.58578644,21.75 9.25,21.4142136 9.25,21 C9.25,20.6203042 9.53215388,20.306509 9.89822944,20.2568466 L10,20.25 L11.25,20.25 L11.25,3.75 L10,3.75 C9.58578644,3.75 9.25,3.41421356 9.25,3 C9.25,2.62030423 9.53215388,2.30650904 9.89822944,2.25684662 L10,2.25 L14,2.25 C14.4142136,2.25 14.75,2.58578644 14.75,3 C14.75,3.37969577 14.4678461,3.69349096 14.1017706,3.74315338 L14,3.75 L12.75,3.75 L12.75,20.25 L14,20.25 C14.4142136,20.25 14.75,20.5857864 14.75,21 C14.75,21.3796958 14.4678461,21.693491 14.1017706,21.7431534 L14,21.75 L10,21.75 Z M10.5,5 L10.5,6.5 L6,6.5 C4.6745166,6.5 3.58996133,7.53153594 3.50531768,8.83562431 L3.5,9 L3.5,15 C3.5,16.3254834 4.53153594,17.4100387 5.83562431,17.4946823 L6,17.5 L10.5,17.5 L10.5,19 L6,19 C3.790861,19 2,17.209139 2,15 L2,9 C2,6.790861 3.790861,5 6,5 L10.5,5 Z M18,5 C20.209139,5 22,6.790861 22,9 L22,15 C22,17.209139 20.209139,19 18,19 L13.5,19 L13.5,17.5 L18,17.5 C19.3254834,17.5 20.4100387,16.4684641 20.4946823,15.1643757 L20.5,15 L20.5,9 C20.5,7.6745166 19.4684641,6.58996133 18.1643757,6.50531768 L18,6.5 L13.5,6.5 L13.5,5 L18,5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="ic_rename" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 239 KiB |
After Width: | Height: | Size: 1.2 MiB |
57
product/pad/src/main/ets/MainAbility/common/recentEvent.ts
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
/*
|
||||
* 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 commonEvent from '@ohos.commonEvent';
|
||||
import { CommonEventSubscribeInfo } from 'commonEvent/commonEventSubscribeInfo';
|
||||
import { CommonEventData } from 'commonEvent/commonEventData';
|
||||
import { BusinessError } from 'basic';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
|
||||
const TAG = 'RecentEvent';
|
||||
|
||||
const commonEventSubscribeInfo: CommonEventSubscribeInfo = {
|
||||
events: ['CREATE_RECENT_WINDOW_EVENT']
|
||||
};
|
||||
|
||||
let commonEventSubscriber: CommonEventData | undefined;
|
||||
|
||||
class RecentEvent {
|
||||
mCallback: Record<string, () => void> = {};
|
||||
|
||||
registerCallback(callback: Record<string, () => void>): void {
|
||||
Log.showInfo(TAG, 'registerCallback');
|
||||
this.mCallback = callback;
|
||||
if (commonEventSubscriber == undefined) {
|
||||
void commonEvent.createSubscriber(commonEventSubscribeInfo, this.createRecentCallBack.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
private createRecentCallBack(error: BusinessError, data: CommonEventData): void {
|
||||
Log.showInfo(TAG, `createRecentCallBack error: ${JSON.stringify(error)} data: ${JSON.stringify(data)}`);
|
||||
commonEventSubscriber = data;
|
||||
commonEvent.subscribe(data, (error, data) => {
|
||||
Log.showInfo(TAG, `subscribe error: ${JSON.stringify(error)} data: ${JSON.stringify(data)}`);
|
||||
if (error.code == 0) {
|
||||
this.mCallback.onStateChange();
|
||||
} else {
|
||||
Log.showError(TAG, 'data is error');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const recentEvent = new RecentEvent();
|
||||
export default recentEvent;
|
164
product/pad/src/main/ets/MainAbility/pages/EntryView.ets
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 PadStage from '../common/PadStage';
|
||||
import windowManager from '../../../../../../../common/src/main/ets/default/manager/WindowManager';
|
||||
import RdbStoreManager from '../../../../../../../common/src/main/ets/default/manager/RdbStoreManager';
|
||||
import CustomOverlay from '../../../../../../../common/src/main/ets/default/uicomponents/CustomOverlay.ets';
|
||||
import CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PageDesktopLayout from '../../../../../../../feature/pagedesktop/src/main/ets/default/layout/PageDesktopLayout.ets';
|
||||
import AppGridLayout from '../../../../../../../feature/appcenter/src/main/ets/default/layout/AppGridLayout.ets';
|
||||
import SmartDock from '../../../../../../../feature/smartdock/src/main/ets/default/layout/SmartDock.ets';
|
||||
import FolderOpenComponent from '../../../../../../../feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets';
|
||||
import FeatureConstants from '../../../../../../../feature/bigfolder/src/main/ets/default/common/constants/FeatureConstants';
|
||||
import AppBadgeMessage from '../../../../../../../common/src/main/ets/default/bean/AppBadgeMessage';
|
||||
import BadgeManager from '../../../../../../../common/src/main/ets/default/manager/BadgeManager';
|
||||
import LayoutViewModel from '../../../../../../../feature/launcherlayout/src/main/ets/default/common/viewmodel/LayoutViewModel';
|
||||
import Trace from '../../../../../../../common/src/main/ets/default/utils/Trace';
|
||||
import StyleConstants from '../../../../../../../common/src/main/ets/default/constants/StyleConstants';
|
||||
import app from '@system.app';
|
||||
import PageDesktopDragHandler from '../../../../../../../feature/pagedesktop/src/main/ets/default/common/PageDesktopDragHandler';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import RecentEvent from '../common/recentEvent';
|
||||
|
||||
const RAW_IMAGE_CACHE_SIZE = 20000000;
|
||||
const TAG = "EntryView";
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct EntryView {
|
||||
@State showAppCenter: boolean = false;
|
||||
@State workSpaceWidth: number = 0;
|
||||
@State workSpaceHeight: number = 0;
|
||||
@State dockHeight: number = 0;
|
||||
@State indicatorHeight: number = 0;
|
||||
@State device: string = CommonConstants.PAD_DEVICE_TYPE;
|
||||
private mStage: PadStage = new PadStage();
|
||||
private mLayoutViewModel: LayoutViewModel;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mStage.onCreate();
|
||||
let dbStore = RdbStoreManager.getInstance();
|
||||
dbStore.initRdbConfig();
|
||||
AppStorage.SetOrCreate('dockDevice', this.device);
|
||||
this.mLayoutViewModel = LayoutViewModel.getInstance();
|
||||
this.updateScreenSize();
|
||||
let mCallback: Record<string, () => void> = {
|
||||
"onStateChange": () => this.createRecent()
|
||||
};
|
||||
RecentEvent.registerCallback(mCallback);
|
||||
}
|
||||
|
||||
private createRecent(): void {
|
||||
Log.showInfo(TAG, 'receive Subscriber success');
|
||||
globalThis.createRecentWindow();
|
||||
}
|
||||
|
||||
private onPageShow(): void {
|
||||
Log.showInfo(TAG, 'onPageShow');
|
||||
if (typeof globalThis.IsSetImageRawDataCacheSize === 'undefined') {
|
||||
Log.showInfo(TAG, 'onPageShow setImageRawDataCacheSize');
|
||||
|
||||
// If cannot compile this, comment next line or add following code into Class App in "@system.app.d.ts":
|
||||
// static setImageRawDataCacheSize(value: number): void;
|
||||
app.setImageRawDataCacheSize(RAW_IMAGE_CACHE_SIZE);
|
||||
globalThis.IsSetImageRawDataCacheSize = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async updateScreenSize(): Promise<void> {
|
||||
let screenWidth = await windowManager.getWindowWidth();
|
||||
let screenHeight = await windowManager.getWindowHeight();
|
||||
this.mLayoutViewModel.calculate(this.device, screenWidth, screenHeight);
|
||||
this.workSpaceHeight = this.mLayoutViewModel.getWorkSpaceHeight();
|
||||
this.dockHeight = this.mLayoutViewModel.getDockHeight();
|
||||
this.indicatorHeight = this.mLayoutViewModel.getIndicator();
|
||||
AppStorage.SetOrCreate('screenWidth', screenWidth);
|
||||
AppStorage.SetOrCreate('screenHeight', screenHeight);
|
||||
AppStorage.SetOrCreate('systemUiHeght', CommonConstants.SYSTEM_UI_HEIGHT);
|
||||
Log.showInfo(TAG, `updateScreenSize product: ${this.device}, screenWidth: ${screenWidth}
|
||||
, screenHeight: ${screenHeight}, systemUiHeght: ${CommonConstants.SYSTEM_UI_HEIGHT}`);
|
||||
this.workSpaceWidth = screenWidth;
|
||||
AppStorage.SetOrCreate('workSpaceWidth', this.workSpaceWidth);
|
||||
AppStorage.SetOrCreate('workSpaceHeight', this.workSpaceHeight);
|
||||
}
|
||||
|
||||
private aboutToDisappear(): void {
|
||||
this.mStage.onDestroy();
|
||||
}
|
||||
|
||||
private onBackPress(): boolean {
|
||||
console.info(`EntryView onBackPress ${this.showAppCenter}`);
|
||||
ContextMenu.close();
|
||||
AppStorage.SetOrCreate('dialogControllerStatus', !AppStorage.Get('dialogControllerStatus'));
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_HIDE);
|
||||
AppStorage.SetOrCreate('openFolderStatus', FeatureConstants.OPEN_FOLDER_STATUS_CLOSE);
|
||||
AppStorage.SetOrCreate('selectDesktopAppItem', '');
|
||||
this.showAppCenter = false;
|
||||
PageDesktopDragHandler.getInstance().reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
private buildLog(): boolean {
|
||||
Log.showInfo(TAG, `buildLog ${this.showAppCenter}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
if (this.buildLog()) {
|
||||
}
|
||||
Column() {
|
||||
Column() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
if (this.showAppCenter) {
|
||||
AppGridLayout();
|
||||
} else {
|
||||
PageDesktopLayout({
|
||||
device: this.device,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
.height(this.workSpaceHeight)
|
||||
Column() {
|
||||
}
|
||||
.height(this.indicatorHeight)
|
||||
Column() {
|
||||
SmartDock({
|
||||
device: this.device,
|
||||
showAppCenter: () => {
|
||||
Trace.start(Trace.CORE_METHOD_START_APP_CENTER);
|
||||
this.showAppCenter = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
.height(this.dockHeight)
|
||||
}
|
||||
.margin({
|
||||
top: StyleConstants.DEFAULT_28
|
||||
})
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
|
||||
FolderOpenComponent()
|
||||
CustomOverlay()
|
||||
}
|
||||
.backgroundImage(this.showAppCenter ? '/common/pics/ic_wallpaper_recent.jpg' : '/common/pics/img_wallpaper_default.jpg')
|
||||
.backgroundImageSize(ImageSize.Cover)
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
86
product/pad/src/main/ets/MainAbility/pages/RecentView.ets
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 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 windowManager from '../../../../../../../common/src/main/ets/default/manager/WindowManager';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import Trace from '../../../../../../../common/src/main/ets/default/utils/Trace';
|
||||
import RecentMissionInfo from '../../../../../../../common/src/main/ets/default/bean/RecentMissionInfo';
|
||||
import StyleConstants from '../../../../../../../feature/recents/src/main/ets/MainAbility/common/constants/StyleConstants';
|
||||
import RecentMissionsStage from '../../../../../../../feature/recents/src/main/ets/MainAbility/common/RecentMissionsStage';
|
||||
import RecentMissionsViewModel from '../../../../../../../feature/recents/src/main/ets/MainAbility/viewmodel/RecentMissionsViewModel';
|
||||
import EmptyMsgDisplay from '../../../../../../../feature/recents/src/main/ets/MainAbility/view/EmptyMsgDisplay.ets';
|
||||
import RecentMissionsDoubleLayout from '../../../../../../../feature/recents/src/main/ets/MainAbility/view/RecentMissionsDoubleLayout.ets';
|
||||
import RecentMissionsSingleLayout from '../../../../../../../feature/recents/src/main/ets/MainAbility/view/RecentMissionsSingleLayout.ets';
|
||||
|
||||
const TAG = "RecentView";
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct RecentView {
|
||||
@StorageLink('recentMissionsList') mRecentMissionsList: RecentMissionInfo[] = [];
|
||||
@State mIsClickSubComponent: boolean = false;
|
||||
private mRecentMissionsStage: RecentMissionsStage = new RecentMissionsStage();
|
||||
private mRecentMissionsViewModel: RecentMissionsViewModel;
|
||||
|
||||
onPageShow(): void {
|
||||
Log.showInfo(TAG, 'onPageShow' + this.mRecentMissionsList.length);
|
||||
this.mIsClickSubComponent = false;
|
||||
this.mRecentMissionsStage.onCreate();
|
||||
this.mRecentMissionsViewModel = RecentMissionsViewModel.getInstance();
|
||||
this.mRecentMissionsViewModel.getRecentMissionsList();
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
Log.showInfo(TAG, `onPageHide`);
|
||||
this.mIsClickSubComponent = false;
|
||||
this.mRecentMissionsStage.onDestroy();
|
||||
}
|
||||
|
||||
onBackPress(): boolean {
|
||||
Log.showInfo(TAG, 'RecentMission EntryView onBackPress');
|
||||
windowManager.hideWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
return true;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
if (this.mRecentMissionsList.length === 0) {
|
||||
EmptyMsgDisplay();
|
||||
} else {
|
||||
if (this.traceLoadData() && this.mRecentMissionsViewModel.getRecentMissionsRowType() === 'single') {
|
||||
RecentMissionsSingleLayout({ mRecentMissionsSingleList: $mRecentMissionsList,
|
||||
mIsClickSubComponent: $mIsClickSubComponent});
|
||||
} else {
|
||||
RecentMissionsDoubleLayout({ mRecentMissionsDoubleList: $mRecentMissionsList,
|
||||
mIsClickSubComponent: $mIsClickSubComponent});
|
||||
}
|
||||
}
|
||||
}
|
||||
.width(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.height(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.backgroundImage(StyleConstants.DEFAULT_RECENT_BACKGROUND_IMAGE)
|
||||
.onClick(() => {
|
||||
if (!this.mIsClickSubComponent) {
|
||||
Log.showInfo(TAG, 'click recent missions area');
|
||||
this.mRecentMissionsViewModel.backView();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private traceLoadData(): boolean {
|
||||
Trace.end(Trace.CORE_METHOD_START_RECENTS);
|
||||
return true;
|
||||
}
|
||||
}
|
28
product/pad/src/main/resources/base/element/color.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "menu_divider_color_dark",
|
||||
"value": "#33ffffff"
|
||||
},
|
||||
{
|
||||
"name": "menu_divider_color_light",
|
||||
"value": "#33000000"
|
||||
},
|
||||
{
|
||||
"name": "menu_background_color_dark",
|
||||
"value": "#ff333333"
|
||||
},
|
||||
{
|
||||
"name": "menu_background_color_light",
|
||||
"value": "#ffdddddd"
|
||||
},
|
||||
{
|
||||
"name": "menu_text_color_dark",
|
||||
"value": "#e5ffffff"
|
||||
},
|
||||
{
|
||||
"name": "menu_text_color_light",
|
||||
"value": "#e5000000"
|
||||
}
|
||||
]
|
||||
}
|
8
product/pad/src/main/resources/base/element/float.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"float": [
|
||||
{
|
||||
"name": "menu_border_radius",
|
||||
"value": "12"
|
||||
}
|
||||
]
|
||||
}
|
176
product/pad/src/main/resources/base/element/string.json
Normal file
@ -0,0 +1,176 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "pad"
|
||||
},
|
||||
{
|
||||
"name": "entry_CalleeAbility",
|
||||
"value": "pad callee"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "calleeability_description",
|
||||
"value": "ETS_Empty Callee Ability"
|
||||
},
|
||||
{
|
||||
"name": "dock_all_app_entry",
|
||||
"value": "全部应用"
|
||||
},
|
||||
{
|
||||
"name": "dock_recents_entry",
|
||||
"value": "最近任务"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_success",
|
||||
"value": "卸载成功"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_failed",
|
||||
"value": "卸载失败"
|
||||
},
|
||||
{
|
||||
"name": "disable_uninstall",
|
||||
"value": "禁止卸载"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "服务卡片"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "编辑"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_dock",
|
||||
"value": "添加到快捷栏"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_desktop",
|
||||
"value": "添加到工作区"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_uninstall",
|
||||
"value": "卸载"
|
||||
},
|
||||
{
|
||||
"name": "display_full_parent",
|
||||
"value": "100%"
|
||||
},
|
||||
{
|
||||
"name": "uninstall",
|
||||
"value": "卸载"
|
||||
},
|
||||
{
|
||||
"name": "delete",
|
||||
"value": "移除"
|
||||
},
|
||||
{
|
||||
"name": "submit",
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "cancel",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_dock",
|
||||
"value": "禁止添加"
|
||||
},
|
||||
{
|
||||
"name": "into_settings",
|
||||
"value": "桌面设置"
|
||||
},
|
||||
{
|
||||
"name": "add_blank_page",
|
||||
"value": "添加空白页"
|
||||
},
|
||||
{
|
||||
"name": "delete_blank_page",
|
||||
"value": "删除空白页"
|
||||
},
|
||||
{
|
||||
"name": "launcher_edit",
|
||||
"value": "桌面编辑"
|
||||
},
|
||||
{
|
||||
"name": "duplicate_add",
|
||||
"value": "重复添加"
|
||||
},
|
||||
{
|
||||
"name": "no_space_for_add",
|
||||
"value": "没有足够空间"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "移除"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_delete",
|
||||
"value": "禁止移除"
|
||||
},
|
||||
{
|
||||
"name": "disable_to_move",
|
||||
"value": "禁止移动"
|
||||
},
|
||||
{
|
||||
"name": "add",
|
||||
"value": "添加"
|
||||
},
|
||||
{
|
||||
"name": "add_to",
|
||||
"value": "添加到"
|
||||
},
|
||||
{
|
||||
"name": "new_folder_name",
|
||||
"value": "新建文件夹"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "重命名"
|
||||
},
|
||||
{
|
||||
"name": "cancel_dialog",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "confirm_dialog",
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "添加到桌面"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "更多服务卡片"
|
||||
},
|
||||
{
|
||||
"name": "delete_form",
|
||||
"value": "移除"
|
||||
},
|
||||
{
|
||||
"name": "is_delete_form",
|
||||
"value": "是否移除"
|
||||
},
|
||||
{
|
||||
"name": "form",
|
||||
"value": "卡片"
|
||||
},
|
||||
{
|
||||
"name": "remove_form_dialog_content",
|
||||
"value": "通过长按应用进入“卡片管理页”界面可以新添加"
|
||||
},
|
||||
{
|
||||
"name": "gesture_navigation_options",
|
||||
"value": "手势导航开关"
|
||||
},
|
||||
{
|
||||
"name": "No_running_apps_recently",
|
||||
"value": "最近无运行应用"
|
||||
}
|
||||
]
|
||||
}
|
BIN
product/pad/src/main/resources/base/media/ic_allapps.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
product/pad/src/main/resources/base/media/ic_multitask.png
Normal file
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
BIN
product/pad/src/main/resources/base/media/img_app_default.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
@ -1,10 +1,11 @@
|
||||
apply plugin: 'com.huawei.ohos.hap'
|
||||
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
|
||||
ohos {
|
||||
compileSdkVersion 7
|
||||
compileSdkVersion 8
|
||||
defaultConfig {
|
||||
compatibleSdkVersion 4
|
||||
compatibleSdkVersion 8
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
proguardOpt {
|
||||
|
@ -9,8 +9,10 @@
|
||||
},
|
||||
"deviceConfig": {},
|
||||
"module": {
|
||||
"srcPath": "",
|
||||
"package": "com.ohos.launcher",
|
||||
"name": ".MyApplication",
|
||||
"mainAbility": ".MainAbility",
|
||||
"deviceType": [
|
||||
"phone"
|
||||
],
|
||||
@ -34,14 +36,14 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"visible": true,
|
||||
"name": "com.ohos.launcher.MainAbility",
|
||||
"visible": false,
|
||||
"name": ".MainAbility",
|
||||
"icon": "$media:icon",
|
||||
"description": "$string:mainability_description",
|
||||
"label": "$string:entry_MainAbility",
|
||||
"type": "page",
|
||||
"type": "service",
|
||||
"launchType": "singleton",
|
||||
"srcPath": "default",
|
||||
"srcPath": "MainAbility",
|
||||
"srcLanguage": "ets",
|
||||
"metaData": {
|
||||
"customizeData": [
|
||||
@ -59,14 +61,32 @@
|
||||
"type": "pageAbility"
|
||||
},
|
||||
"pages": [
|
||||
"pages/EntryView"
|
||||
"pages/EntryView",
|
||||
"pages/RecentView"
|
||||
],
|
||||
"name": "default",
|
||||
"name": ".MainAbility",
|
||||
"window": {
|
||||
"designWidth": 720,
|
||||
"autoDesignWidth": false
|
||||
}
|
||||
}
|
||||
],
|
||||
"reqPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.INSTALL_BUNDLE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.LISTEN_BUNDLE_CHANGE"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_MISSIONS"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.REQUIRE_FORM"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
22
product/phone/src/main/ets/AbilityStage.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 AbilityStage from '@ohos.application.AbilityStage';
|
||||
|
||||
export default class MyAbilityStage extends AbilityStage {
|
||||
onCreate() {
|
||||
console.log('MyAbilityStage onCreate is called');
|
||||
}
|
||||
}
|
63
product/phone/src/main/ets/MainAbility/MainAbility.ts
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility';
|
||||
import display from '@ohos.display';
|
||||
import Want from '@ohos.application.Want';
|
||||
import windowManager from '../../../../../../common/src/main/ets/default/manager/WindowManager';
|
||||
import Log from '../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import GestureNavigationManage from '../../../../../../feature/gesturenavigation/src/main/ets/default/common/GestureNavigationManage';
|
||||
|
||||
const TAG = 'LauncherMainAbility';
|
||||
|
||||
export default class MainAbility extends ServiceExtension {
|
||||
onCreate(want: Want): void {
|
||||
Log.showInfo(TAG,'onCreate start');
|
||||
this.initGlobalConst();
|
||||
windowManager.createWindow(this.context, windowManager.DESKTOP_WINDOW_NAME, 2001, 'pages/EntryView');
|
||||
}
|
||||
|
||||
private initGlobalConst(): void {
|
||||
globalThis.desktopContext = this.context;
|
||||
// ServiceExtension can't access callee.
|
||||
// globalThis.callee = this.callee;
|
||||
globalThis.createRecentWindow = (() => {
|
||||
Log.showInfo(TAG, 'createRecentWindow Begin');
|
||||
windowManager.createWindowIfAbsent(this.context, windowManager.RECENT_WINDOW_NAME, 2115, 'pages/RecentView');
|
||||
});
|
||||
this.startGestureNavigation();
|
||||
}
|
||||
|
||||
private startGestureNavigation(): void {
|
||||
const gestureNavigationManage = GestureNavigationManage.getInstance();
|
||||
display.getDefaultDisplay()
|
||||
.then((dis: { id: number, width: number, height: number, refreshRate: number }) => {
|
||||
Log.showInfo(TAG, `startGestureNavigation display: ${JSON.stringify(dis)}`);
|
||||
gestureNavigationManage.initWindowSize(dis);
|
||||
});
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
windowManager.destroyWindow(windowManager.DESKTOP_WINDOW_NAME);
|
||||
windowManager.destroyWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
Log.showInfo(TAG, 'onDestroy success');
|
||||
}
|
||||
|
||||
onRequest(want: Want, startId: number): void {
|
||||
Log.showInfo(TAG,`onRequest, want:${want.abilityName}`);
|
||||
windowManager.minimizeAllApps();
|
||||
windowManager.hideWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import phoneFolderLayoutInfo from './configs/PhoneFolderLayoutInfo';
|
||||
import FolderLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/FolderLayoutConfig';
|
||||
|
||||
/**
|
||||
* Phone Folder layout configuration
|
||||
*/
|
||||
export default class PhoneFolderLayoutConfig extends FolderLayoutConfig {
|
||||
|
||||
private static sProductInstance: PhoneFolderLayoutConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
this.mFolderLayoutInfo = phoneFolderLayoutInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get folder layout configuration instance
|
||||
*/
|
||||
static getInstance(): PhoneFolderLayoutConfig {
|
||||
if (PhoneFolderLayoutConfig.sProductInstance == undefined) {
|
||||
PhoneFolderLayoutConfig.sProductInstance = new PhoneFolderLayoutConfig();
|
||||
PhoneFolderLayoutConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PhoneFolderLayoutConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import phoneFormLayoutInfo from './configs/PhoneFormLayoutInfo';
|
||||
import FormLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/FormLayoutConfig';
|
||||
|
||||
/**
|
||||
* Phone form layout configuration
|
||||
*/
|
||||
export default class PhoneFormLayoutConfig extends FormLayoutConfig {
|
||||
|
||||
private static sProductInstance: PhoneFormLayoutConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
this.mFormLayoutInfo = phoneFormLayoutInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get form layout configuration instance
|
||||
*/
|
||||
static getInstance(): PhoneFormLayoutConfig {
|
||||
if (PhoneFormLayoutConfig.sProductInstance == undefined) {
|
||||
PhoneFormLayoutConfig.sProductInstance = new PhoneFormLayoutConfig();
|
||||
PhoneFormLayoutConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PhoneFormLayoutConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Copyright (c) 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PhonePresetStyleConstants from './constants/PhonePresetStyleConstants';
|
||||
import LauncherLayoutStyleConfig from '../../../../../../../feature/launcherlayout/src/main/ets/default/common/LauncherLayoutStyleConfig';
|
||||
import PresetStyleConstants from '../../../../../../../common/src/main/ets/default/constants/PresetStyleConstants';
|
||||
|
||||
/**
|
||||
* Phone launcher config
|
||||
*/
|
||||
export default class PhoneLauncherLayoutStyleConfig extends LauncherLayoutStyleConfig {
|
||||
|
||||
mSystemUIHeight = PresetStyleConstants.DEFAULT_PHONE_SYSTEM_UI;
|
||||
|
||||
mIndicatorHeight = PresetStyleConstants.DEFAULT_PHONE_INDICATOR_HEIGHT;
|
||||
|
||||
/**
|
||||
* desktop item Size
|
||||
*/
|
||||
mAppItemSize = PhonePresetStyleConstants.DEFAULT_APP_LAYOUT_SIZE;
|
||||
|
||||
/**
|
||||
* desktop space margin
|
||||
*/
|
||||
mMargin = PhonePresetStyleConstants.DEFAULT_LAYOUT_MARGIN;
|
||||
|
||||
/**
|
||||
* desktop grid gap
|
||||
*/
|
||||
mGridGutter = PhonePresetStyleConstants.DEFAULT_APP_LAYOUT_MIN_GUTTER;
|
||||
|
||||
/**
|
||||
* icon name lines
|
||||
*/
|
||||
mNameLines: number = PhonePresetStyleConstants.DEFAULT_APP_NAME_LINES;
|
||||
/**
|
||||
* icon ratio
|
||||
*/
|
||||
mIconRatio: number = PhonePresetStyleConstants.DEFAULT_APP_TOP_RATIO;
|
||||
|
||||
/**
|
||||
* icon name margin
|
||||
*/
|
||||
mIconNameGap: number = PhonePresetStyleConstants.DEFAULT_ICON_NAME_GAP;
|
||||
|
||||
/**
|
||||
* icon name text size
|
||||
*/
|
||||
mNameSize: number = PhonePresetStyleConstants.DEFAULT_APP_NAME_TEXT_SIZE;
|
||||
|
||||
/**
|
||||
* name height
|
||||
*/
|
||||
mNameHeight: number = PhonePresetStyleConstants.DEFAULT_DESKTOP_NAME_HEIGHT;
|
||||
//folder
|
||||
/**
|
||||
* ratio of gutter with folder
|
||||
*/
|
||||
mFolderGutterRatio: number = PhonePresetStyleConstants.DEFAULT_FOLDER_GUTTER_RATIO;
|
||||
|
||||
/**
|
||||
* ratio of margin with folder
|
||||
*/
|
||||
mFolderMarginRatio: number = PhonePresetStyleConstants.DEFAULT_FOLDER_PADDING_RATIO;
|
||||
|
||||
/**
|
||||
* gutter of open folder
|
||||
*/
|
||||
mFolderOpenGutter: number = PhonePresetStyleConstants.DEFAULT_OPEN_FOLDER_GUTTER;
|
||||
|
||||
/**
|
||||
* padding of open folder
|
||||
*/
|
||||
mFolderOpenPADDING: number = PhonePresetStyleConstants.DEFAULT_OPEN_FOLDER_PADDING;
|
||||
|
||||
/**
|
||||
* margin of open folder
|
||||
*/
|
||||
mFolderOpenMargin: number = PhonePresetStyleConstants.DEFAULT_OPEN_FOLDER_MARGIN_TOP;
|
||||
|
||||
/**
|
||||
* gutter of add app
|
||||
*/
|
||||
mFolderAddGridGap: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_GAP;
|
||||
|
||||
/**
|
||||
* margin of add app and padding of add app
|
||||
*/
|
||||
mFolderAddGridMargin: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_MARGIN;
|
||||
|
||||
/**
|
||||
* max height of add app
|
||||
*/
|
||||
mFolderAddMaxHeight: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_MAX_HEIGHT;
|
||||
|
||||
/**
|
||||
* toggle size of add app
|
||||
*/
|
||||
mFolderToggleSize: number = PhonePresetStyleConstants.DEFAULT_APP_GRID_TOGGLE_SIZE;
|
||||
|
||||
/**
|
||||
* name lines of add app
|
||||
*/
|
||||
mFolderAddTextLines: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_TEXT_LINES;
|
||||
|
||||
/**
|
||||
* text size of add app
|
||||
*/
|
||||
mFolderAddTextSize: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_GRID_TEXT_SIZE;
|
||||
|
||||
/**
|
||||
* title size of add app
|
||||
*/
|
||||
mFolderAddTitleSize: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_TITLE_TEXT_SIZE;
|
||||
|
||||
/**
|
||||
* ratio of padding top with icon in add app
|
||||
*/
|
||||
mFolderAddICONRATIO: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_ICON_TOP_RATIO;
|
||||
|
||||
/**
|
||||
* button size of add app
|
||||
*/
|
||||
mFolderAddButtonSize: number = PhonePresetStyleConstants.DEFAULT_FOLDER_ADD_BUTTON_SIZE;
|
||||
|
||||
//App Center
|
||||
/**
|
||||
* margin of app center
|
||||
*/
|
||||
mAppCenterMargin: number = PhonePresetStyleConstants.DEFAULT_APP_CENTER_MARGIN;
|
||||
|
||||
/**
|
||||
* gutter of app center
|
||||
*/
|
||||
mAppCenterGutter: number = PhonePresetStyleConstants.DEFAULT_APP_CENTER_GUTTER;
|
||||
|
||||
/**
|
||||
* size of app center container
|
||||
*/
|
||||
mAppCenterSize: number = PhonePresetStyleConstants.DEFAULT_APP_CENTER_SIZE;
|
||||
|
||||
/**
|
||||
* ratio of padding top with icon in app center
|
||||
*/
|
||||
mAppCenterRatio: number = PhonePresetStyleConstants.DEFAULT_APP_CENTER_TOP_RATIO;
|
||||
|
||||
/**
|
||||
* name lines of app center
|
||||
*/
|
||||
mAppCenterNameLines: number = PhonePresetStyleConstants.DEFAULT_APP_CENTER_NAME_LINES;
|
||||
|
||||
/**
|
||||
* name size of app center
|
||||
*/
|
||||
mAppCenterNameSize: number = PhonePresetStyleConstants.DEFAULT_APP_CENTER_NAME_TEXT_SIZE;
|
||||
|
||||
//dock
|
||||
/**
|
||||
* padding of dock
|
||||
*/
|
||||
mDockPadding: number = PhonePresetStyleConstants.DEFAULT_DOCK_PADDING;
|
||||
|
||||
/**
|
||||
* icon size of dock
|
||||
*/
|
||||
mDockIconSize: number = PhonePresetStyleConstants.DEFAULT_DOCK_ICON_SIZE;
|
||||
|
||||
/**
|
||||
* gap of icon and icon
|
||||
*/
|
||||
mDockItemGap: number = PhonePresetStyleConstants.DEFAULT_DOCK_ITEM_GAP;
|
||||
|
||||
/**
|
||||
* gap of dock and dock
|
||||
*/
|
||||
mDockGutter: number = PhonePresetStyleConstants.DEFAULT_DOCK_GUTTER;
|
||||
|
||||
/**
|
||||
* save margin of dock
|
||||
*/
|
||||
mDockSaveMargin: number = PhonePresetStyleConstants.DEFAULT_DOCK_SAVE_MARGIN;
|
||||
|
||||
/**
|
||||
* margin bottom of dock
|
||||
*/
|
||||
mDockMarginBottom: number = PhonePresetStyleConstants.DEFAULT_DOCK_MARGIN_BOTTOM;
|
||||
|
||||
private constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* PhoneLauncherLayoutStyleConfig of instance
|
||||
*/
|
||||
static getInstance(): PhoneLauncherLayoutStyleConfig {
|
||||
if (globalThis.PhoneLauncherLayoutStyleConfigInstance == null) {
|
||||
globalThis.PhoneLauncherLayoutStyleConfigInstance = new PhoneLauncherLayoutStyleConfig();
|
||||
}
|
||||
return globalThis.PhoneLauncherLayoutStyleConfigInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import StyleConstants from './constants/StyleConstants';
|
||||
import PageDesktopGridStyleConfig from '../../../../../../../feature/pagedesktop/src/main/ets/default/common/PageDesktopGridStyleConfig';
|
||||
|
||||
/**
|
||||
* Phone定制网格样式配置类
|
||||
*/
|
||||
export default class PhonePageDesktopGridStyleConfig extends PageDesktopGridStyleConfig {
|
||||
/**
|
||||
* 样式配置索引
|
||||
*/
|
||||
private static sProductInstance: PhonePageDesktopGridStyleConfig | undefined;
|
||||
|
||||
/**
|
||||
* 图标大小
|
||||
*/
|
||||
mIconSize = StyleConstants.DEFAULT_APP_ICON_SIZE_WIDTH;
|
||||
|
||||
/**
|
||||
* 名称大小
|
||||
*/
|
||||
mNameSize = StyleConstants.DEFAULT_APP_NAME_SIZE;
|
||||
|
||||
/**
|
||||
* 名称高度
|
||||
*/
|
||||
mNameHeight = StyleConstants.DEFAULT_APP_NAME_HEIGHT;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工作空间样式实例
|
||||
*/
|
||||
static getInstance(): PhonePageDesktopGridStyleConfig {
|
||||
if (PhonePageDesktopGridStyleConfig.sProductInstance == undefined) {
|
||||
PhonePageDesktopGridStyleConfig.sProductInstance = new PhonePageDesktopGridStyleConfig();
|
||||
PhonePageDesktopGridStyleConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PhonePageDesktopGridStyleConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
|
||||
const phonePresetDockItem = [
|
||||
{
|
||||
itemType: CommonConstants.TYPE_APP,
|
||||
bundleName: 'com.ohos.contacts',
|
||||
abilityName: 'com.ohos.contacts.MainAbility',
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
itemType: CommonConstants.TYPE_APP,
|
||||
bundleName: 'com.ohos.photos',
|
||||
abilityName: 'com.ohos.photos.MainAbility',
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
itemType: CommonConstants.TYPE_APP,
|
||||
bundleName: 'com.ohos.settings',
|
||||
abilityName: 'com.ohos.settings.MainAbility',
|
||||
editable: true
|
||||
},
|
||||
{
|
||||
itemType: CommonConstants.TYPE_APP,
|
||||
bundleName: 'com.ohos.mms',
|
||||
abilityName: 'com.ohos.mms.MainAbility',
|
||||
editable: true
|
||||
}
|
||||
];
|
||||
|
||||
export default phonePresetDockItem;
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import SmartDockLayoutConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/SmartDockLayoutConfig';
|
||||
import phonePresetDockItem from './PhonePresetDockItem';
|
||||
|
||||
/**
|
||||
* Desktop Dock function layout configuration.
|
||||
*/
|
||||
export default class PadSmartDockLayoutConfig extends SmartDockLayoutConfig {
|
||||
private static sProductInstance: PadSmartDockLayoutConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
this.mDockLayoutInfo = phonePresetDockItem;
|
||||
}
|
||||
|
||||
static getInstance(): PadSmartDockLayoutConfig {
|
||||
if (PadSmartDockLayoutConfig.sProductInstance == undefined) {
|
||||
PadSmartDockLayoutConfig.sProductInstance = new PadSmartDockLayoutConfig();
|
||||
PadSmartDockLayoutConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PadSmartDockLayoutConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 SmartDockStyleConfig from '../../../../../../../feature/smartdock/src/main/ets/default/common/SmartDockStyleConfig';
|
||||
import CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
|
||||
/**
|
||||
* Dock style configuration class
|
||||
*/
|
||||
export default class PhoneSmartDockStyleConfig extends SmartDockStyleConfig {
|
||||
|
||||
/**
|
||||
* dock列表高度
|
||||
*/
|
||||
mDockHeight = 94;
|
||||
|
||||
/**
|
||||
* dock列表背景色
|
||||
*/
|
||||
mBackgroundColor = '#85FAFAFA';
|
||||
|
||||
/**
|
||||
* dock列表圆角值
|
||||
*/
|
||||
mDockRadius = 22;
|
||||
|
||||
/**
|
||||
* dock列表背景模糊度
|
||||
*/
|
||||
mBackdropBlur = 0;
|
||||
|
||||
/**
|
||||
* dock列表padding
|
||||
*/
|
||||
mDockPadding = 12;
|
||||
|
||||
/**
|
||||
* dock列表margin
|
||||
*/
|
||||
mDockMargin = 10;
|
||||
|
||||
/**
|
||||
* 列表条目宽度
|
||||
*/
|
||||
mListItemWidth = 70;
|
||||
|
||||
/**
|
||||
* 列表条目高度
|
||||
*/
|
||||
mListItemHeight = 70;
|
||||
|
||||
/**
|
||||
* 列表条目间距
|
||||
*/
|
||||
mListItemGap = 60;
|
||||
|
||||
/**
|
||||
* 列表图标大小
|
||||
*/
|
||||
mIconSize = 70;
|
||||
|
||||
/**
|
||||
* 常驻区最大显示数量
|
||||
*/
|
||||
mMaxDockNum = 5;
|
||||
|
||||
private static sProductInstance: PhoneSmartDockStyleConfig | undefined;
|
||||
|
||||
protected constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
static getInstance(): PhoneSmartDockStyleConfig {
|
||||
if (PhoneSmartDockStyleConfig.sProductInstance == undefined) {
|
||||
PhoneSmartDockStyleConfig.sProductInstance = new PhoneSmartDockStyleConfig();
|
||||
PhoneSmartDockStyleConfig.sProductInstance.initConfig();
|
||||
}
|
||||
return PhoneSmartDockStyleConfig.sProductInstance;
|
||||
}
|
||||
|
||||
getConfigLevel(): string {
|
||||
return CommonConstants.LAYOUT_CONFIG_LEVEL_PRODUCT;
|
||||
}
|
||||
}
|
68
product/phone/src/main/ets/MainAbility/common/PhoneStage.ts
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 BaseStage from '../../../../../../../common/src/main/ets/default/base/BaseStage';
|
||||
import appCenterPreLoader from '../../../../../../../feature/appcenter/src/main/ets/default/common/AppCenterPreLoader';
|
||||
import bigFolderPreLoader from '../../../../../../../feature/bigfolder/src/main/ets/default/common/BigFolderPreLoader';
|
||||
import smartDockPreLoader from '../../../../../../../feature/smartdock/src/main/ets/default/common/SmartDockPreLoader';
|
||||
import pageDesktopPreLoader from '../../../../../../../feature/pagedesktop/src/main/ets/default/common/PageDesktopPreLoader';
|
||||
import LayoutConfigManager from '../../../../../../../common/src/main/ets/default/layoutconfig/LayoutConfigManager';
|
||||
import PhoneSmartDockStyleConfig from './PhoneSmartDockStyleConfig';
|
||||
import PhoneSmartDockLayoutConfig from './PhoneSmartDockLayoutConfig';
|
||||
import PhonePageDesktopGridStyleConfig from './PhonePageDesktopGridStyleConfig';
|
||||
import PhoneFolderLayoutConfig from './PhoneFolderLayoutConfig';
|
||||
import launcherLayoutPreLoader from '../../../../../../../feature/launcherlayout/src/main/ets/default/common/LauncherLayoutPreLoader';
|
||||
import formPreLoader from '../../../../../../../feature/form/src/main/ets/default/common/FormPreLoader';
|
||||
import PhoneLauncherLayoutConfig from './PhoneLauncherLayoutStyleConfig';
|
||||
|
||||
/**
|
||||
* phone产品形态Stage
|
||||
*/
|
||||
export default class PhoneStage extends BaseStage {
|
||||
/**
|
||||
* Stage启动时的回调
|
||||
*/
|
||||
onCreate(): void {
|
||||
super.onCreate();
|
||||
smartDockPreLoader.load();
|
||||
appCenterPreLoader.load();
|
||||
pageDesktopPreLoader.load();
|
||||
bigFolderPreLoader.load();
|
||||
launcherLayoutPreLoader.load();
|
||||
formPreLoader.load();
|
||||
this.initPhoneConfig();
|
||||
}
|
||||
|
||||
private initPhoneConfig(): void {
|
||||
LayoutConfigManager.addConfigToManager(PhoneSmartDockStyleConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PhoneSmartDockLayoutConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PhonePageDesktopGridStyleConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PhoneFolderLayoutConfig.getInstance());
|
||||
LayoutConfigManager.addConfigToManager(PhoneLauncherLayoutConfig.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage退出时回调
|
||||
*/
|
||||
onDestroy(): void {
|
||||
super.onDestroy();
|
||||
smartDockPreLoader.releaseConfigAndData();
|
||||
appCenterPreLoader.releaseConfigAndData();
|
||||
pageDesktopPreLoader.releaseConfigAndData();
|
||||
bigFolderPreLoader.releaseConfigAndData();
|
||||
launcherLayoutPreLoader.releaseConfigAndData();
|
||||
formPreLoader.releaseConfigAndData();
|
||||
}
|
||||
}
|
@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const DefaultLayoutConfig = {
|
||||
DefaultAppPageStartConfig: 'Grid',
|
||||
}
|
||||
const defaultLayoutConfig = {
|
||||
defaultAppPageStartConfig: 'Grid',
|
||||
};
|
||||
|
||||
export default DefaultLayoutConfig;
|
||||
export default defaultLayoutConfig;
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
const phoneFolderLayoutInfo = {
|
||||
folderLayoutTable:
|
||||
{
|
||||
id: 0,
|
||||
layout: '3X3',
|
||||
name: '3X3',
|
||||
row: 3,
|
||||
column: 3,
|
||||
area: [2, 2],
|
||||
checked: false
|
||||
},
|
||||
folderOpenLayoutTable:
|
||||
{
|
||||
id: 1,
|
||||
layout: '4X3',
|
||||
name: '4X3',
|
||||
row: 4,
|
||||
column: 3,
|
||||
checked: false
|
||||
},
|
||||
folderAddAppLayoutTable:
|
||||
{
|
||||
id: 2,
|
||||
layout: '6X4',
|
||||
name: '6X4',
|
||||
row: 6,
|
||||
column: 4,
|
||||
checked: false
|
||||
}
|
||||
};
|
||||
|
||||
export default phoneFolderLayoutInfo;
|
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
const phoneFormLayoutInfo = {
|
||||
formLayoutDimension1X2:
|
||||
{
|
||||
id: 0,
|
||||
layout: '1X2',
|
||||
name: '1X2',
|
||||
row: 1,
|
||||
column: 2,
|
||||
area: [1, 2],
|
||||
checked: false
|
||||
},
|
||||
formLayoutDimension2X2:
|
||||
{
|
||||
id: 1,
|
||||
layout: '2X2',
|
||||
name: '2X2',
|
||||
row: 2,
|
||||
column: 2,
|
||||
checked: false
|
||||
},
|
||||
formLayoutDimension2X4:
|
||||
{
|
||||
id: 2,
|
||||
layout: '2X4',
|
||||
name: '2X4',
|
||||
row: 2,
|
||||
column: 4,
|
||||
checked: false
|
||||
},
|
||||
formLayoutDimension4X4:
|
||||
{
|
||||
id: 3,
|
||||
layout: '4X4',
|
||||
name: '4X4',
|
||||
row: 4,
|
||||
column: 4,
|
||||
checked: false
|
||||
}
|
||||
};
|
||||
|
||||
export default phoneFormLayoutInfo;
|
@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 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.
|
||||
*/
|
||||
export default class PhonePresetStyleConstants {
|
||||
//----------- desktop layout-------------
|
||||
/**
|
||||
* desktop item size
|
||||
*/
|
||||
static readonly DEFAULT_APP_LAYOUT_SIZE = 120;
|
||||
/**
|
||||
* desktop container margin
|
||||
*/
|
||||
static readonly DEFAULT_LAYOUT_MARGIN = 19.5;
|
||||
/**
|
||||
* desktop container minimum gutter
|
||||
*/
|
||||
static readonly DEFAULT_APP_LAYOUT_MIN_GUTTER = 7;
|
||||
//----------- desktop icon-------------
|
||||
/**
|
||||
* desktop item padding top
|
||||
*/
|
||||
static readonly DEFAULT_APP_TOP_RATIO = 0.01;
|
||||
/**
|
||||
* desktop item name lines
|
||||
*/
|
||||
static readonly DEFAULT_APP_NAME_LINES = 1;
|
||||
/**
|
||||
* desktop item name size
|
||||
*/
|
||||
static readonly DEFAULT_APP_NAME_TEXT_SIZE = 18;
|
||||
/**
|
||||
* desktop item icon and name gap
|
||||
*/
|
||||
static readonly DEFAULT_ICON_NAME_GAP = 6;
|
||||
/**
|
||||
* desktop icon name height
|
||||
*/
|
||||
static readonly DEFAULT_DESKTOP_NAME_HEIGHT = 24;
|
||||
//----------- desktop folder-----------
|
||||
/**
|
||||
* folder gutter with container size
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_GUTTER_RATIO = 0.043;
|
||||
/**
|
||||
* folder padding with container size
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_PADDING_RATIO = 0.07;
|
||||
//----------- desktop open --------------
|
||||
/**
|
||||
* gutter of open folder
|
||||
*/
|
||||
static readonly DEFAULT_OPEN_FOLDER_GUTTER = 15;
|
||||
/**
|
||||
* padding of open folder
|
||||
*/
|
||||
static readonly DEFAULT_OPEN_FOLDER_PADDING = 18;
|
||||
/**
|
||||
* margin top of open folder
|
||||
*/
|
||||
static readonly DEFAULT_OPEN_FOLDER_MARGIN_TOP = 214;
|
||||
//----------- folder add list ------------------
|
||||
/**
|
||||
* max height of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_MAX_HEIGHT = 0.8;
|
||||
/**
|
||||
* margin of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_MARGIN = 18;
|
||||
/**
|
||||
* gutter of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_GAP = 12;
|
||||
/**
|
||||
* toggle of item
|
||||
*/
|
||||
static readonly DEFAULT_APP_GRID_TOGGLE_SIZE = 24;
|
||||
/**
|
||||
* icon padding of item with item size
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_ICON_TOP_RATIO = 0.075;
|
||||
/**
|
||||
* name size of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_GRID_TEXT_SIZE = 18;
|
||||
/**
|
||||
* title size of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_TITLE_TEXT_SIZE = 30;
|
||||
/**
|
||||
* name lines of item
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_TEXT_LINES = 1;
|
||||
/**
|
||||
* button size of container
|
||||
*/
|
||||
static readonly DEFAULT_FOLDER_ADD_BUTTON_SIZE = 24;
|
||||
//----------- app center--------------
|
||||
/**
|
||||
* margin left of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_MARGIN = 215;
|
||||
/**
|
||||
* gutter of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_GUTTER = 18;
|
||||
/**
|
||||
* item size of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_SIZE = 106;
|
||||
/**
|
||||
* icon padding top with item size
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_TOP_RATIO = 0.01;
|
||||
/**
|
||||
* name lines of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_NAME_LINES = 2;
|
||||
/**
|
||||
* name size of app center
|
||||
*/
|
||||
static readonly DEFAULT_APP_CENTER_NAME_TEXT_SIZE = 18;
|
||||
//----------- dock----------------
|
||||
/**
|
||||
* icon size of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_ICON_SIZE = 75;
|
||||
/**
|
||||
* padding of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_PADDING = 21;
|
||||
/**
|
||||
* gap of dock container
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_ITEM_GAP = 55;
|
||||
/**
|
||||
* gap with resident and recent
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_GUTTER = 18;
|
||||
/**
|
||||
* save margin of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_SAVE_MARGIN = 16;
|
||||
/**
|
||||
* margin bottom of dock
|
||||
*/
|
||||
static readonly DEFAULT_DOCK_MARGIN_BOTTOM = 27;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
|
||||
export default class StyleConstants {
|
||||
static readonly DEFAULT_BACKGROUND_IMAGE = '/common/pics/img_wallpaper_default.jpg';
|
||||
static readonly DEFAULT_APP_ICON_SIZE_WIDTH = 70;
|
||||
static readonly DEFAULT_APP_NAME_SIZE = 20;
|
||||
static readonly DEFAULT_APP_NAME_HEIGHT = 95;
|
||||
}
|
After Width: | Height: | Size: 3.7 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_add</title>
|
||||
<defs>
|
||||
<path d="M12.75,21.25 C12.75,21.6642136 12.4142136,22 12,22 C11.5857864,22 11.25,21.6642136 11.25,21.25 L11.25,12.75 L2.75,12.75 C2.33578644,12.75 2,12.4142136 2,12 C2,11.5857864 2.33578644,11.25 2.75,11.25 L11.25,11.25 L11.25,2.75 C11.25,2.33578644 11.5857864,2 12,2 C12.4142136,2 12.75,2.33578644 12.75,2.75 L12.75,21.25 Z M21.25,11.25 C21.6642136,11.25 22,11.5857864 22,12 C22,12.4142136 21.6642136,12.75 21.25,12.75 L13.75,12.75 L13.75,11.25 L21.25,11.25 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_add" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 9.2 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_copy</title>
|
||||
<defs>
|
||||
<path d="M15.0132009,4.5 C16.5733587,4.5 17.1391096,4.66244482 17.70948,4.96748223 C18.2798504,5.27251964 18.7274804,5.72014965 19.0325178,6.29052002 L19.1342249,6.49326214 C19.3735291,7.00777167 19.5,7.61018928 19.5,8.9867991 L19.5,17.5132009 C19.5,19.0733587 19.3375552,19.6391096 19.0325178,20.20948 C18.7274804,20.7798504 18.2798504,21.2274804 17.70948,21.5325178 L17.5067379,21.6342249 C16.9922283,21.8735291 16.3898107,22 15.0132009,22 L6.4867991,22 C4.92664131,22 4.36089039,21.8375552 3.79052002,21.5325178 C3.22014965,21.2274804 2.77251964,20.7798504 2.46748223,20.20948 L2.36577509,20.0067379 C2.12647088,19.4922283 2,18.8898107 2,17.5132009 L2,8.9867991 C2,7.42664131 2.16244482,6.86089039 2.46748223,6.29052002 C2.77251964,5.72014965 3.22014965,5.27251964 3.79052002,4.96748223 L3.99326214,4.86577509 C4.47347103,4.64242449 5.03025764,4.51736427 6.22159636,4.50168224 L15.0132009,4.5 Z M6.4867991,6 C5.29081707,6 4.8991107,6.07564199 4.49791831,6.29020203 C4.18895065,6.45543974 3.95543974,6.68895065 3.79020203,6.99791831 L3.71163699,7.15981826 C3.56872488,7.49032199 3.50932077,7.88419566 3.50102731,8.75808525 L3.5,17.5132009 C3.5,18.7091829 3.57564199,19.1008893 3.79020203,19.5020817 C3.95543974,19.8110494 4.18895065,20.0445603 4.49791831,20.209798 L4.65981826,20.288363 C4.99032199,20.4312751 5.38419566,20.4906792 6.25808525,20.4989727 L6.4867991,20.5 L15.0132009,20.5 L15.4506279,20.4958158 C16.3138066,20.4773591 16.6543816,20.39575 17.0020817,20.209798 C17.3110494,20.0445603 17.5445603,19.8110494 17.709798,19.5020817 L17.788363,19.3401817 C17.9312751,19.009678 17.9906792,18.6158043 17.9989727,17.7419147 L18,17.5132009 L18,8.9867991 L17.9958158,8.54937207 C17.9773591,7.6861934 17.89575,7.34561838 17.709798,6.99791831 C17.5445603,6.68895065 17.3110494,6.45543974 17.0020817,6.29020203 L16.8401817,6.21163699 C16.509678,6.06872488 16.1158043,6.00932077 15.2419147,6.00102731 L6.4867991,6 Z M15.590287,2 C17.8190838,2 18.6272994,2.23206403 19.4421143,2.66783176 C20.2569291,3.10359949 20.8964005,3.74307093 21.3321682,4.55788574 C21.767936,5.37270056 22,6.18091615 22,8.409713 L22,14.3722296 C22,16.1552671 21.8143488,16.8018396 21.4657346,17.4536914 C21.2202776,17.9126561 20.8940321,18.3020799 20.4949174,18.6140435 C20.4981214,18.4695118 20.5,18.316606 20.5,18.1541722 L20.5,8.3458278 C20.5,6.97563815 20.3663256,6.28341544 19.9811141,5.56313259 C19.6264537,4.89997522 19.1000248,4.3735463 18.4368674,4.01888586 C17.7646034,3.65935514 17.1167829,3.51894119 15.9193798,3.50181725 L5.8458278,3.5 C5.68310622,3.5 5.5299464,3.50188529 5.38516578,3.50585327 C5.69792007,3.10596794 6.0873439,2.77972241 6.54630859,2.53426541 C7.19816044,2.18565122 7.84473292,2 9.6277704,2 L15.590287,2 Z M10.75,8.25 C11.1642136,8.25 11.5,8.58578644 11.5,9 L11.5,17.5 C11.5,17.9142136 11.1642136,18.25 10.75,18.25 C10.3357864,18.25 10,17.9142136 10,17.5 L10,14 L6.5,14 C6.08578644,14 5.75,13.6642136 5.75,13.25 C5.75,12.8357864 6.08578644,12.5 6.5,12.5 L10,12.5 L10,9 C10,8.58578644 10.3357864,8.25 10.75,8.25 Z M15,12.5 C15.4142136,12.5 15.75,12.8357864 15.75,13.25 C15.75,13.6642136 15.4142136,14 15,14 L12.5,14 L12.5,12.5 L15,12.5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_copy" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_delete</title>
|
||||
<defs>
|
||||
<path d="M5.629,7.5 L6.72612901,18.4738834 C6.83893748,19.6019681 7.77211147,20.4662096 8.89848718,20.4990325 L8.96496269,20.5 L15.0342282,20.5 C16.1681898,20.5 17.1211231,19.6570911 17.2655686,18.5392856 L17.2731282,18.4732196 L18.1924161,9.2527383 L18.369,7.5 L19.877,7.5 L19.6849078,9.40262938 L18.7657282,18.6220326 C18.5772847,20.512127 17.0070268,21.9581787 15.1166184,21.9991088 L15.0342282,22 L8.96496269,22 C7.06591715,22 5.47142703,20.5815579 5.24265599,18.7050136 L5.23357322,18.6231389 L4.121,7.5 L5.629,7.5 Z M10.25,11.75 C10.6642136,11.75 11,12.0857864 11,12.5 L11,18.5 C11,18.9142136 10.6642136,19.25 10.25,19.25 C9.83578644,19.25 9.5,18.9142136 9.5,18.5 L9.5,12.5 C9.5,12.0857864 9.83578644,11.75 10.25,11.75 Z M13.75,11.75 C14.1642136,11.75 14.5,12.0857864 14.5,12.5 L14.5,18.5 C14.5,18.9142136 14.1642136,19.25 13.75,19.25 C13.3357864,19.25 13,18.9142136 13,18.5 L13,12.5 C13,12.0857864 13.3357864,11.75 13.75,11.75 Z M12,1.75 C13.7692836,1.75 15.2083571,3.16379796 15.2491124,4.92328595 L15.25,5 L21,5 C21.4142136,5 21.75,5.33578644 21.75,5.75 C21.75,6.14942022 21.43777,6.47591522 21.0440682,6.49872683 L21,6.5 L14.5,6.5 C14.1005798,6.5 13.7740848,6.18777001 13.7512732,5.7940682 L13.75,5.75 L13.75,5 C13.75,4.03350169 12.9664983,3.25 12,3.25 C11.0536371,3.25 10.2827253,4.00119585 10.2510148,4.93983756 L10.25,5 L10.25,5.75 C10.25,6.14942022 9.93777001,6.47591522 9.5440682,6.49872683 L9.5,6.5 L2.75,6.5 C2.33578644,6.5 2,6.16421356 2,5.75 C2,5.35057978 2.31222999,5.02408478 2.7059318,5.00127317 L2.75,5 L8.75,5 C8.75,3.20507456 10.2050746,1.75 12,1.75 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_delete" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_edit</title>
|
||||
<defs>
|
||||
<path d="M16.8722296,2 C17.8721999,2 18.5147251,2.05839169 19.0012003,2.17117304 L17.6599443,3.51379911 C17.4862664,3.50652642 17.2928183,3.5022817 17.0753381,3.50070655 L7.02453833,3.50017541 L6.82305804,3.501658 C5.6550816,3.5151767 5.20981608,3.61305534 4.75370688,3.8569852 C4.36325774,4.06579969 4.06579969,4.36325774 3.8569852,4.75370688 C3.59290159,5.24750032 3.5,5.72858421 3.5,7.1277704 L3.50017541,16.9754617 L3.501658,17.176942 C3.5151767,18.3449184 3.61305534,18.7901839 3.8569852,19.2462931 C4.06579969,19.6367423 4.36325774,19.9342003 4.75370688,20.1430148 C5.22281064,20.3938942 5.68044405,20.4902819 6.92466189,20.4992935 L16.8722296,20.5 C18.2714158,20.5 18.7524997,20.4070984 19.2462931,20.1430148 C19.6367423,19.9342003 19.9342003,19.6367423 20.1430148,19.2462931 C20.3938942,18.7771894 20.4902819,18.319556 20.4992935,17.0753381 L20.5,16.8722296 L20.5,7.1277704 C20.5,6.82616011 20.4956832,6.56721095 20.4862654,6.34159954 L21.8289375,4.9992768 C21.9416465,5.48569497 22,6.12812696 22,7.1277704 L22,16.8722296 L21.9989932,17.0937657 C21.9842401,18.674381 21.8076257,19.3015622 21.487765,19.91208 L21.4657346,19.9536914 C21.1337211,20.5745027 20.6538954,21.0680807 20.0458564,21.4148264 L19.9536914,21.4657346 C19.3018396,21.8143488 18.6552671,22 16.8722296,22 L7.1277704,22 L6.90623426,21.9989932 C5.32561899,21.9842401 4.69843783,21.8076257 4.08791999,21.487765 L4.04630859,21.4657346 C3.42549731,21.1337211 2.93191931,20.6538954 2.58517358,20.0458564 L2.53426541,19.9536914 C2.18565122,19.3018396 2,18.6552671 2,16.8722296 L2,7.1277704 C2,5.38266989 2.17783521,4.72618864 2.51223497,4.08791999 L2.53426541,4.04630859 C2.86627892,3.42549731 3.34610464,2.93191931 3.9541436,2.58517358 L4.04630859,2.53426541 C4.69816044,2.18565122 5.34473292,2 7.1277704,2 L16.8722296,2 Z M22.2300776,1.76992245 C22.6206018,2.16044674 22.6206018,2.79361172 22.2300776,3.18413601 L12.684136,12.7300776 C12.2936117,13.1206018 11.6604467,13.1206018 11.2699224,12.7300776 C10.8793982,12.3395533 10.8793982,11.7063883 11.2699224,11.315864 L20.815864,1.76992245 C21.2063883,1.37939815 21.8395533,1.37939815 22.2300776,1.76992245 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_edit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<g id="形状结合" fill-rule="nonzero"></g>
|
||||
<g id="Group" mask="url(#mask-2)" fill="#000000" fill-opacity="0.9">
|
||||
<g id="color/#000000">
|
||||
<rect x="0" y="0" width="24" height="24"></rect>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.8 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_lock</title>
|
||||
<defs>
|
||||
<path d="M12,2 C14.3202308,2 16.206199,3.85929891 16.249248,6.16924008 L16.25,6.25 L16.25,9 L16.5,9 C18.1568542,9 19.5,10.3431458 19.5,12 L19.5,18.5 C19.5,20.1568542 18.1568542,21.5 16.5,21.5 L7.5,21.5 C5.84314575,21.5 4.5,20.1568542 4.5,18.5 L4.5,12 C4.5,10.3431458 5.84314575,9 7.5,9 L7.75,9 L7.75,6.25 C7.75,3.90278981 9.65278981,2 12,2 Z M16.5,10.5 L7.5,10.5 C6.69040076,10.5 6.03060706,11.1413937 6.00103462,11.9437654 L6,12 L6,18.5 C6,19.3095992 6.64139372,19.9693929 7.44376543,19.9989654 L7.5,20 L16.5,20 C17.3095992,20 17.9693929,19.3586063 17.9989654,18.5562346 L18,18.5 L18,12 C18,11.1904008 17.3586063,10.5306071 16.5562346,10.5010346 L16.5,10.5 Z M12,13.25 C13.1045695,13.25 14,14.1454305 14,15.25 C14,16.3545695 13.1045695,17.25 12,17.25 C10.8954305,17.25 10,16.3545695 10,15.25 C10,14.1454305 10.8954305,13.25 12,13.25 Z M12,3.5 C10.5053246,3.5 9.28915871,4.69244089 9.25092685,6.17789813 L9.25,9 L14.75,9 L14.75,6.25 C14.75,4.73121694 13.5187831,3.5 12,3.5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_lock" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="none">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#ffffff" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_remove</title>
|
||||
<defs>
|
||||
<path d="M12,1 C18.0751322,1 23,5.92486775 23,12 C23,18.0751322 18.0751322,23 12,23 C5.92486775,23 1,18.0751322 1,12 C1,5.92486775 5.92486775,1 12,1 Z M12,2.5 C6.75329488,2.5 2.5,6.75329488 2.5,12 C2.5,17.2467051 6.75329488,21.5 12,21.5 C17.2467051,21.5 21.5,17.2467051 21.5,12 C21.5,6.75329488 17.2467051,2.5 12,2.5 Z M17.25,11.25 C17.6642136,11.25 18,11.5857864 18,12 C18,12.4142136 17.6642136,12.75 17.25,12.75 L6.75,12.75 C6.33578644,12.75 6,12.4142136 6,12 C6,11.5857864 6.33578644,11.25 6.75,11.25 L17.25,11.25 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_remove" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>ic_rename</title>
|
||||
<defs>
|
||||
<path d="M10,21.75 C9.58578644,21.75 9.25,21.4142136 9.25,21 C9.25,20.6203042 9.53215388,20.306509 9.89822944,20.2568466 L10,20.25 L11.25,20.25 L11.25,3.75 L10,3.75 C9.58578644,3.75 9.25,3.41421356 9.25,3 C9.25,2.62030423 9.53215388,2.30650904 9.89822944,2.25684662 L10,2.25 L14,2.25 C14.4142136,2.25 14.75,2.58578644 14.75,3 C14.75,3.37969577 14.4678461,3.69349096 14.1017706,3.74315338 L14,3.75 L12.75,3.75 L12.75,20.25 L14,20.25 C14.4142136,20.25 14.75,20.5857864 14.75,21 C14.75,21.3796958 14.4678461,21.693491 14.1017706,21.7431534 L14,21.75 L10,21.75 Z M10.5,5 L10.5,6.5 L6,6.5 C4.6745166,6.5 3.58996133,7.53153594 3.50531768,8.83562431 L3.5,9 L3.5,15 C3.5,16.3254834 4.53153594,17.4100387 5.83562431,17.4946823 L6,17.5 L10.5,17.5 L10.5,19 L6,19 C3.790861,19 2,17.209139 2,15 L2,9 C2,6.790861 3.790861,5 6,5 L10.5,5 Z M18,5 C20.209139,5 22,6.790861 22,9 L22,15 C22,17.209139 20.209139,19 18,19 L13.5,19 L13.5,17.5 L18,17.5 C19.3254834,17.5 20.4100387,16.4684641 20.4946823,15.1643757 L20.5,15 L20.5,9 C20.5,7.6745166 19.4684641,6.58996133 18.1643757,6.50531768 L18,6.5 L13.5,6.5 L13.5,5 L18,5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="ic_rename" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 239 KiB |
BIN
product/phone/src/main/ets/MainAbility/common/pics/icon.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
After Width: | Height: | Size: 1.2 MiB |
56
product/phone/src/main/ets/MainAbility/common/recentEvent.ts
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 commonEvent from '@ohos.commonEvent';
|
||||
import { CommonEventSubscribeInfo } from 'commonEvent/commonEventSubscribeInfo';
|
||||
import { CommonEventData } from 'commonEvent/commonEventData';
|
||||
import { BusinessError } from 'basic';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
|
||||
const TAG = 'RecentEvent';
|
||||
|
||||
const commonEventSubscribeInfo: CommonEventSubscribeInfo = {
|
||||
events: ['CREATE_RECENT_WINDOW_EVENT']
|
||||
};
|
||||
|
||||
let commonEventSubscriber: CommonEventData | null = null;
|
||||
|
||||
class RecentEvent {
|
||||
mCallback: Record<string, () => void> = {};
|
||||
|
||||
registerCallback(callback: Record<string, () => void>): void {
|
||||
Log.showInfo(TAG, 'registerCallback');
|
||||
this.mCallback = callback;
|
||||
if (commonEventSubscriber == null) {
|
||||
void commonEvent.createSubscriber(commonEventSubscribeInfo, this.createRecentCallBack.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
private createRecentCallBack(error: BusinessError, data: CommonEventData): void {
|
||||
Log.showInfo(TAG, `createRecentCallBack error: ${JSON.stringify(error)} data: ${JSON.stringify(data)}`);
|
||||
commonEventSubscriber = data;
|
||||
commonEvent.subscribe(data, (error, data) => {
|
||||
Log.showInfo(TAG, `subscribe error: ${JSON.stringify(error)} data: ${JSON.stringify(data)}`);
|
||||
if (error.code == 0) {
|
||||
this.mCallback.onStateChange();
|
||||
} else {
|
||||
Log.showError(TAG, 'data is error');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const recentEvent = new RecentEvent();
|
||||
export default recentEvent;
|
139
product/phone/src/main/ets/MainAbility/pages/EntryView.ets
Normal file
@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 windowManager from '../../../../../../../common/src/main/ets/default/manager/WindowManager';
|
||||
import RdbStoreManager from '../../../../../../../common/src/main/ets/default/manager/RdbStoreManager';
|
||||
import LayoutConfigManager from '../../../../../../../common/src/main/ets/default/layoutconfig/LayoutConfigManager';
|
||||
import SmartDock from '../../../../../../../feature/smartdock/src/main/ets/default/layout/SmartDock.ets';
|
||||
import CommonConstants from '../../../../../../../common/src/main/ets/default/constants/CommonConstants';
|
||||
import PageDesktopLayout from '../../../../../../../feature/pagedesktop/src/main/ets/default/layout/PageDesktopLayout.ets';
|
||||
import AppListLayout from '../../../../../../../feature/appcenter/src/main/ets/default/layout/AppListLayout.ets';
|
||||
import CustomOverlay from '../../../../../../../common/src/main/ets/default/uicomponents/CustomOverlay.ets';
|
||||
import PageDesktopModeConfig from '../../../../../../../common/src/main/ets/default/layoutconfig/PageDesktopModeConfig';
|
||||
import PhoneStage from '../common/PhoneStage';
|
||||
import StyleConstants from '../common/constants/StyleConstants';
|
||||
import FolderOpenComponent from '../../../../../../../feature/bigfolder/src/main/ets/default/view/FolderOpenComponent.ets';
|
||||
import FeatureConstants from '../../../../../../../feature/bigfolder/src/main/ets/default/common/constants/FeatureConstants';
|
||||
import LayoutViewModel from '../../../../../../../feature/launcherlayout/src/main/ets/default/common/viewmodel/LayoutViewModel';
|
||||
import AppBadgeMessage from '../../../../../../../common/src/main/ets/default/bean/AppBadgeMessage';
|
||||
import BadgeManager from '../../../../../../../common/src/main/ets/default/manager/BadgeManager';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import RecentEvent from '../common/recentEvent';
|
||||
|
||||
const TAG = "EntryView";
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct LayoutManager {
|
||||
@StorageLink('AppPageStartConfig') mAppPageStartConfig: string = '';
|
||||
@State workSpaceWidth: number = 0;
|
||||
@State workSpaceHeight: number = 0;
|
||||
@State dockHeight: number = 0;
|
||||
@State indicatorHeight: number = 0;
|
||||
@State device: string = 'phone';
|
||||
private mStage: PhoneStage = new PhoneStage();
|
||||
private mLayoutViewModel: LayoutViewModel;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mStage.onCreate();
|
||||
let dbStore = RdbStoreManager.getInstance();
|
||||
dbStore.initRdbConfig();
|
||||
AppStorage.SetOrCreate('dockDevice', this.device);
|
||||
this.mLayoutViewModel = LayoutViewModel.getInstance();
|
||||
this.updateScreenSize();
|
||||
// ServiceExtension can't access callee.
|
||||
// globalThis.callee.on(BadgeManager.UPDATE_BADGE, this.updateBadge);
|
||||
let mCallback: Record<string, () => void> = {
|
||||
"onStateChange": () => this.createRecent()
|
||||
};
|
||||
RecentEvent.registerCallback(mCallback);
|
||||
}
|
||||
|
||||
private createRecent(): void {
|
||||
Log.showInfo(TAG, 'receive Subscriber success');
|
||||
globalThis.createRecentWindow();
|
||||
}
|
||||
|
||||
private updateBadge(badgeData): AppBadgeMessage {
|
||||
Log.showInfo(TAG, 'updateBadge is calld');
|
||||
let badgeMsg = new AppBadgeMessage(CommonConstants.INVALID_VALUE, '');
|
||||
badgeData.readSequenceable(badgeMsg);
|
||||
Log.showInfo(TAG, `updateBadge is called, badgeMsg.badge:${badgeMsg.badge}, badgeMsg.bundleName:${badgeMsg.bundleName}`);
|
||||
BadgeManager.getInstance().updateBadgeNumber(badgeMsg.bundleName, badgeMsg.badge);
|
||||
return new AppBadgeMessage(0, 'update badge success');
|
||||
}
|
||||
|
||||
private async updateScreenSize(): Promise<void> {
|
||||
let screenWidth = await windowManager.getWindowWidth();
|
||||
let screenHeight = await windowManager.getWindowHeight();
|
||||
this.mLayoutViewModel.calculate(this.device, screenWidth, screenHeight);
|
||||
this.workSpaceHeight = this.mLayoutViewModel.getWorkSpaceHeight();
|
||||
this.dockHeight = this.mLayoutViewModel.getDockHeight();
|
||||
this.indicatorHeight = this.mLayoutViewModel.getIndicator();
|
||||
AppStorage.SetOrCreate('screenWidth', screenWidth);
|
||||
AppStorage.SetOrCreate('screenHeight', screenHeight);
|
||||
AppStorage.SetOrCreate('systemUiHeght', CommonConstants.PHONE_SYSTEM_UI_HEIGHT);
|
||||
Log.showInfo(TAG, `updateScreenSize product: ${this.device}, screenWidth: ${screenWidth}
|
||||
, screenHeight: ${screenHeight}, systemUiHeght: ${CommonConstants.PHONE_SYSTEM_UI_HEIGHT}`);
|
||||
this.workSpaceWidth = screenWidth;
|
||||
AppStorage.SetOrCreate('workSpaceWidth', this.workSpaceWidth);
|
||||
AppStorage.SetOrCreate('workSpaceHeight', this.workSpaceHeight);
|
||||
}
|
||||
|
||||
private aboutToDisappear(): void {
|
||||
this.mStage.onDestroy();
|
||||
}
|
||||
|
||||
onPageShow(): void {
|
||||
Log.showInfo(TAG, 'onPageShow');
|
||||
this.mAppPageStartConfig = LayoutConfigManager.getModeConfig<PageDesktopModeConfig>(PageDesktopModeConfig.DESKTOP_MODE_CONFIG).getAppStartPageType();
|
||||
}
|
||||
|
||||
private onBackPress(): void {
|
||||
ContextMenu.close();
|
||||
AppStorage.SetOrCreate('dialogControllerStatus', !AppStorage.Get('dialogControllerStatus'));
|
||||
AppStorage.SetOrCreate('overlayMode', CommonConstants.OVERLAY_TYPE_HIDE);
|
||||
AppStorage.SetOrCreate('openFolderStatus', FeatureConstants.OPEN_FOLDER_STATUS_CLOSE);
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
|
||||
if (this.mAppPageStartConfig === 'Grid') {
|
||||
Column() {
|
||||
PageDesktopLayout({
|
||||
device: this.device
|
||||
});
|
||||
}
|
||||
.height(this.workSpaceHeight)
|
||||
Column() {
|
||||
}.height(this.indicatorHeight)
|
||||
Column() {
|
||||
SmartDock()
|
||||
}
|
||||
.height(this.dockHeight)
|
||||
} else {
|
||||
AppListLayout();
|
||||
}
|
||||
}
|
||||
FolderOpenComponent()
|
||||
CustomOverlay()
|
||||
}
|
||||
.backgroundImage(StyleConstants.DEFAULT_BACKGROUND_IMAGE)
|
||||
.backgroundImageSize(ImageSize.Cover)
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 router from '@system.router';
|
||||
import PhoneStage from '../common/PhoneStage';
|
||||
import FormMgrTitleComponent from '../../../../../../../feature/form/src/main/ets/default/common/uicomponents/FormMgrTitleComponent.ets';
|
||||
import FormMgrSwiperComponent from '../../../../../../../feature/form/src/main/ets/default/common/uicomponents/FormMgrSwiperComponent.ets';
|
||||
import FormMgrBottomComponent from '../../../../../../../feature/form/src/main/ets/default/common/uicomponents/FormMgrBottomComponent.ets';
|
||||
import StyleConstants from '../../../../../../../feature/form/src/main/ets/default/common/constants/StyleConstants';
|
||||
|
||||
async function routeEntryView() {
|
||||
let options = {
|
||||
uri: 'pages/EntryView'
|
||||
}
|
||||
try {
|
||||
await router.push(options);
|
||||
} catch (err) {
|
||||
console.error(`fail callback, code: ${err.code}, msg: ${err.msg}`);
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct FormManagerView {
|
||||
private mStage: PhoneStage = new PhoneStage();
|
||||
private mFormInfo: Object = {};
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mStage.onCreate();
|
||||
this.mFormInfo = router.getParams();
|
||||
}
|
||||
|
||||
private aboutToDisappear(): void {
|
||||
this.mStage.onDestroy();
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
Image(StyleConstants.DEFAULT_FORM_MGR_BACK_IMAGE)
|
||||
.width(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.height(StyleConstants.FORM_MGR_TOP_HEIGHT_PERCENTAGE)
|
||||
.align(Alignment.Bottom)
|
||||
}.alignItems(HorizontalAlign.Center)
|
||||
.height(StyleConstants.FORM_MGR_TOP_HEIGHT_PERCENTAGE)
|
||||
.onClick(() => {
|
||||
routeEntryView();
|
||||
})
|
||||
FormMgrTitleComponent({mFormMgrTitleComponent: this.mFormInfo.formName});
|
||||
FormMgrSwiperComponent({formItemInfo: this.mFormInfo});
|
||||
FormMgrBottomComponent();
|
||||
}
|
||||
.height(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.width(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.backgroundImage(StyleConstants.DEFAULT_FORM_MGR_BACKGROUND_IMAGE)
|
||||
.onClick(() => {
|
||||
})
|
||||
}
|
||||
}
|
86
product/phone/src/main/ets/MainAbility/pages/RecentView.ets
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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 windowManager from '../../../../../../../common/src/main/ets/default/manager/WindowManager';
|
||||
import Log from '../../../../../../../common/src/main/ets/default/utils/Log';
|
||||
import Trace from '../../../../../../../common/src/main/ets/default/utils/Trace';
|
||||
import RecentMissionInfo from '../../../../../../../common/src/main/ets/default/bean/RecentMissionInfo';
|
||||
import StyleConstants from '../../../../../../../feature/recents/src/main/ets/MainAbility/common/constants/StyleConstants';
|
||||
import RecentMissionsStage from '../../../../../../../feature/recents/src/main/ets/MainAbility/common/RecentMissionsStage';
|
||||
import RecentMissionsViewModel from '../../../../../../../feature/recents/src/main/ets/MainAbility/viewmodel/RecentMissionsViewModel';
|
||||
import EmptyMsgDisplay from '../../../../../../../feature/recents/src/main/ets/MainAbility/view/EmptyMsgDisplay.ets';
|
||||
import RecentMissionsDoubleLayout from '../../../../../../../feature/recents/src/main/ets/MainAbility/view/RecentMissionsDoubleLayout.ets';
|
||||
import RecentMissionsSingleLayout from '../../../../../../../feature/recents/src/main/ets/MainAbility/view/RecentMissionsSingleLayout.ets';
|
||||
|
||||
const TAG = "RecentView";
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct RecentView {
|
||||
@StorageLink('recentMissionsList') mRecentMissionsList: RecentMissionInfo[] = [];
|
||||
@State mIsClickSubComponent: boolean = false;
|
||||
private mRecentMissionsStage: RecentMissionsStage = new RecentMissionsStage();
|
||||
private mRecentMissionsViewModel: RecentMissionsViewModel;
|
||||
|
||||
onPageShow(): void {
|
||||
Log.showInfo(TAG, 'onPageShow' + this.mRecentMissionsList.length);
|
||||
this.mIsClickSubComponent = false;
|
||||
this.mRecentMissionsStage.onCreate();
|
||||
this.mRecentMissionsViewModel = RecentMissionsViewModel.getInstance();
|
||||
this.mRecentMissionsViewModel.getRecentMissionsList();
|
||||
}
|
||||
|
||||
onPageHide(): void {
|
||||
Log.showInfo(TAG, `onPageHide`);
|
||||
this.mIsClickSubComponent = false;
|
||||
this.mRecentMissionsStage.onDestroy();
|
||||
}
|
||||
|
||||
onBackPress(): boolean {
|
||||
Log.showInfo(TAG, 'RecentMission EntryView onBackPress');
|
||||
windowManager.hideWindow(windowManager.RECENT_WINDOW_NAME);
|
||||
return true;
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
if (this.mRecentMissionsList.length === 0) {
|
||||
EmptyMsgDisplay();
|
||||
} else {
|
||||
if (this.traceLoadData() && this.mRecentMissionsViewModel.getRecentMissionsRowType() === 'single') {
|
||||
RecentMissionsSingleLayout({ mRecentMissionsSingleList: $mRecentMissionsList,
|
||||
mIsClickSubComponent: $mIsClickSubComponent});
|
||||
} else {
|
||||
RecentMissionsDoubleLayout({ mRecentMissionsDoubleList: $mRecentMissionsList,
|
||||
mIsClickSubComponent: $mIsClickSubComponent});
|
||||
}
|
||||
}
|
||||
}
|
||||
.width(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.height(StyleConstants.DEFAULT_LAYOUT_PERCENTAGE)
|
||||
.backgroundImage(StyleConstants.DEFAULT_RECENT_BACKGROUND_IMAGE)
|
||||
.onClick(() => {
|
||||
if (!this.mIsClickSubComponent) {
|
||||
Log.showInfo(TAG, 'click recent missions area');
|
||||
this.mRecentMissionsViewModel.backView();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private traceLoadData(): boolean {
|
||||
Trace.end(Trace.CORE_METHOD_START_RECENTS);
|
||||
return true;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 1.6 MiB |
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 display from '@ohos.display';
|
||||
import StyleConstants from '../common/constants/StyleConstants.ets';
|
||||
import GridLayout from '../../../../../../../feature/layoutmanager/src/main/ets/default/layout/GridLayout.ets';
|
||||
import ListLayout from '../../../../../../../feature/layoutmanager/src/main/ets/default/layout/ListLayout.ets';
|
||||
import AppModel from '../../../../../../../common/src/main/ets/default/model/AppModel.ets';
|
||||
import SettingsModel from '../../../../../../../common/src/main/ets/default/model/SettingsModel.ets';
|
||||
import PhoneStage from '../common/PhoneStage.ets';
|
||||
|
||||
const SYSTEM_UI_HEIGHT = 134;
|
||||
const DESIGN_WIDTH = 720.0;
|
||||
const HORIZONTAL = 0.7;
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct LayoutManager {
|
||||
@State mAppPageStartConfig: string = '';
|
||||
@State proportion: number = 0;
|
||||
@State mScreenHeight: number = 0;
|
||||
@State mScreenWidth: number = 0;
|
||||
@State gridConfig: string = '';
|
||||
@State equipment: string = 'phone';
|
||||
@State show: boolean = false;
|
||||
@State SwiperProportion: string = '85%';
|
||||
@State BottomBarProportion: string = '15%';
|
||||
private mStage = new PhoneStage();
|
||||
private mAppModel: AppModel;
|
||||
private mSettingsModel: SettingsModel;
|
||||
|
||||
private aboutToAppear(): void {
|
||||
this.mStage.onCreate();
|
||||
this.mAppModel = AppModel.getInstance();
|
||||
this.mSettingsModel = new SettingsModel();
|
||||
this.mAppPageStartConfig = this.mSettingsModel.getAppPageStartConfig();
|
||||
this.mAppModel.registerAppListEvent();
|
||||
display.getDefaultDisplay().then(dis => {
|
||||
this.proportion = DESIGN_WIDTH / dis.width;
|
||||
this.mScreenHeight = (dis.height - SYSTEM_UI_HEIGHT) * this.proportion;
|
||||
this.mScreenWidth = DESIGN_WIDTH;
|
||||
if (this.mScreenHeight < this.mScreenWidth) {
|
||||
this.equipment = 'smartVision';
|
||||
this.SwiperProportion = '75%';
|
||||
this.BottomBarProportion = '25%';
|
||||
}
|
||||
this.show = true;
|
||||
console.info("Launcher EntryView onShow end");
|
||||
})
|
||||
}
|
||||
|
||||
private aboutToDisappear() {
|
||||
this.mStage.onDestroy();
|
||||
this.mAppModel.unregisterAppListEvent();
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
if (this.mSettingsModel != undefined) {
|
||||
this.mSettingsModel.forceReloadConfig();
|
||||
this.mAppPageStartConfig = this.mSettingsModel.getAppPageStartConfig();
|
||||
this.gridConfig = this.mSettingsModel.getGridConfig().layout;
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||
if (this.show == true) {
|
||||
if (this.mAppPageStartConfig === 'Grid') {
|
||||
GridLayout({
|
||||
equipment: this.equipment,
|
||||
mScreenHeight: this.mScreenHeight,
|
||||
mScreenWidth: this.mScreenWidth,
|
||||
ScreenMagnification: this.proportion,
|
||||
SwiperProportion: this.SwiperProportion,
|
||||
BottomBarProportion: this.BottomBarProportion,
|
||||
gridConfig: this.gridConfig
|
||||
});
|
||||
} else {
|
||||
ListLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
.backgroundImage(StyleConstants.DEFAULT_BACKGROUND_IMAGE)
|
||||
.backgroundImageSize(ImageSize.Cover)
|
||||
}
|
||||
}
|
@ -9,15 +9,15 @@
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "intoSettings",
|
||||
"name": "into_settings",
|
||||
"value": "Launcher settings"
|
||||
},
|
||||
{
|
||||
"name": "addBlankPage",
|
||||
"name": "add_blank_page",
|
||||
"value": "Add Blank Page"
|
||||
},
|
||||
{
|
||||
"name": "deleteBlankPage",
|
||||
"name": "delete_blank_page",
|
||||
"value": "Delete Blank Page"
|
||||
},
|
||||
{
|
||||
@ -25,15 +25,15 @@
|
||||
"value": "Layout"
|
||||
},
|
||||
{
|
||||
"name": "layoutStyle",
|
||||
"name": "layout_style",
|
||||
"value": "Layout Style"
|
||||
},
|
||||
{
|
||||
"name": "launcherLayout",
|
||||
"name": "launcher_layout",
|
||||
"value": "Launcher Layout"
|
||||
},
|
||||
{
|
||||
"name": "recentTasksSetting",
|
||||
"name": "recent_tasks_setting",
|
||||
"value": "Recent Tasks Setting"
|
||||
},
|
||||
{
|
||||
@ -49,8 +49,120 @@
|
||||
"value": "Submit"
|
||||
},
|
||||
{
|
||||
"name": "launcherEdit",
|
||||
"value": "launcherEdit"
|
||||
"name": "launcher_edit",
|
||||
"value": "Launcher Edit"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_success",
|
||||
"value": "Successfully uninstalled"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_failed",
|
||||
"value": "Uninstallation failed"
|
||||
},
|
||||
{
|
||||
"name": "disable_uninstall",
|
||||
"value": "Disable uninstall"
|
||||
},
|
||||
{
|
||||
"name": "duplicate_add",
|
||||
"value": "Duplicate add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "no_space_for_add",
|
||||
"value": "No Space for add"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "Delete application"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_dock",
|
||||
"value": "Disable add to dock"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_delete",
|
||||
"value": "Disable add to delete"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "add service widget to desktop"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "edit service widget"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_dock",
|
||||
"value": "add to dock"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_desktop",
|
||||
"value": "add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "disable_to_move",
|
||||
"value": "disable to move"
|
||||
},
|
||||
{
|
||||
"name": "add",
|
||||
"value": "Add"
|
||||
},
|
||||
{
|
||||
"name": "add_to",
|
||||
"value": "Add to "
|
||||
},
|
||||
{
|
||||
"name": "new_folder_name",
|
||||
"value": "New folder"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "Rename"
|
||||
},
|
||||
{
|
||||
"name": "cancel_dialog",
|
||||
"value": "cancel"
|
||||
},
|
||||
{
|
||||
"name": "confirm_dialog",
|
||||
"value": "confirm"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "add service widget to desktop more"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_uninstall",
|
||||
"value": "uninstall"
|
||||
},
|
||||
{
|
||||
"name": "delete_form",
|
||||
"value": "Delete Service Widget"
|
||||
},
|
||||
{
|
||||
"name": "is_delete_form",
|
||||
"value": "Whether to remove"
|
||||
},
|
||||
{
|
||||
"name": "form",
|
||||
"value": "service widget"
|
||||
},
|
||||
{
|
||||
"name": "remove_form_dialog_content",
|
||||
"value": "Long press the application to enter the service widget management page to add a new service widget"
|
||||
},
|
||||
{
|
||||
"name": "gesture_navigation_options",
|
||||
"value": "Gesture Navigation Options"
|
||||
},
|
||||
{
|
||||
"name": "No_running_apps_recently",
|
||||
"value": "no recently running applications"
|
||||
}
|
||||
]
|
||||
}
|
BIN
product/phone/src/main/resources/base/media/img_app_default.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
@ -9,15 +9,15 @@
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "intoSettings",
|
||||
"name": "into_settings",
|
||||
"value": "Launcher settings"
|
||||
},
|
||||
{
|
||||
"name": "addBlankPage",
|
||||
"name": "add_blank_page",
|
||||
"value": "Add Blank Page"
|
||||
},
|
||||
{
|
||||
"name": "deleteBlankPage",
|
||||
"name": "delete_blank_page",
|
||||
"value": "Delete Blank Page"
|
||||
},
|
||||
{
|
||||
@ -25,15 +25,15 @@
|
||||
"value": "Layout"
|
||||
},
|
||||
{
|
||||
"name": "layoutStyle",
|
||||
"name": "layout_style",
|
||||
"value": "Layout Style"
|
||||
},
|
||||
{
|
||||
"name": "launcherLayout",
|
||||
"name": "launcher_layout",
|
||||
"value": "Launcher Layout"
|
||||
},
|
||||
{
|
||||
"name": "recentTasksSetting",
|
||||
"name": "recent_tasks_setting",
|
||||
"value": "Recent Tasks Setting"
|
||||
},
|
||||
{
|
||||
@ -49,8 +49,120 @@
|
||||
"value": "Submit"
|
||||
},
|
||||
{
|
||||
"name": "launcherEdit",
|
||||
"value": "launcherEdit"
|
||||
"name": "launcher_edit",
|
||||
"value": "Launcher Edit"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_success",
|
||||
"value": "Successfully uninstalled"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_failed",
|
||||
"value": "Uninstallation failed"
|
||||
},
|
||||
{
|
||||
"name": "disable_uninstall",
|
||||
"value": "Disable uninstall"
|
||||
},
|
||||
{
|
||||
"name": "duplicate_add",
|
||||
"value": "Duplicate add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "no_space_for_add",
|
||||
"value": "No Space for add"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "Delete application"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_dock",
|
||||
"value": "Disable add to dock"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_delete",
|
||||
"value": "Disable add to delete"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "add service widget to desktop"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "edit service widget"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_dock",
|
||||
"value": "add to dock"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_desktop",
|
||||
"value": "add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "disable_to_move",
|
||||
"value": "disable to move"
|
||||
},
|
||||
{
|
||||
"name": "add",
|
||||
"value": "Add"
|
||||
},
|
||||
{
|
||||
"name": "add_to",
|
||||
"value": "Add to "
|
||||
},
|
||||
{
|
||||
"name": "new_folder_name",
|
||||
"value": "New folder"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "Rename"
|
||||
},
|
||||
{
|
||||
"name": "cancel_dialog",
|
||||
"value": "cancel"
|
||||
},
|
||||
{
|
||||
"name": "confirm_dialog",
|
||||
"value": "confirm"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "add to desktop"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "add service widget to desktop more"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_uninstall",
|
||||
"value": "uninstall"
|
||||
},
|
||||
{
|
||||
"name": "delete_form",
|
||||
"value": "Delete service widget"
|
||||
},
|
||||
{
|
||||
"name": "is_delete_form",
|
||||
"value": "Whether to remove"
|
||||
},
|
||||
{
|
||||
"name": "form",
|
||||
"value": "service widget"
|
||||
},
|
||||
{
|
||||
"name": "remove_form_dialog_content",
|
||||
"value": "Long press the application to enter the service widget management page to add a new service widget"
|
||||
},
|
||||
{
|
||||
"name": "gesture_navigation_options",
|
||||
"value": "Gesture Navigation Options"
|
||||
},
|
||||
{
|
||||
"name": "No_running_apps_recently",
|
||||
"value": "no recently running applications"
|
||||
}
|
||||
]
|
||||
}
|
@ -5,7 +5,5 @@
|
||||
"column" : 4
|
||||
},
|
||||
"layoutInfo" : [
|
||||
],
|
||||
"bottomBarInfo" : [
|
||||
]
|
||||
}
|
@ -9,15 +9,15 @@
|
||||
"value": "ETS_Empty Feature Ability"
|
||||
},
|
||||
{
|
||||
"name": "intoSettings",
|
||||
"name": "into_settings",
|
||||
"value": "桌面设置"
|
||||
},
|
||||
{
|
||||
"name": "addBlankPage",
|
||||
"name": "add_blank_page",
|
||||
"value": "添加空白页"
|
||||
},
|
||||
{
|
||||
"name": "deleteBlankPage",
|
||||
"name": "delete_blank_page",
|
||||
"value": "删除空白页"
|
||||
},
|
||||
{
|
||||
@ -25,15 +25,15 @@
|
||||
"value": "布局"
|
||||
},
|
||||
{
|
||||
"name": "layoutStyle",
|
||||
"name": "layout_style",
|
||||
"value": "布局样式"
|
||||
},
|
||||
{
|
||||
"name": "launcherLayout",
|
||||
"name": "launcher_layout",
|
||||
"value": "桌面布局"
|
||||
},
|
||||
{
|
||||
"name": "recentTasksSetting",
|
||||
"name": "recent_tasks_setting",
|
||||
"value": "最近任务数"
|
||||
},
|
||||
{
|
||||
@ -49,8 +49,120 @@
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "launcherEdit",
|
||||
"name": "launcher_edit",
|
||||
"value": "桌面编辑"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_success",
|
||||
"value": "卸载成功"
|
||||
},
|
||||
{
|
||||
"name": "uninstall_failed",
|
||||
"value": "卸载失败"
|
||||
},
|
||||
{
|
||||
"name": "disable_uninstall",
|
||||
"value": "禁止卸载"
|
||||
},
|
||||
{
|
||||
"name": "duplicate_add",
|
||||
"value": "重复添加"
|
||||
},
|
||||
{
|
||||
"name": "no_space_for_add",
|
||||
"value": "没有多余的空间"
|
||||
},
|
||||
{
|
||||
"name": "delete_app",
|
||||
"value": "移除应用"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_dock",
|
||||
"value": "禁止添加"
|
||||
},
|
||||
{
|
||||
"name": "disable_add_to_delete",
|
||||
"value": "禁止移除"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop",
|
||||
"value": "服务卡片"
|
||||
},
|
||||
{
|
||||
"name": "form_edit",
|
||||
"value": "编辑"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_dock",
|
||||
"value": "添加到快捷栏"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_add_desktop",
|
||||
"value": "添加到工作区"
|
||||
},
|
||||
{
|
||||
"name": "disable_to_move",
|
||||
"value": "禁止移动"
|
||||
},
|
||||
{
|
||||
"name": "add",
|
||||
"value": "添加"
|
||||
},
|
||||
{
|
||||
"name": "add_to",
|
||||
"value": "添加到"
|
||||
},
|
||||
{
|
||||
"name": "new_folder_name",
|
||||
"value": "新建文件夹"
|
||||
},
|
||||
{
|
||||
"name": "rename_folder",
|
||||
"value": "重命名"
|
||||
},
|
||||
{
|
||||
"name": "cancel_dialog",
|
||||
"value": "取消"
|
||||
},
|
||||
{
|
||||
"name": "confirm_dialog",
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "add_to_desktop",
|
||||
"value": "添加到桌面"
|
||||
},
|
||||
{
|
||||
"name": "add_form_to_desktop_more",
|
||||
"value": "更多服务卡片"
|
||||
},
|
||||
{
|
||||
"name": "app_center_menu_uninstall",
|
||||
"value": "卸载"
|
||||
},
|
||||
{
|
||||
"name": "delete_form",
|
||||
"value": "移除"
|
||||
},
|
||||
{
|
||||
"name": "is_delete_form",
|
||||
"value": "是否移除"
|
||||
},
|
||||
{
|
||||
"name": "form",
|
||||
"value": "卡片"
|
||||
},
|
||||
{
|
||||
"name": "remove_form_dialog_content",
|
||||
"value": "通过长按应用进入“卡片管理页”界面可以新添加"
|
||||
},
|
||||
{
|
||||
"name": "gesture_navigation_options",
|
||||
"value": "手势导航开关"
|
||||
},
|
||||
{
|
||||
"name": "No_running_apps_recently",
|
||||
"value": "最近无运行应用"
|
||||
}
|
||||
]
|
||||
}
|