From d754530c0bc11c210b2e7f95d87bc57d03719407 Mon Sep 17 00:00:00 2001 From: Croden1999 <851577088@qq.com> Date: Tue, 10 Oct 2023 11:50:47 +0800 Subject: [PATCH] app/src/main: Add copy pkg button and update version for SingleAppFragment. --- .../com/illusionware/npsbrowser/AppData.kt | 4 +- .../npsbrowser/fragments/SingleAppFragment.kt | 22 ++++---- .../mainactivity/MainActivityFragment.kt | 3 +- .../main/res/layout/single_app_fragment.xml | 50 ++++++++++++++++++- app/src/main/res/values-zh-rCN/strings.xml | 4 +- app/src/main/res/values-zh-rTW/strings.xml | 4 +- app/src/main/res/values/strings.xml | 4 +- 7 files changed, 74 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/com/illusionware/npsbrowser/AppData.kt b/app/src/main/java/com/illusionware/npsbrowser/AppData.kt index a195d6f..72ca3c2 100644 --- a/app/src/main/java/com/illusionware/npsbrowser/AppData.kt +++ b/app/src/main/java/com/illusionware/npsbrowser/AppData.kt @@ -5,7 +5,7 @@ import com.github.wrdlbrnft.sortedlistadapter.SortedListAdapter data class AppData( val titleID: String?, val region: String?, val title: String?, val link: String?, val license: String?, val contentID: String?, val lastDateTime: String?, - val fileSize: Number?, val sha256: String?, val minFW: String? + val fileSize: Number?, val version: String?, val sha256: String?, val minFW: String? ) : SortedListAdapter.ViewModel { override fun equals(other: Any?): Boolean { if (this === other) return true @@ -21,6 +21,7 @@ data class AppData( if (contentID != other.contentID) return false if (lastDateTime != other.lastDateTime) return false if (fileSize != other.fileSize) return false + if (version != other.version) return false if (sha256 != other.sha256) return false if (minFW != other.minFW) return false @@ -36,6 +37,7 @@ data class AppData( result = 31 * result + (contentID?.hashCode() ?: 0) result = 31 * result + (lastDateTime?.hashCode() ?: 0) result = 31 * result + (fileSize?.hashCode() ?: 0) + result = 31 * result + (version?.hashCode() ?: 0) result = 31 * result + (sha256?.hashCode() ?: 0) result = 31 * result + (minFW?.hashCode() ?: 0) return result diff --git a/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt b/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt index f439e4c..aeac6fd 100644 --- a/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt +++ b/app/src/main/java/com/illusionware/npsbrowser/fragments/SingleAppFragment.kt @@ -47,6 +47,11 @@ class SingleAppFragment : Fragment() { view?.findViewById(R.id.singleAppSizeTitle)?.visibility = View.INVISIBLE } view?.findViewById(R.id.singleAppContentId)?.text = app.contentID + if (app.version != null) { + view?.findViewById(R.id.singleAppVer)?.text = app.version + } else { + view?.findViewById(R.id.singleAppVerTitle)?.visibility = View.INVISIBLE + } view?.findViewById(R.id.singleAppFwVer)?.text = app.minFW // TODO: get and set app icon if (app.minFW.isNullOrBlank()) { @@ -59,10 +64,12 @@ class SingleAppFragment : Fragment() { if (app.link == "CART ONLY") { view?.findViewById(R.id.singleAppError)?.text = getString(R.string.cart_only) view?.findViewById