mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-03-16 03:02:47 +00:00
show airpods name in notification
This commit is contained in:
@@ -148,7 +148,7 @@ class AirPodsService: Service() {
|
|||||||
notificationManager.createNotificationChannel(notificationChannel)
|
notificationManager.createNotificationChannel(notificationChannel)
|
||||||
val notification = NotificationCompat.Builder(this, "background_service_status")
|
val notification = NotificationCompat.Builder(this, "background_service_status")
|
||||||
.setSmallIcon(R.drawable.airpods)
|
.setSmallIcon(R.drawable.airpods)
|
||||||
.setContentTitle("AirPods are not connected")
|
.setContentTitle("AirPods not connected")
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
@@ -261,24 +261,24 @@ class AirPodsService: Service() {
|
|||||||
|
|
||||||
updatedNotification = NotificationCompat.Builder(this, "background_service_status")
|
updatedNotification = NotificationCompat.Builder(this, "background_service_status")
|
||||||
.setSmallIcon(R.drawable.airpods)
|
.setSmallIcon(R.drawable.airpods)
|
||||||
.setContentTitle("""AirPods –${batteryList?.find { it.component == BatteryComponent.LEFT }?.let {
|
.setContentTitle("""$airpodsName –${batteryList?.find { it.component == BatteryComponent.LEFT }?.let {
|
||||||
// if (it.status != BatteryStatus.DISCONNECTED) {
|
if (it.status != BatteryStatus.DISCONNECTED) {
|
||||||
" L:${if (it.status == BatteryStatus.CHARGING) "⚡" else ""} ${it.level}%"
|
" L:${if (it.status == BatteryStatus.CHARGING) "⚡" else ""} ${it.level}%"
|
||||||
// } else {
|
} else {
|
||||||
// ""
|
""
|
||||||
// }
|
}
|
||||||
} ?: ""}${batteryList?.find { it.component == BatteryComponent.RIGHT }?.let {
|
} ?: ""}${batteryList?.find { it.component == BatteryComponent.RIGHT }?.let {
|
||||||
// if (it.status != BatteryStatus.DISCONNECTED) {
|
if (it.status != BatteryStatus.DISCONNECTED) {
|
||||||
" R:${if (it.status == BatteryStatus.CHARGING) "⚡" else ""} ${it.level}%"
|
" R:${if (it.status == BatteryStatus.CHARGING) "⚡" else ""} ${it.level}%"
|
||||||
// } else {
|
} else {
|
||||||
// ""
|
""
|
||||||
// }
|
}
|
||||||
} ?: ""}${batteryList?.find { it.component == BatteryComponent.CASE }?.let {
|
} ?: ""}${batteryList?.find { it.component == BatteryComponent.CASE }?.let {
|
||||||
// if (it.status != BatteryStatus.DISCONNECTED) {
|
if (it.status != BatteryStatus.DISCONNECTED) {
|
||||||
" C:${if (it.status == BatteryStatus.CHARGING) "⚡" else ""} ${it.level}%"
|
" C:${if (it.status == BatteryStatus.CHARGING) "⚡" else ""} ${it.level}%"
|
||||||
// } else {
|
} else {
|
||||||
// ""
|
""
|
||||||
// }
|
}
|
||||||
} ?: ""}""")
|
} ?: ""}""")
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||||
@@ -288,7 +288,7 @@ class AirPodsService: Service() {
|
|||||||
} else {
|
} else {
|
||||||
updatedNotification = NotificationCompat.Builder(this, "background_service_status")
|
updatedNotification = NotificationCompat.Builder(this, "background_service_status")
|
||||||
.setSmallIcon(R.drawable.airpods)
|
.setSmallIcon(R.drawable.airpods)
|
||||||
.setContentTitle("AirPods are not connected")
|
.setContentTitle("AirPods not connected")
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user