|
|
@@ -85,9 +85,11 @@ import { LrcParser } from '@sgaolei/lrc_parser';
|
|
|
import app, { AppResponse } from '@system.app';
|
|
|
import { Log } from '@tencent/wechat_open_sdk';
|
|
|
import { TextNodeController } from './PipLyricTextBuilder';
|
|
|
+import { IndexerView } from './IndexerView';
|
|
|
|
|
|
const TAG = 'LocalMusic';
|
|
|
|
|
|
+const DEFAULT_INDEX = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
|
|
|
|
|
//排序类型
|
|
|
function getTypeOrder(type: number) {
|
|
|
@@ -185,6 +187,7 @@ export struct LocalMusic {
|
|
|
@State blurValue: number = 0 //背景模糊
|
|
|
@State bgBrightness: number = 0 //背景亮度
|
|
|
private listScroller: ListScroller = new ListScroller()
|
|
|
+ private playListScroller: Scroller = new Scroller()
|
|
|
private listArea: Area = {
|
|
|
width: 0,
|
|
|
height: 0,
|
|
|
@@ -1862,16 +1865,42 @@ export struct LocalMusic {
|
|
|
.height(CommonConstants.FULL_PERCENT)
|
|
|
.width(CommonConstants.FULL_PERCENT)
|
|
|
|
|
|
+ Stack() {
|
|
|
+ Row() {
|
|
|
+ Blank()
|
|
|
+ .layoutWeight(1)
|
|
|
+ IndexerView(
|
|
|
+ {
|
|
|
+ indexArray: DEFAULT_INDEX,
|
|
|
+ selectedIndex: this.selectedIndex,
|
|
|
+ textSize: 12,
|
|
|
+ selectedColor: "#ff419ee5",
|
|
|
+ normalColor: "#ffa0a0a0",
|
|
|
+ floatSelectedTextColor: "#ffffff",
|
|
|
+ floatSelectedViewColor: "#ff419ee5",
|
|
|
+ onIndexChanged: (index) => {
|
|
|
+ this.listScroller.scrollToIndex(index)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .width(24)
|
|
|
+ .height("50%")
|
|
|
+ }.visibility(Visibility.None)
|
|
|
|
|
|
- Column() {
|
|
|
- this.tabTitle()
|
|
|
- this.listViewTitle()
|
|
|
- if(this.isGridMusic){
|
|
|
- this.getGridView()
|
|
|
- }else {
|
|
|
- this.getListView()
|
|
|
+ Column() {
|
|
|
+ this.tabTitle()
|
|
|
+ this.listViewTitle()
|
|
|
+ if(this.isGridMusic){
|
|
|
+ this.getGridView()
|
|
|
+ }else {
|
|
|
+ this.getListView()
|
|
|
+ }
|
|
|
}
|
|
|
+ .layoutWeight(1)
|
|
|
+ .height('100%')
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
.layoutWeight(1)
|
|
|
.height('100%')
|
|
|
|
|
|
@@ -1882,6 +1911,7 @@ export struct LocalMusic {
|
|
|
.height(60)
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
.backgroundColor(this.themeColor)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
if (this.isAllSelected) {
|
|
|
// 全不选
|
|
|
@@ -1897,6 +1927,7 @@ export struct LocalMusic {
|
|
|
.height(60)
|
|
|
.id('music_cut')
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.backgroundColor(this.themeColor)
|
|
|
.onClick(() => {
|
|
|
this.showCutDialogForMultipleFiles(false, 'music_cut')
|
|
|
@@ -1909,6 +1940,7 @@ export struct LocalMusic {
|
|
|
.visibility(this.isHasDir ? Visibility.Visible : Visibility.None)
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
.backgroundColor(this.themeColor)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
|
|
|
this.showCutDialogForMultipleFiles(true, 'music_cut_current')
|
|
|
@@ -1919,6 +1951,7 @@ export struct LocalMusic {
|
|
|
.id('music_copy_current')// .visibility(this.isHasDir?Visibility.None:Visibility.None)
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
.backgroundColor(this.themeColor)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
this.showCopyDialogForMultipleFiles(false, 'music_copy_current')
|
|
|
})
|
|
|
@@ -1929,6 +1962,7 @@ export struct LocalMusic {
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
.visibility(this.isFavMusic?Visibility.None:Visibility.Visible)
|
|
|
.backgroundColor(this.themeColor)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
this.showWarnIsDelete()
|
|
|
})
|
|
|
@@ -1937,6 +1971,7 @@ export struct LocalMusic {
|
|
|
.height(60)
|
|
|
.margin({ top: 10, bottom: 10, right: 6 })
|
|
|
.backgroundColor(this.themeColor)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
this.selectedFiles = [];
|
|
|
this.isAllSelected = false
|
|
|
@@ -2626,6 +2661,7 @@ export struct LocalMusic {
|
|
|
curve: 'ease-in-out' // 可选动画曲线
|
|
|
})
|
|
|
}
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT})
|
|
|
.visibility(this.isSearchMode ? Visibility.None : Visibility.Visible)
|
|
|
.animation({
|
|
|
duration: 666,
|
|
|
@@ -2687,7 +2723,7 @@ export struct LocalMusic {
|
|
|
curve: 'ease-in-out' // 可选动画曲线
|
|
|
})// .opacity(this.opacityItem)
|
|
|
.fillColor(this.themeColor)
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT})
|
|
|
.onClick(() => {
|
|
|
this.isSearchMode = true
|
|
|
})
|
|
|
@@ -2700,7 +2736,7 @@ export struct LocalMusic {
|
|
|
duration: 666,
|
|
|
curve: 'ease-in-out' // 可选动画曲线
|
|
|
})
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT})
|
|
|
.onClick(() => {
|
|
|
if(this.isFavMusic){
|
|
|
this.getFavList(true)
|
|
|
@@ -2719,7 +2755,7 @@ export struct LocalMusic {
|
|
|
curve: 'ease-in-out' // 可选动画曲线
|
|
|
})
|
|
|
.fillColor(this.themeColor)
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE })
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
this.showRankDialog()
|
|
|
})
|
|
|
@@ -2932,7 +2968,7 @@ export struct LocalMusic {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT})
|
|
|
.scale({ x: this.scaleItem === index ? 1.02 : 1, y: this.scaleItem === index ? 1.02 : 1 })
|
|
|
.zIndex(this.dragItem === index ? 1 : 0)
|
|
|
.translate(this.dragItem === index ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
|
|
|
@@ -3046,7 +3082,7 @@ export struct LocalMusic {
|
|
|
@State tempLyricContent:string = ''
|
|
|
@Builder
|
|
|
private MusicItemGrid(item: VideoItem, index: number) {
|
|
|
- Button({ type: ButtonType.Normal, stateEffect: true }) {
|
|
|
+ Button({ type: ButtonType.Normal, stateEffect: false }) {
|
|
|
Stack() {
|
|
|
Column() {
|
|
|
Image(StrUtil.isEmpty(item.pixelMapPath) ?Utility.getMusisBg2(index) : item.pixelMapPath)
|
|
|
@@ -3261,6 +3297,7 @@ export struct LocalMusic {
|
|
|
}
|
|
|
|
|
|
private listMaxScrollOffsetY: number = 0
|
|
|
+ @State selectedIndex: number = -1
|
|
|
@Builder
|
|
|
getListView() {
|
|
|
|
|
|
@@ -3318,6 +3355,7 @@ export struct LocalMusic {
|
|
|
.animation({ curve: Curve.Sharp, duration: 300 })
|
|
|
|
|
|
}
|
|
|
+ .clickEffect({level:ClickEffectLevel.LIGHT})
|
|
|
//.transition(TransitionEffect.move(TransitionEdge.BOTTOM).animation({ duration: 800, curve: Curve.Ease, delay: 100*index }))
|
|
|
.swipeAction((
|
|
|
(this.modeType==0||this.modeType==1 ||((this.modeType==3||this.modeType==2)&&this.isCanBack))
|
|
|
@@ -3328,6 +3366,7 @@ export struct LocalMusic {
|
|
|
this.doPlay(item, index)
|
|
|
|
|
|
})
|
|
|
+
|
|
|
//拖动List关键代码开始
|
|
|
.scale({ x: this.scaleSelect(index), y: this.scaleSelect(index) })
|
|
|
.zIndex(this.dragItem === index ? 1 : 0)
|
|
|
@@ -3440,6 +3479,9 @@ export struct LocalMusic {
|
|
|
.transition(TransitionEffect.move(TransitionEdge.BOTTOM)
|
|
|
.animation({ duration: 500, curve: Curve.Ease }))
|
|
|
.layoutWeight(1)
|
|
|
+ .onScrollIndex((start) => {
|
|
|
+ this.selectedIndex = start
|
|
|
+ })
|
|
|
.visibility(this.isGridMusic?Visibility.None:Visibility.Visible)
|
|
|
.lanes(
|
|
|
new BreakpointType<number>({
|
|
|
@@ -3693,6 +3735,7 @@ export struct LocalMusic {
|
|
|
Image($r('app.media.hm_previous'))
|
|
|
.height(24)
|
|
|
.width(24)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.margin({ left: 8, right: 16 })
|
|
|
.fillColor(this.themeColor)
|
|
|
.displayPriority(2)
|
|
|
@@ -3720,6 +3763,7 @@ export struct LocalMusic {
|
|
|
.height(32)
|
|
|
.width(32)
|
|
|
.displayPriority(3)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.fillColor(this.themeColor)
|
|
|
.onClick(() => {
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
@@ -3739,6 +3783,7 @@ export struct LocalMusic {
|
|
|
left: 16
|
|
|
})
|
|
|
.fillColor(this.themeColor)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.displayPriority(2)
|
|
|
.onClick(() => {
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
@@ -3753,6 +3798,7 @@ export struct LocalMusic {
|
|
|
.height(24)
|
|
|
.width(24)
|
|
|
.displayPriority(1)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.fillColor(this.themeColor)
|
|
|
.bindSheet($$this.isShowSheet, this.PlayListSheet(), {
|
|
|
height: '95%',
|
|
|
@@ -3770,6 +3816,8 @@ export struct LocalMusic {
|
|
|
if (ArrayUtil.isNotEmpty(this.songList)) {
|
|
|
this.isShowSheet = !this.isShowSheet;
|
|
|
this.isFrontWhite = false
|
|
|
+ LogUtil.info('onecold scrollToIndex = '+this.curIndex)
|
|
|
+ this.playListScroller.scrollToIndex(this.curIndex,true, ScrollAlign.CENTER)
|
|
|
} else {
|
|
|
ToastUtil.showToast('当前播放列表为空,请先导入音乐。')
|
|
|
}
|
|
|
@@ -3796,7 +3844,7 @@ export struct LocalMusic {
|
|
|
// .visibility(this.isPhoneLan()?Visibility.None:this.isCustomizeBg?Visibility.Hidden:Visibility.Visible)
|
|
|
.visibility(this.isCustomizeBg?Visibility.Hidden:Visibility.Visible)
|
|
|
}
|
|
|
-
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
}
|
|
|
|
|
|
@State isFrontWhite: boolean = false
|
|
|
@@ -4597,7 +4645,7 @@ export struct LocalMusic {
|
|
|
|
|
|
@Builder
|
|
|
PlayList() {
|
|
|
- List() {
|
|
|
+ List({ scroller: this.playListScroller }) {
|
|
|
LazyForEach(this.sonDataSource, (item: VideoItem, index: number) => {
|
|
|
ListItem() {
|
|
|
this.MusicItemSon(item, index)
|
|
|
@@ -4607,7 +4655,7 @@ export struct LocalMusic {
|
|
|
duration: 666,
|
|
|
curve: 'ease-in-out' // 可选动画曲线
|
|
|
})
|
|
|
-
|
|
|
+ .clickEffect({level:ClickEffectLevel.MIDDLE})
|
|
|
//拖动List关键代码开始
|
|
|
.scale({ x: this.scaleSelect(index), y: this.scaleSelect(index) })
|
|
|
.zIndex(this.dragItem === index ? 1 : 0)
|
|
|
@@ -5586,7 +5634,9 @@ export struct LocalMusic {
|
|
|
.width(39)
|
|
|
.alt(this.imageLabel)
|
|
|
.borderRadius(8)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.margin({ left: this.currentLyricAlignMode === 0 ? 25 : -15 })
|
|
|
+
|
|
|
}
|
|
|
.width('15%')
|
|
|
|
|
|
@@ -5625,6 +5675,7 @@ export struct LocalMusic {
|
|
|
.width(25)
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.margin({ right: 30 })
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.onClick(() => {
|
|
|
|
|
|
this.isLyricSetting = !this.isLyricSetting;
|
|
|
@@ -5658,7 +5709,7 @@ export struct LocalMusic {
|
|
|
}
|
|
|
.height(this.isPuraWP() ? 15 : 58)
|
|
|
.visibility(this.currentBreakpoint !== BreakpointTypeEnum.SM ?
|
|
|
- Visibility.None : Visibility.Visible)
|
|
|
+ Visibility.None: Visibility.Visible)
|
|
|
.margin({ left: 6, top: this.isPuraWP() ? 5 : 38 })
|
|
|
.width("100%")
|
|
|
|
|
|
@@ -5685,7 +5736,7 @@ export struct LocalMusic {
|
|
|
})
|
|
|
.width("100%")
|
|
|
.layoutWeight(1)
|
|
|
- .margin({ left: this.currentLyricAlignMode === 0 ? 0 : 50, top: 2, bottom: 10 })
|
|
|
+ .margin({ left: this.currentLyricAlignMode === 0 ? 0 : 50, top: 2, bottom: this.isPhoneLan() ? 40 :10 })
|
|
|
|
|
|
}
|
|
|
.position({
|
|
|
@@ -5712,6 +5763,7 @@ export struct LocalMusic {
|
|
|
//更多功能
|
|
|
Image($r('app.media.menu'))
|
|
|
.width(24)
|
|
|
+ .clickEffect({level:ClickEffectLevel.MIDDLE})
|
|
|
.bindSheet($$this.isShowMoreView, this.PlayMoreSheet(), {
|
|
|
height: this.isCoverOpacity() ? '95%' : '93%',
|
|
|
preferType: this.currentBreakpoint!==BreakpointTypeEnum.SM?SheetType.CENTER:SheetType.BOTTOM,
|
|
|
@@ -5729,6 +5781,7 @@ export struct LocalMusic {
|
|
|
Button({type:ButtonType.Circle,stateEffect:true}){
|
|
|
Image($r('app.media.ic_previous'))
|
|
|
.width(33)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.onClick(async () => {
|
|
|
this.playPrevious()
|
|
|
@@ -5744,6 +5797,7 @@ export struct LocalMusic {
|
|
|
Image(this.CONTROL_PlayStatus === PlayStatus.PLAY ?
|
|
|
$r('app.media.ic_public_play') : $r('app.media.ic_public_pause'))
|
|
|
.width(this.isPhoneLan()?48:60)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.onClick(async () => {
|
|
|
this.playOrPause()
|
|
|
@@ -5762,6 +5816,7 @@ export struct LocalMusic {
|
|
|
Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
Image($r('app.media.ic_next'))
|
|
|
.width(33)
|
|
|
+ .clickEffect({level:ClickEffectLevel.HEAVY})
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.onClick(() => {
|
|
|
|
|
|
@@ -5777,6 +5832,7 @@ export struct LocalMusic {
|
|
|
Image(Utility.getIsFav(this.favList,this.currentSong)?
|
|
|
$r('app.media.add_fac_light'):$r('app.media.add_fac'))
|
|
|
.width(24)
|
|
|
+ .clickEffect({level:ClickEffectLevel.MIDDLE})
|
|
|
.aspectRatio(CommonConstants.ASPECT_RATIO)
|
|
|
.onClick(async () => {
|
|
|
if(this.currentSong){
|
|
|
@@ -5902,6 +5958,7 @@ export struct LocalMusic {
|
|
|
.onClick(() => {
|
|
|
this.isShowSheetView = !this.isShowSheetView;
|
|
|
this.isFrontWhite = true
|
|
|
+ // this.listScroller.scrollToIndex(this.curIndex)
|
|
|
})
|
|
|
|
|
|
}
|
|
|
@@ -5978,6 +6035,7 @@ export struct LocalMusic {
|
|
|
.aspectRatio(1)
|
|
|
.visibility(this.isPuraWP()?Visibility.None:Visibility.Visible)
|
|
|
.borderRadius(this.isCoverRectangle ? 20 : '100%')
|
|
|
+ .clickEffect({level:ClickEffectLevel.MIDDLE})
|
|
|
.align(Alignment.Center)// .opacity(this.isCoverOpacity()||this.isCoverRectangle?0:1)
|
|
|
.clip(true)
|
|
|
.rotate({
|
|
|
@@ -6008,6 +6066,7 @@ export struct LocalMusic {
|
|
|
.width('48%')
|
|
|
.textAlign(TextAlign.Center)
|
|
|
.fontColor(Color.White)
|
|
|
+ .visibility(this.isPhoneLan()?Visibility.None:Visibility.Visible)
|
|
|
Text(this.artist)
|
|
|
.fontSize(this.isPuraWP()?18:(this.isCoverOpacity() ? 12 : 15))
|
|
|
.fontColor(Color.White)
|
|
|
@@ -6016,7 +6075,6 @@ export struct LocalMusic {
|
|
|
}
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
.zIndex(1)
|
|
|
- // .margin({bottom:180})
|
|
|
.visibility(this.isCoverOpacity() ? Visibility.Visible : Visibility.None)
|
|
|
|
|
|
}
|