Explorar el Código

优化下载中心的UI

onecold hace 5 meses
padre
commit
c349a18df2

+ 7 - 17
entry/src/main/ets/pages/WebDavMainPage.ets

@@ -2735,23 +2735,6 @@ export struct WebDavMainPage {
         this.buildSelectionOverlay()
       }
 
-      if (this.isShowDownloadCenter) {
-        Stack() {
-          Column()
-            .width('100%')
-            .height('100%')
-            .backgroundColor('#66000000')
-            .onClick(() => {
-              this.isShowDownloadCenter = false
-            })
-
-          this.DownloadCenterBuilder()
-        }
-        .width('100%')
-        .height('100%')
-        .zIndex(999)
-        .transition(TransitionEffect.translate({ x: 500 }).animation({ curve: curves.springMotion(0.6, 0.8) }))
-      }
     }
     .width('100%')
     .height('100%')
@@ -2806,6 +2789,13 @@ export struct WebDavMainPage {
           .backgroundColor('#EFEFEF')
           .margin({left:5})
           .onClick(() => this.goBack())
+          .bindContentCover($$this.isShowDownloadCenter, this.DownloadCenterBuilder(),
+            {
+              modalTransition:ModalTransition.DEFAULT,
+              onWillDisappear: () => {
+                this.isShowDownloadCenter = false
+              },
+            })
 
           Row({ space: 4 }) {
             ForEach(this.breadcrumbs, (crumb: BreadcrumbItem, index: number) => {

+ 21 - 20
entry/src/main/ets/view/DownloadCenter.ets

@@ -2,6 +2,7 @@ import { SegmentButton, SegmentButtonItemTuple, SegmentButtonOptions } from '@ki
 import { DownloadCenterTask } from '../common/util/DownloadCenterManager';
 import { CommonConstants } from '../common/constants/CommonConstants';
 import { StrUtil } from '@pura/harmony-utils';
+import { PointLightDefaultButton } from './PointLight/PointLightDeFaultButton';
 
 @Observed
 class DownloadCenterTaskState implements DownloadCenterTask {
@@ -60,8 +61,8 @@ struct DownloadCenterTaskRow {
       Column({ space: 8 }) {
         Row({ space: 10 }) {
           Image(StrUtil.isNotEmpty(this.task.coverPath) ? this.task.coverPath : $r('app.media.alt'))
-            .width(54)
-            .height(54)
+            .width(48)
+            .height(48)
             .borderRadius(9)
             .sourceSize({ width: 38, height: 38 })
             .alt($r('app.media.alt'))
@@ -85,10 +86,16 @@ struct DownloadCenterTaskRow {
                 .fontSize(12)
                 .fontColor($r('app.color.text_color'))
                 .opacity(0.35)
-              Text(this.isDownloading ? this.getTaskStatusText() : '已完成')
+              Text(this.isDownloading ?'' : '已完成')
                 .fontSize(12)
-                .fontColor(this.getTaskStatusColor())
+                .fontColor($r('app.color.text_color'))
                 .opacity(0.85)
+
+              Text(this.getTaskSpeedText())
+                .fontSize(12)
+                .fontColor($r('app.color.text_color'))
+                .opacity(0.75)
+                .margin({ right: 6 })
             }
             .width('100%')
           }
@@ -115,11 +122,6 @@ struct DownloadCenterTaskRow {
               .maxLines(1)
               .textOverflow({ overflow: TextOverflow.Ellipsis })
               .layoutWeight(1)
-            Text(this.getTaskSpeedText())
-              .fontSize(12)
-              .fontColor($r('app.color.text_color'))
-              .opacity(0.75)
-              .margin({ right: 6 })
             Text(this.getTaskProgressInfo())
               .fontSize(12)
               .fontColor($r('app.color.text_color'))
@@ -144,13 +146,16 @@ struct DownloadCenterTaskRow {
 
   @Builder
   private taskActionButtonBuilder() {
-    Button(this.getTaskActionText())
-      .fontSize(12)
-      .fontColor(this.isTaskRunning() ? $r('app.color.text_color') : $r('app.color.start_window_background'))
-      .height(30)
-      .padding({ left: 14, right: 14, top: 0, bottom: 0 })
-      .backgroundColor(this.isTaskRunning() ? $r('app.color.bg_card') : this.themeColor)
-      .borderRadius(15)
+    PointLightDefaultButton({
+      isPx: false,
+      isSysBol: true,
+      pointColor: this.isTaskRunning() ? $r('app.color.text_color') : this.themeColor,
+      imageResource: this.isTaskRunning() ? $r('sys.symbol.pause') : $r('sys.symbol.play_fill'),
+      builderHeight: 30,
+      builderWidth: 30,
+      buttonScale: 1,
+      canShadow: false,
+    })
       .onClick(() => {
         if (this.isTaskRunning()) {
           this.onPauseTask(this.task.taskId);
@@ -164,10 +169,6 @@ struct DownloadCenterTaskRow {
     return this.task.status === 'downloading';
   }
 
-  private getTaskActionText(): string {
-    return this.isTaskRunning() ? '暂停' : '开始';
-  }
-
   private getTaskTotalSizeText(): string {
     if (this.task.totalBytes > 0) {
       return this.formatBytes(this.task.totalBytes);