Files
assistant-android/app/src/main/java/com/gh/gamecenter/entity/ApkEntity.kt
2019-02-16 15:46:15 +08:00

63 lines
2.1 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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
}
}