|
@@ -394,6 +394,7 @@ export struct LocalMusic {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
doSwipBack() {
|
|
doSwipBack() {
|
|
|
|
|
+ this.isZero = false
|
|
|
if (this.modeType !== 0 && this.isCanBack) {
|
|
if (this.modeType !== 0 && this.isCanBack) {
|
|
|
this.onModeChange()
|
|
this.onModeChange()
|
|
|
this.isCanBack = false
|
|
this.isCanBack = false
|
|
@@ -4522,142 +4523,19 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
|
|
|
|
|
Row() {
|
|
Row() {
|
|
|
- Row() {
|
|
|
|
|
- RotatingCover({ songLabel: this.currentSong?.pixelMapPath })
|
|
|
|
|
|
|
+ if(this.isHiCar()){
|
|
|
|
|
+ this.playConRigth()
|
|
|
|
|
+ Column(){
|
|
|
|
|
+ this.centerName()
|
|
|
|
|
+ }.layoutWeight(1)
|
|
|
|
|
+ this.playConLeft(false)
|
|
|
|
|
|
|
|
- Column() {
|
|
|
|
|
- Text(this.currentSong?.name)
|
|
|
|
|
- .fontSize(16)
|
|
|
|
|
- .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
|
|
- .maxLines(1)
|
|
|
|
|
- .fontColor($r('app.color.text_color'))
|
|
|
|
|
- .fontWeight(500)
|
|
|
|
|
- Row() {
|
|
|
|
|
- Text(this.currentSong?.artist)
|
|
|
|
|
- .margin({ top: 2 })
|
|
|
|
|
- .fontSize(13)
|
|
|
|
|
- .maxLines(1)
|
|
|
|
|
- .textOverflow({ overflow: TextOverflow.MARQUEE })//超长滚动
|
|
|
|
|
- .fontColor($r('app.color.text_color'))
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- .alignItems(HorizontalAlign.Start)
|
|
|
|
|
- .margin({ right: 22 })
|
|
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.playConLeft()
|
|
|
|
|
+ this.playConRigth()
|
|
|
}
|
|
}
|
|
|
- .padding({ right: 18 })
|
|
|
|
|
- .layoutWeight(1)
|
|
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
- .onClick(() => {
|
|
|
|
|
-
|
|
|
|
|
- if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
- this.isShowPlay = true;
|
|
|
|
|
- let lyricPath = this.videoUrl.substring(0, this.videoUrl.lastIndexOf('.')) + '.lrc'
|
|
|
|
|
- this.initLyric(lyricPath);
|
|
|
|
|
- this.startAutoHide()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- } else {
|
|
|
|
|
- ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- Row() {
|
|
|
|
|
- Image($r('app.media.hm_previous'))
|
|
|
|
|
- .height(28)
|
|
|
|
|
- .width(28)
|
|
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
- .margin({ left: 8, right: 16 })
|
|
|
|
|
- .fillColor(this.themeColor)
|
|
|
|
|
- .displayPriority(2)
|
|
|
|
|
- .onClick(() => {
|
|
|
|
|
- if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
- this.playPrevious()
|
|
|
|
|
- } else {
|
|
|
|
|
- ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- //播放进度条
|
|
|
|
|
- Stack() {
|
|
|
|
|
- Progress({
|
|
|
|
|
- value: Math.floor(this.progressValue),
|
|
|
|
|
- type: ProgressType.Ring,
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- .color(this.themeColor)// 进度条前景色为灰色
|
|
|
|
|
- .backgroundColor($r('app.color.index_background'))
|
|
|
|
|
- .height(40)
|
|
|
|
|
- .aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
|
|
- Image(this.CONTROL_PlayStatus === PlayStatus.PLAY ? $r('app.media.hm_pause') : $r('app.media.hm_play2'))
|
|
|
|
|
- .height(38)
|
|
|
|
|
- .width(38)
|
|
|
|
|
- .displayPriority(3)
|
|
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
- .fillColor(this.themeColor)
|
|
|
|
|
- .onClick(() => {
|
|
|
|
|
- if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
- console.info('onecold playOrPause 4642')
|
|
|
|
|
- this.playOrPause()
|
|
|
|
|
- } else {
|
|
|
|
|
- ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- Image($r('app.media.hm_next'))
|
|
|
|
|
- .height(28)
|
|
|
|
|
- .width(28)
|
|
|
|
|
- .margin({
|
|
|
|
|
- right: 16,
|
|
|
|
|
- left: 16
|
|
|
|
|
- })
|
|
|
|
|
- .fillColor(this.themeColor)
|
|
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
- .displayPriority(2)
|
|
|
|
|
- .onClick(() => {
|
|
|
|
|
- if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
- this.playNext()
|
|
|
|
|
- } else {
|
|
|
|
|
- ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- Image($r('app.media.hm_playlist'))
|
|
|
|
|
- .height(28)
|
|
|
|
|
- .width(28)
|
|
|
|
|
- .displayPriority(1)
|
|
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
- .fillColor(this.themeColor)
|
|
|
|
|
- .bindSheet($$this.isShowSheet, this.PlayListSheet(), {
|
|
|
|
|
- height: '95%',
|
|
|
|
|
- dragBar: true,
|
|
|
|
|
- showClose: true,
|
|
|
|
|
- blurStyle: BlurStyle.Thin,
|
|
|
|
|
- preferType: this.currentBreakpoint !== BreakpointTypeEnum.SM ? SheetType.CENTER : SheetType.BOTTOM,
|
|
|
|
|
- backgroundColor: this.isPlayListBgGrass ? Color.Transparent : $r('app.color.silvery'),
|
|
|
|
|
- title: {
|
|
|
|
|
- title: Utility.resourceToString(this.context, $r('app.string.current_play_list'))
|
|
|
|
|
- + `(${this.songList.length}首)`
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .onClick(() => {
|
|
|
|
|
- if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
- this.isShowSheet = !this.isShowSheet;
|
|
|
|
|
- this.isFrontWhite = false
|
|
|
|
|
- LogUtil.info('onecold scrollToIndex = ' + this.curIndex)
|
|
|
|
|
-
|
|
|
|
|
- this.scrollIndex()
|
|
|
|
|
-
|
|
|
|
|
- } else {
|
|
|
|
|
- ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
.width('100%')
|
|
.width('100%')
|
|
|
.height(this.bottomBarHeight)
|
|
.height(this.bottomBarHeight)
|
|
@@ -4685,6 +4563,174 @@ export struct LocalMusic {
|
|
|
|
|
|
|
|
@State isFrontWhite: boolean = false
|
|
@State isFrontWhite: boolean = false
|
|
|
|
|
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ centerName() {
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ Text(this.currentSong?.name)
|
|
|
|
|
+ .fontSize(16)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.MARQUEE }) //超长滚动
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
|
|
+ .fontWeight(500);
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Text(this.currentSong?.artist)
|
|
|
|
|
+ .margin({ top: 2 })
|
|
|
|
|
+ .fontSize(13)
|
|
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.MARQUEE }) //超长滚动
|
|
|
|
|
+ .fontColor($r('app.color.text_color'));
|
|
|
|
|
+ }
|
|
|
|
|
+ .visibility(this.currentSong?.artist? Visibility.Visible:Visibility.None)
|
|
|
|
|
+ }
|
|
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
|
|
+ }
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ playConLeft(isLeft: boolean = true) {
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ RotatingCover({ songLabel: this.currentSong?.pixelMapPath });
|
|
|
|
|
+
|
|
|
|
|
+ Column() {
|
|
|
|
|
+ Text(this.currentSong?.name)
|
|
|
|
|
+ .fontSize(16)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.MARQUEE }) //超长滚动
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
|
|
+ .fontWeight(500);
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Text(this.currentSong?.artist)
|
|
|
|
|
+ .margin({ top: 2 })
|
|
|
|
|
+ .fontSize(13)
|
|
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
|
|
+ .maxLines(1)
|
|
|
|
|
+ .textOverflow({ overflow: TextOverflow.MARQUEE }) //超长滚动
|
|
|
|
|
+ .fontColor($r('app.color.text_color'));
|
|
|
|
|
+ }
|
|
|
|
|
+ .visibility(this.currentSong?.artist? Visibility.Visible:Visibility.None)
|
|
|
|
|
+ }
|
|
|
|
|
+ .alignItems(isLeft?HorizontalAlign.Start:HorizontalAlign.End)
|
|
|
|
|
+ .margin({ right: isLeft?22:10 })
|
|
|
|
|
+ .visibility(isLeft? Visibility.Visible:Visibility.None)
|
|
|
|
|
+ }
|
|
|
|
|
+ .padding({ right: 18 })
|
|
|
|
|
+ .layoutWeight(isLeft?1:0)
|
|
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+
|
|
|
|
|
+ if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
+ this.isShowPlay = true;
|
|
|
|
|
+ let lyricPath = this.videoUrl.substring(0, this.videoUrl.lastIndexOf('.')) + '.lrc';
|
|
|
|
|
+ this.initLyric(lyricPath);
|
|
|
|
|
+ this.startAutoHide();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ToastUtil.showToast('当前播放列表为空,请先导入音乐。');
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Builder
|
|
|
|
|
+ playConRigth() {
|
|
|
|
|
+ Row() {
|
|
|
|
|
+ Image($r('app.media.hm_previous'))
|
|
|
|
|
+ .height(28)
|
|
|
|
|
+ .width(28)
|
|
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
+ .margin({ left: 8, right: 16 })
|
|
|
|
|
+ .fillColor(this.themeColor)
|
|
|
|
|
+ .displayPriority(2)
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
+ this.playPrevious()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ //播放进度条
|
|
|
|
|
+ Stack() {
|
|
|
|
|
+ Progress({
|
|
|
|
|
+ value: Math.floor(this.progressValue),
|
|
|
|
|
+ type: ProgressType.Ring,
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ .color(this.themeColor)// 进度条前景色为灰色
|
|
|
|
|
+ .backgroundColor($r('app.color.index_background'))
|
|
|
|
|
+ .height(40)
|
|
|
|
|
+ .aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
|
|
+ Image(this.CONTROL_PlayStatus === PlayStatus.PLAY ? $r('app.media.hm_pause') : $r('app.media.hm_play2'))
|
|
|
|
|
+ .height(38)
|
|
|
|
|
+ .width(38)
|
|
|
|
|
+ .displayPriority(3)
|
|
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
+ .fillColor(this.themeColor)
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
+ console.info('onecold playOrPause 4642')
|
|
|
|
|
+ this.playOrPause()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Image($r('app.media.hm_next'))
|
|
|
|
|
+ .height(28)
|
|
|
|
|
+ .width(28)
|
|
|
|
|
+ .margin({
|
|
|
|
|
+ right: 16,
|
|
|
|
|
+ left: 16
|
|
|
|
|
+ })
|
|
|
|
|
+ .fillColor(this.themeColor)
|
|
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
+ .displayPriority(2)
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
+ this.playNext()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ Image($r('app.media.hm_playlist'))
|
|
|
|
|
+ .height(28)
|
|
|
|
|
+ .width(28)
|
|
|
|
|
+ .displayPriority(1)
|
|
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.5 })
|
|
|
|
|
+ .fillColor(this.themeColor)
|
|
|
|
|
+ .bindSheet($$this.isShowSheet, this.PlayListSheet(), {
|
|
|
|
|
+ height: '95%',
|
|
|
|
|
+ dragBar: true,
|
|
|
|
|
+ showClose: true,
|
|
|
|
|
+ blurStyle: BlurStyle.Thin,
|
|
|
|
|
+ preferType: this.currentBreakpoint !== BreakpointTypeEnum.SM ? SheetType.CENTER : SheetType.BOTTOM,
|
|
|
|
|
+ backgroundColor: this.isPlayListBgGrass ? Color.Transparent : $r('app.color.silvery'),
|
|
|
|
|
+ title: {
|
|
|
|
|
+ title: Utility.resourceToString(this.context, $r('app.string.current_play_list'))
|
|
|
|
|
+ + `(${this.songList.length}首)`
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .onClick(() => {
|
|
|
|
|
+ if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
|
|
+ this.isShowSheet = !this.isShowSheet;
|
|
|
|
|
+ this.isFrontWhite = false
|
|
|
|
|
+ LogUtil.info('onecold scrollToIndex = ' + this.curIndex)
|
|
|
|
|
+
|
|
|
|
|
+ this.scrollIndex()
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
scrollIndex(){
|
|
scrollIndex(){
|
|
|
if(this.curIndex>500)//条数太大的时候 滚动非常卡 导致闪退,先改为不滚
|
|
if(this.curIndex>500)//条数太大的时候 滚动非常卡 导致闪退,先改为不滚
|
|
|
return
|
|
return
|
|
@@ -8073,7 +8119,8 @@ export struct LocalMusic {
|
|
|
this.musicNameInfo(false)
|
|
this.musicNameInfo(false)
|
|
|
} else {
|
|
} else {
|
|
|
Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)
|
|
Image(StrUtil.isEmpty(this.cover) ? this.imageLabel : this.cover)
|
|
|
- .height(this.isHiCarSmall()?(this.isHiCarKuanBianPing()?140:px2vp(this.windowHeight)*0.38):(this.isCoverOpacity() ? 250 : this.isCoverRectangle ? 320 : 162))
|
|
|
|
|
|
|
+ .height(this.isHiCarSmall()?(this.isHiCarKuanBianPing()?140:px2vp(this.windowHeight)*0.38):
|
|
|
|
|
+ (this.isCoverOpacity() ? (px2vp(this.windowHeight)*0.62) : this.isCoverRectangle ? 320 : 162))
|
|
|
.objectFit(this.isCoverRectangle ? ImageFit.Contain : ImageFit.Auto)
|
|
.objectFit(this.isCoverRectangle ? ImageFit.Contain : ImageFit.Auto)
|
|
|
.alt(this.imageLabel)
|
|
.alt(this.imageLabel)
|
|
|
.margin({ right: 20, left: 20 })
|
|
.margin({ right: 20, left: 20 })
|