Procházet zdrojové kódy

针对歌单进行优化

onecold před 10 měsíci
rodič
revize
9608254cfc

+ 8 - 1
entry/src/main/ets/pages/NewIndex.ets

@@ -1,4 +1,4 @@
-import { AppUtil, DeviceUtil, DisplayUtil, LogUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils';
+import { AppUtil, ArrayUtil, DeviceUtil, DisplayUtil, LogUtil, PreferencesUtil, ToastUtil } from '@pura/harmony-utils';
 import TitleBar from '../view/TitleBar';
 import { curves, LengthMetrics, router, SegmentButton, SegmentButtonOptions, SymbolGlyphModifier } from '@kit.ArkUI';
 import mainViewModel, { MainViewModel } from '../viewmodel/MainViewModel';
@@ -1246,6 +1246,13 @@ struct NewIndex {
         const playlists = await this.playlistTable.queryAllPlaylists()
         this.playlistList = playlists
         console.info(`成功加载 ${playlists.length} 个歌单`)
+        if(ArrayUtil.isNotEmpty(this.playlistList)){
+          const playlistSongs = await this.playlistTable.queryPlaylistSongs(this.playlistList[0].id)
+          this.currentSongList = await convertPlaylistSongsToVideoItems(this.context,playlistSongs)
+          this.currentSongListName= this.playlistList[0].name
+          this.currentSongListID = this.playlistList[0].id
+        }
+
       } else {
         console.warn('歌单表未初始化')
       }

+ 2 - 1
entry/src/main/ets/view/LocalMusic.ets

@@ -314,6 +314,7 @@ export struct LocalMusic {
       this.titleBarModel.setRightIcon(($r('app.media.add')))
     }
     LogUtil.info('onecold onModeChange = ' + this.modeType)
+    this.isShowTitleBar = PreferencesUtil.getBooleanSync(SettingPage.IS_SHOW_TITLTBAR, true)
     switch (this.modeType) {
       case 0:
         this.getSortedFiles(this.currentPath)
@@ -3080,7 +3081,7 @@ export struct LocalMusic {
 
   private readonly tabs: string[] = ['文件夹', '媒体库', '艺术家', '专辑']
   @State tabOptions: SegmentButtonOptions = SegmentButtonOptions.tab({
-    buttons: [{ text: '文件夹' }, { text: '媒体库' },{ text: '艺术家' },{ text: '专辑' }],
+    buttons: [{ text: '文件夹' }, { text: '媒体库' },{ text: '艺术家' }],
     direction: Direction.Ltr,
     buttonPadding:{top:12,bottom:12},
     backgroundColor: Color.Transparent,