Compare commits
1 commit
da396dd99d
...
f2c697342c
Author | SHA1 | Date | |
---|---|---|---|
f2c697342c |
2 changed files with 7 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
||||||
package im.angry.openeuicc.ui
|
package im.angry.openeuicc.ui
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
|
import android.net.Uri
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuInflater
|
import android.view.MenuInflater
|
||||||
|
|
|
@ -23,13 +23,16 @@ class SIMToolkit(private val context: Context) {
|
||||||
|
|
||||||
operator fun get(slotId: Int): Slot? = when (slotId) {
|
operator fun get(slotId: Int): Slot? = when (slotId) {
|
||||||
-1, EuiccChannelManager.USB_CHANNEL_ID -> null
|
-1, EuiccChannelManager.USB_CHANNEL_ID -> null
|
||||||
else -> Slot(context.packageManager, buildSet {
|
else -> Slot(context, buildSet {
|
||||||
addAll(slots.getOrDefault(slotId, emptySet()))
|
addAll(slots.getOrDefault(slotId, emptySet()))
|
||||||
addAll(slots.getOrDefault(-1, emptySet()))
|
addAll(slots.getOrDefault(-1, emptySet()))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Slot(private val packageManager: PackageManager, private val components: Set<ComponentName>) {
|
data class Slot(private val context: Context, private val components: Set<ComponentName>) {
|
||||||
|
private val packageManager: PackageManager
|
||||||
|
get() = context.packageManager
|
||||||
|
|
||||||
private val packageNames: Iterable<String>
|
private val packageNames: Iterable<String>
|
||||||
get() = components.map(ComponentName::getPackageName).toSet()
|
get() = components.map(ComponentName::getPackageName).toSet()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue