mirror of
https://github.com/IllusionMan1212/NPS-Browser.git
synced 2026-10-24 18:12:38 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d754530c0b |
@@ -5,7 +5,7 @@ import com.github.wrdlbrnft.sortedlistadapter.SortedListAdapter
|
|||||||
data class AppData(
|
data class AppData(
|
||||||
val titleID: String?, val region: String?, val title: String?, val link: String?,
|
val titleID: String?, val region: String?, val title: String?, val link: String?,
|
||||||
val license: String?, val contentID: String?, val lastDateTime: 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 {
|
) : SortedListAdapter.ViewModel {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (this === other) return true
|
if (this === other) return true
|
||||||
@@ -21,6 +21,7 @@ data class AppData(
|
|||||||
if (contentID != other.contentID) return false
|
if (contentID != other.contentID) return false
|
||||||
if (lastDateTime != other.lastDateTime) return false
|
if (lastDateTime != other.lastDateTime) return false
|
||||||
if (fileSize != other.fileSize) return false
|
if (fileSize != other.fileSize) return false
|
||||||
|
if (version != other.version) return false
|
||||||
if (sha256 != other.sha256) return false
|
if (sha256 != other.sha256) return false
|
||||||
if (minFW != other.minFW) return false
|
if (minFW != other.minFW) return false
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ data class AppData(
|
|||||||
result = 31 * result + (contentID?.hashCode() ?: 0)
|
result = 31 * result + (contentID?.hashCode() ?: 0)
|
||||||
result = 31 * result + (lastDateTime?.hashCode() ?: 0)
|
result = 31 * result + (lastDateTime?.hashCode() ?: 0)
|
||||||
result = 31 * result + (fileSize?.hashCode() ?: 0)
|
result = 31 * result + (fileSize?.hashCode() ?: 0)
|
||||||
|
result = 31 * result + (version?.hashCode() ?: 0)
|
||||||
result = 31 * result + (sha256?.hashCode() ?: 0)
|
result = 31 * result + (sha256?.hashCode() ?: 0)
|
||||||
result = 31 * result + (minFW?.hashCode() ?: 0)
|
result = 31 * result + (minFW?.hashCode() ?: 0)
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ class SingleAppFragment : Fragment() {
|
|||||||
view?.findViewById<TextView>(R.id.singleAppSizeTitle)?.visibility = View.INVISIBLE
|
view?.findViewById<TextView>(R.id.singleAppSizeTitle)?.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
view?.findViewById<TextView>(R.id.singleAppContentId)?.text = app.contentID
|
view?.findViewById<TextView>(R.id.singleAppContentId)?.text = app.contentID
|
||||||
|
if (app.version != null) {
|
||||||
|
view?.findViewById<TextView>(R.id.singleAppVer)?.text = app.version
|
||||||
|
} else {
|
||||||
|
view?.findViewById<TextView>(R.id.singleAppVerTitle)?.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
view?.findViewById<TextView>(R.id.singleAppFwVer)?.text = app.minFW
|
view?.findViewById<TextView>(R.id.singleAppFwVer)?.text = app.minFW
|
||||||
// TODO: get and set app icon
|
// TODO: get and set app icon
|
||||||
if (app.minFW.isNullOrBlank()) {
|
if (app.minFW.isNullOrBlank()) {
|
||||||
@@ -59,10 +64,12 @@ class SingleAppFragment : Fragment() {
|
|||||||
if (app.link == "CART ONLY") {
|
if (app.link == "CART ONLY") {
|
||||||
view?.findViewById<TextView>(R.id.singleAppError)?.text = getString(R.string.cart_only)
|
view?.findViewById<TextView>(R.id.singleAppError)?.text = getString(R.string.cart_only)
|
||||||
view?.findViewById<Button>(R.id.singleAppDownloadButton)?.isEnabled = false
|
view?.findViewById<Button>(R.id.singleAppDownloadButton)?.isEnabled = false
|
||||||
|
view?.findViewById<Button>(R.id.singleAppCopyPKGButton)?.isEnabled = false
|
||||||
view?.findViewById<Button>(R.id.singleAppCopyZRIFButton)?.isEnabled = false
|
view?.findViewById<Button>(R.id.singleAppCopyZRIFButton)?.isEnabled = false
|
||||||
} else if (app.link == "MISSING") {
|
} else if (app.link == "MISSING") {
|
||||||
view?.findViewById<TextView>(R.id.singleAppError)?.text = getString(R.string.no_download_link)
|
view?.findViewById<TextView>(R.id.singleAppError)?.text = getString(R.string.no_download_link)
|
||||||
view?.findViewById<Button>(R.id.singleAppDownloadButton)?.isEnabled = false
|
view?.findViewById<Button>(R.id.singleAppDownloadButton)?.isEnabled = false
|
||||||
|
view?.findViewById<Button>(R.id.singleAppCopyPKGButton)?.isEnabled = false
|
||||||
view?.findViewById<Button>(R.id.singleAppCopyZRIFButton)?.isEnabled = false
|
view?.findViewById<Button>(R.id.singleAppCopyZRIFButton)?.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,24 +97,19 @@ class SingleAppFragment : Fragment() {
|
|||||||
) // TODO: set up preference for this
|
) // TODO: set up preference for this
|
||||||
downloadManager.enqueue(request)
|
downloadManager.enqueue(request)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Toast.makeText(
|
Toast.makeText(requireContext(), getString(R.string.download_error), Toast.LENGTH_SHORT).show()
|
||||||
requireContext(),
|
|
||||||
getString(R.string.download_error),
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// long click listener for download button
|
// click listener for the copy pkg button
|
||||||
view?.findViewById<Button>(R.id.singleAppDownloadButton)?.setOnLongClickListener {
|
view?.findViewById<Button>(R.id.singleAppCopyPKGButton)?.setOnClickListener {
|
||||||
val clipboardManager = requireActivity().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboardManager = requireActivity().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clipData = ClipData.newPlainText("PKG URL", app.link)
|
val clipData = ClipData.newPlainText("PKG URL", app.link)
|
||||||
clipboardManager.setPrimaryClip(clipData)
|
clipboardManager.setPrimaryClip(clipData)
|
||||||
Toast.makeText(requireContext(), getString(R.string.pkg_url_copied), Toast.LENGTH_SHORT).show()
|
Toast.makeText(requireContext(),getString(R.string.pkg_url_copied),Toast.LENGTH_SHORT).show()
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// click listener for the copyzrifbutton button
|
// click listener for the copy zRIF button
|
||||||
view?.findViewById<Button>(R.id.singleAppCopyZRIFButton)?.setOnClickListener {
|
view?.findViewById<Button>(R.id.singleAppCopyZRIFButton)?.setOnClickListener {
|
||||||
val clipboardManager = requireActivity().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboardManager = requireActivity().getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clipData = ClipData.newPlainText("zRIF", app.license)
|
val clipData = ClipData.newPlainText("zRIF", app.license)
|
||||||
|
|||||||
+2
-1
@@ -151,12 +151,13 @@ class MainActivityFragment : Fragment() {
|
|||||||
lastDateTime = lastDateTime.substring(0, 10)
|
lastDateTime = lastDateTime.substring(0, 10)
|
||||||
}
|
}
|
||||||
val fileSize = entry["File Size"]?.toLongOrNull()
|
val fileSize = entry["File Size"]?.toLongOrNull()
|
||||||
|
val version = entry["Update Version"]
|
||||||
val sha256 = entry["SHA256"]
|
val sha256 = entry["SHA256"]
|
||||||
val minFW = entry["Required FW"]
|
val minFW = entry["Required FW"]
|
||||||
val app = AppData(
|
val app = AppData(
|
||||||
id, region, name, link ?: "MISSING", license ?: "MISSING",
|
id, region, name, link ?: "MISSING", license ?: "MISSING",
|
||||||
contentID ?: "MISSING", lastDateTime ?: "MISSING",
|
contentID ?: "MISSING", lastDateTime ?: "MISSING",
|
||||||
fileSize, sha256 ?: "MISSING", minFW
|
fileSize, version, sha256 ?: "MISSING", minFW
|
||||||
)
|
)
|
||||||
apps?.add(app)
|
apps?.add(app)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,19 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/singleAppTitle" />
|
app:layout_constraintTop_toBottomOf="@+id/singleAppTitle" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/singleAppCopyPKGButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="66dp"
|
||||||
|
android:layout_marginStart="48dp"
|
||||||
|
android:layout_marginTop="6dp"
|
||||||
|
android:layout_marginEnd="48dp"
|
||||||
|
android:text="@string/copy_pkg"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/singleAppDownloadButton" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/singleAppCopyZRIFButton"
|
android:id="@+id/singleAppCopyZRIFButton"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -81,7 +94,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/singleAppDownloadButton" />
|
app:layout_constraintTop_toBottomOf="@+id/singleAppCopyPKGButton" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/singleAppContentIdTitle"
|
android:id="@+id/singleAppContentIdTitle"
|
||||||
@@ -134,6 +147,23 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/singleAppContentId" />
|
app:layout_constraintTop_toBottomOf="@+id/singleAppContentId" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/singleAppVerTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="48dp"
|
||||||
|
android:layout_marginTop="24dp"
|
||||||
|
android:layout_marginEnd="48dp"
|
||||||
|
android:fontFamily="sans-serif-black"
|
||||||
|
android:text="@string/version"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="24sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/singleAppSize" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/singleAppFwVerTitle"
|
android:id="@+id/singleAppFwVerTitle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -168,6 +198,23 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/singleAppSizeTitle"
|
app:layout_constraintTop_toBottomOf="@+id/singleAppSizeTitle"
|
||||||
tools:text="Size" />
|
tools:text="Size" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/singleAppVer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="48dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="48dp"
|
||||||
|
android:fontFamily="sans-serif-light"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/singleAppVerTitle"
|
||||||
|
tools:text="Version" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/singleAppFwVer"
|
android:id="@+id/singleAppFwVer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -185,7 +232,6 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/singleAppFwVerTitle"
|
app:layout_constraintTop_toBottomOf="@+id/singleAppFwVerTitle"
|
||||||
tools:text="MinFW" />
|
tools:text="MinFW" />
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
<string name="title_activity_settings">设置</string>
|
<string name="title_activity_settings">设置</string>
|
||||||
<string name="search">搜索</string>
|
<string name="search">搜索</string>
|
||||||
<string name="download">下载</string>
|
<string name="download">下载</string>
|
||||||
<string name="copy_zrif">复制zRIF</string>
|
<string name="copy_pkg">复制PKG地址</string>
|
||||||
|
<string name="copy_zrif">复制zRIF密钥</string>
|
||||||
<string name="content_id">内容ID</string>
|
<string name="content_id">内容ID</string>
|
||||||
<string name="size">大小</string>
|
<string name="size">大小</string>
|
||||||
|
<string name="version">版本</string>
|
||||||
<string name="minfw">最低固件版本</string>
|
<string name="minfw">最低固件版本</string>
|
||||||
<string name="single_app_icon">应用图标</string>
|
<string name="single_app_icon">应用图标</string>
|
||||||
<string name="no_license">注意:这个内容没有提供授权</string>
|
<string name="no_license">注意:这个内容没有提供授权</string>
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
<string name="title_activity_settings">設置</string>
|
<string name="title_activity_settings">設置</string>
|
||||||
<string name="search">搜尋</string>
|
<string name="search">搜尋</string>
|
||||||
<string name="download">下載</string>
|
<string name="download">下載</string>
|
||||||
<string name="copy_zrif">複製zRIF</string>
|
<string name="copy_pkg">複製PKG地址</string>
|
||||||
|
<string name="copy_zrif">複製zRIF金鑰</string>
|
||||||
<string name="content_id">內容ID</string>
|
<string name="content_id">內容ID</string>
|
||||||
<string name="size">檔案大小</string>
|
<string name="size">檔案大小</string>
|
||||||
|
<string name="version">版本</string>
|
||||||
<string name="minfw">最低韌體版本</string>
|
<string name="minfw">最低韌體版本</string>
|
||||||
<string name="single_app_icon">應用程式圖標</string>
|
<string name="single_app_icon">應用程式圖標</string>
|
||||||
<string name="no_license">注意:這個內容沒有提供授權</string>
|
<string name="no_license">注意:這個內容沒有提供授權</string>
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
<string name="title_activity_settings">Settings</string>
|
<string name="title_activity_settings">Settings</string>
|
||||||
<string name="search">Search</string>
|
<string name="search">Search</string>
|
||||||
<string name="download">Download</string>
|
<string name="download">Download</string>
|
||||||
<string name="copy_zrif">Copy zRIF</string>
|
<string name="copy_pkg">Copy PKG URL</string>
|
||||||
|
<string name="copy_zrif">Copy zRIF Key</string>
|
||||||
<string name="content_id">Content ID</string>
|
<string name="content_id">Content ID</string>
|
||||||
<string name="size">Size</string>
|
<string name="size">Size</string>
|
||||||
|
<string name="version">Version</string>
|
||||||
<string name="minfw">Minimum Firmware Version</string>
|
<string name="minfw">Minimum Firmware Version</string>
|
||||||
<string name="single_app_icon">Single app icon</string>
|
<string name="single_app_icon">Single app icon</string>
|
||||||
<string name="no_license">Warning: No license was provided for this content.</string>
|
<string name="no_license">Warning: No license was provided for this content.</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user