]> git.cameronkatri.com Git - tweaks.git/commitdiff
BatteryPercent: Make battery outline green when charging
authorCameron Katri <me@cameronkatri.com>
Mon, 9 Aug 2021 18:34:37 +0000 (14:34 -0400)
committerCameron Katri <me@cameronkatri.com>
Mon, 9 Aug 2021 18:34:37 +0000 (14:34 -0400)
BatteryPercent/Tweak.x
BatteryPercent/control

index b1f7c74fb5bb94201849a93ff1eb890981dee5b2..47241ef2fa032c0d322142a5de1bf90356e17b05 100644 (file)
@@ -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
        %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
index 2c727fd1595a37e4e2da26fb8e415733f00e7293..58f379a466890edc829aad1383803e7b6a78b28c 100644 (file)
@@ -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 <me@cameronkatri.com>