mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-01 06:35:09 +00:00
Invert condition to avoid empty if block
This commit is contained in:
@@ -65,22 +65,17 @@ public class BatteryPlugin extends Plugin {
|
||||
boolean lowBattery = Intent.ACTION_BATTERY_LOW.equals(batteryIntent.getAction());
|
||||
int thresholdEvent = lowBattery ? THRESHOLD_EVENT_BATTERY_LOW : THRESHOLD_EVENT_NONE;
|
||||
|
||||
if (isCharging == batteryInfo.getBoolean("isCharging")
|
||||
&& currentCharge == batteryInfo.getInt("currentCharge")
|
||||
&& thresholdEvent == batteryInfo.getInt("thresholdEvent")
|
||||
if (isCharging != batteryInfo.getBoolean("isCharging")
|
||||
|| currentCharge != batteryInfo.getInt("currentCharge")
|
||||
|| thresholdEvent != batteryInfo.getInt("thresholdEvent")
|
||||
) {
|
||||
|
||||
//Do not send again if nothing has changed
|
||||
|
||||
} else {
|
||||
|
||||
batteryInfo.set("currentCharge", currentCharge);
|
||||
batteryInfo.set("isCharging", isCharging);
|
||||
batteryInfo.set("thresholdEvent", thresholdEvent);
|
||||
device.sendPacket(batteryInfo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user