ui: Fix USB hotplug not getting picked up when no SIM is found
Some checks failed
/ build-debug (push) Has been cancelled
Some checks failed
/ build-debug (push) Has been cancelled
This commit is contained in:
parent
5300178a0e
commit
154ac77203
|
@ -119,7 +119,7 @@ open class MainActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
||||||
viewPager.visibility = View.GONE
|
viewPager.visibility = View.GONE
|
||||||
tabs.visibility = View.GONE
|
tabs.visibility = View.GONE
|
||||||
|
|
||||||
val knownChannels = withContext(Dispatchers.IO) {
|
var knownChannels = withContext(Dispatchers.IO) {
|
||||||
euiccChannelManager.enumerateEuiccChannels().onEach {
|
euiccChannelManager.enumerateEuiccChannels().onEach {
|
||||||
Log.d(TAG, "slot ${it.slotId} port ${it.portId}")
|
Log.d(TAG, "slot ${it.slotId} port ${it.portId}")
|
||||||
Log.d(TAG, it.lpa.eID)
|
Log.d(TAG, it.lpa.eID)
|
||||||
|
@ -146,19 +146,21 @@ open class MainActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
||||||
// If USB readers exist, add them at the very last
|
// If USB readers exist, add them at the very last
|
||||||
// We use a wrapper fragment to handle logic specific to USB readers
|
// We use a wrapper fragment to handle logic specific to USB readers
|
||||||
usbDevice?.let {
|
usbDevice?.let {
|
||||||
//spinnerAdapter.add(it.productName)
|
|
||||||
pages.add(Page(it.productName ?: "USB") { UsbCcidReaderFragment() })
|
pages.add(Page(it.productName ?: "USB") { UsbCcidReaderFragment() })
|
||||||
}
|
}
|
||||||
pagerAdapter.notifyDataSetChanged()
|
|
||||||
viewPager.visibility = View.VISIBLE
|
viewPager.visibility = View.VISIBLE
|
||||||
|
|
||||||
if (pages.size > 1) {
|
if (pages.size > 1) {
|
||||||
tabs.visibility = View.VISIBLE
|
tabs.visibility = View.VISIBLE
|
||||||
} else if (pages.isEmpty()) {
|
} else if (pages.isEmpty()) {
|
||||||
pages.add(Page("") { appContainer.uiComponentFactory.createNoEuiccPlaceholderFragment() })
|
pages.add(Page("") { appContainer.uiComponentFactory.createNoEuiccPlaceholderFragment() })
|
||||||
pagerAdapter.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pagerAdapter.notifyDataSetChanged()
|
||||||
|
// Reset the adapter so that the current view actually gets cleared
|
||||||
|
// notifyDataSetChanged() doesn't cause the current view to be removed.
|
||||||
|
viewPager.adapter = pagerAdapter
|
||||||
|
|
||||||
if (fromUsbEvent && usbDevice != null) {
|
if (fromUsbEvent && usbDevice != null) {
|
||||||
// If this refresh was triggered by a USB insertion while active, scroll to that page
|
// If this refresh was triggered by a USB insertion while active, scroll to that page
|
||||||
viewPager.post {
|
viewPager.post {
|
||||||
|
@ -182,6 +184,7 @@ open class MainActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
||||||
|
|
||||||
pages.clear()
|
pages.clear()
|
||||||
pagerAdapter.notifyDataSetChanged()
|
pagerAdapter.notifyDataSetChanged()
|
||||||
|
viewPager.adapter = pagerAdapter
|
||||||
|
|
||||||
init(fromUsbEvent) // will set refreshing = false
|
init(fromUsbEvent) // will set refreshing = false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue