]> git.cameronkatri.com Git - tweaks.git/blob - BatteryPercent/Tweak.x
47241ef2fa032c0d322142a5de1bf90356e17b05
[tweaks.git] / BatteryPercent / Tweak.x
1 @interface _UIBatteryView : UIView
2 @property (assign,nonatomic) double bodyColorAlpha;
3 @property (assign,nonatomic) double pinColorAlpha;
4 -(void)setBodyColor:(UIColor *)arg1;
5 -(void)setPinColor:(UIColor *)arg1;
6 @end
7
8 %hook _UIBatteryView
9
10 -(void)setShowsPercentage:(BOOL)enabled
11 {
12 %orig(true);
13 }
14
15 -(void)setShowsInlineChargingIndicator:(BOOL)enabled
16 {
17 %orig(false);
18 }
19
20 -(void)setChargingState:(NSInteger)state
21 {
22 %orig;
23 if (state) {
24 [self setBodyColor:[UIColor systemGreenColor]];
25 [self setPinColor:[UIColor systemGreenColor]];
26 } else {
27 [self setBodyColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:self.bodyColorAlpha]];
28 [self setPinColor:[UIColor colorWithRed:1 green:1 blue:1 alpha:self.pinColorAlpha]];
29 }
30 }
31
32 %end
33
34 // vim: filetype=logos