wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  feat:换肤 1)频道图片展示;2)changeTopStatusBarColor 方法修改
... ... @@ -35,7 +35,6 @@ export struct TopNavigationComponentNew {
navItem: BottomNavDTO = {} as BottomNavDTO
// 首页当前正在哪个tab的索引值
@Link @Watch('setBarBackgroundColor') _currentNavIndex?: number;
@Consume @Watch('pageShowChange') pageShow: number
// 记录首页底部tab 的索引值
@State bottomNavIndex: number = 0
... ... @@ -43,7 +42,6 @@ export struct TopNavigationComponentNew {
@State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@Consume barBackgroundColor: Color
@Consume isImmersive: boolean
//
... ... @@ -329,36 +327,32 @@ export struct TopNavigationComponentNew {
@Builder
tabBarBuilder(item: TopNavDTO, index: number) {
Column() {
if (item.iconUrl && item.iconCUrl) {
// 有图
Image(this.currentTopNavSelectedIndex === index ? item.iconUrl : item.iconCUrl)
.height(36)
} else {
// 无图
Text(item?.name)
.fontSize($r('app.float.selected_text_size'))
.fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
.fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index))
.padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
.padding({
top: $r('app.float.top_tab_item_padding_top'),
bottom: $r('app.float.top_tab_item_padding_bottom')
})
.maxLines(this.MAX_LINE)
.id(index.toString())
// .onAreaChange((oldValue: Area, newValue: Area) => {
// if (this.currentTopNavSelectedIndex === index &&
// (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
// if (newValue.position.x != undefined) {
// let positionX = Number.parseFloat(newValue.position.x.toString())
// this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
// }
// let width = Number.parseFloat(newValue.width.toString())
// this.indicatorWidth = Number.isNaN(width) ? 0 : width
// }
// })
if (this.currentTopNavSelectedIndex === index) {
Image($r('app.media.icon_channel_active'))
.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3)
// Row()
// .width(20)
// .height(3)
// .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)
// .backgroundImageSize(ImageSize.Contain)
}
}
}
.hoverEffect(HoverEffect.Highlight)
.constraintSize({
... ... @@ -482,24 +476,22 @@ export struct TopNavigationComponentNew {
this.backgroundImageH = px2vp(this.topRectHeight) + 44
}
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
}
pageShowChange() {
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
}
/**
* 修改手机顶部状态栏颜色
*/
setBarBackgroundColor() {
if(this._currentNavIndex == this.bottomNavIndex){
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
if (this._currentNavIndex == this.bottomNavIndex) {
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1)
this.isImmersive = false
this.barBackgroundColor = Color.White
... ... @@ -646,7 +638,6 @@ export struct TopNavigationComponentNew {
return null
}
/**
* 进入早晚报专题
*/
... ...
... ... @@ -270,10 +270,16 @@ export class ColorUtils {
/**
* 修改手机顶部状态栏颜色
* @param statusValue
* @param statusValue 动态修改值
* @param defaultValue 页面默认值:statusValue== null 就按此值走
*/
public static changeTopStatusBarColor(statusValue: number) {
if (statusValue === 1) { // 黑色状态栏
public static changeTopStatusBarColor(statusValue: number, defaultValue: number) {
if (statusValue == null) {
statusValue = defaultValue
} else { //白色状态栏
}
if (statusValue === 1 || statusValue == null) { // 黑色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
... ...
... ... @@ -57,11 +57,11 @@ export struct VideoChannelPage {
if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) {
this.barBackgroundColor = Color.Black
this.isImmersive = true
ColorUtils.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色
ColorUtils.changeTopStatusBarColor(0,0)// 沉浸页面顶部导航栏颜色固定黑色
} else {
this.isImmersive = false
this.barBackgroundColor = Color.White
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor,1)
}
}
... ... @@ -127,7 +127,7 @@ export struct VideoChannelPage {
Image($r('app.media.icon_channel_active'))
.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
// .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width(20)
.height(3).visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden)
... ...