Showing
6 changed files
with
19 additions
and
44 deletions
| @@ -3,7 +3,6 @@ import { display, router } from '@kit.ArkUI'; | @@ -3,7 +3,6 @@ import { display, router } from '@kit.ArkUI'; | ||
| 3 | import { ImageItemView } from '../components/view/ImageItemView'; | 3 | import { ImageItemView } from '../components/view/ImageItemView'; |
| 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; |
| 5 | import { Action } from 'wdBean'; | 5 | import { Action } from 'wdBean'; |
| 6 | -import { WindowModel } from 'wdKit/Index'; | ||
| 7 | 6 | ||
| 8 | const TAG = 'MultiPictureListPage'; | 7 | const TAG = 'MultiPictureListPage'; |
| 9 | 8 | ||
| @@ -20,11 +19,11 @@ export struct MultiPictureListPage { | @@ -20,11 +19,11 @@ export struct MultiPictureListPage { | ||
| 20 | @State picHeight: number = 0 | 19 | @State picHeight: number = 0 |
| 21 | @State isEnableSwipe: boolean = true; | 20 | @State isEnableSwipe: boolean = true; |
| 22 | @State currentUrl: string = '' | 21 | @State currentUrl: string = '' |
| 23 | - | 22 | + @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 23 | + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 24 | // @Provide bgc: Color = Color.White; | 24 | // @Provide bgc: Color = Color.White; |
| 25 | 25 | ||
| 26 | aboutToAppear(): void { | 26 | aboutToAppear(): void { |
| 27 | - this.openFullScreen() | ||
| 28 | //获取宽高尺寸 | 27 | //获取宽高尺寸 |
| 29 | this.screenWidth = this.displayTool.width | 28 | this.screenWidth = this.displayTool.width |
| 30 | // this.picWidth = this.screenWidth - vp2px(52) | 29 | // this.picWidth = this.screenWidth - vp2px(52) |
| @@ -57,7 +56,6 @@ export struct MultiPictureListPage { | @@ -57,7 +56,6 @@ export struct MultiPictureListPage { | ||
| 57 | if (this.photoList && this.photoList?.length > 0) { | 56 | if (this.photoList && this.photoList?.length > 0) { |
| 58 | Swiper(this.swiperController) { | 57 | Swiper(this.swiperController) { |
| 59 | ForEach(this.photoList, (item: PhotoListBean) => { | 58 | ForEach(this.photoList, (item: PhotoListBean) => { |
| 60 | - // MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | ||
| 61 | ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) | 59 | ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) |
| 62 | }) | 60 | }) |
| 63 | } | 61 | } |
| @@ -135,36 +133,13 @@ export struct MultiPictureListPage { | @@ -135,36 +133,13 @@ export struct MultiPictureListPage { | ||
| 135 | } | 133 | } |
| 136 | .width('100%') | 134 | .width('100%') |
| 137 | .height('100%') | 135 | .height('100%') |
| 138 | - // .padding({top:$r('app.float.margin_44')}) | 136 | + .padding({top: `${this.topSafeHeight}px`,bottom:`${this.bottomSafeHeight}px`}) |
| 139 | .backgroundColor(Color.Black) | 137 | .backgroundColor(Color.Black) |
| 140 | .id('e_picture_container') | 138 | .id('e_picture_container') |
| 141 | - // 设置顶部绘制延伸到状态栏 | ||
| 142 | - // 设置底部绘制延伸到导航条 | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - /** | ||
| 146 | - * 开启沉浸式 | ||
| 147 | - * TODO:颜色待根据业务接口修改 | ||
| 148 | - */ | ||
| 149 | - openFullScreen() { | ||
| 150 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 151 | - // WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 152 | - // WindowModel.shared.setWindowSystemBarEnable([]) | ||
| 153 | } | 139 | } |
| 154 | 140 | ||
| 155 | aboutToDisappear(): void { | 141 | aboutToDisappear(): void { |
| 156 | console.log(TAG, 'aboutToDisappear') | 142 | console.log(TAG, 'aboutToDisappear') |
| 157 | - this.closeFullScreen() | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - /** | ||
| 161 | - * 关闭沉浸式 | ||
| 162 | - * TODO:颜色待根据业务接口修改 | ||
| 163 | - */ | ||
| 164 | - closeFullScreen() { | ||
| 165 | - WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 166 | - // WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 167 | - // WindowModel.shared.setWindowSystemBarEnable(['status', 'navigation']) | ||
| 168 | } | 143 | } |
| 169 | 144 | ||
| 170 | onBackPress(): boolean | void { | 145 | onBackPress(): boolean | void { |
| @@ -172,7 +147,5 @@ export struct MultiPictureListPage { | @@ -172,7 +147,5 @@ export struct MultiPictureListPage { | ||
| 172 | } | 147 | } |
| 173 | 148 | ||
| 174 | private onBack() { | 149 | private onBack() { |
| 175 | - // 提前设置,否则返回的页面展示有问题(有时延) | ||
| 176 | - this.closeFullScreen() | ||
| 177 | } | 150 | } |
| 178 | } | 151 | } |
| @@ -4,7 +4,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | @@ -4,7 +4,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; | ||
| 4 | import Want from '@ohos.app.ability.Want'; | 4 | import Want from '@ohos.app.ability.Want'; |
| 5 | import window from '@ohos.window'; | 5 | import window from '@ohos.window'; |
| 6 | import { BusinessError } from '@ohos.base'; | 6 | import { BusinessError } from '@ohos.base'; |
| 7 | -import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, WindowModel } from 'wdKit'; | 7 | +import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdKit'; |
| 8 | import { ConfigurationConstant } from '@kit.AbilityKit'; | 8 | import { ConfigurationConstant } from '@kit.AbilityKit'; |
| 9 | import { StartupManager } from '../startupmanager/StartupManager'; | 9 | import { StartupManager } from '../startupmanager/StartupManager'; |
| 10 | 10 | ||
| @@ -14,6 +14,10 @@ const TAG = 'EntryAbility' | @@ -14,6 +14,10 @@ const TAG = 'EntryAbility' | ||
| 14 | export default class EntryAbility extends UIAbility { | 14 | export default class EntryAbility extends UIAbility { |
| 15 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 15 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| 16 | StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context) | 16 | StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context) |
| 17 | + if (SPHelper.default.getSync('isPrivacy', true)) { | ||
| 18 | + // 同意隐私协议,这里直接初始化。TODO 耗时梳理 | ||
| 19 | + StartupManager.sharedInstance().appAgreedProtocol() | ||
| 20 | + } | ||
| 17 | Logger.info(TAG, 'Ability onCreate'); | 21 | Logger.info(TAG, 'Ability onCreate'); |
| 18 | 22 | ||
| 19 | // 还没深色模式需求,暂直接不跟随系统。 | 23 | // 还没深色模式需求,暂直接不跟随系统。 |
| @@ -21,7 +21,8 @@ struct MultiPictureDetailPage { | @@ -21,7 +21,8 @@ struct MultiPictureDetailPage { | ||
| 21 | pageHideTime:number = 0; | 21 | pageHideTime:number = 0; |
| 22 | @Provide pageId: string = TrackConstants.PageName.Atlas_Detail | 22 | @Provide pageId: string = TrackConstants.PageName.Atlas_Detail |
| 23 | @Provide pageName: string = TrackConstants.PageName.Atlas_Detail | 23 | @Provide pageName: string = TrackConstants.PageName.Atlas_Detail |
| 24 | - | 24 | + @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 25 | + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 25 | build() { | 26 | build() { |
| 26 | Row() { | 27 | Row() { |
| 27 | Column() { | 28 | Column() { |
| @@ -31,6 +32,8 @@ struct MultiPictureDetailPage { | @@ -31,6 +32,8 @@ struct MultiPictureDetailPage { | ||
| 31 | relType: this.relType | 32 | relType: this.relType |
| 32 | }) | 33 | }) |
| 33 | } | 34 | } |
| 35 | + .padding({top: `${this.topSafeHeight}px`,bottom:`${this.bottomSafeHeight}px`}) | ||
| 36 | + | ||
| 34 | } | 37 | } |
| 35 | .backgroundColor(Color.Black) | 38 | .backgroundColor(Color.Black) |
| 36 | } | 39 | } |
| @@ -72,18 +75,12 @@ struct MultiPictureDetailPage { | @@ -72,18 +75,12 @@ struct MultiPictureDetailPage { | ||
| 72 | onPageShow(): void { | 75 | onPageShow(): void { |
| 73 | console.log(TAG, 'onPageShow') | 76 | console.log(TAG, 'onPageShow') |
| 74 | this.pageShowTime = DateTimeUtils.getTimeStamp() | 77 | this.pageShowTime = DateTimeUtils.getTimeStamp() |
| 75 | - /*// 获取当前应用窗口 | ||
| 76 | - let windowClass: window.Window = window.getLastWindow(this.context) | ||
| 77 | - // 将状态栏和导航栏的背景色设置为跟应用窗口相同的颜色 | ||
| 78 | - windowClass.setWindowSystemBarProperties({ | ||
| 79 | - navigationBarColor: color, | ||
| 80 | - statusBarColor: barColor, | ||
| 81 | - statusBarContentColor: barContentColor, | ||
| 82 | - })*/ | 78 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff'}) |
| 83 | } | 79 | } |
| 84 | 80 | ||
| 85 | onPageHide(): void { | 81 | onPageHide(): void { |
| 86 | console.log(TAG, 'onPageHide') | 82 | console.log(TAG, 'onPageHide') |
| 83 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000'}) | ||
| 87 | this.pageHideTime = DateTimeUtils.getTimeStamp() | 84 | this.pageHideTime = DateTimeUtils.getTimeStamp() |
| 88 | let duration = 0 | 85 | let duration = 0 |
| 89 | duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | 86 | duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) |
| @@ -97,8 +97,8 @@ struct LaunchPage { | @@ -97,8 +97,8 @@ struct LaunchPage { | ||
| 97 | this.dialogController.open(); | 97 | this.dialogController.open(); |
| 98 | // } | 98 | // } |
| 99 | } else { | 99 | } else { |
| 100 | - | ||
| 101 | - StartupManager.sharedInstance().appAgreedProtocol() | 100 | + // 挪到ability里处理了。 |
| 101 | + // StartupManager.sharedInstance().appAgreedProtocol() | ||
| 102 | 102 | ||
| 103 | //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 | 103 | //需要根据请求数据判断是否需要进入广告页,广告数据为nil则直接跳转到首页 |
| 104 | //获取本地存储的启动页数据 | 104 | //获取本地存储的启动页数据 |
| @@ -90,13 +90,14 @@ export class StartupManager { | @@ -90,13 +90,14 @@ export class StartupManager { | ||
| 90 | Logger.debug(TAG, "App 已同意隐私等协议,开始必要初始化") | 90 | Logger.debug(TAG, "App 已同意隐私等协议,开始必要初始化") |
| 91 | this.initCheckDeviceId() | 91 | this.initCheckDeviceId() |
| 92 | 92 | ||
| 93 | + this.initNetwork() | ||
| 94 | + | ||
| 93 | this.initMpaas() | 95 | this.initMpaas() |
| 96 | + | ||
| 94 | this.initSensorData() | 97 | this.initSensorData() |
| 95 | 98 | ||
| 96 | this.initTingyun() | 99 | this.initTingyun() |
| 97 | 100 | ||
| 98 | - this.initNetwork() | ||
| 99 | - | ||
| 100 | this.initGeTuiPush() | 101 | this.initGeTuiPush() |
| 101 | 102 | ||
| 102 | this.initUmengStat() | 103 | this.initUmengStat() |
-
Please register or login to post a comment