From 207acb6a47882cae44292b1b2295dc9f1920434f Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 27 Jul 2020 17:36:09 -0500 Subject: [PATCH] Convert NotificationClearedReceiver to Kotlin --- .../NotificationClearedReceiver.java | 23 ------------------- .../NotificationClearedReceiver.kt | 20 ++++++++++++++++ 2 files changed, 20 insertions(+), 23 deletions(-) delete mode 100644 app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.java create mode 100644 app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.kt diff --git a/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.java b/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.java deleted file mode 100644 index 2154d4fcc..000000000 --- a/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.tasks.notifications; - -import android.content.Context; -import android.content.Intent; -import dagger.hilt.android.AndroidEntryPoint; -import javax.inject.Inject; -import org.tasks.injection.InjectingBroadcastReceiver; -import timber.log.Timber; - -@AndroidEntryPoint -public class NotificationClearedReceiver extends InjectingBroadcastReceiver { - - @Inject NotificationManager notificationManager; - - @Override - public void onReceive(Context context, Intent intent) { - super.onReceive(context, intent); - - long notificationId = intent.getLongExtra(NotificationManager.EXTRA_NOTIFICATION_ID, -1L); - Timber.d("cleared %s", notificationId); - notificationManager.cancel(notificationId); - } -} diff --git a/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.kt b/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.kt new file mode 100644 index 000000000..afa9fdedd --- /dev/null +++ b/app/src/main/java/org/tasks/notifications/NotificationClearedReceiver.kt @@ -0,0 +1,20 @@ +package org.tasks.notifications + +import android.content.Context +import android.content.Intent +import dagger.hilt.android.AndroidEntryPoint +import org.tasks.injection.InjectingBroadcastReceiver +import timber.log.Timber +import javax.inject.Inject + +@AndroidEntryPoint +class NotificationClearedReceiver : InjectingBroadcastReceiver() { + @Inject lateinit var notificationManager: NotificationManager + + override fun onReceive(context: Context, intent: Intent) { + super.onReceive(context, intent) + val notificationId = intent.getLongExtra(NotificationManager.EXTRA_NOTIFICATION_ID, -1L) + Timber.d("cleared $notificationId") + notificationManager.cancel(notificationId) + } +} \ No newline at end of file