|
|
@@ -138,6 +138,7 @@ const ITEM_HEIGHT_BIG: number = 78; // 列表项大高度
|
|
|
@Preview
|
|
|
@Component
|
|
|
export struct LocalMusic {
|
|
|
+ @State isCanAuto:boolean = true
|
|
|
@State opacityValueImage: number = 1;
|
|
|
@State tipPopup:boolean = false
|
|
|
@Consume mType: number;
|
|
|
@@ -503,11 +504,13 @@ export struct LocalMusic {
|
|
|
});
|
|
|
|
|
|
let event: Callback<InterruptEvent> = (event) => {
|
|
|
- LogUtils.getInstance().LOGI(`onecold 与其他应用音频冲突 被截断点event: ${JSON.stringify(event)}`);
|
|
|
+ // LogUtils.getInstance().LOGI(`onecold 与其他应用音频冲突 被截断点event: ${JSON.stringify(event)}`);
|
|
|
+ console.info(`onecold 与其他应用音频冲突 被截断点event: ${JSON.stringify(event)}`)
|
|
|
this.savePlaybackPosition()
|
|
|
if (event.hintType === InterruptHintType.INTERRUPT_HINT_PAUSE) {
|
|
|
this.pause();
|
|
|
} else if (event.hintType === InterruptHintType.INTERRUPT_HINT_RESUME) {
|
|
|
+ console.info(`onecold audioInterrupt startPlayOrResumePlay: ${JSON.stringify(event)}`)
|
|
|
this.startPlayOrResumePlay();
|
|
|
} else if (event.hintType === InterruptHintType.INTERRUPT_HINT_STOP) {
|
|
|
this.stop();
|
|
|
@@ -748,7 +751,8 @@ export struct LocalMusic {
|
|
|
|
|
|
this.albumList = e.data.data2
|
|
|
//查询完毕在启动是否自动播放
|
|
|
- if (this.isStartAutoPlay) {
|
|
|
+ if (this.isStartAutoPlay&&this.isCanAuto) {
|
|
|
+ this.isCanAuto = false
|
|
|
this.startPlayOrResumePlay()
|
|
|
}
|
|
|
PreferencesUtil.putSync('albumCount', this.albumList.length)
|
|
|
@@ -4848,6 +4852,8 @@ export struct LocalMusic {
|
|
|
this.currentSong.year = this.yearStr
|
|
|
this.currentSong.genre = this.genreStr
|
|
|
this.currentSong.track = this.trackStr
|
|
|
+ this.currentSong.lyricContent = this.lyricConStr
|
|
|
+ this.initLyric(item.filePath)
|
|
|
|
|
|
this.currentSong.ALBUMARTIST = this.albumArtistStr
|
|
|
this.currentSong.COMPOSER = this.composerStr
|
|
|
@@ -4961,15 +4967,26 @@ export struct LocalMusic {
|
|
|
.alignItems(HorizontalAlign.Start)
|
|
|
|
|
|
Column() {
|
|
|
- Button('获取封面')
|
|
|
- .fontColor(Color.White)
|
|
|
- .fontSize(12)
|
|
|
+ Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
+ Row(){
|
|
|
+ SymbolGlyph($r('sys.symbol.picture'))
|
|
|
+ .fontSize(18)
|
|
|
+ .fontColor([Color.White])
|
|
|
+ Text('获取封面')
|
|
|
+ .margin({ left: 4 })
|
|
|
+ .fontSize(11)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ .fontWeight(480)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
.height(38)
|
|
|
- .width(88)
|
|
|
+ .width(100)
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
.backgroundColor(this.themeColor)
|
|
|
.stateEffect(true)
|
|
|
- .margin({ left: 5 })
|
|
|
+ .margin({ right: 35 })
|
|
|
.onClick(async () => {
|
|
|
if (PreferencesUtil.getStringSync('COVER_API', '') === '') {
|
|
|
this.showTipsDialog();
|
|
|
@@ -4989,15 +5006,26 @@ export struct LocalMusic {
|
|
|
|
|
|
})
|
|
|
|
|
|
- Button('获取歌词')
|
|
|
- .fontColor(Color.White)
|
|
|
- .fontSize(12)
|
|
|
+ Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
+ Row(){
|
|
|
+ SymbolGlyph($r('sys.symbol.input_mode'))
|
|
|
+ .fontSize(18)
|
|
|
+ .fontColor([Color.White])
|
|
|
+ Text('获取歌词')
|
|
|
+ .margin({ left: 4 })
|
|
|
+ .fontSize(11)
|
|
|
+ .fontColor(Color.White)
|
|
|
+ .fontWeight(480)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ }
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+ }
|
|
|
.height(38)
|
|
|
- .width(88)
|
|
|
+ .width(100)
|
|
|
.clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
.backgroundColor(this.themeColor)
|
|
|
.stateEffect(true)
|
|
|
- .margin({ top: 9, left: 5 })
|
|
|
+ .margin({ top: 9, right: 35 })
|
|
|
.onClick(async () => {
|
|
|
//判断有没有设置api
|
|
|
let apiUrl = PreferencesUtil.getStringSync('LRC_API', '')
|
|
|
@@ -5100,40 +5128,45 @@ export struct LocalMusic {
|
|
|
|
|
|
Row() {
|
|
|
Column(){
|
|
|
- Text('歌词:')
|
|
|
- .fontSize(14)
|
|
|
- .fontColor($r('app.color.text_color'))
|
|
|
- .margin({ left: 22 })
|
|
|
+ Column(){
|
|
|
+ Text('歌词:')
|
|
|
+ .fontSize(14)
|
|
|
+ .fontColor($r('app.color.text_color'))
|
|
|
+ .margin({ top:5,left: 22 })
|
|
|
|
|
|
- Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
- SymbolGlyph($r('sys.symbol.trash_fill'))
|
|
|
- .fontSize(25)
|
|
|
- .alignSelf(ItemAlign.Center)
|
|
|
- .margin({ left: 22,top:25})
|
|
|
- }
|
|
|
- .backgroundColor(Color.Transparent)
|
|
|
- .visibility(StrUtil.isEmpty(this.tempLyricContent)&&StrUtil.isEmpty(this.lyricConStr)?
|
|
|
- Visibility.None:Visibility.Visible)
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
- .onClick(()=>{
|
|
|
- this.lyricConStr = ''
|
|
|
- this.lyricContent = ''
|
|
|
- this.tempLyricContent = ''
|
|
|
- })
|
|
|
+ Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
+ SymbolGlyph($r('sys.symbol.trash_fill'))
|
|
|
+ .fontSize(25)
|
|
|
+ .alignSelf(ItemAlign.Center)
|
|
|
+ .margin({ left: 22,top:25})
|
|
|
+ }
|
|
|
+ .backgroundColor(Color.Transparent)
|
|
|
+ .visibility(StrUtil.isEmpty(this.tempLyricContent)&&StrUtil.isEmpty(this.lyricConStr)?
|
|
|
+ Visibility.None:Visibility.Visible)
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
+ .onClick(()=>{
|
|
|
+ this.lyricConStr = ''
|
|
|
+ this.lyricContent = ''
|
|
|
+ this.tempLyricContent = ''
|
|
|
+ })
|
|
|
|
|
|
- Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
- SymbolGlyph($r('sys.symbol.plus'))
|
|
|
- .fontSize(25)
|
|
|
- .alignSelf(ItemAlign.Center)
|
|
|
- .margin({ left: 22,top:25})
|
|
|
+ Button({ type: ButtonType.Capsule, stateEffect: true }) {
|
|
|
+ SymbolGlyph($r('sys.symbol.plus'))
|
|
|
+ .fontSize(25)
|
|
|
+ .alignSelf(ItemAlign.Center)
|
|
|
+ .margin({ left: 22,top:25})
|
|
|
+ }
|
|
|
+ .backgroundColor(Color.Transparent)
|
|
|
+ .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
+ .onClick( ()=>{
|
|
|
+ this.callFilePickerSelectFileForLyric()
|
|
|
+ })
|
|
|
}
|
|
|
- .backgroundColor(Color.Transparent)
|
|
|
- .clickEffect({ level: ClickEffectLevel.MIDDLE,scale:0.6 })
|
|
|
- .onClick( ()=>{
|
|
|
- this.callFilePickerSelectFileForLyric()
|
|
|
- })
|
|
|
+ .layoutWeight(1)
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
TextArea({ text: StrUtil.isNotEmpty(this.lyricConStr)?this.lyricConStr:
|
|
|
this.tempLyricContent })
|
|
|
.type(TextAreaType.NORMAL)
|
|
|
@@ -5147,6 +5180,7 @@ export struct LocalMusic {
|
|
|
})
|
|
|
}
|
|
|
.width('100%')
|
|
|
+ .height(StrUtil.isEmpty(this.lyricConStr)&&StrUtil.isEmpty(this.tempLyricContent)?100:'auto')
|
|
|
.margin({ top: 10, bottom: 10 })
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
|
|
|
@@ -7471,7 +7505,8 @@ export struct LocalMusic {
|
|
|
onSeekAction: (position: number) => { // 滑动歌词触发seek定位回调
|
|
|
if (!this.isPlaying) {
|
|
|
this.startPlayOrResumePlay()
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
this.isSeekTo = true;
|
|
|
this.mDestroyPage = false;
|
|
|
this.showLoadIng();
|
|
|
@@ -10101,7 +10136,7 @@ export struct LocalMusic {
|
|
|
this.startPipLyric()
|
|
|
this.mDestroyPage = false;
|
|
|
this.animationState = AnimationStatus.Running
|
|
|
- LogUtils.getInstance().LOGI("startPlayOrResumePlay start this.CONTROL_PlayStatus:" + this.CONTROL_PlayStatus)
|
|
|
+ LogUtils.getInstance().LOGI("onecold startPlayOrResumePlay start this.CONTROL_PlayStatus:" + this.CONTROL_PlayStatus)
|
|
|
if (this.CONTROL_PlayStatus == PlayStatus.INIT) {
|
|
|
this.stopProgressTask();
|
|
|
this.startProgressTask();
|