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