Commit cd7a932d authored by sheteng's avatar sheteng

2.0 开发 7

parent 5b740373
...@@ -15,6 +15,7 @@ data class GameInfo( ...@@ -15,6 +15,7 @@ data class GameInfo(
val dnsServer: String, val dnsServer: String,
val downloadType : Int, val downloadType : Int,
val downloadUrl: String, val downloadUrl: String,
val downloadUrlTools : String?,
val gameName: String, val gameName: String,
val icon: String, val icon: String,
val id: Int, val id: Int,
...@@ -25,7 +26,8 @@ data class GameInfo( ...@@ -25,7 +26,8 @@ data class GameInfo(
val score: String, val score: String,
val size: String, val size: String,
val type: Int, val type: Int,
val version: String val version: String,
val versionTools : String?
) )
data class Announcement( data class Announcement(
......
...@@ -204,6 +204,9 @@ class GameListFragment : XPageFragment() { ...@@ -204,6 +204,9 @@ class GameListFragment : XPageFragment() {
else if (!SysUtils.compareVersionTo( else if (!SysUtils.compareVersionTo(
AppUtils.getAppVersionName(itemData.packageName), AppUtils.getAppVersionName(itemData.packageName),
itemData.version itemData.version
) || !SysUtils.compareVersionTo(
AppUtils.getAppVersionName(itemData.packageName),
itemData.versionTools
) )
) { ) {
btn_uninstall.visibility = View.GONE btn_uninstall.visibility = View.GONE
...@@ -212,8 +215,7 @@ class GameListFragment : XPageFragment() { ...@@ -212,8 +215,7 @@ class GameListFragment : XPageFragment() {
tx_game_update_notice.visibility = View.VISIBLE tx_game_update_notice.visibility = View.VISIBLE
tx_download_status.visibility = View.GONE tx_download_status.visibility = View.GONE
btn_download_status.visibility = View.GONE btn_download_status.visibility = View.GONE
} } else {
else {
btn_uninstall.visibility = View.GONE btn_uninstall.visibility = View.GONE
btn_acc.visibility = View.VISIBLE btn_acc.visibility = View.VISIBLE
btn_acc_stop.visibility = View.GONE btn_acc_stop.visibility = View.GONE
...@@ -290,7 +292,7 @@ class GameListFragment : XPageFragment() { ...@@ -290,7 +292,7 @@ class GameListFragment : XPageFragment() {
downloadInfo.speed = downloadInfo.speed =
(downloadInfo.download_so_far - if (lastInfo == null) 0 else lastInfo.download_so_far) (downloadInfo.download_so_far - if (lastInfo == null) 0 else lastInfo.download_so_far)
if (lastInfo != null) { if (lastInfo != null) {
if (downloadInfo.speed == 0L && lastInfo.speed != 0L){ if (downloadInfo.speed == 0L && lastInfo.speed != 0L) {
downloadInfo.speed = lastInfo.speed downloadInfo.speed = lastInfo.speed
} }
} }
...@@ -318,7 +320,7 @@ class GameListFragment : XPageFragment() { ...@@ -318,7 +320,7 @@ class GameListFragment : XPageFragment() {
} else if (ann.type == 1) { } else if (ann.type == 1) {
val params = Bundle() val params = Bundle()
params.putInt(Constants.GAME_ID, ann.gameId) params.putInt(Constants.GAME_ID, ann.gameId)
openPage(NewsFragment::class.java,params) openPage(NewsFragment::class.java, params)
} }
} }
...@@ -391,7 +393,13 @@ class GameListFragment : XPageFragment() { ...@@ -391,7 +393,13 @@ class GameListFragment : XPageFragment() {
return return
} }
activity?.let { activity?.let {
if (itemData.downloadUrl.endsWith(".apk")) { var downloadUrl = itemData.downloadUrl
if (SysUtils.compareVersionTo(itemData.versionTools, itemData.version)) {
itemData.downloadUrlTools?.let {
downloadUrl = it
}
}
if (downloadUrl?.endsWith(".apk") == true) {
GameDownloadDialog( GameDownloadDialog(
itemData, itemData,
this@GameListFragment this@GameListFragment
...@@ -403,7 +411,7 @@ class GameListFragment : XPageFragment() { ...@@ -403,7 +411,7 @@ class GameListFragment : XPageFragment() {
}.setBtnRight("去找找") { }.setBtnRight("去找找") {
val intent = Intent( val intent = Intent(
Intent.ACTION_VIEW, Intent.ACTION_VIEW,
Uri.parse(itemData.downloadUrl) Uri.parse(downloadUrl)
) )
startActivity(intent) startActivity(intent)
}.show<CommonDialog>() }.show<CommonDialog>()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment