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、直播全屏聊天室,聊天区域信息从底部展示
  fix: 18377 搜索结果页-标题展示不全
  fix:bug[18481] 号主互动列表页-登记元素未做圆角处理
  fix(动态卡片):评论控制
... ... @@ -98,4 +98,8 @@ export class DeviceUtil {
static isTablet(): boolean {
return deviceInfo.deviceType == 'tablet';
}
static is2in1(): boolean {
return deviceInfo.deviceType == '2in1';
}
}
... ...
... ... @@ -43,6 +43,9 @@ export class WindowModel {
return this.windowClass as window.Window
}
/**
* @deprecated 应用整体全屏,不需要再设置全屏与否了。
*/
setMainWindowFullScreen(fullScreen: boolean) {
if (deviceInfo.deviceType != "phone") {
return
... ... @@ -140,6 +143,9 @@ export class WindowModel {
return this.windowClass?.getWindowProperties()
}
/**
* @deprecated 应用整体全屏,不需要再设置全屏与否了。
*/
setWindowLayoutFullScreen(isFullScreen: boolean) {
this.isFullScreen = isFullScreen
this.windowClass?.setWindowLayoutFullScreen(isFullScreen)
... ...
... ... @@ -60,12 +60,12 @@ export struct CarderInteraction {
})
}
if(this.contentDetailData.rmhInfo != null){
if(this.contentDetailData.shareInfo != null && 1 == this.contentDetailData.shareInfo.shareOpen && 1 == this.contentDetailData.rmhInfo.cnShareControl){
this.shareLayout()
if(this.contentDTO.rmhInfo != null){
if(this.contentDTO.shareInfo != null && 1 == this.contentDTO.shareInfo.shareOpen && 1 == this.contentDTO.rmhInfo.cnShareControl){
this.commentLayout()
}
}else{
this.shareLayout()
this.commentLayout()
}
this.builderLike()
... ... @@ -81,7 +81,7 @@ export struct CarderInteraction {
}
@Builder
shareLayout() {
commentLayout() {
Row() {
Image($r('app.media.CarderInteraction_comment'))
.width(18)
... ...
... ... @@ -88,7 +88,7 @@ export struct Card6Component {
.fontSize(18)
.lineHeight(27)
.fontWeight(FontWeight.Normal)
.maxLines(this.contentDTO.appStyle === '6' ? 4 : 2)
.maxLines(this.contentDTO.appStyle === '6' ? 4 : 3)
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textIndent((this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 &&
... ... @@ -107,7 +107,7 @@ export struct Card6Component {
}
.alignItems(HorizontalAlign.Start)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 156)
.justifyContent(FlexAlign.SpaceBetween)
... ... @@ -138,7 +138,8 @@ export struct Card6Component {
})
.width(CommonConstants.FULL_WIDTH)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? 106 : 184) .justifyContent(FlexAlign.SpaceBetween)
.height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 184)
.justifyContent(FlexAlign.SpaceBetween)
.alignItems(VerticalAlign.Top)
}
}
... ...
... ... @@ -133,6 +133,7 @@ struct MineHomePage {
.backgroundImageSize(ImageSize.Cover)
.padding({left:"17lpx",right:"8lpx"})
.height('35lpx')
.borderRadius({topRight:2,bottomRight:2})
}
Blank()
... ...
... ... @@ -78,7 +78,7 @@ export struct DetailPlayVLivePage {
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
.height('30%').margin({top:this.topSafeHeight })
.height('40%').margin({top:this.topSafeHeight })
} else {
if (this.liveDetailPageLogic.showPad) {
... ... @@ -92,7 +92,7 @@ export struct DetailPlayVLivePage {
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
.height('30%').margin({top:this.topSafeHeight })
.height('40%').margin({top:this.topSafeHeight })
}
... ...
... ... @@ -14,6 +14,7 @@ import { EmitterEventId, EmitterUtils, Logger, SPHelper, WindowModel } from 'wdK
import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'
const TAG = "PlayerCommentComponent"
/**
* 沉浸式直播--- 聊天区域
*/
... ... @@ -52,7 +53,7 @@ export struct PlayerCommentComponent {
this.liveViewModel.getLiveCommentList(
1,
this.contentDetailData?.liveInfo?.mlive?.mliveId,
this.contentDetailData?.newsId+'',
this.contentDetailData?.newsId + '',
20,)
.then(
(data) => {
... ... @@ -82,21 +83,22 @@ export struct PlayerCommentComponent {
build() {
Column() {
List({ scroller: this.scroller }) {
// 主持人
if (this.contentDetailData.oldNewsId) {
ChartItemCompereComponent()
}
ForEach(this.liveChatList, (item: LiveRoomItemBean) => {
ListItem() {
ChatItemComponent({ item: item })
Stack({ alignContent: Alignment.BottomStart }) {
List({ scroller: this.scroller }) {
// 主持人
if (this.contentDetailData.oldNewsId) {
ChartItemCompereComponent()
}
})
}
.height(280)
.width('80%')
.scrollBar(BarState.Off)
.margin({ bottom: 20 })
ForEach(this.liveChatList, (item: LiveRoomItemBean) => {
ListItem() {
ChatItemComponent({ item: item })
}
})
}
.width('80%')
.scrollBar(BarState.Off)
}.height(280)
// 收藏、分享、点赞是否需要根据字段显隐
LiveOperRowListView({
... ...
... ... @@ -13,6 +13,7 @@ export struct PlayerUIComponent {
build() {
Stack() {
// 标题
PlayerTitleComponent()
PlayerCommentComponent()
... ...
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
import app from '@system.app';
import hilog from '@ohos.hilog';
import UIAbility from '@ohos.app.ability.UIAbility';
import Want from '@ohos.app.ability.Want';
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
import { DeviceUtil, EmitterEventId, EmitterUtils, WindowModel } from 'wdKit';
import { DeviceUtil, EmitterEventId, EmitterUtils, Logger, WindowModel } from 'wdKit';
import { ConfigurationConstant } from '@kit.AbilityKit';
import { StartupManager } from '../startupmanager/StartupManager';
import { UIContext } from '@ohos.arkui.UIContext';
let floatWindowClass: window.Window | null = null;
const TAG = 'EntryAbility'
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
StartupManager.sharedInstance().appOnCreate(want, launchParam, this.context)
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
Logger.info(TAG, 'Ability onCreate');
// 还没深色模式需求,暂直接不跟随系统。
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT);
... ... @@ -32,13 +31,13 @@ export default class EntryAbility extends UIAbility {
}
onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
Logger.info(TAG, 'Ability onDestroy');
StartupManager.sharedInstance().appOnDestory()
}
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
Logger.info(TAG, 'Ability onWindowStageCreate');
WindowModel.shared.setWindowStage(windowStage);
// 2. 获取布局避让遮挡的区域
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
... ... @@ -57,72 +56,50 @@ export default class EntryAbility extends UIAbility {
// 音频悬浮窗初始移动位置604为ui高度
let initMoveY = vp2px(604)
// 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
// 设置窗口的布局是否为沉浸式布局
// 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
// 非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。
// windowClass.setWindowLayoutFullScreen(true)
// 设置窗口全屏模式时窗口内导航栏、状态栏的属性
// windowClass.setWindowSystemBarProperties({
// statusBarContentColor: "#FFFFFF"
// })
// 设置启动时窗口的显示方向属性,
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
hilog.info(0x0000, 'testTag', 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
hilog.error(0x0000, 'testTag',
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
}
this.onWindowSetup(windowClass)
//../../../../../../features/wdLogin/src/main/ets/pages/launchPage/LaunchPage
windowStage.loadContent('pages/launchPage/LaunchPage', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
Logger.error(TAG, 'Failed to load the content. Cause: ' + JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
Logger.info(TAG, 'Succeeded in loading the content. Data: ' + JSON.stringify(data) ?? '');
});
// 1.创建悬浮窗
windowStage.createSubWindow('subWindow', (err: BusinessError, data) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to create the subwindow. Cause: ' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
Logger.info('floatWindowClass Succeeded in creating the subwindow. Data: ' + JSON.stringify(data));
floatWindowClass = data;
AppStorage.setOrCreate('floatWindowClass', floatWindowClass);
// 2.悬浮窗窗口创建成功后,设置悬浮窗的位置、大小及相关属性等。
floatWindowClass.moveWindowTo(0, initMoveY, (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to move the window. Cause:' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in moving the window.');
Logger.info('floatWindowClass Succeeded in moving the window.');
});
// 3.为悬浮窗加载对应的目标页面。
floatWindowClass.setUIContent("pages/view/AudioComponent", (err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in loading the content.');
Logger.info('floatWindowClass Succeeded in loading the content.');
let color: string = 'rgba(0,0,0,0)';
try {
(floatWindowClass as window.Window).setWindowBackgroundColor(color);
} catch (exception) {
console.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
};
Logger.error('Failed to set the background color. Cause: ' + JSON.stringify(exception));
}
;
});
floatWindowClass.on('windowEvent', (data) => {
... ... @@ -132,33 +109,68 @@ export default class EntryAbility extends UIAbility {
});
}
public async onWindowSetup(mainWindow: window.Window) {
// 在普通phone/折叠屏/tablet设备上以沉浸式(全屏)启动
if (DeviceUtil.isPhone() || DeviceUtil.isTablet()) {
// 设置窗口的布局是否为沉浸式布局
// 沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。
// 非沉浸式布局是指布局避让状态栏与导航栏,,组件不会与其重叠
mainWindow.setWindowLayoutFullScreen(true)
//设置窗口全屏模式时窗口内导航栏、状态栏的属性
mainWindow.setWindowSystemBarProperties({
//statusBarColor:'#000000'
statusBarContentColor: '#FFFFFF'
})
mainWindow.setSpecificSystemBarEnabled('status', true)
// 设置启动时窗口的显示方向属性,
// 普通phone以PORTRAIT/竖屏显示模式启动
// 折叠屏和tablet是以AUTO_ROTATION_RESTRICTED/受开关控制的自动旋转模式启动
WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT)
.then(() => {
Logger.info(TAG, 'setPreferredOrientation Succeeded');
})
.catch((err: Error) => {
Logger.info(TAG,
`setPreferredOrientation catch, error error.name : ${err.name}, error.message:${err.message}`);
})
} else if (DeviceUtil.is2in1()) {
// 2in1(PC)设备不支持旋转(无横竖屏模式),会以默认窗口(非全屏)显示模式启动Logger.info(TAG,`start at 2in1 window device )
Logger.info(TAG, 'start at 2in1 window device')
} else {
// 轻量级智能穿戴/lite wearable device
Logger.info(TAG, 'start at other type device')
}
}
destroyFloatWindow() {
(floatWindowClass as window.Window).destroyWindow((err: BusinessError) => {
let errCode: number = err.code;
if (errCode) {
console.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
Logger.error('floatWindowClass Failed to destroy the window. Cause: ' + JSON.stringify(err));
return;
}
console.info('floatWindowClass Succeeded in destroying the window.');
Logger.info('floatWindowClass Succeeded in destroying the window.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
this.destroyFloatWindow()
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
Logger.info(TAG, 'Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
Logger.info(TAG, 'Ability onForeground');
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_FOREGROUD)
}
onBackground(): void {
// Ability has back to background
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
Logger.info(TAG, 'Ability onBackground');
EmitterUtils.sendEmptyEvent(EmitterEventId.APP_ENTER_BACKGROUD)
}
... ...