|
|
@@ -40,6 +40,7 @@ export struct NavidromePage {
|
|
|
@Link mType: number;
|
|
|
@Link offsetX: number;
|
|
|
@Link isShowDrawer: boolean;
|
|
|
+ @State isNoJumpToHome: boolean = false //网盘播放不跳转首页
|
|
|
@Prop @Watch('onSwitchAccount') selectedAccount: WebDavAccount;
|
|
|
@StorageProp('currentTheme') currentTheme: number = 0;
|
|
|
@State selectedTab: number = 0; // 0: 全部, 1: 艺术家, 2: 专辑
|
|
|
@@ -47,6 +48,7 @@ export struct NavidromePage {
|
|
|
@State artists: NavidromeRestArtist[] = [];
|
|
|
@State albums: NavidromeRestAlbum[] = [];
|
|
|
@State loading: boolean = false;
|
|
|
+ @StorageLink('currentSong') currentSong: VideoItem | undefined = undefined;
|
|
|
@StorageProp('topRectHeight') topRectHeight: number = 0;
|
|
|
@State @Watch('onTabSelectedIndexesChanged') tabSelectedIndexes: number[] = [0];
|
|
|
@StorageProp('themeColor') themeColor: string =
|
|
|
@@ -62,11 +64,11 @@ export struct NavidromePage {
|
|
|
buttons: [{ text: '全部' }, { text: '艺术家' }, { text: '专辑' }] as SegmentButtonItemTuple,
|
|
|
direction: Direction.Ltr,
|
|
|
buttonPadding: { top: 12, bottom: 12 },
|
|
|
- backgroundColor: $r('app.color.start_window_background'),
|
|
|
+ backgroundColor: $r('app.color.index_background'),
|
|
|
+ selectedBackgroundColor: $r('app.color.start_window_background'),
|
|
|
+ selectedFontColor: $r('app.color.text_color'),
|
|
|
fontSize: 14,
|
|
|
selectedFontSize: 15,
|
|
|
- selectedFontColor: Color.White,
|
|
|
- selectedBackgroundColor: $r('app.color.title_bar_bg'),
|
|
|
localizedTextPadding: {
|
|
|
end: LengthMetrics.vp(20),
|
|
|
start: LengthMetrics.vp(20)
|
|
|
@@ -85,6 +87,7 @@ export struct NavidromePage {
|
|
|
}
|
|
|
|
|
|
aboutToAppear() {
|
|
|
+ this.isNoJumpToHome = PreferencesUtil.getBooleanSync('isNoJumpToHome', true)
|
|
|
this.refreshNavidromeData();
|
|
|
}
|
|
|
|
|
|
@@ -195,7 +198,7 @@ export struct NavidromePage {
|
|
|
@Builder
|
|
|
topTitleBar() {
|
|
|
Column() {
|
|
|
- Row({ space: 15 }) {
|
|
|
+ Row({ space: 6 }) {
|
|
|
// 左侧返回按钮
|
|
|
Button({ type: ButtonType.Circle, stateEffect: true }) {
|
|
|
SymbolGlyph($r('sys.symbol.sort'))
|
|
|
@@ -227,11 +230,9 @@ export struct NavidromePage {
|
|
|
// 可以添加标题点击事件
|
|
|
})
|
|
|
.animation({ duration: 300, curve: Curve.Ease })
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
.width('100%')
|
|
|
- .height(60)
|
|
|
+ .height(55)
|
|
|
.padding({left: 15, right: 15})
|
|
|
.justifyContent(FlexAlign.SpaceBetween)
|
|
|
.alignItems(VerticalAlign.Center)
|
|
|
@@ -243,10 +244,9 @@ export struct NavidromePage {
|
|
|
})
|
|
|
.width('100%')
|
|
|
.padding({ left: 25, right: 25, top: 5, bottom: 5 })
|
|
|
- .margin({top:5})
|
|
|
}
|
|
|
.width('100%')
|
|
|
- .padding({ top: this.topRectHeight+10})
|
|
|
+ .padding({ top: this.topRectHeight+5})
|
|
|
.backgroundColor($r('app.color.start_window_background'))
|
|
|
}
|
|
|
|
|
|
@@ -297,26 +297,29 @@ export struct NavidromePage {
|
|
|
.fillColor(this.themeColor)
|
|
|
.objectFit(ImageFit.Cover)
|
|
|
.margin({ left: 8 })
|
|
|
+ .onClick(() => {
|
|
|
+ this.playSong(song, index, true);
|
|
|
+ })
|
|
|
|
|
|
// 歌曲信息
|
|
|
Column({ space: 4 }) {
|
|
|
Text(song.name)
|
|
|
.fontSize(15)
|
|
|
- .fontColor(this.themeColor)
|
|
|
+ .fontColor(this.currentSong?.filePath==song.filePath?this.themeColor:$r('app.color.index_tab_font_color'))
|
|
|
.maxLines(1)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
|
|
|
Row(){
|
|
|
Text((song.artist ?? '') + " ")
|
|
|
.fontSize(13)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
+ .fontColor(this.currentSong?.filePath==song.filePath?this.themeColor:$r('app.color.index_tab_font_color'))
|
|
|
.opacity(0.6)
|
|
|
.maxLines(1)
|
|
|
.visibility(song.artist?Visibility.Visible:Visibility.None)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
Text(this.buildSongMetaLine(song))
|
|
|
.fontSize(13)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
+ .fontColor(this.currentSong?.filePath==song.filePath?this.themeColor:$r('app.color.index_tab_font_color'))
|
|
|
.opacity(0.6)
|
|
|
.maxLines(1)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
@@ -333,6 +336,8 @@ export struct NavidromePage {
|
|
|
.duration(1000)// 持续
|
|
|
.state(AnimationStatus.Running)// 动画状态
|
|
|
.fillMode(FillMode.Forwards)
|
|
|
+ .visibility(this.currentSong?.filePath==song.filePath ? Visibility.Visible :
|
|
|
+ Visibility.None)
|
|
|
.width(18)
|
|
|
.margin({ right: 12, top: 8, bottom: 8 })
|
|
|
.height(18)
|
|
|
@@ -362,8 +367,9 @@ export struct NavidromePage {
|
|
|
Column({ space: 4 }) {
|
|
|
Text(artist.name ?? Constants.UNKNOWN_ARTIST)
|
|
|
.fontSize(15)
|
|
|
- .fontColor(this.themeColor)
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'))
|
|
|
.maxLines(1)
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
|
|
|
Text(this.buildArtistMetaLine(artist))
|
|
|
@@ -373,9 +379,11 @@ export struct NavidromePage {
|
|
|
.maxLines(1)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
}
|
|
|
- .layoutWeight(1)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
.padding({ right: 20 })
|
|
|
+
|
|
|
}
|
|
|
+ .width('100%')
|
|
|
}
|
|
|
.width('100%')
|
|
|
.padding(12)
|
|
|
@@ -399,27 +407,31 @@ export struct NavidromePage {
|
|
|
Column({ space: 4 }) {
|
|
|
Text(album.name ?? '未知专辑')
|
|
|
.fontSize(15)
|
|
|
- .fontColor(this.themeColor)
|
|
|
- .maxLines(1)
|
|
|
- .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
-
|
|
|
- Text(album.artist ?? Constants.UNKNOWN_ARTIST)
|
|
|
- .fontSize(13)
|
|
|
.fontColor($r('app.color.index_tab_font_color'))
|
|
|
- .opacity(0.6)
|
|
|
.maxLines(1)
|
|
|
+ .textAlign(TextAlign.Start)
|
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
+ Row(){
|
|
|
+ Text(album.artist ?? Constants.UNKNOWN_ARTIST)
|
|
|
+ .fontSize(13)
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'))
|
|
|
+ .opacity(0.6)
|
|
|
+ .maxLines(1)
|
|
|
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
+
|
|
|
+ Text(this.buildAlbumMetaLine(album))
|
|
|
+ .fontSize(13)
|
|
|
+ .fontColor($r('app.color.index_tab_font_color'))
|
|
|
+ .opacity(0.6)
|
|
|
+ .maxLines(1)
|
|
|
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
+ }
|
|
|
|
|
|
- Text(this.buildAlbumMetaLine(album))
|
|
|
- .fontSize(13)
|
|
|
- .fontColor($r('app.color.index_tab_font_color'))
|
|
|
- .opacity(0.6)
|
|
|
- .maxLines(1)
|
|
|
- .textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
|
}
|
|
|
- .layoutWeight(1)
|
|
|
+ .alignItems(HorizontalAlign.Start)
|
|
|
.padding({ right: 20 })
|
|
|
}
|
|
|
+ .width('100%')
|
|
|
}
|
|
|
.width('100%')
|
|
|
.padding(12)
|
|
|
@@ -493,11 +505,14 @@ export struct NavidromePage {
|
|
|
}
|
|
|
|
|
|
private applyFilter(type: NavFilterType, id: string, label: string): void {
|
|
|
- this.filterType = type;
|
|
|
- this.filterId = id;
|
|
|
- this.filterLabel = label;
|
|
|
- this.selectedTab = 0;
|
|
|
- this.tabSelectedIndexes = [0];
|
|
|
+ this.getUIContext().animateTo({ duration: 555 }, () => {
|
|
|
+ this.filterType = type;
|
|
|
+ this.filterId = id;
|
|
|
+ this.filterLabel = label;
|
|
|
+ this.selectedTab = 0;
|
|
|
+ this.tabSelectedIndexes = [0];
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private clearFilter(): void {
|
|
|
@@ -506,7 +521,7 @@ export struct NavidromePage {
|
|
|
this.filterLabel = '';
|
|
|
}
|
|
|
|
|
|
- private playSong(song: VideoItem, index: number): void {
|
|
|
+ private playSong(song: VideoItem, index: number,isJump?:boolean): void {
|
|
|
try {
|
|
|
if (!this.allVideos || this.allVideos.length === 0) {
|
|
|
ToastUtil.showToast('暂无可播放的歌曲');
|
|
|
@@ -531,7 +546,12 @@ export struct NavidromePage {
|
|
|
const eventPlaylistPlay: emitter.InnerEvent = { eventId: EventConstants.EVENT_PLAYLIST_PLAY };
|
|
|
emitter.emit(eventPlaylistPlay, { data: playlistData });
|
|
|
Logger.info('heanup', `Navidrome 发送播放事件,歌曲数: ${this.allVideos.length}, 起始: ${index}`);
|
|
|
- this.mType = 0;
|
|
|
+ if(!this.isNoJumpToHome||isJump){
|
|
|
+ // 跳转到首页播放器
|
|
|
+ this.getUIContext()?.animateTo({ duration: 555 }, () => {
|
|
|
+ this.mType = 0
|
|
|
+ })
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
const err = error as Error;
|
|
|
Logger.error('heanup', '播放歌曲失败: ' + err.message);
|
|
|
@@ -568,10 +588,11 @@ export struct NavidromePage {
|
|
|
.layoutWeight(1)
|
|
|
Button('清除筛选')
|
|
|
.type(ButtonType.Capsule)
|
|
|
+ .backgroundColor(this.themeColor)
|
|
|
.fontSize(12)
|
|
|
.onClick(() => this.clearFilter())
|
|
|
}
|
|
|
- .width('100%')
|
|
|
+ .width('90%')
|
|
|
.padding({ left: 16, right: 16, top: 6, bottom: 2 })
|
|
|
}
|
|
|
|