Showing
3 changed files
with
25 additions
and
36 deletions
| @@ -482,12 +482,12 @@ export struct TopNavigationComponentNew { | @@ -482,12 +482,12 @@ export struct TopNavigationComponentNew { | ||
| 482 | this.backgroundImageH = px2vp(this.topRectHeight) + 44 | 482 | this.backgroundImageH = px2vp(this.topRectHeight) + 44 |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 485 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 486 | 486 | ||
| 487 | } | 487 | } |
| 488 | 488 | ||
| 489 | pageShowChange() { | 489 | pageShowChange() { |
| 490 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 490 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | 493 | ||
| @@ -499,28 +499,14 @@ export struct TopNavigationComponentNew { | @@ -499,28 +499,14 @@ export struct TopNavigationComponentNew { | ||
| 499 | 499 | ||
| 500 | 500 | ||
| 501 | if(this._currentNavIndex == this.bottomNavIndex){ | 501 | if(this._currentNavIndex == this.bottomNavIndex){ |
| 502 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 502 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 503 | 503 | ||
| 504 | this.isImmersive = false | 504 | this.isImmersive = false |
| 505 | this.barBackgroundColor = Color.White | 505 | this.barBackgroundColor = Color.White |
| 506 | } | 506 | } |
| 507 | 507 | ||
| 508 | } | 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 | - }) | ||
| 522 | - } | ||
| 523 | - } | 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 | } |
| @@ -57,31 +57,15 @@ export struct VideoChannelPage { | @@ -57,31 +57,15 @@ export struct VideoChannelPage { | ||
| 57 | if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { | 57 | if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { |
| 58 | this.barBackgroundColor = Color.Black | 58 | this.barBackgroundColor = Color.Black |
| 59 | this.isImmersive = true | 59 | this.isImmersive = true |
| 60 | - this.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色 | 60 | + ColorUtils.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色 |
| 61 | } else { | 61 | } else { |
| 62 | this.isImmersive = false | 62 | this.isImmersive = false |
| 63 | this.barBackgroundColor = Color.White | 63 | this.barBackgroundColor = Color.White |
| 64 | - this.changeTopStatusBarColor(this.navItem.statusBarColor) | 64 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | - /** | ||
| 70 | - * 修改手机顶部状态栏颜色 | ||
| 71 | - * @param statusValue | ||
| 72 | - */ | ||
| 73 | - changeTopStatusBarColor(statusValue: number) { | ||
| 74 | - if (statusValue === 1) { // 黑色状态栏 | ||
| 75 | - WindowModel.shared.setWindowSystemBarProperties({ | ||
| 76 | - statusBarContentColor: '#000000', | ||
| 77 | - | ||
| 78 | - }) | ||
| 79 | - } else { //白色状态栏 | ||
| 80 | - WindowModel.shared.setWindowSystemBarProperties({ | ||
| 81 | - statusBarContentColor: '#ffffff', | ||
| 82 | - }) | ||
| 83 | - } | ||
| 84 | - } | ||
| 85 | 69 | ||
| 86 | /** | 70 | /** |
| 87 | * 得到顶导文字颜色 | 71 | * 得到顶导文字颜色 |
-
Please register or login to post a comment