mirror of
https://github.com/SimpleMobileTools/Simple-Contacts.git
synced 2025-04-06 14:21:43 +02:00
show the incoming call screen if the screen is turned off too
This commit is contained in:
parent
659b2abb4c
commit
570f55eeb8
@ -57,7 +57,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:5.27.0'
|
implementation 'com.simplemobiletools:commons:5.27.1'
|
||||||
implementation 'joda-time:joda-time:2.10.1'
|
implementation 'joda-time:joda-time:2.10.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
|
||||||
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
|
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
package com.simplemobiletools.contacts.pro.activities
|
package com.simplemobiletools.contacts.pro.activities
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Notification
|
import android.app.*
|
||||||
import android.app.NotificationChannel
|
import android.content.Context
|
||||||
import android.app.NotificationManager
|
|
||||||
import android.app.PendingIntent
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.telecom.Call
|
import android.telecom.Call
|
||||||
import android.util.Size
|
import android.util.Size
|
||||||
|
import android.view.WindowManager
|
||||||
import android.widget.RemoteViews
|
import android.widget.RemoteViews
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import com.simplemobiletools.commons.extensions.*
|
import com.simplemobiletools.commons.extensions.*
|
||||||
|
import com.simplemobiletools.commons.helpers.isOreoMr1Plus
|
||||||
import com.simplemobiletools.commons.helpers.isOreoPlus
|
import com.simplemobiletools.commons.helpers.isOreoPlus
|
||||||
import com.simplemobiletools.commons.helpers.isQPlus
|
import com.simplemobiletools.commons.helpers.isQPlus
|
||||||
import com.simplemobiletools.contacts.pro.R
|
import com.simplemobiletools.contacts.pro.R
|
||||||
@ -43,11 +44,12 @@ class CallActivity : SimpleActivity() {
|
|||||||
|
|
||||||
callContact = CallManager.getCallContact(applicationContext)
|
callContact = CallManager.getCallContact(applicationContext)
|
||||||
callContactAvatar = getCallContactAvatar()
|
callContactAvatar = getCallContactAvatar()
|
||||||
|
addLockScreenFlags()
|
||||||
showNotification()
|
showNotification()
|
||||||
|
updateOtherPersonsInfo()
|
||||||
|
|
||||||
CallManager.registerCallback(getCallCallback())
|
CallManager.registerCallback(getCallCallback())
|
||||||
updateCallState(CallManager.getState())
|
updateCallState(CallManager.getState())
|
||||||
updateOtherPersonsInfo()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
@ -134,6 +136,22 @@ class CallActivity : SimpleActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
|
private fun addLockScreenFlags() {
|
||||||
|
if (isOreoMr1Plus()) {
|
||||||
|
setShowWhenLocked(true)
|
||||||
|
setTurnScreenOn(true)
|
||||||
|
} else {
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isOreoPlus()) {
|
||||||
|
(getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).requestDismissKeyguard(this, null)
|
||||||
|
} else {
|
||||||
|
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
private fun showNotification() {
|
private fun showNotification() {
|
||||||
val channelId = "simple_contacts_call"
|
val channelId = "simple_contacts_call"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user