store the Sim card ID at the SIM model too

This commit is contained in:
tibbi
2020-05-11 15:32:29 +02:00
parent 335129aee4
commit b353a96c1a
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ val Context.audioManager: AudioManager get() = getSystemService(Context.AUDIO_SE
@SuppressLint("MissingPermission")
fun Context.getAvailableSIMCardLabels(): ArrayList<SIMAccount> {
val SIMAccounts = ArrayList<SIMAccount>()
telecomManager.callCapablePhoneAccounts.forEach { account ->
telecomManager.callCapablePhoneAccounts.forEachIndexed { index, account ->
val phoneAccount = telecomManager.getPhoneAccount(account)
var label = phoneAccount.label.toString()
var address = phoneAccount.address.toString()
@ -23,7 +23,7 @@ fun Context.getAvailableSIMCardLabels(): ArrayList<SIMAccount> {
address = Uri.decode(address.substringAfter("tel:"))
label += " ($address)"
}
val SIM = SIMAccount(phoneAccount.accountHandle, label)
val SIM = SIMAccount(index + 1, phoneAccount.accountHandle, label)
SIMAccounts.add(SIM)
}
return SIMAccounts

View File

@ -2,4 +2,4 @@ package com.simplemobiletools.dialer.models
import android.telecom.PhoneAccountHandle
data class SIMAccount(val handle: PhoneAccountHandle, val label: String)
data class SIMAccount(val id: Int, val handle: PhoneAccountHandle, val label: String)