From af6c94ec8564d0c7f9b12d4d5738a8a4113c0006 Mon Sep 17 00:00:00 2001 From: Cameron Katri Date: Mon, 9 Aug 2021 14:34:37 -0400 Subject: BatteryPercent: Make battery outline green when charging --- BatteryPercent/Tweak.x | 19 +++++++++++++++++++ BatteryPercent/control | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/BatteryPercent/Tweak.x b/BatteryPercent/Tweak.x index b1f7c74..47241ef 100644 --- a/BatteryPercent/Tweak.x +++ b/BatteryPercent/Tweak.x @@ -1,3 +1,10 @@ +@interface _UIBatteryView : UIView +@property (assign,nonatomic) double bodyColorAlpha; +@property (assign,nonatomic) double pinColorAlpha; +-(void)setBodyColor:(UIColor *)arg1; +-(void)setPinColor:(UIColor *)arg1; +@end + %hook _UIBatteryView -(void)setShowsPercentage:(BOOL)enabled @@ -10,6 +17,18 @@ %orig(false); } +-(void)setChargingState:(NSInteger)state +{ + %orig; + if (state) { + [self setBodyColor:[UIColor systemGreenColor]]; + [self setPinColor:[UIColor systemGreenColor]]; + } else { + [self setBodyColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:self.bodyColorAlpha]]; + [self setPinColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:self.pinColorAlpha]]; + } +} + %end // vim: filetype=logos diff --git a/BatteryPercent/control b/BatteryPercent/control index 2c727fd..58f379a 100644 --- a/BatteryPercent/control +++ b/BatteryPercent/control @@ -1,6 +1,6 @@ Package: com.cameronkatri.batterypercent Name: BatteryPercent -Version: 0.0.1 +Version: 0.0.2 Architecture: iphoneos-arm Description: An awesome MobileSubstrate tweak! Maintainer: Cameron Katri -- cgit v1.2.3-56-ge451