Răsfoiți Sursa

适配主题暗黑模式

onecold 9 luni în urmă
părinte
comite
73282ce117

+ 2 - 3
entry/src/main/ets/dialog/WebDavAccountDialog.ets

@@ -143,8 +143,8 @@ export struct WebDavAccountDialog {
       // 按钮
       Row({ space: 12 }) {
         Button('取消', { type: ButtonType.Capsule })
-          .backgroundColor($r('app.color.input_background'))
-          .fontColor($r('app.color.index_tab_font_color'))
+          .backgroundColor($r('app.color.cancel_button_background'))
+          .fontColor($r('app.color.cancel_button_text'))
           .layoutWeight(1)
           .onClick(() => {
             this.onCancel?.();
@@ -185,7 +185,6 @@ export struct WebDavAccountDialog {
     }
     .padding(24)
     .width('90%')
-    .backgroundColor($r('app.color.start_window_background'))
     .borderRadius(16)
   }
 }

+ 10 - 6
entry/src/main/ets/pages/NewIndex.ets

@@ -181,7 +181,7 @@ struct NewIndex {
   @State webDavAccounts: WebDavAccount[] = []
   private webdavManager: WebdavManager = WebdavManager.getInstance()
   private _webDavLoading: boolean = false // 防止重复加载WebDAV账户的标志
-
+  @State selectedAccount: WebDavAccount = new WebDavAccount()
   /**
    * 返回键处理逻辑:
    * - 如果不是根目录或有历史记录,发送广播通知更新列表
@@ -395,7 +395,12 @@ struct NewIndex {
           AboutPage()
             .visibility(this.mType === 5 ? Visibility.Visible : Visibility.None)
 
-          WebDavMainPage({mType:this.mType})
+          WebDavMainPage({
+            offsetX:this.offsetX,
+            isShowDrawer:this.isShowDrawer,
+            mType:this.mType,
+            selectedAccount:this.selectedAccount
+          })
             .visibility(this.mType === 6 ? Visibility.Visible : Visibility.None)
           
           // 抽屉打开时的遮罩层,用于拦截点击事件  这个只能正常尺寸的手机竖屏的才能生效
@@ -1554,18 +1559,17 @@ struct NewIndex {
 
         // 激活选中的账户
         account.isActivate = true
-
         // 更新数据库中的激活状态
         this.webdavManager.editAccount(account).then(() => {
           LogUtil.info('heanup NewIndex', 'WebDAV账户编辑成功:', account.name)
-          // 重新加载账户列表,观察着模式通知更新了,这里不需要更新
-          // this.loadWebDavAccounts()
+
+
         }).catch((error: Error) => {
           LogUtil.error('heanup NewIndex', `编辑WebDAV账户失败: ${error.message}`)
           ToastUtil.showToast('编辑账户失败')
         })
       }
-
+      this.selectedAccount = account
       // 切换到WebDAV页面
       this.mType = 6
       this.doShowDrawer()

+ 59 - 52
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -374,7 +374,7 @@ export struct WebDavMainPage {
       emitter.emit(eventPlaylistPlay, eventData);
 
       // 跳转到首页播放器
-      router.pushUrl({
+      this.getUIContext().getRouter().pushUrl({
         url: 'pages/NewIndex',
         params: {
           fromWebDAV: true
@@ -587,7 +587,7 @@ export struct WebDavMainPage {
           })
         }
         .layoutWeight(1)
-        .divider({ strokeWidth: 1, color: '#EEEEEE' })
+        .divider({ strokeWidth: 1, color: this.isDarkMode ? '#333333' :'#EEEEEE' })
         .margin({ top: 4 })
       } else if (!this.isLoading) {
         Column() {
@@ -611,32 +611,36 @@ export struct WebDavMainPage {
   // 文件夹列表项
   @Builder
   buildFolderItem(folder: FileInfo) {
-    Row({ space: 2 }) {
-      SymbolGlyph($r('sys.symbol.folder'))
-        .fontSize(48)
-        .fontColor([this.themeColor])
-        .alignSelf(ItemAlign.Center)
-        .margin({ left: 8, right: 6 })
-
-      // 文件夹信息
-      Column({ space: 4 }) {
-        Text(decodeUrlEncodedString(folder.fileName.replace('/', '')))
-          .fontSize(15)
-          .fontColor($r('app.color.index_tab_font_color'))
-          .maxLines(1)
-          .textOverflow({ overflow: TextOverflow.Ellipsis })
+    Button({ type: ButtonType.Normal, stateEffect: false }) {
+      Row({ space: 2 }) {
+        SymbolGlyph($r('sys.symbol.folder'))
+          .fontSize(48)
+          .fontColor([this.themeColor])
+          .alignSelf(ItemAlign.Center)
+          .margin({ left: 8, right: 6 })
+
+        // 文件夹信息
+        Column({ space: 4 }) {
+          Text(decodeUrlEncodedString(folder.fileName.replace('/', '')))
+            .fontSize(15)
+            .fontColor($r('app.color.index_tab_font_color'))
+            .maxLines(1)
+            .textOverflow({ overflow: TextOverflow.Ellipsis })
 
-        Text('文件夹')
-          .fontSize(13)
-          .fontColor($r('app.color.index_tab_font_color'))
-          .opacity(0.6)
+          Text('文件夹')
+            .fontSize(13)
+            .fontColor($r('app.color.index_tab_font_color'))
+            .opacity(0.6)
+        }
+        .alignItems(HorizontalAlign.Start)
+        .layoutWeight(1)
       }
-      .alignItems(HorizontalAlign.Start)
-      .layoutWeight(1)
     }
+    .reuseId('dir_item')
     .width('100%')
     .padding(12)
     .backgroundColor($r('app.color.start_window_background'))
+    .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.8 })
     .onClick(() => {
       this.enterFolder(folder);
       this.breadcrumbs = this.webdavManager.getBreadcrumbs();
@@ -646,42 +650,45 @@ export struct WebDavMainPage {
   // 歌曲列表项
   @Builder
   buildSongItem(song: Song, index: number) {
-    Row({ space: 12 }) {
-      // 序号
-      // 歌曲封面
-      Image(song.img)
-        .width(48)
-        .height(48)
-        .borderRadius(4)
-        .objectFit(ImageFit.Cover)
+    Button({ type: ButtonType.Normal, stateEffect: false }) {
+      Row({ space: 12 }) {
+        // 序号
+        // 歌曲封面
+        Image(song.img)
+          .width(48)
+          .height(48)
+          .borderRadius(4)
+          .objectFit(ImageFit.Cover)
+
+        // 歌曲信息
+        Column({ space: 4 }) {
+          Text(decodeUrlEncodedString(song.title))
+            .fontSize(15)
+            .fontColor($r('app.color.index_tab_font_color'))
+            .maxLines(1)
+            .textOverflow({ overflow: TextOverflow.Ellipsis })
 
-      // 歌曲信息
-      Column({ space: 4 }) {
-        Text(decodeUrlEncodedString(song.title))
-          .fontSize(15)
-          .fontColor($r('app.color.index_tab_font_color'))
-          .maxLines(1)
-          .textOverflow({ overflow: TextOverflow.Ellipsis })
+          Text(decodeUrlEncodedString(song.artist))
+            .fontSize(13)
+            .fontColor($r('app.color.index_tab_font_color'))
+            .opacity(0.6)
+            .maxLines(1)
+            .textOverflow({ overflow: TextOverflow.Ellipsis })
+        }
+        .alignItems(HorizontalAlign.Start)
+        .layoutWeight(1)
 
-        Text(decodeUrlEncodedString(song.artist))
-          .fontSize(13)
-          .fontColor($r('app.color.index_tab_font_color'))
-          .opacity(0.6)
-          .maxLines(1)
-          .textOverflow({ overflow: TextOverflow.Ellipsis })
+        // 播放图标
+        Image($r('app.media.ic_play'))
+          .width(20)
+          .height(20)
+          .fillColor($r('app.color.index_tab_font_color'))
+          .opacity(0.4)
       }
-      .alignItems(HorizontalAlign.Start)
-      .layoutWeight(1)
-
-      // 播放图标
-      Image($r('app.media.ic_play'))
-        .width(20)
-        .height(20)
-        .fillColor($r('app.color.index_tab_font_color'))
-        .opacity(0.4)
     }
     .width('100%')
     .padding(12)
+    .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.8 })
     .backgroundColor($r('app.color.start_window_background'))
     .onClick(() => {
       this.playSong(song, index);

+ 8 - 0
entry/src/main/resources/dark/element/color.json

@@ -196,6 +196,14 @@
     {
       "name": "left_draw_bg",
       "value": "#000000"
+    },
+    {
+      "name": "cancel_button_background",
+      "value": "#666666"
+    },
+    {
+      "name": "cancel_button_text",
+      "value": "#F5F5F5"
     }
   ]
 }