mirror of https://github.com/tasks/tasks
Convert NotificationClearedReceiver to Kotlin
parent
65d57c7649
commit
207acb6a47
@ -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);
|
||||
}
|
||||
}
|
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue