|
|
@@ -1,7 +1,5 @@
|
|
|
package com.github.kr328.clash
|
|
|
|
|
|
-import android.app.NotificationChannel
|
|
|
-import android.app.NotificationManager
|
|
|
import android.app.PendingIntent
|
|
|
import android.app.Service
|
|
|
import android.content.ComponentName
|
|
|
@@ -9,12 +7,13 @@ import android.content.Context
|
|
|
import android.content.Intent
|
|
|
import android.content.ServiceConnection
|
|
|
import android.os.Binder
|
|
|
-import android.os.Build
|
|
|
import android.os.IBinder
|
|
|
import android.os.IInterface
|
|
|
+import androidx.core.app.NotificationChannelCompat
|
|
|
import androidx.core.app.NotificationCompat
|
|
|
import androidx.core.app.NotificationManagerCompat
|
|
|
import com.github.kr328.clash.common.compat.getColorCompat
|
|
|
+import com.github.kr328.clash.common.compat.pendingIntentFlags
|
|
|
import com.github.kr328.clash.common.log.Log
|
|
|
import com.github.kr328.clash.common.util.intent
|
|
|
import com.github.kr328.clash.core.model.LogMessage
|
|
|
@@ -126,16 +125,12 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
|
|
|
}
|
|
|
|
|
|
private fun createNotificationChannel() {
|
|
|
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
|
|
|
- return
|
|
|
-
|
|
|
NotificationManagerCompat.from(this)
|
|
|
.createNotificationChannel(
|
|
|
- NotificationChannel(
|
|
|
+ NotificationChannelCompat.Builder(
|
|
|
CHANNEL_ID,
|
|
|
- getString(R.string.clash_logcat),
|
|
|
- NotificationManager.IMPORTANCE_DEFAULT
|
|
|
- )
|
|
|
+ NotificationManagerCompat.IMPORTANCE_DEFAULT
|
|
|
+ ).setName(getString(R.string.clash_logcat)).build()
|
|
|
)
|
|
|
}
|
|
|
|
|
|
@@ -152,7 +147,7 @@ class LogcatService : Service(), CoroutineScope by CoroutineScope(Dispatchers.De
|
|
|
R.id.nf_logcat_status,
|
|
|
LogcatActivity::class.intent
|
|
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP),
|
|
|
- PendingIntent.FLAG_UPDATE_CURRENT
|
|
|
+ pendingIntentFlags(PendingIntent.FLAG_UPDATE_CURRENT)
|
|
|
)
|
|
|
)
|
|
|
.build()
|