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)修改手机顶部状态栏颜色
  feat:换肤 1)优化沉浸式频道检测
  feat:换肤 1)底部导航栏颜色修改
  feat:换肤 1)底部导航栏颜色修改
... ... @@ -222,7 +222,7 @@ export class ProcessUtils {
ProcessUtils.gotoThemeListPage(content)
break;
default:
ToastUtils.shortToast('敬请期待')
ToastUtils.shortToast('敬请期待')
break;
}
}
... ...
... ... @@ -96,7 +96,7 @@ export struct ENewspaperItemComponent {
}
if (event.type === TouchType.Up) {
this.context.clearRect(0, 0, this.context.width, this.context.height)
if (this.itemBeanClicked != null && this.itemBeanClicked.newsId != 0) {
if (this.itemBeanClicked != null && this.itemBeanClicked.newsId != 0 && this.itemBeanClicked.newsType ) {
//公共跳转
let content: ContentDTO = {
objectId: this.itemBeanClicked.newsId + '',
... ...
... ... @@ -11,7 +11,6 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/
import DailyPaperTopicModel from '../../model/DailyPaperTopicModel';
import { CompUtils } from '../../utils/CompUtils';
import ChannelViewModel from '../../viewmodel/ChannelViewModel';
import { common2D, drawing } from '@kit.ArkGraphics2D';
import { ColorUtils } from '../../utils/ColorUtils';
const TAG = 'TopNavigationComponent';
... ... @@ -45,6 +44,8 @@ export struct TopNavigationComponentNew {
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@Consume barBackgroundColor: Color
@Consume isImmersive: boolean
//
@State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
//本地缓存频道id列表
... ... @@ -469,9 +470,6 @@ export struct TopNavigationComponentNew {
return item?.channelType === 3
}
@Consume barBackgroundColor: Color
@Consume isImmersive: boolean
async aboutToAppear() {
if (CompUtils.isNews(this.navItem)) {
... ... @@ -484,12 +482,12 @@ export struct TopNavigationComponentNew {
this.backgroundImageH = px2vp(this.topRectHeight) + 44
}
this.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
}
pageShowChange() {
this.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
}
... ... @@ -499,28 +497,16 @@ export struct TopNavigationComponentNew {
*/
setBarBackgroundColor() {
Logger.debug('setBarBackgroundColor','setBarBackgroundColor '+this.navItem.name+' '+this._currentNavIndex +' '+this.bottomNavIndex)
if(this._currentNavIndex == this.bottomNavIndex){
this.changeTopStatusBarColor(this.navItem.statusBarColor)
}
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
}
/**
* 修改手机顶部状态栏颜色
* @param statusValue
*/
changeTopStatusBarColor(statusValue: number) {
if (statusValue === 1) { // 黑色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
})
} else { //白色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
this.isImmersive = false
this.barBackgroundColor = Color.White
}
}
onTopNavigationDataUpdated() {
Logger.info(TAG,
`onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
... ...
... ... @@ -13,6 +13,7 @@
* limitations under the License.
*/
import { common2D, drawing } from '@kit.ArkGraphics2D';
import { WindowModel } from 'wdKit/Index';
/**
* RGB颜色类型
... ... @@ -265,4 +266,22 @@ export class ColorUtils {
return drawColorFilter
}
/**
* 修改手机顶部状态栏颜色
* @param statusValue
*/
public static changeTopStatusBarColor(statusValue: number) {
if (statusValue === 1) { // 黑色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
})
} else { //白色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
}
}
}
\ No newline at end of file
... ...
... ... @@ -35,11 +35,9 @@ export struct BottomNavigationComponent {
@Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息
@Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息
@Provide barBackgroundColor: Color = Color.Transparent
// @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据
@State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标
// @State topNavList: TopNavDTO[] = []
// 底导TabsController
private navController: TabsController = new TabsController();
readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比
... ... @@ -281,7 +279,6 @@ export struct BottomNavigationComponent {
onBottomNavigationDataUpdated() {
Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList))
// Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`);
}
/**
... ...
... ... @@ -54,36 +54,18 @@ export struct VideoChannelPage {
*/
setBarBackgroundColor() {
Logger.debug('setBarBackgroundColor','setBarBackgroundColor '+this.navItem.name+' '+this.navItem.statusBarColor)
if (this.currentTopNavSelectedIndex === 0 && CompUtils.isVideo(this.currentBottomNavInfo)) {
if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) {
this.barBackgroundColor = Color.Black
this.isImmersive = true
this.changeTopStatusBarColor(0)
ColorUtils.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色
} else {
this.isImmersive = false
this.barBackgroundColor = Color.White
this.changeTopStatusBarColor(this.navItem.statusBarColor)
ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor)
}
}
/**
* 修改手机顶部状态栏颜色
* @param statusValue
*/
changeTopStatusBarColor(statusValue: number) {
if (statusValue === 1) { // 黑色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
})
} else { //白色状态栏
WindowModel.shared.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
}
}
/**
* 得到顶导文字颜色
... ... @@ -180,9 +162,9 @@ export struct VideoChannelPage {
// 搜索按钮
Row() {
Image($r(this.currentTopNavSelectedIndex === 0 ? 'app.media.icon_search_gray_svg' :
Image($r(this.isImmerseChannel() ? 'app.media.icon_search_gray_svg' :
'app.media.icon_search'))
.colorFilter(this.currentTopNavSelectedIndex === 0 ? undefined :
.colorFilter(this.isImmerseChannel() ? undefined :
ColorUtils.getDrawingColorFilter(this.getBothColor("")))
.width('24vp')
.height('24vp')
... ... @@ -212,6 +194,15 @@ export struct VideoChannelPage {
}
/**
* 检测是否是沉浸式频道
* @returns
*/
isImmerseChannel():boolean{
return this.navItem.topNavChannelList[this.currentTopNavSelectedIndex].channelStyle === 1;
}
/**
* 两侧文字图标颜色,搜索图标颜色
* @returns
*/
... ... @@ -224,7 +215,7 @@ export struct VideoChannelPage {
pageSwiperView() {
Swiper(this.swiperController) {
ForEach(this.topNavList, (item: TopNavDTO, index: number) => {
if (index == 0) {
if (item.channelStyle===1) {
// 视频
VideoChannelDetail({
bottomNavIndex: $_currentNavIndex,
... ... @@ -246,8 +237,7 @@ export struct VideoChannelPage {
pageId: item.pageId + '',
channelId: item.channelId + '',
autoRefresh: this.autoRefresh
})// .padding({ top: px2vp(this.topSafeHeight) + 44 })
.backgroundColor(Color.White)
}).backgroundColor(Color.White)
}
}
... ...