diff --git a/common/src/main/ets/default/constants/PresetStyleConstants.ts b/common/src/main/ets/default/constants/PresetStyleConstants.ts index cd39efc0..c879ce1e 100644 --- a/common/src/main/ets/default/constants/PresetStyleConstants.ts +++ b/common/src/main/ets/default/constants/PresetStyleConstants.ts @@ -48,7 +48,7 @@ export default class PresetStyleConstants { /** * desktop indicator height */ - static readonly DEFAULT_PHONE_INDICATOR_HEIGHT = 48; + static readonly DEFAULT_PHONE_INDICATOR_HEIGHT = 32; /** * columns of screen with phone diff --git a/common/src/main/ets/default/viewmodel/LayoutViewModel.ts b/common/src/main/ets/default/viewmodel/LayoutViewModel.ts index 7dc1d148..30113044 100644 --- a/common/src/main/ets/default/viewmodel/LayoutViewModel.ts +++ b/common/src/main/ets/default/viewmodel/LayoutViewModel.ts @@ -82,8 +82,13 @@ export default class LayoutViewModel { this.mSysUITopHeight = this.mLauncherLayoutStyleConfig.mSysTopHeight; this.mNavigationBarStatus = navigationBarStatus === '0' ? true : false; Log.showInfo(TAG, `initScreen navigationBarStatus: ${this.mNavigationBarStatus}`); + if (!this.mNavigationBarStatus) { - this.mSysUIBottomHeight = this.mLauncherLayoutStyleConfig.mSysBottomHeight; + if (this.mScreenWidth > this.mScreenHeight) { + this.mSysUIBottomHeight = this.mLauncherLayoutStyleConfig.mSysBottomHeight * this.mScreenWidth / 1280; + } else { + this.mSysUIBottomHeight = this.mLauncherLayoutStyleConfig.mSysBottomHeight * this.mScreenWidth / 360; + } } else { this.mSysUIBottomHeight = 0; } @@ -199,6 +204,20 @@ export default class LayoutViewModel { let row = ~~((realHeight + gutter) / (itemSize + gutter)); let marginTop = ((realHeight + gutter - (itemSize + gutter) * row) / 2); Log.showInfo(TAG, `calculateDesktop gutter: ${gutter}, marginTop: ${marginTop}`); + if (!this.mIsPad) { + if (row > 6) { + row = 6; + } + + if (this.mNavigationBarStatus) { + realHeight = realHeight + this.mLauncherLayoutStyleConfig.mSysBottomHeight; + } + let remainHeight = (realHeight + gutter - (itemSize + gutter) * row) + realHeight -= remainHeight + marginTop = remainHeight / 2 + this.mSysUITopHeight + Log.showInfo(TAG, `realHeight = ${realHeight} marginTop = ${marginTop}`) + } + Log.showInfo(TAG, `desktop marginTop ${marginTop}`); //set desktop icon let ratio = this.mLauncherLayoutStyleConfig.mIconRatio; let lines = this.mLauncherLayoutStyleConfig.mNameLines; diff --git a/feature/pagedesktop/src/main/ets/default/common/PageDesktopDragHandler.ts b/feature/pagedesktop/src/main/ets/default/common/PageDesktopDragHandler.ts index 3c806a76..4fd283ca 100644 --- a/feature/pagedesktop/src/main/ets/default/common/PageDesktopDragHandler.ts +++ b/feature/pagedesktop/src/main/ets/default/common/PageDesktopDragHandler.ts @@ -63,8 +63,8 @@ export default class PageDesktopDragHandler extends BaseDragHandler { } private updateGridParam(effectArea) { - const gridWidth = effectArea.right - effectArea.left; - const gridHeight = effectArea.bottom - effectArea.top; + const gridWidth = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mGridWidth; + const gridHeight = this.mPageDesktopViewModel.getPageDesktopStyleConfig().mGridHeight; Log.showInfo(TAG, `updateGridParam gridWidth: ${gridWidth}, gridHeight: ${gridHeight}`); this.mGridConfig = this.mPageDesktopViewModel.getGridConfig(); const column = this.mGridConfig.column; diff --git a/feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets b/feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets index c2550584..2c7452de 100644 --- a/feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets +++ b/feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets @@ -26,6 +26,7 @@ const TAG = "SwiperPage"; @Component export default struct SwiperPage { @StorageLink('workSpaceWidth') workSpaceWidth: number = 0; + @StorageLink('NavigationBarStatusValue') navigationBarStatusValue: boolean = false; @State ColumnsTemplate: string = ''; @State RowsTemplate: string = '' @Prop @Watch('changeColumnAndRow') gridConfig: string; @@ -117,6 +118,10 @@ export default struct SwiperPage { .rowsGap(this.mRowsGap) .width(this.mGridWidth) .height(this.mGridHeight) - .margin({ right: this.mMargin, left: this.mMargin, top: this.mMarginTop}) + .margin({ + right: this.mMargin, + left: this.mMargin, + top: this.navigationBarStatusValue ? this.mPageDesktopStyleConfig.mDesktopMarginTop : this.mPageDesktopStyleConfig.mDesktopMarginTop + 0 + }) } } \ No newline at end of file diff --git a/product/phone/src/main/ets/common/constants/PhonePresetStyleConstants.ts b/product/phone/src/main/ets/common/constants/PhonePresetStyleConstants.ts index 6269739a..f77a050a 100644 --- a/product/phone/src/main/ets/common/constants/PhonePresetStyleConstants.ts +++ b/product/phone/src/main/ets/common/constants/PhonePresetStyleConstants.ts @@ -24,12 +24,12 @@ export default class PhonePresetStyleConstants { /** * systemUI top height */ - static readonly DEFAULT_SYS_TOP_HEIGHT = 48; + static readonly DEFAULT_SYS_TOP_HEIGHT = 44; /** * systemUI bottom height */ - static readonly DEFAULT_SYS_BOTTOM_HEIGHT = 72; + static readonly DEFAULT_SYS_BOTTOM_HEIGHT = 36; /** * desktop item size diff --git a/product/phone/src/main/ets/pages/EntryView.ets b/product/phone/src/main/ets/pages/EntryView.ets index 5dc911bf..74b43377 100644 --- a/product/phone/src/main/ets/pages/EntryView.ets +++ b/product/phone/src/main/ets/pages/EntryView.ets @@ -141,7 +141,7 @@ struct EntryView { build() { Stack() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start }) { if (this.mAppPageStartConfig === 'Grid') { Column() { PageDesktopLayout({