From 11c6bc9dee9aec76c4ec68c14dbad359244d3fd5 Mon Sep 17 00:00:00 2001 From: Tibor Kaputa Date: Wed, 22 Sep 2021 23:36:04 +0200 Subject: [PATCH] removing some magic numbers --- .../dialer/helpers/CallNotificationManager.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/CallNotificationManager.kt b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/CallNotificationManager.kt index b6fda71c..2fd1b9c9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/CallNotificationManager.kt +++ b/app/src/main/kotlin/com/simplemobiletools/dialer/helpers/CallNotificationManager.kt @@ -20,6 +20,8 @@ import com.simplemobiletools.dialer.receivers.CallActionReceiver class CallNotificationManager(private val context: Context) { private val CALL_NOTIFICATION_ID = 1 + private val ACCEPT_CALL_CODE = 0 + private val DECLINE_CALL_CODE = 1 private val notificationManager = context.notificationManager private val callContactAvatarHelper = CallContactAvatarHelper(context) @@ -44,11 +46,11 @@ class CallNotificationManager(private val context: Context) { val acceptCallIntent = Intent(context, CallActionReceiver::class.java) acceptCallIntent.action = ACCEPT_CALL - val acceptPendingIntent = PendingIntent.getBroadcast(context, 0, acceptCallIntent, PendingIntent.FLAG_CANCEL_CURRENT) + val acceptPendingIntent = PendingIntent.getBroadcast(context, ACCEPT_CALL_CODE, acceptCallIntent, PendingIntent.FLAG_CANCEL_CURRENT) val declineCallIntent = Intent(context, CallActionReceiver::class.java) declineCallIntent.action = DECLINE_CALL - val declinePendingIntent = PendingIntent.getBroadcast(context, 1, declineCallIntent, PendingIntent.FLAG_CANCEL_CURRENT) + val declinePendingIntent = PendingIntent.getBroadcast(context, DECLINE_CALL_CODE, declineCallIntent, PendingIntent.FLAG_CANCEL_CURRENT) val callerName = if (callContact != null && callContact.name.isNotEmpty()) callContact.name else context.getString(R.string.unknown_caller) val contentTextId = when (callState) {