mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
use helper function to check sdk version
This commit is contained in:
@@ -1,15 +1,15 @@
|
|||||||
package com.simplemobiletools.dialer.extensions
|
package com.simplemobiletools.dialer.extensions
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import android.telecom.Call
|
import android.telecom.Call
|
||||||
import android.telecom.Call.STATE_CONNECTING
|
import android.telecom.Call.STATE_CONNECTING
|
||||||
import android.telecom.Call.STATE_DIALING
|
import android.telecom.Call.STATE_DIALING
|
||||||
import android.telecom.Call.STATE_SELECT_PHONE_ACCOUNT
|
import android.telecom.Call.STATE_SELECT_PHONE_ACCOUNT
|
||||||
|
import com.simplemobiletools.commons.helpers.isSPlus
|
||||||
|
|
||||||
private val OUTGOING_CALL_STATES = arrayOf(STATE_CONNECTING, STATE_DIALING, STATE_SELECT_PHONE_ACCOUNT)
|
private val OUTGOING_CALL_STATES = arrayOf(STATE_CONNECTING, STATE_DIALING, STATE_SELECT_PHONE_ACCOUNT)
|
||||||
|
|
||||||
fun Call.getStateCompat(): Int {
|
fun Call.getStateCompat(): Int {
|
||||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
return if (isSPlus()) {
|
||||||
details.state
|
details.state
|
||||||
} else {
|
} else {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
|
Reference in New Issue
Block a user