mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-18 05:17:08 +01:00
Unset notification color for Android 12+
This commit is contained in:
parent
fea2d98bd1
commit
1092e1b10a
@ -380,6 +380,9 @@ public class GBApplication extends Application {
|
|||||||
return VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
return VERSION.SDK_INT >= Build.VERSION_CODES.Q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isRunningTwelveOrLater() {
|
||||||
|
return VERSION.SDK_INT >= 31; // Build.VERSION_CODES.S, but our target SDK is lower
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isRunningPieOrLater() {
|
public static boolean isRunningPieOrLater() {
|
||||||
return VERSION.SDK_INT >= Build.VERSION_CODES.P;
|
return VERSION.SDK_INT >= Build.VERSION_CODES.P;
|
||||||
|
@ -151,10 +151,13 @@ public class GB {
|
|||||||
.setContentText(text)
|
.setContentText(text)
|
||||||
.setSmallIcon(connected ? device.getNotificationIconConnected() : device.getNotificationIconDisconnected())
|
.setSmallIcon(connected ? device.getNotificationIconConnected() : device.getNotificationIconDisconnected())
|
||||||
.setContentIntent(getContentIntent(context))
|
.setContentIntent(getContentIntent(context))
|
||||||
.setColor(context.getResources().getColor(R.color.accent))
|
|
||||||
.setShowWhen(false)
|
.setShowWhen(false)
|
||||||
.setOngoing(true);
|
.setOngoing(true);
|
||||||
|
|
||||||
|
if (!GBApplication.isRunningTwelveOrLater()) {
|
||||||
|
builder.setColor(context.getResources().getColor(R.color.accent));
|
||||||
|
}
|
||||||
|
|
||||||
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
||||||
if (connected) {
|
if (connected) {
|
||||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_DISCONNECT);
|
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_DISCONNECT);
|
||||||
@ -187,9 +190,13 @@ public class GB {
|
|||||||
.setContentText(text)
|
.setContentText(text)
|
||||||
.setSmallIcon(R.drawable.ic_notification_disconnected)
|
.setSmallIcon(R.drawable.ic_notification_disconnected)
|
||||||
.setContentIntent(getContentIntent(context))
|
.setContentIntent(getContentIntent(context))
|
||||||
.setColor(context.getResources().getColor(R.color.accent))
|
|
||||||
.setShowWhen(false)
|
.setShowWhen(false)
|
||||||
.setOngoing(true);
|
.setOngoing(true);
|
||||||
|
|
||||||
|
if (!GBApplication.isRunningTwelveOrLater()) {
|
||||||
|
builder.setColor(context.getResources().getColor(R.color.accent));
|
||||||
|
}
|
||||||
|
|
||||||
if (GBApplication.getPrefs().getString("last_device_address", null) != null) {
|
if (GBApplication.getPrefs().getString("last_device_address", null) != null) {
|
||||||
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
||||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_CONNECT);
|
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_CONNECT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user