Commit 77f295db authored by wanglei's avatar wanglei

...

parent a68b65da
......@@ -118,12 +118,22 @@ object NotificationUtils {
}
private var lastNotificationTime = 0L
fun sendNotification(context: Context, where: String) {
if (isDeviceLocked || isAppInForeground || !isScreenOn) {
return
}
val actionId = nextNotificationId
val intervalTime = System.currentTimeMillis() - lastNotificationTime
val spInterval = SpUtils.getInstance().getInt("NotificationInterval", 1)
val oneMinute = 1 * 60 * 1000L
Log.e("sendNotification", "where=$where actionId=$actionId intervalTime=$intervalTime spInterval=$spInterval")
if (lastNotificationTime != 0L && intervalTime < spInterval * oneMinute) {
return
}
val bigRemoteViews = RemoteViews(context.packageName, R.layout.notification_common)
val smallRemoteViews = RemoteViews(context.packageName, R.layout.notification_common_small)
var intentAction = ""
......@@ -138,9 +148,11 @@ object NotificationUtils {
intentAction = Global.FUNCTION_CLEAN
}
FUNCTION_APP_MANAGER -> {
}
FUNCTION_BATTERY -> {
}
......@@ -148,15 +160,19 @@ object NotificationUtils {
FUNCTION_LARGE_FILE -> {
}
FUNCTION_WHATS_APP-> {
FUNCTION_WHATS_APP -> {
}
FUNCTION_APP_PROCESS -> {
}
FUNCTION_SIMILAR_PHOTOS -> {
}
FUNCTION_SCREENSHOT -> {
}
......@@ -183,6 +199,7 @@ object NotificationUtils {
bigRemoteViews,
smallRemoteViews,
)
lastNotificationTime = System.currentTimeMillis()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment