63 lines
2.1 KiB
Kotlin
63 lines
2.1 KiB
Kotlin
package com.gh.gamecenter.entity
|
||
|
||
import android.os.Parcelable
|
||
import android.text.TextUtils
|
||
import com.google.gson.annotations.SerializedName
|
||
import kotlinx.android.parcel.Parcelize
|
||
|
||
@Parcelize
|
||
data class ApkEntity(@SerializedName("package")
|
||
var packageName: String? = null,
|
||
var size: String? = null,
|
||
var url: String? = null,
|
||
private var platform: String? = null,
|
||
var version: String? = null,
|
||
@SerializedName("gh_version")
|
||
var ghVersion: String? = null,
|
||
var etag: String? = null,
|
||
var apkCollection: GameCollectionEntity? = null,
|
||
var order: Int = 0,
|
||
@SerializedName("active")
|
||
var isActive: Boolean = true,
|
||
var force: Boolean = false,
|
||
var apkLink: ApkLink? = null,
|
||
var plugin: String? = "",/*控制是否显示插件化 默认:open,取值有:open/only_index/only_game/close*/
|
||
var time: Long? = null) : Parcelable {
|
||
fun getPlatform(): String? {
|
||
if (TextUtils.isEmpty(platform)) {
|
||
return "官方版"
|
||
}
|
||
return platform
|
||
}
|
||
|
||
fun setPlatform(platform: String) {
|
||
this.platform = platform
|
||
}
|
||
|
||
fun isShowPlugin(location: PluginLocation): Boolean {
|
||
if (plugin.isNullOrEmpty() || "open" == plugin || plugin == location.name) {
|
||
return true
|
||
}
|
||
return false
|
||
}
|
||
}
|
||
|
||
@Parcelize
|
||
class ApkLink(@SerializedName("_id")
|
||
val id: String = "",
|
||
val name: String = "",
|
||
val icon: String = "",
|
||
val type: String = "",
|
||
val link: String = "",
|
||
val text: String = "",
|
||
val sort: Int = 0,
|
||
val collection: String = "") : Parcelable {
|
||
|
||
fun getLinkEntity(): LinkEntity {
|
||
val linkEntity = LinkEntity()
|
||
linkEntity.type = type
|
||
linkEntity.link = link
|
||
linkEntity.text = text
|
||
return linkEntity
|
||
}
|
||
} |