mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
improve part info section
This commit is contained in:
parent
599fdef001
commit
6a0028a8b8
@ -35,10 +35,8 @@ import androidx.compose.ui.text.buildAnnotatedString
|
|||||||
import androidx.compose.ui.text.withStyle
|
import androidx.compose.ui.text.withStyle
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.Dialog
|
|
||||||
import androidx.compose.ui.window.Popup
|
import androidx.compose.ui.window.Popup
|
||||||
import androidx.compose.ui.window.rememberComponentRectPositionProvider
|
import androidx.compose.ui.window.rememberComponentRectPositionProvider
|
||||||
import com.abdownloadmanager.desktop.ui.widget.menu.MyDropDown
|
|
||||||
import com.abdownloadmanager.utils.compose.useIsInDebugMode
|
import com.abdownloadmanager.utils.compose.useIsInDebugMode
|
||||||
import ir.amirab.downloader.downloaditem.DownloadJobStatus
|
import ir.amirab.downloader.downloaditem.DownloadJobStatus
|
||||||
import ir.amirab.downloader.monitor.*
|
import ir.amirab.downloader.monitor.*
|
||||||
@ -257,7 +255,15 @@ fun ColumnScope.RenderPartInfo(itemState: ProcessingDownloadItemState) {
|
|||||||
itemState.parts
|
itemState.parts
|
||||||
.let { parts ->
|
.let { parts ->
|
||||||
if (onlyActiveParts) {
|
if (onlyActiveParts) {
|
||||||
parts.filter { it.status is PartDownloadStatus.IsActive }
|
parts.filter {
|
||||||
|
when(it.status){
|
||||||
|
is PartDownloadStatus.Canceled -> true
|
||||||
|
PartDownloadStatus.Completed -> false
|
||||||
|
PartDownloadStatus.IDLE -> false
|
||||||
|
PartDownloadStatus.ReceivingData -> true
|
||||||
|
PartDownloadStatus.SendGet -> true
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
parts
|
parts
|
||||||
}
|
}
|
||||||
@ -314,7 +320,7 @@ fun ColumnScope.RenderPartInfo(itemState: ProcessingDownloadItemState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PartInfoCells.Status -> {
|
PartInfoCells.Status -> {
|
||||||
SimpleCellText("${it.value.status}")
|
SimpleCellText("${prettifyStatus(it.value.status)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
PartInfoCells.Downloaded -> {
|
PartInfoCells.Downloaded -> {
|
||||||
@ -355,6 +361,16 @@ fun ColumnScope.RenderPartInfo(itemState: ProcessingDownloadItemState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun prettifyStatus(status: PartDownloadStatus): String {
|
||||||
|
return when(status){
|
||||||
|
is PartDownloadStatus.Canceled -> "Disconnected"
|
||||||
|
PartDownloadStatus.IDLE -> "IDLE"
|
||||||
|
PartDownloadStatus.Completed -> "Completed"
|
||||||
|
PartDownloadStatus.ReceivingData -> "Receiving Data"
|
||||||
|
PartDownloadStatus.SendGet -> "Send Get"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SimpleCellText(text: String) {
|
private fun SimpleCellText(text: String) {
|
||||||
Text(text, fontSize = myTextSizes.base, maxLines = 1)
|
Text(text, fontSize = myTextSizes.base, maxLines = 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user