Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix: 横屏视频左侧上下滑动调节屏幕亮度,右侧上下滑动调节音量(目前是播放器音量,调节系统音量还有问题,ir单已提问) feat: 20748 搜索-“钱江视频”,搜索结果切换到人民号tab,动态和单图卡视频未展示文本信息 feat: 20527 【折叠屏】搜索 点击庆祝人民政协成立七十五周年,图片截断了 feat: 20768 搜索-“余华英重审开庭”,搜索结果中存在稿件未展示标题。
Showing
16 changed files
with
225 additions
and
82 deletions
| @@ -22,6 +22,8 @@ export class ContentShareInfoDTO { | @@ -22,6 +22,8 @@ export class ContentShareInfoDTO { | ||
| 22 | 22 | ||
| 23 | @Observed | 23 | @Observed |
| 24 | export class ContentDTO implements BaseDTO { | 24 | export class ContentDTO implements BaseDTO { |
| 25 | + introduction: string = ''; | ||
| 26 | + zhDescription: string = ''; | ||
| 25 | seoTags: string = ''; | 27 | seoTags: string = ''; |
| 26 | cornerMark:string = ''; | 28 | cornerMark:string = ''; |
| 27 | liveType?: string; // 直播新闻-直播状态 | 29 | liveType?: string; // 直播新闻-直播状态 |
| @@ -153,6 +155,7 @@ export class ContentDTO implements BaseDTO { | @@ -153,6 +155,7 @@ export class ContentDTO implements BaseDTO { | ||
| 153 | 155 | ||
| 154 | static clone(old: ContentDTO): ContentDTO { | 156 | static clone(old: ContentDTO): ContentDTO { |
| 155 | let content = new ContentDTO(); | 157 | let content = new ContentDTO(); |
| 158 | + content.zhDescription = old.zhDescription; | ||
| 156 | content.liveType = old.liveType; | 159 | content.liveType = old.liveType; |
| 157 | content.seoTags = old.seoTags; | 160 | content.seoTags = old.seoTags; |
| 158 | content.appStyle = old.appStyle; | 161 | content.appStyle = old.appStyle; |
| @@ -81,7 +81,7 @@ export struct CardParser { | @@ -81,7 +81,7 @@ export struct CardParser { | ||
| 81 | @Builder | 81 | @Builder |
| 82 | contentBuilder(contentDTO: ContentDTO) { | 82 | contentBuilder(contentDTO: ContentDTO) { |
| 83 | // Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 83 | // Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| 84 | - if (!!contentDTO.contentText) { | 84 | + if (!!contentDTO.contentText || !!contentDTO.zhDescription || !!contentDTO.introduction) { |
| 85 | SearchContentComponent({ | 85 | SearchContentComponent({ |
| 86 | contentDTO, | 86 | contentDTO, |
| 87 | compDTO: this.compDTO, | 87 | compDTO: this.compDTO, |
| @@ -114,8 +114,6 @@ export struct MultiPictureDetailItemComponent { | @@ -114,8 +114,6 @@ export struct MultiPictureDetailItemComponent { | ||
| 114 | calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { | 114 | calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { |
| 115 | let width = 0 | 115 | let width = 0 |
| 116 | let height = 0; | 116 | let height = 0; |
| 117 | - // width = size.width; | ||
| 118 | - // height = size.width / imageWHRatio; | ||
| 119 | if (imageWHRatio > size.width / size.height) { | 117 | if (imageWHRatio > size.width / size.height) { |
| 120 | // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 | 118 | // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 |
| 121 | width = size.width; | 119 | width = size.width; |
| @@ -33,7 +33,7 @@ export struct Card11Component { | @@ -33,7 +33,7 @@ export struct Card11Component { | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | titleInit() { | 35 | titleInit() { |
| 36 | - const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); | 36 | + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title || this.contentDTO.newsTitle); |
| 37 | this.titleMarked = titleInitRes.titleMarked; | 37 | this.titleMarked = titleInitRes.titleMarked; |
| 38 | this.textArr = titleInitRes.textArr; | 38 | this.textArr = titleInitRes.textArr; |
| 39 | } | 39 | } |
| @@ -241,7 +241,7 @@ struct createImg { | @@ -241,7 +241,7 @@ struct createImg { | ||
| 241 | Image(this.loadImg ? item.url || item.fullUrl : '') | 241 | Image(this.loadImg ? item.url || item.fullUrl : '') |
| 242 | .backgroundColor(0xf5f5f5) | 242 | .backgroundColor(0xf5f5f5) |
| 243 | .width('100%') | 243 | .width('100%') |
| 244 | - .height(198) | 244 | + .aspectRatio(16 / 9) |
| 245 | .autoResize(true) | 245 | .autoResize(true) |
| 246 | .borderRadius(this.caclImageRadius(index)) | 246 | .borderRadius(this.caclImageRadius(index)) |
| 247 | .borderStyle(BorderStyle.Solid) | 247 | .borderStyle(BorderStyle.Solid) |
| @@ -36,7 +36,7 @@ export struct Card20Component { | @@ -36,7 +36,7 @@ export struct Card20Component { | ||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | titleInit() { | 38 | titleInit() { |
| 39 | - const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); | 39 | + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title || this.contentDTO.newsTitle); |
| 40 | this.titleMarked = titleInitRes.titleMarked; | 40 | this.titleMarked = titleInitRes.titleMarked; |
| 41 | this.textArr = titleInitRes.textArr; | 41 | this.textArr = titleInitRes.textArr; |
| 42 | } | 42 | } |
| @@ -55,7 +55,7 @@ export struct Card20Component { | @@ -55,7 +55,7 @@ export struct Card20Component { | ||
| 55 | isPeopleShipHome:this.isPeopleShipHome, loadImg: this.loadImg | 55 | isPeopleShipHome:this.isPeopleShipHome, loadImg: this.loadImg |
| 56 | } | 56 | } |
| 57 | ) // 标题 | 57 | ) // 标题 |
| 58 | - if (this.contentDTO.newsTitle) { | 58 | + if (this.contentDTO.title || this.contentDTO.newsTitle) { |
| 59 | Stack() { | 59 | Stack() { |
| 60 | if(this.contentDTO.objectType == '5'){ | 60 | if(this.contentDTO.objectType == '5'){ |
| 61 | Notes({ objectType: this.contentDTO.objectType,objectLevel:this.contentDTO.objectLevel }).height(29).align(Alignment.Center) | 61 | Notes({ objectType: this.contentDTO.objectType,objectLevel:this.contentDTO.objectLevel }).height(29).align(Alignment.Center) |
| @@ -36,7 +36,7 @@ export struct Card6Component { | @@ -36,7 +36,7 @@ export struct Card6Component { | ||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | titleInit() { | 38 | titleInit() { |
| 39 | - const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); | 39 | + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title || this.contentDTO.newsTitle); |
| 40 | this.titleMarked = titleInitRes.titleMarked; | 40 | this.titleMarked = titleInitRes.titleMarked; |
| 41 | this.textArr = titleInitRes.textArr; | 41 | this.textArr = titleInitRes.textArr; |
| 42 | } | 42 | } |
| @@ -80,7 +80,7 @@ export struct Card6Component { | @@ -80,7 +80,7 @@ export struct Card6Component { | ||
| 80 | } | 80 | } |
| 81 | }) | 81 | }) |
| 82 | } else { | 82 | } else { |
| 83 | - Span(this.contentDTO.newsTitle) | 83 | + Span(this.contentDTO.newsTitle || this.contentDTO.title) |
| 84 | } | 84 | } |
| 85 | } | 85 | } |
| 86 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 86 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| @@ -34,7 +34,7 @@ export struct SearchContentComponent { | @@ -34,7 +34,7 @@ export struct SearchContentComponent { | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | titleInit() { | 36 | titleInit() { |
| 37 | - const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.contentText || ''); | 37 | + const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.contentText || this.contentDTO.zhDescription || this.contentDTO.introduction); |
| 38 | // this.titleMarked = titleInitRes.titleMarked; | 38 | // this.titleMarked = titleInitRes.titleMarked; |
| 39 | this.textArr = titleInitRes.textArr; | 39 | this.textArr = titleInitRes.textArr; |
| 40 | } | 40 | } |
| @@ -44,7 +44,7 @@ export struct SearchContentComponent { | @@ -44,7 +44,7 @@ export struct SearchContentComponent { | ||
| 44 | //body | 44 | //body |
| 45 | Column() { | 45 | Column() { |
| 46 | //新闻标题 | 46 | //新闻标题 |
| 47 | - Text(this.contentDTO.newsTitle) | 47 | + Text(this.contentDTO.newsTitle || this.contentDTO.title) |
| 48 | .fontSize($r('app.float.font_size_18')) | 48 | .fontSize($r('app.float.font_size_18')) |
| 49 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 49 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 50 | .maxLines(3) | 50 | .maxLines(3) |
| @@ -457,6 +457,8 @@ export struct SearchResultContentComponent { | @@ -457,6 +457,8 @@ export struct SearchResultContentComponent { | ||
| 457 | let seoTags = value.data?.seoTags | 457 | let seoTags = value.data?.seoTags |
| 458 | let cornerMark = value.data?.cornerMark | 458 | let cornerMark = value.data?.cornerMark |
| 459 | let contentDTO = new ContentDTO(); | 459 | let contentDTO = new ContentDTO(); |
| 460 | + contentDTO.introduction = value.data.introduction | ||
| 461 | + contentDTO.zhDescription = value.data.zhDescription | ||
| 460 | contentDTO.liveType = liveType ? liveType : "" | 462 | contentDTO.liveType = liveType ? liveType : "" |
| 461 | contentDTO.seoTags = seoTags ? seoTags : "" | 463 | contentDTO.seoTags = seoTags ? seoTags : "" |
| 462 | contentDTO.cornerMark = cornerMark ? cornerMark : "" | 464 | contentDTO.cornerMark = cornerMark ? cornerMark : "" |
| @@ -6,6 +6,8 @@ export class SearchResultContentItem{ | @@ -6,6 +6,8 @@ export class SearchResultContentItem{ | ||
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | export class SearchDescription{ | 8 | export class SearchDescription{ |
| 9 | + introduction: string = '' | ||
| 10 | + zhDescription: string = '' | ||
| 9 | likeEnable: string = "" | 11 | likeEnable: string = "" |
| 10 | previewUri: string = "" | 12 | previewUri: string = "" |
| 11 | firstFrameImageBucket: string = "" | 13 | firstFrameImageBucket: string = "" |
| @@ -151,7 +153,6 @@ export class SearchDescription{ | @@ -151,7 +153,6 @@ export class SearchDescription{ | ||
| 151 | liveEndTime: string = "" | 153 | liveEndTime: string = "" |
| 152 | topicTemplate: string = "" | 154 | topicTemplate: string = "" |
| 153 | barrageEnable: string = "" | 155 | barrageEnable: string = "" |
| 154 | - introduction: string = "" | ||
| 155 | notice: string = "" | 156 | notice: string = "" |
| 156 | shareTitleLiteral: string = "" | 157 | shareTitleLiteral: string = "" |
| 157 | coverHImageUri: string = "" | 158 | coverHImageUri: string = "" |
| @@ -24,9 +24,12 @@ export struct PlayerFullScreenView { | @@ -24,9 +24,12 @@ export struct PlayerFullScreenView { | ||
| 24 | @State endX: number = 0 | 24 | @State endX: number = 0 |
| 25 | @State panDirection: number = 1 //1左滑 2右滑 | 25 | @State panDirection: number = 1 //1左滑 2右滑 |
| 26 | private panDistance: number = 0 | 26 | private panDistance: number = 0 |
| 27 | - private touchDownX: number = 0 | ||
| 28 | - private touchUpX: number = 0 | ||
| 29 | - @State isTouched: boolean = false | 27 | + // 用于触发拖动手势事件,滑动的最小距离为5vp时拖动手势识别成功。 |
| 28 | + private panOptionBright: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Vertical }); | ||
| 29 | + private panOptionVolume: PanGestureOptions = new PanGestureOptions({ direction: PanDirection.Vertical }); | ||
| 30 | + @Provide isShowVolume: boolean = false; | ||
| 31 | + @Provide isShowBright: boolean = false; | ||
| 32 | + @Provide volumeProgress: number = 1; | ||
| 30 | 33 | ||
| 31 | getTitle() { | 34 | getTitle() { |
| 32 | return this.contentDetailData?.newsTitle | 35 | return this.contentDetailData?.newsTitle |
| @@ -54,6 +57,15 @@ export struct PlayerFullScreenView { | @@ -54,6 +57,15 @@ export struct PlayerFullScreenView { | ||
| 54 | }, 5000) | 57 | }, 5000) |
| 55 | // 初始显示 | 58 | // 初始显示 |
| 56 | this.updateProgress() | 59 | this.updateProgress() |
| 60 | + | ||
| 61 | + if (this.playerController) { | ||
| 62 | + this.playerController.onVolumeUpdate = (volume) => { | ||
| 63 | + this.volumeProgress = volume; | ||
| 64 | + } | ||
| 65 | + this.playerController.onBrightUpdate = (volume) => { | ||
| 66 | + this.volumeProgress = volume; | ||
| 67 | + } | ||
| 68 | + } | ||
| 57 | } | 69 | } |
| 58 | 70 | ||
| 59 | aboutToDisappear(): void { | 71 | aboutToDisappear(): void { |
| @@ -63,24 +75,36 @@ export struct PlayerFullScreenView { | @@ -63,24 +75,36 @@ export struct PlayerFullScreenView { | ||
| 63 | 75 | ||
| 64 | restartTimer() { | 76 | restartTimer() { |
| 65 | clearInterval(this.timer) | 77 | clearInterval(this.timer) |
| 66 | - this.showOperator = true | ||
| 67 | this.timer = setInterval(() => { | 78 | this.timer = setInterval(() => { |
| 68 | this.showOperator = false | 79 | this.showOperator = false |
| 69 | }, 5000) | 80 | }, 5000) |
| 70 | } | 81 | } |
| 71 | 82 | ||
| 72 | build() { | 83 | build() { |
| 73 | - Stack() { | 84 | + Stack({ alignContent: Alignment.Center }) { |
| 74 | Row() { | 85 | Row() { |
| 75 | - }.height('100%').width('100%') | ||
| 76 | - .onClick(() => { | ||
| 77 | - this.restartTimer() | ||
| 78 | - }) | ||
| 79 | - | ||
| 80 | - this.headerBuilder() | ||
| 81 | - this.middleSlideBuilder() | ||
| 82 | - // this.middleContainerBuilder() | ||
| 83 | - this.bottomBuilder() | 86 | + Column() { |
| 87 | + this.leftMiddleRightSlideBuilder() | ||
| 88 | + this.headerBuilder() | ||
| 89 | + this.bottomBuilder() | ||
| 90 | + } | ||
| 91 | + .height('100%') | ||
| 92 | + .width('100%') | ||
| 93 | + .zIndex(1) | ||
| 94 | + .gesture(TapGesture({ count: 1 }) | ||
| 95 | + .onAction((event: GestureEvent) => { | ||
| 96 | + this.showOperator = !this.showOperator | ||
| 97 | + this.restartTimer() | ||
| 98 | + })) | ||
| 99 | + .gesture(TapGesture({ count: 2 }) | ||
| 100 | + .onAction((event: GestureEvent) => { | ||
| 101 | + // TODO 双击点赞|收藏 | ||
| 102 | + })) | ||
| 103 | + } | ||
| 104 | + .height('100%') | ||
| 105 | + .width('100%') | ||
| 106 | + this.volumeProgressBuilder() | ||
| 107 | + this.brightProgressBuilder() | ||
| 84 | } | 108 | } |
| 85 | .zIndex(99999) | 109 | .zIndex(99999) |
| 86 | .height('100%') | 110 | .height('100%') |
| @@ -89,6 +113,128 @@ export struct PlayerFullScreenView { | @@ -89,6 +113,128 @@ export struct PlayerFullScreenView { | ||
| 89 | } | 113 | } |
| 90 | 114 | ||
| 91 | @Builder | 115 | @Builder |
| 116 | + leftMiddleRightSlideBuilder() { | ||
| 117 | + Row() { | ||
| 118 | + Column() | ||
| 119 | + .width('20%') | ||
| 120 | + .height('100%') | ||
| 121 | + .gesture( | ||
| 122 | + PanGesture(this.panOptionBright) | ||
| 123 | + .onActionStart((event?: GestureEvent) => { | ||
| 124 | + console.log(TAG, 'onActionEnd this.panOptionBright') | ||
| 125 | + this.isShowBright = true | ||
| 126 | + this.playerController?.onBrightActionStart(event!); | ||
| 127 | + }) | ||
| 128 | + .onActionUpdate((event?: GestureEvent) => { | ||
| 129 | + this.playerController?.onBrightActionUpdate(event!); | ||
| 130 | + }) | ||
| 131 | + .onActionEnd(() => { | ||
| 132 | + setTimeout(() => { | ||
| 133 | + this.isShowBright = false | ||
| 134 | + }, 500) | ||
| 135 | + this.playerController?.onActionEnd(); | ||
| 136 | + }) | ||
| 137 | + ) | ||
| 138 | + Column() { | ||
| 139 | + this.middleSlideBuilder() | ||
| 140 | + } | ||
| 141 | + .width('60%') | ||
| 142 | + .height('100%') | ||
| 143 | + Column() | ||
| 144 | + .width('20%') | ||
| 145 | + .height('100%') | ||
| 146 | + .gesture( | ||
| 147 | + PanGesture(this.panOptionVolume) | ||
| 148 | + .onActionStart((event?: GestureEvent) => { | ||
| 149 | + // console.log(TAG, 'onActionEnd this.panOptionVolume') | ||
| 150 | + this.isShowVolume = true | ||
| 151 | + this.playerController?.onVolumeActionStart(event!); | ||
| 152 | + }) | ||
| 153 | + .onActionUpdate((event?: GestureEvent) => { | ||
| 154 | + this.playerController?.onVolumeActionUpdate(event!); | ||
| 155 | + }) | ||
| 156 | + .onActionEnd(() => { | ||
| 157 | + setTimeout(() => { | ||
| 158 | + this.isShowVolume = false | ||
| 159 | + }, 500) | ||
| 160 | + this.playerController?.onActionEnd(); | ||
| 161 | + }) | ||
| 162 | + ) | ||
| 163 | + } | ||
| 164 | + .width('100%') | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + @Builder | ||
| 168 | + volumeProgressBuilder() { | ||
| 169 | + Row() { | ||
| 170 | + Image(this.volumeProgress == 0 ? $r('app.media.ic_volume_mute') : $r('app.media.ic_volume')) | ||
| 171 | + .width(20) | ||
| 172 | + .height(20) | ||
| 173 | + .margin({ | ||
| 174 | + right: 8 | ||
| 175 | + }) | ||
| 176 | + Slider({ | ||
| 177 | + value: this.volumeProgress * 100, | ||
| 178 | + step: 0.01, | ||
| 179 | + style: SliderStyle.NONE | ||
| 180 | + }) | ||
| 181 | + .width(132) | ||
| 182 | + .height(2) | ||
| 183 | + .zIndex(2) | ||
| 184 | + .trackColor($r('app.color.pause_track_color')) | ||
| 185 | + .selectedColor($r('app.color.pause_selected_color')) | ||
| 186 | + .sliderInteractionMode(SliderInteraction.SLIDE_ONLY) | ||
| 187 | + } | ||
| 188 | + .width(204) | ||
| 189 | + .height(32) | ||
| 190 | + .borderRadius(16) | ||
| 191 | + .padding({ | ||
| 192 | + top: 4, | ||
| 193 | + bottom: 4, | ||
| 194 | + left: 16, | ||
| 195 | + right: 24 | ||
| 196 | + }) | ||
| 197 | + .backgroundColor('rgba(0, 0, 0, 0.4)') | ||
| 198 | + .justifyContent(FlexAlign.Center) | ||
| 199 | + .visibility(this.isShowVolume ? Visibility.Visible : Visibility.None) | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + @Builder | ||
| 203 | + brightProgressBuilder() { | ||
| 204 | + Row() { | ||
| 205 | + Image($r('app.media.ic_bright')) | ||
| 206 | + .width(20) | ||
| 207 | + .height(20) | ||
| 208 | + .margin({ | ||
| 209 | + right: 8 | ||
| 210 | + }) | ||
| 211 | + Slider({ | ||
| 212 | + value: this.volumeProgress * 100, | ||
| 213 | + step: 0.01, | ||
| 214 | + style: SliderStyle.NONE | ||
| 215 | + }) | ||
| 216 | + .width(132) | ||
| 217 | + .height(2) | ||
| 218 | + .zIndex(2) | ||
| 219 | + .trackColor($r('app.color.pause_track_color')) | ||
| 220 | + .selectedColor($r('app.color.pause_selected_color')) | ||
| 221 | + .sliderInteractionMode(SliderInteraction.SLIDE_ONLY) | ||
| 222 | + } | ||
| 223 | + .width(204) | ||
| 224 | + .height(32) | ||
| 225 | + .borderRadius(16) | ||
| 226 | + .padding({ | ||
| 227 | + top: 4, | ||
| 228 | + bottom: 4, | ||
| 229 | + left: 16, | ||
| 230 | + right: 24 | ||
| 231 | + }) | ||
| 232 | + .backgroundColor('rgba(0, 0, 0, 0.4)') | ||
| 233 | + .justifyContent(FlexAlign.Center) | ||
| 234 | + .visibility(this.isShowBright ? Visibility.Visible : Visibility.None) | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + @Builder | ||
| 92 | headerBuilder() { | 238 | headerBuilder() { |
| 93 | Row() { | 239 | Row() { |
| 94 | Row() { | 240 | Row() { |
| @@ -159,12 +305,14 @@ export struct PlayerFullScreenView { | @@ -159,12 +305,14 @@ export struct PlayerFullScreenView { | ||
| 159 | .onClick(() => { | 305 | .onClick(() => { |
| 160 | // console.log(TAG, `ic_play_2 onClick`, this.status ) | 306 | // console.log(TAG, `ic_play_2 onClick`, this.status ) |
| 161 | this.playerController?.switchPlayOrPause() | 307 | this.playerController?.switchPlayOrPause() |
| 308 | + this.status = PlayerConstants.STATUS_START | ||
| 162 | }) | 309 | }) |
| 163 | Image($r(`app.media.ic_pause_2`)).height(24).width(24) | 310 | Image($r(`app.media.ic_pause_2`)).height(24).width(24) |
| 164 | .visibility(this.status === PlayerConstants.STATUS_PAUSE ? Visibility.None : Visibility.Visible) | 311 | .visibility(this.status === PlayerConstants.STATUS_PAUSE ? Visibility.None : Visibility.Visible) |
| 165 | .onClick(() => { | 312 | .onClick(() => { |
| 166 | // console.log(TAG, `ic_pause_2 onClick`, this.status ) | 313 | // console.log(TAG, `ic_pause_2 onClick`, this.status ) |
| 167 | this.playerController?.switchPlayOrPause() | 314 | this.playerController?.switchPlayOrPause() |
| 315 | + this.status = PlayerConstants.STATUS_PAUSE | ||
| 168 | }) | 316 | }) |
| 169 | 317 | ||
| 170 | Text(this.upProVal) | 318 | Text(this.upProVal) |
| @@ -308,49 +456,18 @@ export struct PlayerFullScreenView { | @@ -308,49 +456,18 @@ export struct PlayerFullScreenView { | ||
| 308 | .width('100%') | 456 | .width('100%') |
| 309 | .height('100%') | 457 | .height('100%') |
| 310 | .onChange((value: number, mode: SliderChangeMode) => { | 458 | .onChange((value: number, mode: SliderChangeMode) => { |
| 311 | - // if (this.isTouched) { | ||
| 312 | - // return | ||
| 313 | - // } | ||
| 314 | this.progressVal = value | 459 | this.progressVal = value |
| 315 | - // console.log('cj2024 onChange slider value:', value) | 460 | + this.showOperator = true |
| 461 | + // console.log(TAG, 'onChange slider value:', value) | ||
| 316 | if (mode === SliderChangeMode.Moving) { | 462 | if (mode === SliderChangeMode.Moving) { |
| 317 | this.isDragging = true | 463 | this.isDragging = true |
| 318 | } | 464 | } |
| 319 | if (mode === SliderChangeMode.End) { | 465 | if (mode === SliderChangeMode.End) { |
| 466 | + this.restartTimer() | ||
| 320 | this.isDragging = false | 467 | this.isDragging = false |
| 321 | this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End); | 468 | this.playerController?.setSeekTime(this.progressVal, SliderChangeMode.End); |
| 322 | } | 469 | } |
| 323 | }) | 470 | }) |
| 324 | }.margin({ top: 73, bottom: 73 }) | 471 | }.margin({ top: 73, bottom: 73 }) |
| 325 | - .onTouch((event?: TouchEvent) => { | ||
| 326 | - // console.log(`cj2024 onTouch isDragging = ${this.isDragging}`) | ||
| 327 | - if (this.isDragging) { | ||
| 328 | - return | ||
| 329 | - } | ||
| 330 | - if (event) { | ||
| 331 | - if (event.type === TouchType.Down) { | ||
| 332 | - // console.info(`cj2024 onTouch Down x=${event?.touches[0].x}`) | ||
| 333 | - if (event?.touches.length > 0) { | ||
| 334 | - this.touchDownX = event?.touches[0].x | ||
| 335 | - } | ||
| 336 | - clearInterval(this.timer) | ||
| 337 | - } | ||
| 338 | - if (event.type === TouchType.Up) { | ||
| 339 | - // console.info(`cj2024 onTouch Up x=${event?.touches[0].x}`) | ||
| 340 | - if (event?.touches.length > 0) { | ||
| 341 | - this.touchUpX = event?.touches[0].x | ||
| 342 | - this.isTouched = this.touchUpX == this.touchDownX ? true : false | ||
| 343 | - } | ||
| 344 | - if (this.showOperator == false) { | ||
| 345 | - this.restartTimer(); | ||
| 346 | - } else { | ||
| 347 | - // if (this.isTouched) { | ||
| 348 | - this.showOperator = false | ||
| 349 | - // } | ||
| 350 | - // this.restartTimer(); | ||
| 351 | - } | ||
| 352 | - } | ||
| 353 | - } | ||
| 354 | - }) | ||
| 355 | } | 472 | } |
| 356 | } | 473 | } |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_bright.svg
0 → 100644
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_13863_054207"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_13863_054207)"><g><g><g><rect x="11.25" y="1.50048828125" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(0.7071067690849304,0.7071067690849304,-0.7071067690849304,0.7071067690849304,8.571029755170457,-12.24893618770875)"><g><rect x="18.8223876953125" y="4.2216796875" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(0,1,-1,0,33.9990234375,-11)"><g><rect x="22.24951171875" y="11.49951171875" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(-0.7071067690849304,0.7071067690849304,-0.7071067690849304,-0.7071067690849304,47.24796326266369,18.57085419842042)"><g><rect x="19.52880859375" y="19.0697021484375" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(-1,0,0,-1,25,44.9990234375)"><g><rect x="12.25" y="22.49951171875" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(-0.7071068286895752,-0.7071067094802856,0.7071067094802856,-0.7071068286895752,-5.569534533715341,37.24868722411338)"><g><rect x="4.6787109375" y="19.77685546875" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(0,-1,1,0,-10.99951171875,13.99951171875)"><g><rect x="1.25" y="12.49951171875" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(0.7071066498756409,-0.70710688829422,0.70710688829422,0.7071066498756409,-2.2488258001976646,4.429253726848401)"><g><rect x="3.97216796875" y="4.9302978515625" width="1.5" height="2.5" rx="0.20000000298023224" fill="#FFFFFF" fill-opacity="1"/></g></g></g><g><ellipse cx="12" cy="12" rx="5.5" ry="5.5" fill="#FFFFFF" fill-opacity="1"/></g></g></svg> |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_volume.png
deleted
100644 → 0
6.02 KB
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_volume.svg
0 → 100644
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_13863_054208"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_13863_054208)"><g><g><path d="M14.7395,2.3000410000000002Q9.105879999999999,6.9891,8.55184,7.45024C8.51231,7.48314,8.46376,7.50053,8.41233,7.50053Q7.84572,7.50044,3.219141,7.49976C3.0976259,7.49974,3,7.59824,3,7.71976L3,16.079700000000003C3,16.2012,3.0976429,16.2997,3.219141,16.2997Q8.49141,16.3,8.49141,16.3C8.49141,16.3,8.49248,16.3,8.49248,16.3Q8.49248,16.3,14.7396,21.5C14.8829,21.6193,15.1,21.5171,15.1,21.3306L15.1,2.469347C15.1,2.282884,14.8828,2.180755,14.7395,2.3000410000000002M19.2049,16.805500000000002C18.9178,16.5183,18.2758,15.8763,17.9631,15.5636C17.8692,15.4697,17.8781,15.3147,17.9786,15.2279C18.4241,14.8432,18.7884,14.3723,19.0489,13.8426C19.3462,13.2381,19.5007,12.5734,19.5,11.89975C19.5,10.42702,18.7768,9.12304,17.6645,8.32452C17.549599999999998,8.24204,17.5302,8.07039,17.630200000000002,7.97038C17.9568,7.64378,18.5997,7.00082,18.8795,6.72104C18.956400000000002,6.64417,19.0775,6.63112,19.1632,6.69798C19.9287,7.29505,20.5533,8.054369999999999,20.9918,8.92218C21.4582,9.845369999999999,21.7009,10.8654,21.7,11.89975C21.7,13.8537,20.8509,15.6093,19.5009,16.8181C19.4158,16.8943,19.2857,16.886200000000002,19.2049,16.805500000000002" fill="#FFFFFF" fill-opacity="1"/></g></g></g></svg> |
sight_harmony/features/wdDetailPlayShortVideo/src/main/resources/base/media/ic_volume_mute.svg
0 → 100644
| 1 | +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_21334_091013"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_21334_091013)"><g><g><path d="M10.55184,7.450458405447006L16.7395,2.300264605447006C16.8828,2.1809784054470063,17.1,2.2831074054470064,17.1,2.4695704054470062L17.1,14.575658405447006L9.68048,7.500638405447006L10.41233,7.500748405447006C10.46376,7.500758405447006,10.51231,7.483368405447006,10.55184,7.450458405447006ZM6.78191,7.500208405447006L5.219141,7.499978405447006C5.0976259,7.499968405447007,5,7.598468405447006,5,7.719978405447006L5,16.07995840544701C5,16.201458405447006,5.0976429,16.299958405447008,5.219141,16.299958405447008L10.49141,16.300258405447007L10.49248,16.300258405447007L16.7396,21.500258405447006C16.8829,21.619458405447006,17.1,21.517358405447006,17.1,21.330858405447007L17.1,17.33915840544701L6.78191,7.500208405447006Z" fill-rule="evenodd" fill="#FFFFFF" fill-opacity="1"/></g></g><g transform="matrix(0.7237114310264587,0.6901028156280518,-0.6901028156280518,0.723711371421814,3.2684092820854858,-1.7144847984891385)"><line x1="3.775390625" y1="2.724609375" x2="29.231157302856445" y2="2.724609375" fill-opacity="0" stroke-opacity="1" stroke="#FFFFFF" fill="none" stroke-width="1"/></g></g></svg> |
| @@ -4,7 +4,7 @@ import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerCons | @@ -4,7 +4,7 @@ import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerCons | ||
| 4 | import { BusinessError } from '@ohos.base'; | 4 | import { BusinessError } from '@ohos.base'; |
| 5 | import { TrackingPlay } from 'wdTracking/Index'; | 5 | import { TrackingPlay } from 'wdTracking/Index'; |
| 6 | import { ParamType } from 'wdTracking/Index'; | 6 | import { ParamType } from 'wdTracking/Index'; |
| 7 | -import { DateTimeUtils, Logger } from 'wdKit/Index'; | 7 | +import { DateTimeUtils, Logger, WindowModel } from 'wdKit/Index'; |
| 8 | import { BackgroundAudioController } from './BackgroundAudioController'; | 8 | import { BackgroundAudioController } from './BackgroundAudioController'; |
| 9 | import { audio } from '@kit.AudioKit'; | 9 | import { audio } from '@kit.AudioKit'; |
| 10 | 10 | ||
| @@ -37,6 +37,7 @@ export class WDPlayerController { | @@ -37,6 +37,7 @@ export class WDPlayerController { | ||
| 37 | public onLoaded?: (loaded: number) => void; | 37 | public onLoaded?: (loaded: number) => void; |
| 38 | public onTimeUpdate?: (position: number, duration: number) => void; | 38 | public onTimeUpdate?: (position: number, duration: number) => void; |
| 39 | public onVolumeUpdate?: (volume: number) => void; | 39 | public onVolumeUpdate?: (volume: number) => void; |
| 40 | + public onBrightUpdate?: (volume: number) => void; | ||
| 40 | public continue?: () => void; | 41 | public continue?: () => void; |
| 41 | public onCanplay?: () => void; | 42 | public onCanplay?: () => void; |
| 42 | public onStatusChange?: (status: number) => void; | 43 | public onStatusChange?: (status: number) => void; |
| @@ -45,6 +46,7 @@ export class WDPlayerController { | @@ -45,6 +46,7 @@ export class WDPlayerController { | ||
| 45 | public videoWidth: number = 0 | 46 | public videoWidth: number = 0 |
| 46 | public videoHeight: number = 0 | 47 | public videoHeight: number = 0 |
| 47 | public keepOnBackground = false | 48 | public keepOnBackground = false |
| 49 | + private windowHeight: number = px2vp(AppStorage.get<number>('windowHeight') || 0) | ||
| 48 | 50 | ||
| 49 | 51 | ||
| 50 | 52 | ||
| @@ -422,10 +424,6 @@ export class WDPlayerController { | @@ -422,10 +424,6 @@ export class WDPlayerController { | ||
| 422 | } | 424 | } |
| 423 | } | 425 | } |
| 424 | 426 | ||
| 425 | - setBright() { | ||
| 426 | - // globalThis.windowClass.setWindowBrightness(this.playerThis.bright) | ||
| 427 | - } | ||
| 428 | - | ||
| 429 | getStatus() { | 427 | getStatus() { |
| 430 | return this.status; | 428 | return this.status; |
| 431 | } | 429 | } |
| @@ -465,14 +463,14 @@ export class WDPlayerController { | @@ -465,14 +463,14 @@ export class WDPlayerController { | ||
| 465 | } | 463 | } |
| 466 | 464 | ||
| 467 | onVolumeActionStart(event: GestureEvent) { | 465 | onVolumeActionStart(event: GestureEvent) { |
| 468 | - this.positionY = event.offsetY; | ||
| 469 | - } | ||
| 470 | - | ||
| 471 | - onBrightActionStart(event: GestureEvent) { | 466 | + if (!event) { |
| 467 | + return; | ||
| 468 | + } | ||
| 472 | this.positionY = event.offsetY; | 469 | this.positionY = event.offsetY; |
| 473 | } | 470 | } |
| 474 | 471 | ||
| 475 | volume: number = 1 | 472 | volume: number = 1 |
| 473 | + bright: number = 1 | ||
| 476 | 474 | ||
| 477 | onVolumeActionUpdate(event: GestureEvent) { | 475 | onVolumeActionUpdate(event: GestureEvent) { |
| 478 | if (!this.avPlayer) { | 476 | if (!this.avPlayer) { |
| @@ -481,7 +479,7 @@ export class WDPlayerController { | @@ -481,7 +479,7 @@ export class WDPlayerController { | ||
| 481 | if (PlayerConstants.OPERATE_STATE.indexOf(this.avPlayer.state) === -1) { | 479 | if (PlayerConstants.OPERATE_STATE.indexOf(this.avPlayer.state) === -1) { |
| 482 | return; | 480 | return; |
| 483 | } | 481 | } |
| 484 | - let changeVolume = (event.offsetY - this.positionY) / 300; | 482 | + let changeVolume = (event.offsetY - this.positionY) / this.windowHeight; |
| 485 | let currentVolume = this.volume - changeVolume; | 483 | let currentVolume = this.volume - changeVolume; |
| 486 | if (currentVolume > 1) { | 484 | if (currentVolume > 1) { |
| 487 | currentVolume = 1; | 485 | currentVolume = 1; |
| @@ -490,26 +488,47 @@ export class WDPlayerController { | @@ -490,26 +488,47 @@ export class WDPlayerController { | ||
| 490 | currentVolume = 0; | 488 | currentVolume = 0; |
| 491 | } | 489 | } |
| 492 | this.volume = currentVolume; | 490 | this.volume = currentVolume; |
| 491 | + // Logger.debug(TAG, "changeVolume : " + changeVolume) | ||
| 492 | + // Logger.debug(TAG, "windowHeight : " + this.windowHeight) | ||
| 493 | + // Logger.debug(TAG, "volume : " + this.volume) | ||
| 493 | this.avPlayer?.setVolume(this.volume); | 494 | this.avPlayer?.setVolume(this.volume); |
| 494 | this.positionY = event.offsetY; | 495 | this.positionY = event.offsetY; |
| 495 | if (this.onVolumeUpdate) { | 496 | if (this.onVolumeUpdate) { |
| 496 | this.onVolumeUpdate(this.volume); | 497 | this.onVolumeUpdate(this.volume); |
| 497 | } | 498 | } |
| 498 | - Logger.debug(TAG, "volume : " + this.volume) | 499 | + } |
| 500 | + | ||
| 501 | + onBrightActionStart(event: GestureEvent) { | ||
| 502 | + if (!event) { | ||
| 503 | + return; | ||
| 504 | + } | ||
| 505 | + this.positionY = event.offsetY; | ||
| 506 | + } | ||
| 507 | + | ||
| 508 | + setBright() { | ||
| 509 | + const windowClass = WindowModel.shared.getWindowClass(); | ||
| 510 | + windowClass.setWindowBrightness(this.bright) | ||
| 499 | } | 511 | } |
| 500 | 512 | ||
| 501 | onBrightActionUpdate(event: GestureEvent) { | 513 | onBrightActionUpdate(event: GestureEvent) { |
| 502 | - // if (!this.playerThis.volumeShow) { | ||
| 503 | - // this.playerThis.brightShow = true; | ||
| 504 | - // let changeBright = (this.positionY - event.offsetY) / globalThis.screenHeight; | ||
| 505 | - // let currentBright = this.playerThis.bright + changeBright; | ||
| 506 | - // let brightMinFlag = currentBright <= 0; | ||
| 507 | - // let brightMaxFlag = currentBright > 1; | ||
| 508 | - // this.playerThis.bright = brightMinFlag ? 0 : | ||
| 509 | - // (brightMaxFlag ? 1 : currentBright); | ||
| 510 | - // this.setBright(); | ||
| 511 | - // this.positionY = event.offsetY; | ||
| 512 | - // } | 514 | + |
| 515 | + let changeBright = (event.offsetY - this.positionY) / this.windowHeight; | ||
| 516 | + let currentBright = this.bright - changeBright; | ||
| 517 | + if (currentBright > 1) { | ||
| 518 | + currentBright = 1; | ||
| 519 | + } | ||
| 520 | + if (currentBright <= 0.1) { | ||
| 521 | + currentBright = 0.1; | ||
| 522 | + } | ||
| 523 | + this.bright = currentBright; | ||
| 524 | + // Logger.debug(TAG, "changeBright : " + changeBright) | ||
| 525 | + // Logger.debug(TAG, "windowHeight : " + this.windowHeight) | ||
| 526 | + // Logger.debug(TAG, "bright : " + this.bright) | ||
| 527 | + this.setBright() | ||
| 528 | + this.positionY = event.offsetY; | ||
| 529 | + if (this.onBrightUpdate) { | ||
| 530 | + this.onBrightUpdate(this.bright); | ||
| 531 | + } | ||
| 513 | } | 532 | } |
| 514 | 533 | ||
| 515 | onActionEnd() { | 534 | onActionEnd() { |
-
Please register or login to post a comment