Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-06-24 14:02:44 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
791915616953379e0f76909b538cb585bda81ce7
79191561
2 parents
ca60a4aa
5d9fe9f4
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
139 additions
and
60 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ImageDownloadComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailItemComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/LiveFollowComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/LiveBigImage01Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/ImageItemView.ets
sight_harmony/features/wdComponent/src/main/ets/model/MineSettingDatasModel.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/LiveCountdownComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/PlayUIComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerTitleComponent.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerProgressFullScreenView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerTitleView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_share.png
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageDownloadComponent.ets
View file @
7919156
...
...
@@ -62,25 +62,52 @@ export struct ImageDownloadComponent {
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.url,
(error: BusinessError, data: http.HttpResponse) => {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.url,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
...
...
@@ -89,10 +116,8 @@ export struct ImageDownloadComponent {
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
const options: image.InitializationOptions = {
...
...
@@ -108,7 +133,6 @@ export struct ImageDownloadComponent {
this.image = pixelMap;
});
}
}
/**
* 保存ArrayBuffer到图库
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MultiPictureDetailItemComponent.ets
View file @
7919156
...
...
@@ -38,25 +38,52 @@ export struct MultiPictureDetailItemComponent {
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.imageUri,
(error: BusinessError, data: http.HttpResponse) => {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.imageUri,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
...
...
@@ -65,15 +92,12 @@ export struct MultiPictureDetailItemComponent {
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
this.initCurrentImageInfo(imageSource);
}
}
/**
* 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/LiveFollowComponent.ets
View file @
7919156
...
...
@@ -42,6 +42,7 @@ export struct LiveFollowComponent {
Row() {
//号主头像
Image(this.rmhInfo.rmhHeadUrl)
.alt($r('app.media.icon_default_head_mater'))
.width(24)
.height(24)
.borderRadius(90)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/LiveBigImage01Component.ets
View file @
7919156
...
...
@@ -216,8 +216,12 @@ export struct LiveBigImage01Component {
} else {
const month = eventDateTime.getMonth() + 1;
const date = eventDateTime.getDate();
if(date < 10){
return `${month}月${'0'+date}日`;
}else{
return `${month}月${date}日`;
}
}
} else {
return `${eventTimeStr}`;
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/ImageItemView.ets
View file @
7919156
...
...
@@ -38,25 +38,53 @@ export struct ImageItemView {
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.imageUri,
(error: BusinessError, data: http.HttpResponse) => {
// 每一个httpRequest对应一个HTTP请求任务,不可复用
let httpRequest = http.createHttp();
// 用于订阅HTTP响应头事件
httpRequest.on('headersReceive', (header: Object) => {
console.info('header: ' + JSON.stringify(header));
});
// 用于订阅HTTP流式响应数据接收事件
let res = new ArrayBuffer(0);
httpRequest.on('dataReceive', (data: ArrayBuffer) => {
const newRes = new ArrayBuffer(res.byteLength + data.byteLength);
const resView = new Uint8Array(newRes);
resView.set(new Uint8Array(res));
resView.set(new Uint8Array(data), res.byteLength);
res = newRes;
// console.info('dataReceive res length: ' + res.byteLength);
});
// 用于订阅HTTP流式响应数据接收完毕事件
httpRequest.on('dataEnd', () => {
this.transcodePixelMap(res);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`dataEnd getPicture ${res}`)
if (res instanceof ArrayBuffer) {
console.info(`dataEnd getPicture`)
this.imageBuffer = res as ArrayBuffer;
}
console.info('No more data in response, data receive end');
});
httpRequest.requestInStream(this.imageUri,
(error: BusinessError, data: number) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
this.getPicture()
console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`);
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
// 取消订阅HTTP响应头事件
httpRequest.off('headersReceive');
// 取消订阅HTTP流式响应数据接收事件
httpRequest.off('dataReceive');
// 取消订阅HTTP流式响应数据接收完毕事件
httpRequest.off('dataEnd');
// 当该请求使用完毕时,调用destroy方法主动销毁
httpRequest.destroy();
}
)
}
...
...
@@ -65,15 +93,12 @@ export struct ImageItemView {
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
transcodePixelMap(data: ArrayBuffer) {
const imageData: ArrayBuffer = data;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
this.initCurrentImageInfo(imageSource);
}
}
/**
* 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小
...
...
sight_harmony/features/wdComponent/src/main/ets/model/MineSettingDatasModel.ets
View file @
7919156
...
...
@@ -29,7 +29,7 @@ export class MineSettingDatasModel {
let videoState=SPHelper.default.getSync(SpConstants.SETTING_WIFI_VIDEO_SWITCH,false) as boolean
mainSettingData.push(new MineMainSettingFunctionItem(null, 'wifi网络情况下自动播放视频', null, 1, videoState,"video_switch"))
let suspensionState=SPHelper.default.getSync(SpConstants.SETTING_SUSPENSION_SWITCH,false) as boolean
mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, suspensionState,"suspensionState_switch"))
//
mainSettingData.push(new MineMainSettingFunctionItem(null, '开启播放器悬浮窗', null, 1, suspensionState,"suspensionState_switch"))
// this.mainSettingData.push(new MineMainSettingFunctionItem(null, null, null, 2, null,""))
mainSettingData.push(new MineMainSettingFunctionItem(null, '清理缓存', '32MB', 0, false,"clear_cache"))
// this.mainSettingData.push(new MineMainSettingFunctionItem(null, '评价我们', null, 0, false,""))
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/LiveCountdownComponent.ets
View file @
7919156
...
...
@@ -154,7 +154,12 @@ export struct LiveCountdownComponent {
if (StringUtils.isNotEmpty(this.liveDetailsBean.liveInfo?.planStartTime)) {
let playStartTimeTmp = this.liveDetailsBean.liveInfo?.planStartTime + ''
this.month = Number(playStartTimeTmp.substring(5, 7)).toString()
this.day = playStartTimeTmp.substring(8, 10)
let tempDay = playStartTimeTmp.substring(8, 10)
if(tempDay.startsWith('0')){
this.day = playStartTimeTmp.substring(9, 10)
}else{
this.day = tempDay
}
this.hour = playStartTimeTmp.substring(11, 13)
this.minute = playStartTimeTmp.substring(14, 16)
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/PlayUIComponent.ets
View file @
7919156
...
...
@@ -223,6 +223,7 @@ export struct PlayUIComponent {
right: 4,
bottom: 1
})
.margin({left: this.contentDetailData?.rmhInfo ? 0 : 34})
}
//回看
else if (this.contentDetailData.liveInfo?.liveState == 'end') {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerTitleComponent.ets
View file @
7919156
...
...
@@ -154,6 +154,7 @@ export struct PlayerTitleComponent {
top: 0,
bottom: 0
} : 4)
.margin({left: this.contentDetailData.rmhInfo?.rmhName ? 0 : 34})
}
}
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerProgressFullScreenView.ets
View file @
7919156
...
...
@@ -37,6 +37,7 @@ export struct PlayerProgressFullScreenView {
type: SliderBlockType.IMAGE,
image: $r('app.media.ic_player_block')
})
.trackThickness(1)
.blockSize({ width: 18, height: 12 })
.width('100%')
.height(19)
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerTitleView.ets
View file @
7919156
...
...
@@ -107,7 +107,7 @@ export struct PlayerTitleView {
Row() {
Text("@" + this.getName())
.fontColor(Color.White)
.fontSize(1
7
)
.fontSize(1
4
)
.maxLines(1)
.lineHeight(25)
.fontWeight(600)
...
...
@@ -115,7 +115,7 @@ export struct PlayerTitleView {
.textOverflow({ overflow: TextOverflow.Ellipsis })
if (this.getIcon()) {
Image(this.getIcon()).height(1
0).margin({ left: 4
})
Image(this.getIcon()).height(1
1).margin({ left: 4, top: 3
})
}
}.margin({ bottom: 8 })
...
...
@@ -126,7 +126,7 @@ export struct PlayerTitleView {
.fontSize(15)
.maxLines(3)
.lineHeight(20)
.fontWeight(
4
00)
.fontWeight(
6
00)
.fontFamily('PingFang SC-Regular')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 8 })
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_share.png
View file @
7919156
4.1 KB
|
W:
|
H:
1.92 KB
|
W:
|
H:
2-up
Swipe
Onion skin
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
View file @
7919156
...
...
@@ -35,9 +35,6 @@ export struct MultiPictureDetailPageComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
private displayTool = display.getDefaultDisplaySync()
@State nShowDownloadTitleHeight: number = 0
@State titleHeight: number = 0
@State index: number = 0
@State currentIndex: number = 0
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
...
...
@@ -51,7 +48,6 @@ export struct MultiPictureDetailPageComponent {
@State swiperIndex: number = 0;
@Provide followStatus: string | undefined = undefined // 关注状态
@Provide showCommentList: boolean = false
private subScroller: Scroller = new Scroller()
private scroller: Scroller = new Scroller()
private listScroller: ListScroller = new ListScroller()
@State contentStartOffset: number = 0;
...
...
@@ -80,9 +76,6 @@ export struct MultiPictureDetailPageComponent {
}
async aboutToAppear() {
//获取宽高尺寸
this.titleHeight = this.displayTool.width * 227 / 375
this.nShowDownloadTitleHeight = this.displayTool.width * 311 / 375
//注册字体
// font.registerFont({
// familyName: 'BebasNeueBold',
...
...
Please
register
or
login
to post a comment