Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: feat:换肤 1)修改手机顶部状态栏颜色 feat:换肤 1)优化沉浸式频道检测 feat:换肤 1)底部导航栏颜色修改 feat:换肤 1)底部导航栏颜色修改
Showing
6 changed files
with
46 additions
and
54 deletions
| @@ -222,7 +222,7 @@ export class ProcessUtils { | @@ -222,7 +222,7 @@ export class ProcessUtils { | ||
| 222 | ProcessUtils.gotoThemeListPage(content) | 222 | ProcessUtils.gotoThemeListPage(content) |
| 223 | break; | 223 | break; |
| 224 | default: | 224 | default: |
| 225 | - ToastUtils.shortToast('敬请期待') | 225 | + ToastUtils.shortToast('敬请期待') |
| 226 | break; | 226 | break; |
| 227 | } | 227 | } |
| 228 | } | 228 | } |
| @@ -96,7 +96,7 @@ export struct ENewspaperItemComponent { | @@ -96,7 +96,7 @@ export struct ENewspaperItemComponent { | ||
| 96 | } | 96 | } |
| 97 | if (event.type === TouchType.Up) { | 97 | if (event.type === TouchType.Up) { |
| 98 | this.context.clearRect(0, 0, this.context.width, this.context.height) | 98 | this.context.clearRect(0, 0, this.context.width, this.context.height) |
| 99 | - if (this.itemBeanClicked != null && this.itemBeanClicked.newsId != 0) { | 99 | + if (this.itemBeanClicked != null && this.itemBeanClicked.newsId != 0 && this.itemBeanClicked.newsType ) { |
| 100 | //公共跳转 | 100 | //公共跳转 |
| 101 | let content: ContentDTO = { | 101 | let content: ContentDTO = { |
| 102 | objectId: this.itemBeanClicked.newsId + '', | 102 | objectId: this.itemBeanClicked.newsId + '', |
| @@ -11,7 +11,6 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/ | @@ -11,7 +11,6 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/ | ||
| 11 | import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; | 11 | import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; |
| 12 | import { CompUtils } from '../../utils/CompUtils'; | 12 | import { CompUtils } from '../../utils/CompUtils'; |
| 13 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; | 13 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; |
| 14 | -import { common2D, drawing } from '@kit.ArkGraphics2D'; | ||
| 15 | import { ColorUtils } from '../../utils/ColorUtils'; | 14 | import { ColorUtils } from '../../utils/ColorUtils'; |
| 16 | 15 | ||
| 17 | const TAG = 'TopNavigationComponent'; | 16 | const TAG = 'TopNavigationComponent'; |
| @@ -45,6 +44,8 @@ export struct TopNavigationComponentNew { | @@ -45,6 +44,8 @@ export struct TopNavigationComponentNew { | ||
| 45 | // 顶导数据 | 44 | // 顶导数据 |
| 46 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 45 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 47 | 46 | ||
| 47 | + @Consume barBackgroundColor: Color | ||
| 48 | + @Consume isImmersive: boolean | ||
| 48 | // | 49 | // |
| 49 | @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 | 50 | @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 |
| 50 | //本地缓存频道id列表 | 51 | //本地缓存频道id列表 |
| @@ -469,9 +470,6 @@ export struct TopNavigationComponentNew { | @@ -469,9 +470,6 @@ export struct TopNavigationComponentNew { | ||
| 469 | return item?.channelType === 3 | 470 | return item?.channelType === 3 |
| 470 | } | 471 | } |
| 471 | 472 | ||
| 472 | - @Consume barBackgroundColor: Color | ||
| 473 | - @Consume isImmersive: boolean | ||
| 474 | - | ||
| 475 | async aboutToAppear() { | 473 | async aboutToAppear() { |
| 476 | 474 | ||
| 477 | if (CompUtils.isNews(this.navItem)) { | 475 | if (CompUtils.isNews(this.navItem)) { |
| @@ -484,12 +482,12 @@ export struct TopNavigationComponentNew { | @@ -484,12 +482,12 @@ export struct TopNavigationComponentNew { | ||
| 484 | this.backgroundImageH = px2vp(this.topRectHeight) + 44 | 482 | this.backgroundImageH = px2vp(this.topRectHeight) + 44 |
| 485 | } | 483 | } |
| 486 | 484 | ||
| 487 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 485 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 488 | 486 | ||
| 489 | } | 487 | } |
| 490 | 488 | ||
| 491 | pageShowChange() { | 489 | pageShowChange() { |
| 492 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 490 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 493 | } | 491 | } |
| 494 | 492 | ||
| 495 | 493 | ||
| @@ -499,28 +497,16 @@ export struct TopNavigationComponentNew { | @@ -499,28 +497,16 @@ export struct TopNavigationComponentNew { | ||
| 499 | */ | 497 | */ |
| 500 | setBarBackgroundColor() { | 498 | setBarBackgroundColor() { |
| 501 | 499 | ||
| 502 | - Logger.debug('setBarBackgroundColor','setBarBackgroundColor '+this.navItem.name+' '+this._currentNavIndex +' '+this.bottomNavIndex) | ||
| 503 | 500 | ||
| 504 | if(this._currentNavIndex == this.bottomNavIndex){ | 501 | if(this._currentNavIndex == this.bottomNavIndex){ |
| 505 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | ||
| 506 | - } | 502 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 507 | 503 | ||
| 508 | - } | ||
| 509 | - /** | ||
| 510 | - * 修改手机顶部状态栏颜色 | ||
| 511 | - * @param statusValue | ||
| 512 | - */ | ||
| 513 | - changeTopStatusBarColor(statusValue: number) { | ||
| 514 | - if (statusValue === 1) { // 黑色状态栏 | ||
| 515 | - WindowModel.shared.setWindowSystemBarProperties({ | ||
| 516 | - statusBarContentColor: '#000000', | ||
| 517 | - }) | ||
| 518 | - } else { //白色状态栏 | ||
| 519 | - WindowModel.shared.setWindowSystemBarProperties({ | ||
| 520 | - statusBarContentColor: '#ffffff', | ||
| 521 | - }) | 504 | + this.isImmersive = false |
| 505 | + this.barBackgroundColor = Color.White | ||
| 522 | } | 506 | } |
| 507 | + | ||
| 523 | } | 508 | } |
| 509 | + | ||
| 524 | onTopNavigationDataUpdated() { | 510 | onTopNavigationDataUpdated() { |
| 525 | Logger.info(TAG, | 511 | Logger.info(TAG, |
| 526 | `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | 512 | `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); |
| @@ -13,6 +13,7 @@ | @@ -13,6 +13,7 @@ | ||
| 13 | * limitations under the License. | 13 | * limitations under the License. |
| 14 | */ | 14 | */ |
| 15 | import { common2D, drawing } from '@kit.ArkGraphics2D'; | 15 | import { common2D, drawing } from '@kit.ArkGraphics2D'; |
| 16 | +import { WindowModel } from 'wdKit/Index'; | ||
| 16 | 17 | ||
| 17 | /** | 18 | /** |
| 18 | * RGB颜色类型 | 19 | * RGB颜色类型 |
| @@ -265,4 +266,22 @@ export class ColorUtils { | @@ -265,4 +266,22 @@ export class ColorUtils { | ||
| 265 | 266 | ||
| 266 | return drawColorFilter | 267 | return drawColorFilter |
| 267 | } | 268 | } |
| 269 | + | ||
| 270 | + | ||
| 271 | + /** | ||
| 272 | + * 修改手机顶部状态栏颜色 | ||
| 273 | + * @param statusValue | ||
| 274 | + */ | ||
| 275 | + public static changeTopStatusBarColor(statusValue: number) { | ||
| 276 | + if (statusValue === 1) { // 黑色状态栏 | ||
| 277 | + WindowModel.shared.setWindowSystemBarProperties({ | ||
| 278 | + statusBarContentColor: '#000000', | ||
| 279 | + | ||
| 280 | + }) | ||
| 281 | + } else { //白色状态栏 | ||
| 282 | + WindowModel.shared.setWindowSystemBarProperties({ | ||
| 283 | + statusBarContentColor: '#ffffff', | ||
| 284 | + }) | ||
| 285 | + } | ||
| 286 | + } | ||
| 268 | } | 287 | } |
| @@ -35,11 +35,9 @@ export struct BottomNavigationComponent { | @@ -35,11 +35,9 @@ export struct BottomNavigationComponent { | ||
| 35 | @Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息 | 35 | @Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息 |
| 36 | @Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息 | 36 | @Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息 |
| 37 | @Provide barBackgroundColor: Color = Color.Transparent | 37 | @Provide barBackgroundColor: Color = Color.Transparent |
| 38 | - // @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 39 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 38 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 40 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据 | 39 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据 |
| 41 | @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标 | 40 | @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标 |
| 42 | - // @State topNavList: TopNavDTO[] = [] | ||
| 43 | // 底导TabsController | 41 | // 底导TabsController |
| 44 | private navController: TabsController = new TabsController(); | 42 | private navController: TabsController = new TabsController(); |
| 45 | readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 | 43 | readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比 |
| @@ -281,7 +279,6 @@ export struct BottomNavigationComponent { | @@ -281,7 +279,6 @@ export struct BottomNavigationComponent { | ||
| 281 | 279 | ||
| 282 | onBottomNavigationDataUpdated() { | 280 | onBottomNavigationDataUpdated() { |
| 283 | Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList)) | 281 | Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList)) |
| 284 | - // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); | ||
| 285 | } | 282 | } |
| 286 | 283 | ||
| 287 | /** | 284 | /** |
| @@ -54,36 +54,18 @@ export struct VideoChannelPage { | @@ -54,36 +54,18 @@ export struct VideoChannelPage { | ||
| 54 | */ | 54 | */ |
| 55 | setBarBackgroundColor() { | 55 | setBarBackgroundColor() { |
| 56 | 56 | ||
| 57 | - Logger.debug('setBarBackgroundColor','setBarBackgroundColor '+this.navItem.name+' '+this.navItem.statusBarColor) | ||
| 58 | - | ||
| 59 | - if (this.currentTopNavSelectedIndex === 0 && CompUtils.isVideo(this.currentBottomNavInfo)) { | 57 | + if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { |
| 60 | this.barBackgroundColor = Color.Black | 58 | this.barBackgroundColor = Color.Black |
| 61 | this.isImmersive = true | 59 | this.isImmersive = true |
| 62 | - this.changeTopStatusBarColor(0) | 60 | + ColorUtils.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色 |
| 63 | } else { | 61 | } else { |
| 64 | this.isImmersive = false | 62 | this.isImmersive = false |
| 65 | this.barBackgroundColor = Color.White | 63 | this.barBackgroundColor = Color.White |
| 66 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 64 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 67 | } | 65 | } |
| 68 | 66 | ||
| 69 | } | 67 | } |
| 70 | 68 | ||
| 71 | - /** | ||
| 72 | - * 修改手机顶部状态栏颜色 | ||
| 73 | - * @param statusValue | ||
| 74 | - */ | ||
| 75 | - changeTopStatusBarColor(statusValue: number) { | ||
| 76 | - if (statusValue === 1) { // 黑色状态栏 | ||
| 77 | - WindowModel.shared.setWindowSystemBarProperties({ | ||
| 78 | - statusBarContentColor: '#000000', | ||
| 79 | - | ||
| 80 | - }) | ||
| 81 | - } else { //白色状态栏 | ||
| 82 | - WindowModel.shared.setWindowSystemBarProperties({ | ||
| 83 | - statusBarContentColor: '#ffffff', | ||
| 84 | - }) | ||
| 85 | - } | ||
| 86 | - } | ||
| 87 | 69 | ||
| 88 | /** | 70 | /** |
| 89 | * 得到顶导文字颜色 | 71 | * 得到顶导文字颜色 |
| @@ -180,9 +162,9 @@ export struct VideoChannelPage { | @@ -180,9 +162,9 @@ export struct VideoChannelPage { | ||
| 180 | 162 | ||
| 181 | // 搜索按钮 | 163 | // 搜索按钮 |
| 182 | Row() { | 164 | Row() { |
| 183 | - Image($r(this.currentTopNavSelectedIndex === 0 ? 'app.media.icon_search_gray_svg' : | 165 | + Image($r(this.isImmerseChannel() ? 'app.media.icon_search_gray_svg' : |
| 184 | 'app.media.icon_search')) | 166 | 'app.media.icon_search')) |
| 185 | - .colorFilter(this.currentTopNavSelectedIndex === 0 ? undefined : | 167 | + .colorFilter(this.isImmerseChannel() ? undefined : |
| 186 | ColorUtils.getDrawingColorFilter(this.getBothColor(""))) | 168 | ColorUtils.getDrawingColorFilter(this.getBothColor(""))) |
| 187 | .width('24vp') | 169 | .width('24vp') |
| 188 | .height('24vp') | 170 | .height('24vp') |
| @@ -212,6 +194,15 @@ export struct VideoChannelPage { | @@ -212,6 +194,15 @@ export struct VideoChannelPage { | ||
| 212 | } | 194 | } |
| 213 | 195 | ||
| 214 | /** | 196 | /** |
| 197 | + * 检测是否是沉浸式频道 | ||
| 198 | + * @returns | ||
| 199 | + */ | ||
| 200 | + isImmerseChannel():boolean{ | ||
| 201 | + | ||
| 202 | + return this.navItem.topNavChannelList[this.currentTopNavSelectedIndex].channelStyle === 1; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + /** | ||
| 215 | * 两侧文字图标颜色,搜索图标颜色 | 206 | * 两侧文字图标颜色,搜索图标颜色 |
| 216 | * @returns | 207 | * @returns |
| 217 | */ | 208 | */ |
| @@ -224,7 +215,7 @@ export struct VideoChannelPage { | @@ -224,7 +215,7 @@ export struct VideoChannelPage { | ||
| 224 | pageSwiperView() { | 215 | pageSwiperView() { |
| 225 | Swiper(this.swiperController) { | 216 | Swiper(this.swiperController) { |
| 226 | ForEach(this.topNavList, (item: TopNavDTO, index: number) => { | 217 | ForEach(this.topNavList, (item: TopNavDTO, index: number) => { |
| 227 | - if (index == 0) { | 218 | + if (item.channelStyle===1) { |
| 228 | // 视频 | 219 | // 视频 |
| 229 | VideoChannelDetail({ | 220 | VideoChannelDetail({ |
| 230 | bottomNavIndex: $_currentNavIndex, | 221 | bottomNavIndex: $_currentNavIndex, |
| @@ -246,8 +237,7 @@ export struct VideoChannelPage { | @@ -246,8 +237,7 @@ export struct VideoChannelPage { | ||
| 246 | pageId: item.pageId + '', | 237 | pageId: item.pageId + '', |
| 247 | channelId: item.channelId + '', | 238 | channelId: item.channelId + '', |
| 248 | autoRefresh: this.autoRefresh | 239 | autoRefresh: this.autoRefresh |
| 249 | - })// .padding({ top: px2vp(this.topSafeHeight) + 44 }) | ||
| 250 | - .backgroundColor(Color.White) | 240 | + }).backgroundColor(Color.White) |
| 251 | } | 241 | } |
| 252 | 242 | ||
| 253 | } | 243 | } |
-
Please register or login to post a comment