-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature|doc] Support downloading common files; supports renaming med…
…ia library files; update README and screenshots
- Loading branch information
Showing
81 changed files
with
3,073 additions
and
745 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
125 changes: 12 additions & 113 deletions
125
app/src/main/java/com/skyd/anivu/model/bean/download/DownloadInfoBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,17 @@ | ||
package com.skyd.anivu.model.bean.download | ||
|
||
import android.os.Parcelable | ||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.Ignore | ||
import androidx.room.Index | ||
import com.skyd.anivu.base.BaseBean | ||
import kotlinx.parcelize.IgnoredOnParcel | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.Serializable | ||
import com.skyd.downloader.Status | ||
|
||
const val DOWNLOAD_INFO_TABLE_NAME = "DownloadInfo" | ||
|
||
@Parcelize | ||
@Serializable | ||
@Entity( | ||
tableName = DOWNLOAD_INFO_TABLE_NAME, | ||
primaryKeys = [ | ||
DownloadInfoBean.LINK_COLUMN | ||
], | ||
indices = [ | ||
Index(DownloadInfoBean.LINK_COLUMN, unique = true), | ||
] | ||
) | ||
data class DownloadInfoBean( | ||
@ColumnInfo(name = LINK_COLUMN) | ||
val link: String, | ||
@ColumnInfo(name = NAME_COLUMN) | ||
val name: String, | ||
@ColumnInfo(name = DOWNLOAD_DATE_COLUMN) | ||
var downloadDate: Long, | ||
@ColumnInfo(name = SIZE_COLUMN) | ||
val size: Long, | ||
@ColumnInfo(name = PROGRESS_COLUMN) | ||
val progress: Float, | ||
@ColumnInfo(name = DESCRIPTION_COLUMN) | ||
val description: String? = null, | ||
@ColumnInfo(name = DOWNLOAD_STATE_COLUMN) | ||
val downloadState: DownloadState = DownloadState.Init, | ||
@ColumnInfo(name = DOWNLOAD_REQUEST_ID_COLUMN) | ||
val downloadRequestId: String, | ||
) : BaseBean, Parcelable { | ||
@IgnoredOnParcel | ||
@Ignore | ||
var peerInfoList: List<PeerInfoBean> = emptyList() | ||
|
||
@IgnoredOnParcel | ||
@Ignore | ||
var uploadPayloadRate: Int = 0 | ||
|
||
@IgnoredOnParcel | ||
@Ignore | ||
var downloadPayloadRate: Int = 0 | ||
|
||
enum class DownloadState { | ||
Init, Downloading, Paused, Completed, ErrorPaused, StorageMovedFailed, Seeding, SeedingPaused; | ||
|
||
fun downloadComplete(): Boolean { | ||
return this == Completed || this == Seeding || this == SeedingPaused | ||
} | ||
} | ||
|
||
companion object { | ||
const val LINK_COLUMN = "link" | ||
const val NAME_COLUMN = "name" | ||
const val DOWNLOAD_DATE_COLUMN = "downloadDate" | ||
const val SIZE_COLUMN = "size" | ||
const val PROGRESS_COLUMN = "progress" | ||
const val DESCRIPTION_COLUMN = "description" | ||
const val DOWNLOAD_STATE_COLUMN = "downloadState" | ||
const val DOWNLOAD_REQUEST_ID_COLUMN = "downloadRequestId" | ||
|
||
const val PAYLOAD_PROGRESS = "progress" | ||
const val PAYLOAD_DESCRIPTION = "description" | ||
const val PAYLOAD_PEER_INFO = "peerInfo" | ||
const val PAYLOAD_UPLOAD_PAYLOAD_RATE = "uploadPayloadRate" | ||
const val PAYLOAD_DOWNLOAD_PAYLOAD_RATE = "downloadPayloadRate" | ||
const val PAYLOAD_DOWNLOAD_STATE = "downloadState" | ||
const val PAYLOAD_NAME = "name" | ||
const val PAYLOAD_DOWNLOADING_DIR_NAME = "downloadingDirName" | ||
const val PAYLOAD_SIZE = "size" | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as DownloadInfoBean | ||
|
||
if (link != other.link) return false | ||
if (name != other.name) return false | ||
if (downloadDate != other.downloadDate) return false | ||
if (size != other.size) return false | ||
if (progress != other.progress) return false | ||
if (description != other.description) return false | ||
if (downloadState != other.downloadState) return false | ||
if (downloadRequestId != other.downloadRequestId) return false | ||
if (uploadPayloadRate != other.uploadPayloadRate) return false | ||
if (downloadPayloadRate != other.downloadPayloadRate) return false | ||
return peerInfoList == other.peerInfoList | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = link.hashCode() | ||
result = 31 * result + name.hashCode() | ||
result = 31 * result + downloadDate.hashCode() | ||
result = 31 * result + size.hashCode() | ||
result = 31 * result + progress.hashCode() | ||
result = 31 * result + (description?.hashCode() ?: 0) | ||
result = 31 * result + downloadState.hashCode() | ||
result = 31 * result + downloadRequestId.hashCode() | ||
result = 31 * result + peerInfoList.hashCode() | ||
result = 31 * result + uploadPayloadRate.hashCode() | ||
result = 31 * result + downloadPayloadRate.hashCode() | ||
return result | ||
} | ||
} | ||
val id: Int, | ||
val url: String, | ||
val path: String, | ||
val fileName: String, | ||
val status: Status, | ||
val totalBytes: Long, | ||
val downloadedBytes: Long, | ||
val speedInBytePerMs: Float, | ||
val createTime: Long, | ||
val failureReason: String | ||
) |
108 changes: 108 additions & 0 deletions
108
app/src/main/java/com/skyd/anivu/model/bean/download/bt/BtDownloadInfoBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package com.skyd.anivu.model.bean.download.bt | ||
|
||
import android.os.Parcelable | ||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.Ignore | ||
import androidx.room.Index | ||
import com.skyd.anivu.base.BaseBean | ||
import kotlinx.parcelize.IgnoredOnParcel | ||
import kotlinx.parcelize.Parcelize | ||
import kotlinx.serialization.Serializable | ||
|
||
const val DOWNLOAD_INFO_TABLE_NAME = "DownloadInfo" | ||
|
||
@Parcelize | ||
@Serializable | ||
@Entity( | ||
tableName = DOWNLOAD_INFO_TABLE_NAME, | ||
primaryKeys = [ | ||
BtDownloadInfoBean.LINK_COLUMN | ||
], | ||
indices = [ | ||
Index(BtDownloadInfoBean.LINK_COLUMN, unique = true), | ||
] | ||
) | ||
data class BtDownloadInfoBean( | ||
@ColumnInfo(name = LINK_COLUMN) | ||
val link: String, | ||
@ColumnInfo(name = NAME_COLUMN) | ||
val name: String, | ||
@ColumnInfo(name = DOWNLOAD_DATE_COLUMN) | ||
var downloadDate: Long, | ||
@ColumnInfo(name = SIZE_COLUMN) | ||
val size: Long, | ||
@ColumnInfo(name = PROGRESS_COLUMN) | ||
val progress: Float, | ||
@ColumnInfo(name = DESCRIPTION_COLUMN) | ||
val description: String? = null, | ||
@ColumnInfo(name = DOWNLOAD_STATE_COLUMN) | ||
val downloadState: DownloadState = DownloadState.Init, | ||
@ColumnInfo(name = DOWNLOAD_REQUEST_ID_COLUMN) | ||
val downloadRequestId: String, | ||
) : BaseBean, Parcelable { | ||
@IgnoredOnParcel | ||
@Ignore | ||
var peerInfoList: List<PeerInfoBean> = emptyList() | ||
|
||
@IgnoredOnParcel | ||
@Ignore | ||
var uploadPayloadRate: Int = 0 | ||
|
||
@IgnoredOnParcel | ||
@Ignore | ||
var downloadPayloadRate: Int = 0 | ||
|
||
enum class DownloadState { | ||
Init, Downloading, Paused, Completed, ErrorPaused, StorageMovedFailed, Seeding, SeedingPaused; | ||
|
||
fun downloadComplete(): Boolean { | ||
return this == Completed || this == Seeding || this == SeedingPaused | ||
} | ||
} | ||
|
||
companion object { | ||
const val LINK_COLUMN = "link" | ||
const val NAME_COLUMN = "name" | ||
const val DOWNLOAD_DATE_COLUMN = "downloadDate" | ||
const val SIZE_COLUMN = "size" | ||
const val PROGRESS_COLUMN = "progress" | ||
const val DESCRIPTION_COLUMN = "description" | ||
const val DOWNLOAD_STATE_COLUMN = "downloadState" | ||
const val DOWNLOAD_REQUEST_ID_COLUMN = "downloadRequestId" | ||
} | ||
|
||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as BtDownloadInfoBean | ||
|
||
if (link != other.link) return false | ||
if (name != other.name) return false | ||
if (downloadDate != other.downloadDate) return false | ||
if (size != other.size) return false | ||
if (progress != other.progress) return false | ||
if (description != other.description) return false | ||
if (downloadState != other.downloadState) return false | ||
if (downloadRequestId != other.downloadRequestId) return false | ||
if (uploadPayloadRate != other.uploadPayloadRate) return false | ||
if (downloadPayloadRate != other.downloadPayloadRate) return false | ||
return peerInfoList == other.peerInfoList | ||
} | ||
|
||
override fun hashCode(): Int { | ||
var result = link.hashCode() | ||
result = 31 * result + name.hashCode() | ||
result = 31 * result + downloadDate.hashCode() | ||
result = 31 * result + size.hashCode() | ||
result = 31 * result + progress.hashCode() | ||
result = 31 * result + (description?.hashCode() ?: 0) | ||
result = 31 * result + downloadState.hashCode() | ||
result = 31 * result + downloadRequestId.hashCode() | ||
result = 31 * result + peerInfoList.hashCode() | ||
result = 31 * result + uploadPayloadRate.hashCode() | ||
result = 31 * result + downloadPayloadRate.hashCode() | ||
return result | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../bean/download/DownloadLinkUuidMapBean.kt → ...an/download/bt/DownloadLinkUuidMapBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...anivu/model/bean/download/PeerInfoBean.kt → ...vu/model/bean/download/bt/PeerInfoBean.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.