chore: improve compatibility check #96

Merged
PeterCxy merged 1 commit from septs/OpenEUICC:improve-compatibility-check into master 2024-12-08 16:29:10 +01:00
2 changed files with 14 additions and 10 deletions

View file

@ -1,6 +1,8 @@
package im.angry.openeuicc.ui package im.angry.openeuicc.ui
import android.annotation.SuppressLint
import android.os.Bundle import android.os.Bundle
import android.text.Html
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -8,6 +10,7 @@ import android.widget.TextView
import androidx.activity.enableEdgeToEdge import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.children import androidx.core.view.children
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -29,15 +32,16 @@ class CompatibilityCheckActivity: AppCompatActivity() {
setupToolbarInsets() setupToolbarInsets()
supportActionBar!!.setDisplayHomeAsUpEnabled(true) supportActionBar!!.setDisplayHomeAsUpEnabled(true)
compatibilityCheckList = requireViewById(R.id.recycler_view) compatibilityCheckList = requireViewById<RecyclerView>(R.id.recycler_view).also {
compatibilityCheckList.layoutManager = it.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false) it.addItemDecoration(DividerItemDecoration(this, LinearLayoutManager.VERTICAL))
compatibilityCheckList.addItemDecoration(DividerItemDecoration(this, LinearLayoutManager.VERTICAL)) it.adapter = adapter
compatibilityCheckList.adapter = adapter }
setupRootViewInsets(compatibilityCheckList) setupRootViewInsets(compatibilityCheckList)
} }
@SuppressLint("NotifyDataSetChanged")
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
lifecycleScope.launch { lifecycleScope.launch {
@ -61,10 +65,10 @@ class CompatibilityCheckActivity: AppCompatActivity() {
fun bindItem(item: CompatibilityCheck) { fun bindItem(item: CompatibilityCheck) {
titleView.text = item.title titleView.text = item.title
descView.text = item.description descView.text = Html.fromHtml(item.description, Html.FROM_HTML_MODE_COMPACT)
statusContainer.children.forEach { statusContainer.children.forEach {
it.visibility = View.GONE it.isVisible = false
} }
val viewId = when (item.state) { val viewId = when (item.state) {
@ -73,7 +77,7 @@ class CompatibilityCheckActivity: AppCompatActivity() {
CompatibilityCheck.State.FAILURE_UNKNOWN -> R.id.compatibility_check_unknown CompatibilityCheck.State.FAILURE_UNKNOWN -> R.id.compatibility_check_unknown
else -> R.id.compatibility_check_progress_bar else -> R.id.compatibility_check_progress_bar
} }
root.requireViewById<View>(viewId).visibility = View.VISIBLE root.requireViewById<View>(viewId).isVisible = true
} }
} }

View file

@ -12,11 +12,11 @@
<string name="compatibility_check_omapi_connectivity">OMAPI Connectivity</string> <string name="compatibility_check_omapi_connectivity">OMAPI Connectivity</string>
<string name="compatibility_check_omapi_connectivity_desc">Does your device allow access to Secure Elements on SIM cards via OMAPI?</string> <string name="compatibility_check_omapi_connectivity_desc">Does your device allow access to Secure Elements on SIM cards via OMAPI?</string>
<string name="compatibility_check_omapi_connectivity_fail">Unable to detect Secure Element readers for SIM cards via OMAPI. If you have not inserted a SIM in this device, try inserting one and retry this check.</string> <string name="compatibility_check_omapi_connectivity_fail">Unable to detect Secure Element readers for SIM cards via OMAPI. If you have not inserted a SIM in this device, try inserting one and retry this check.</string>
<string name="compatibility_check_omapi_connectivity_partial_success_sim_number">Successfully detected Secure Element access, but only for the following SIM slots: <b>SIM%s</b>.</string> <string name="compatibility_check_omapi_connectivity_partial_success_sim_number">Successfully detected Secure Element access, but only for the following SIM slots: &lt;b&gt;SIM%s&lt;/b&gt;.</string>
<string name="compatibility_check_isdr_channel">ISD-R Channel Access</string> <string name="compatibility_check_isdr_channel">ISD-R Channel Access</string>
<string name="compatibility_check_isdr_channel_desc">Does your device support opening an ISD-R (management) channel to eSIMs via OMAPI?</string> <string name="compatibility_check_isdr_channel_desc">Does your device support opening an ISD-R (management) channel to eSIMs via OMAPI?</string>
<string name="compatibility_check_isdr_channel_desc_unknown">Cannot determine whether ISD-R access through OMAPI is supported. You might want to retry with SIM cards inserted (any SIM card will do) if not already.</string> <string name="compatibility_check_isdr_channel_desc_unknown">Cannot determine whether ISD-R access through OMAPI is supported. You might want to retry with SIM cards inserted (any SIM card will do) if not already.</string>
<string name="compatibility_check_isdr_channel_desc_partial_fail">OMAPI access to ISD-R is only possible on the following SIM slots: <b>SIM%s</b>.</string> <string name="compatibility_check_isdr_channel_desc_partial_fail">OMAPI access to ISD-R is only possible on the following SIM slots: &lt;b&gt;SIM%s&lt;/b&gt;.</string>
<string name="compatibility_check_known_broken">Not on the Known Broken List</string> <string name="compatibility_check_known_broken">Not on the Known Broken List</string>
<string name="compatibility_check_known_broken_desc">Making sure your device is not known to have bugs associated with removable eSIMs.</string> <string name="compatibility_check_known_broken_desc">Making sure your device is not known to have bugs associated with removable eSIMs.</string>
<string name="compatibility_check_known_broken_fail">Oops, your device is known to have bugs when accessing removable eSIMs. This does not necessarily mean that it will not work at all, but you will have to proceed with caution.</string> <string name="compatibility_check_known_broken_fail">Oops, your device is known to have bugs when accessing removable eSIMs. This does not necessarily mean that it will not work at all, but you will have to proceed with caution.</string>