mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-26 18:49:26 +03:00
Use ContextCompat.getSystemService function.
This commit is contained in:
parent
bd05484b2d
commit
914ec895ee
1 changed files with 3 additions and 4 deletions
|
@ -23,6 +23,7 @@ import android.hardware.SensorEvent
|
||||||
import android.hardware.SensorEventListener
|
import android.hardware.SensorEventListener
|
||||||
import android.hardware.SensorManager
|
import android.hardware.SensorManager
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
|
import androidx.core.content.ContextCompat.getSystemService
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -33,15 +34,13 @@ class CallProximityManager @Inject constructor(val context: Context) : SensorEve
|
||||||
|
|
||||||
private val PROXIMITY_WAKE_LOCK_TAG = "PROXIMITY_WAKE_LOCK_TAG"
|
private val PROXIMITY_WAKE_LOCK_TAG = "PROXIMITY_WAKE_LOCK_TAG"
|
||||||
|
|
||||||
private lateinit var powerManager: PowerManager
|
private var powerManager: PowerManager = getSystemService(context, PowerManager::class.java)!!
|
||||||
private lateinit var sensorManager: SensorManager
|
private var sensorManager: SensorManager = getSystemService(context, SensorManager::class.java)!!
|
||||||
|
|
||||||
private var wakeLock: PowerManager.WakeLock? = null
|
private var wakeLock: PowerManager.WakeLock? = null
|
||||||
private var sensor: Sensor? = null
|
private var sensor: Sensor? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager
|
|
||||||
sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager
|
|
||||||
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY)
|
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue