mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-25 11:26:47 +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;
|
||||
}
|
||||
|
||||
public static boolean isRunningTwelveOrLater() {
|
||||
return VERSION.SDK_INT >= 31; // Build.VERSION_CODES.S, but our target SDK is lower
|
||||
}
|
||||
|
||||
public static boolean isRunningPieOrLater() {
|
||||
return VERSION.SDK_INT >= Build.VERSION_CODES.P;
|
||||
|
@ -151,10 +151,13 @@ public class GB {
|
||||
.setContentText(text)
|
||||
.setSmallIcon(connected ? device.getNotificationIconConnected() : device.getNotificationIconDisconnected())
|
||||
.setContentIntent(getContentIntent(context))
|
||||
.setColor(context.getResources().getColor(R.color.accent))
|
||||
.setShowWhen(false)
|
||||
.setOngoing(true);
|
||||
|
||||
if (!GBApplication.isRunningTwelveOrLater()) {
|
||||
builder.setColor(context.getResources().getColor(R.color.accent));
|
||||
}
|
||||
|
||||
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
||||
if (connected) {
|
||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_DISCONNECT);
|
||||
@ -187,9 +190,13 @@ public class GB {
|
||||
.setContentText(text)
|
||||
.setSmallIcon(R.drawable.ic_notification_disconnected)
|
||||
.setContentIntent(getContentIntent(context))
|
||||
.setColor(context.getResources().getColor(R.color.accent))
|
||||
.setShowWhen(false)
|
||||
.setOngoing(true);
|
||||
|
||||
if (!GBApplication.isRunningTwelveOrLater()) {
|
||||
builder.setColor(context.getResources().getColor(R.color.accent));
|
||||
}
|
||||
|
||||
if (GBApplication.getPrefs().getString("last_device_address", null) != null) {
|
||||
Intent deviceCommunicationServiceIntent = new Intent(context, DeviceCommunicationService.class);
|
||||
deviceCommunicationServiceIntent.setAction(DeviceService.ACTION_CONNECT);
|
||||
|
Loading…
Reference in New Issue
Block a user