Showing
2 changed files
with
161 additions
and
133 deletions
| @@ -249,7 +249,16 @@ export struct PlayerTitleView { | @@ -249,7 +249,16 @@ export struct PlayerTitleView { | ||
| 249 | } | 249 | } |
| 250 | }) | 250 | }) |
| 251 | if (this.isOverLines) { | 251 | if (this.isOverLines) { |
| 252 | - Span('... 全文') | 252 | + Span('... ') |
| 253 | + .fontColor(Color.White) | ||
| 254 | + .fontWeight(400) | ||
| 255 | + .fontFamily('PingFang SC-Regular') | ||
| 256 | + .fontSize(12) | ||
| 257 | + .onClick(() => { | ||
| 258 | + this.isOpenDetail = true | ||
| 259 | + this.dialogController?.open() | ||
| 260 | + }) | ||
| 261 | + Span('全文') | ||
| 253 | .fontColor('#99FFFFFF') | 262 | .fontColor('#99FFFFFF') |
| 254 | .fontWeight(400) | 263 | .fontWeight(400) |
| 255 | .fontFamily('PingFang SC-Regular') | 264 | .fontFamily('PingFang SC-Regular') |
| @@ -309,9 +318,18 @@ export struct PlayerTitleView { | @@ -309,9 +318,18 @@ export struct PlayerTitleView { | ||
| 309 | .fontWeight(600) | 318 | .fontWeight(600) |
| 310 | .fontFamily('PingFang SC-Regular') | 319 | .fontFamily('PingFang SC-Regular') |
| 311 | if (this.isTitleOverLines) { | 320 | if (this.isTitleOverLines) { |
| 312 | - Span('... 全文') | 321 | + Span('... ') |
| 322 | + .fontColor(Color.White) | ||
| 323 | + .fontWeight(400) | ||
| 324 | + .fontFamily('PingFang SC-Regular') | ||
| 325 | + .fontSize(12) | ||
| 326 | + .onClick(() => { | ||
| 327 | + this.isOpenDetail = true | ||
| 328 | + this.dialogController?.open() | ||
| 329 | + }) | ||
| 330 | + Span('全文') | ||
| 313 | .fontColor('#99FFFFFF') | 331 | .fontColor('#99FFFFFF') |
| 314 | - .fontWeight(600) | 332 | + .fontWeight(400) |
| 315 | .fontFamily('PingFang SC-Regular') | 333 | .fontFamily('PingFang SC-Regular') |
| 316 | .fontSize(12) | 334 | .fontSize(12) |
| 317 | .onClick(() => { | 335 | .onClick(() => { |
| @@ -101,38 +101,39 @@ struct Index { | @@ -101,38 +101,39 @@ struct Index { | ||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | build() { | 103 | build() { |
| 104 | - Stack({ alignContent: Alignment.End }) { | ||
| 105 | - Progress( | ||
| 106 | - { | ||
| 107 | - value: this.progressVal, | ||
| 108 | - total: 100, | ||
| 109 | - type: ProgressType.Linear, | ||
| 110 | - }) | ||
| 111 | - .style({ | ||
| 112 | - enableSmoothEffect: false | ||
| 113 | - }) | ||
| 114 | - .color("#ED2800") | ||
| 115 | - .backgroundColor($r('app.color.white')) | ||
| 116 | - .width("100%") | ||
| 117 | - .height(3) | ||
| 118 | - .margin({ top: 57 }) | ||
| 119 | - .visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden) | 104 | + Column(){ |
| 120 | Stack({ alignContent: Alignment.End }) { | 105 | Stack({ alignContent: Alignment.End }) { |
| 121 | - Column() { //标题 时间 进度条 | ||
| 122 | - Marquee({ | ||
| 123 | - start: true, | ||
| 124 | - step: 5, | ||
| 125 | - loop: Number.POSITIVE_INFINITY, | ||
| 126 | - fromStart: true, | ||
| 127 | - src: this.audioTitle | 106 | + Progress( |
| 107 | + { | ||
| 108 | + value: this.progressVal, | ||
| 109 | + total: 100, | ||
| 110 | + type: ProgressType.Linear, | ||
| 111 | + }) | ||
| 112 | + .style({ | ||
| 113 | + enableSmoothEffect: false | ||
| 128 | }) | 114 | }) |
| 129 | - .width("60%") | ||
| 130 | - .height(20) | ||
| 131 | - .fontColor('#222222') | ||
| 132 | - .fontSize(14) | ||
| 133 | - .fontFamily('PingFang SC-Medium') | ||
| 134 | - .fontWeight(500) | ||
| 135 | - .alignSelf(ItemAlign.Start) | 115 | + .color("#ED2800") |
| 116 | + .backgroundColor($r('app.color.white')) | ||
| 117 | + .width("100%") | ||
| 118 | + .height(3) | ||
| 119 | + .margin({ top: 56 }) | ||
| 120 | + .visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden) | ||
| 121 | + Stack({ alignContent: Alignment.End }) { | ||
| 122 | + Column() { //标题 时间 进度条 | ||
| 123 | + Marquee({ | ||
| 124 | + start: true, | ||
| 125 | + step: 5, | ||
| 126 | + loop: Number.POSITIVE_INFINITY, | ||
| 127 | + fromStart: true, | ||
| 128 | + src: this.audioTitle | ||
| 129 | + }) | ||
| 130 | + .width("60%") | ||
| 131 | + .height(20) | ||
| 132 | + .fontColor('#222222') | ||
| 133 | + .fontSize(14) | ||
| 134 | + .fontFamily('PingFang SC-Medium') | ||
| 135 | + .fontWeight(500) | ||
| 136 | + .alignSelf(ItemAlign.Start) | ||
| 136 | // .onStart(() => { | 137 | // .onStart(() => { |
| 137 | // console.info('Marquee animation complete onStart') | 138 | // console.info('Marquee animation complete onStart') |
| 138 | // }) | 139 | // }) |
| @@ -143,118 +144,127 @@ struct Index { | @@ -143,118 +144,127 @@ struct Index { | ||
| 143 | // console.info('Marquee animation complete onFinish') | 144 | // console.info('Marquee animation complete onFinish') |
| 144 | // }) | 145 | // }) |
| 145 | 146 | ||
| 146 | - Row() { | ||
| 147 | - Text(this.currentTime) | ||
| 148 | - .fontSize(12) | ||
| 149 | - .fontColor("#999999") | ||
| 150 | - .height("100%") | ||
| 151 | - .alignSelf(ItemAlign.Start) | ||
| 152 | - Text("/" + this.totalTime) | ||
| 153 | - .fontSize(12) | ||
| 154 | - .fontColor("#999999") | ||
| 155 | - .height("100%") | ||
| 156 | - .alignSelf(ItemAlign.Start) | 147 | + Row() { |
| 148 | + Text(this.currentTime) | ||
| 149 | + .fontSize(12) | ||
| 150 | + .fontColor("#999999") | ||
| 151 | + .height("100%") | ||
| 152 | + .alignSelf(ItemAlign.Start) | ||
| 153 | + Text("/" + this.totalTime) | ||
| 154 | + .fontSize(12) | ||
| 155 | + .fontColor("#999999") | ||
| 156 | + .height("100%") | ||
| 157 | + .alignSelf(ItemAlign.Start) | ||
| 157 | 158 | ||
| 159 | + } | ||
| 160 | + .width("100%") | ||
| 161 | + .height(16) | ||
| 162 | + .margin({ top: 4}) | ||
| 158 | } | 163 | } |
| 159 | - .width("100%") | ||
| 160 | - .height(16) | ||
| 161 | - .margin({ top: 4}) | 164 | + .padding({ |
| 165 | + top: 10, | ||
| 166 | + bottom: 10, | ||
| 167 | + left: 10, | ||
| 168 | + right: 0 | ||
| 169 | + }) | ||
| 170 | + .width(247) | ||
| 171 | + .height(60) | ||
| 172 | + .justifyContent(FlexAlign.Start) | ||
| 173 | + // .onClick(() => { | ||
| 174 | + // let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_NEWS_INFO_DATA_MODEL,'') as string | ||
| 175 | + // console.log(TAG, dataModelStr) | ||
| 176 | + // let dataModel : CompInfoBean = JSON.parse(dataModelStr) | ||
| 177 | + // //公共跳转 | ||
| 178 | + // let content: ContentDTO = { | ||
| 179 | + // objectId: this.itemBeanClicked.newsId + '', | ||
| 180 | + // objectType: this.itemBeanClicked.newsType + '', | ||
| 181 | + // relId: this.itemBeanClicked.relId + '', | ||
| 182 | + // relType: this.itemBeanClicked.relType ?? '0' | ||
| 183 | + // } as ContentDTO | ||
| 184 | + // ProcessUtils.processPage(content) | ||
| 185 | + // }) | ||
| 186 | + | ||
| 187 | + Row() { | ||
| 188 | + Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause_svg") : $r("app.media.icon_audio_playing_svg")) | ||
| 189 | + .objectFit(ImageFit.Contain) | ||
| 190 | + .width(24) | ||
| 191 | + .height(24) | ||
| 192 | + .margin({ right: 12 }) | ||
| 193 | + .gesture( | ||
| 194 | + TapGesture() | ||
| 195 | + .onAction((event: GestureEvent) => { | ||
| 196 | + if (this.AudioSuspension.playerController) { | ||
| 197 | + this.AudioSuspension.playerController.get().switchPlayOrPause() | ||
| 198 | + } | ||
| 199 | + })) | ||
| 200 | + Image($r("app.media.icon_audio_close")) | ||
| 201 | + .objectFit(ImageFit.Contain) | ||
| 202 | + .width(24) | ||
| 203 | + .height(24) | ||
| 204 | + .gesture( | ||
| 205 | + TapGesture() | ||
| 206 | + .onAction((event: GestureEvent) => { | ||
| 207 | + if (this.AudioSuspension.playerController) { | ||
| 208 | + this.AudioSuspension.playerController.get().pause() | ||
| 209 | + this.AudioSuspension.minimize() | ||
| 210 | + BackgroundAudioController.sharedController().destorySession() | ||
| 211 | + } | ||
| 212 | + })) | ||
| 213 | + } | ||
| 214 | + .width(80) | ||
| 215 | + .height(60) | ||
| 162 | } | 216 | } |
| 163 | - .padding({ | ||
| 164 | - top: 10, | ||
| 165 | - bottom: 10, | ||
| 166 | - left: 10, | ||
| 167 | - right: 0 | ||
| 168 | - }) | ||
| 169 | - .width(243) | ||
| 170 | - .height(60) | ||
| 171 | - .justifyContent(FlexAlign.Start) | ||
| 172 | - // .onClick(() => { | ||
| 173 | - // let dataModelStr : string = SPHelper.default.getSync(SpConstants.APP_NEWS_INFO_DATA_MODEL,'') as string | ||
| 174 | - // console.log(TAG, dataModelStr) | ||
| 175 | - // let dataModel : CompInfoBean = JSON.parse(dataModelStr) | ||
| 176 | - // //公共跳转 | ||
| 177 | - // let content: ContentDTO = { | ||
| 178 | - // objectId: this.itemBeanClicked.newsId + '', | ||
| 179 | - // objectType: this.itemBeanClicked.newsType + '', | ||
| 180 | - // relId: this.itemBeanClicked.relId + '', | ||
| 181 | - // relType: this.itemBeanClicked.relType ?? '0' | ||
| 182 | - // } as ContentDTO | ||
| 183 | - // ProcessUtils.processPage(content) | ||
| 184 | - // }) | 217 | + .visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden) |
| 185 | 218 | ||
| 186 | Row() { | 219 | Row() { |
| 187 | - Image(this.currentStatus === PlayerConstants.STATUS_START ? $r("app.media.icon_audio_pause_svg") : $r("app.media.icon_audio_playing_svg")) | ||
| 188 | - .objectFit(ImageFit.Contain) | ||
| 189 | - .width(24) | ||
| 190 | - .height(24) | ||
| 191 | - .margin({ right: 12 }) | ||
| 192 | - .gesture( | ||
| 193 | - TapGesture() | ||
| 194 | - .onAction((event: GestureEvent) => { | ||
| 195 | - if (this.AudioSuspension.playerController) { | ||
| 196 | - this.AudioSuspension.playerController.get().switchPlayOrPause() | ||
| 197 | - } | ||
| 198 | - })) | ||
| 199 | - Image($r("app.media.icon_audio_close")) | ||
| 200 | - .objectFit(ImageFit.Contain) | ||
| 201 | - .width(24) | ||
| 202 | - .height(24) | ||
| 203 | - .gesture( | ||
| 204 | - TapGesture() | ||
| 205 | - .onAction((event: GestureEvent) => { | ||
| 206 | - if (this.AudioSuspension.playerController) { | ||
| 207 | - this.AudioSuspension.playerController.get().pause() | ||
| 208 | - this.AudioSuspension.minimize() | ||
| 209 | - BackgroundAudioController.sharedController().destorySession() | ||
| 210 | - } | ||
| 211 | - })) | 220 | + LottieView({ |
| 221 | + name: this.name, | ||
| 222 | + path: "lottie/audio_animation_playing.json", | ||
| 223 | + lottieWidth: 24, | ||
| 224 | + lottieHeight: 24, | ||
| 225 | + autoplay: false, | ||
| 226 | + loop: true | ||
| 227 | + }) | ||
| 212 | } | 228 | } |
| 213 | - .width(80) | 229 | + .justifyContent(FlexAlign.Center) |
| 230 | + .width(60) | ||
| 214 | .height(60) | 231 | .height(60) |
| 232 | + .visibility(!this.isExpand ? Visibility.Visible : Visibility.Hidden) | ||
| 215 | } | 233 | } |
| 216 | - .visibility(this.isExpand ? Visibility.Visible : Visibility.Hidden) | ||
| 217 | - | ||
| 218 | - Row() { | ||
| 219 | - LottieView({ | ||
| 220 | - name: this.name, | ||
| 221 | - path: "lottie/audio_animation_playing.json", | ||
| 222 | - lottieWidth: 24, | ||
| 223 | - lottieHeight: 24, | ||
| 224 | - autoplay: false, | ||
| 225 | - loop: true | ||
| 226 | - }) | ||
| 227 | - } | ||
| 228 | - .justifyContent(FlexAlign.Center) | ||
| 229 | - .width(60) | ||
| 230 | - .height(60) | ||
| 231 | - .visibility(!this.isExpand ? Visibility.Visible : Visibility.Hidden) | ||
| 232 | - } | ||
| 233 | - .parallelGesture( | ||
| 234 | - GestureGroup(GestureMode.Parallel, | ||
| 235 | - TapGesture() | ||
| 236 | - .onAction((event?: GestureEvent) => { | ||
| 237 | - this.isExpand = true | ||
| 238 | - this.AudioSuspension.resizeWindow(this.expandWidth, this.expandHeight) | ||
| 239 | - }), | ||
| 240 | - PanGesture(this.panOption) | ||
| 241 | - //手势识别成功回调。 | ||
| 242 | - // .onActionStart((event: GestureEvent) => { | ||
| 243 | - // console.info('Pan start'); | ||
| 244 | - // }) | 234 | + .parallelGesture( |
| 235 | + GestureGroup(GestureMode.Parallel, | ||
| 236 | + TapGesture() | ||
| 237 | + .onAction((event?: GestureEvent) => { | ||
| 238 | + this.isExpand = true | ||
| 239 | + this.AudioSuspension.resizeWindow(this.expandWidth, this.expandHeight) | ||
| 240 | + }), | ||
| 241 | + PanGesture(this.panOption) | ||
| 242 | + //手势识别成功回调。 | ||
| 243 | + // .onActionStart((event: GestureEvent) => { | ||
| 244 | + // console.info('Pan start'); | ||
| 245 | + // }) | ||
| 245 | // 手势移动过程中回调。发生拖拽时,获取到触摸点的位置,并将位置信息传递给windowPosition | 246 | // 手势移动过程中回调。发生拖拽时,获取到触摸点的位置,并将位置信息传递给windowPosition |
| 246 | - .onActionUpdate((event: GestureEvent) => { | ||
| 247 | - // this.windowPosition.x += event.offsetX; | ||
| 248 | - let newY = this.windowPosition.y + event.offsetY; | ||
| 249 | - this.windowPosition.y = Math.min(Math.max(newY, this.topSafeHeight), this.bottomSafeHeight); | ||
| 250 | - }) | ||
| 251 | - //手势识别成功,手指抬起后触发回调。 | 247 | + .onActionUpdate((event: GestureEvent) => { |
| 248 | + // this.windowPosition.x += event.offsetX; | ||
| 249 | + let newY = this.windowPosition.y + event.offsetY; | ||
| 250 | + this.windowPosition.y = Math.min(Math.max(newY, this.topSafeHeight), this.bottomSafeHeight); | ||
| 251 | + }) | ||
| 252 | + //手势识别成功,手指抬起后触发回调。 | ||
| 252 | // .onActionEnd(() => { | 253 | // .onActionEnd(() => { |
| 253 | // console.info('Pan end'); | 254 | // console.info('Pan end'); |
| 254 | // }) | 255 | // }) |
| 256 | + ) | ||
| 255 | ) | 257 | ) |
| 256 | - ) | ||
| 257 | - .borderRadius(4) | ||
| 258 | - .backgroundColor(Color.White) | 258 | + .borderRadius(4) |
| 259 | + .shadow({ | ||
| 260 | + radius: vp2px(5), | ||
| 261 | + color: 'rgba(0, 0, 0, 0.10)', | ||
| 262 | + offsetX: 0, | ||
| 263 | + offsetY: 1 | ||
| 264 | + }) // 设 | ||
| 265 | + .backgroundColor(Color.White) | ||
| 266 | + } | ||
| 267 | + .padding(1) | ||
| 268 | + | ||
| 259 | } | 269 | } |
| 260 | } | 270 | } |
-
Please register or login to post a comment