1
0
mirror of https://github.com/Burrit0z/kai synced 2025-07-03 13:16:46 +00:00

so close to beta 1

This commit is contained in:
Burrit0z
2020-05-24 19:06:27 -04:00
parent e937a735c6
commit 00de4d98ba
6 changed files with 33 additions and 55 deletions

24
Kai.xm
View File

@ -50,6 +50,21 @@
-(void)KaiUpdate {
KAIBatteryStack *battery = [KAIBatteryStack sharedInstance];
//battery.number = [battery.subviews count];
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
NSArray *devices = MSHookIvar<NSArray *>(bcb, "_sortedDevices");
for(KAIBatteryCell *cell in battery.subviews) {
//BCBatteryDevice *device = cell.device;
[cell updateInfo];
if(![devices containsObject:cell.device]) {
[UIView animateWithDuration:0.3 animations:^{
cell.alpha = 0;
} completion:^(BOOL finished) {
[cell removeFromSuperview];
[battery removeArrangedSubview:cell];
cell.alpha = 1;
}];
}
}
[UIView animateWithDuration:0.3 animations:^{
@ -130,6 +145,15 @@
return self.kaiCell;
}
%new
-(void)resetKaiCellForNewPrefs {
self.kaiCell = [[KAIBatteryCell alloc] initWithFrame:CGRectMake(0,0,[KAIBatteryStack sharedInstance].frame.size.width,0) device:self];
((KAIBatteryCell *)self.kaiCell).translatesAutoresizingMaskIntoConstraints = NO;
[((KAIBatteryCell *)self.kaiCell).heightAnchor constraintEqualToConstant:bannerHeight].active = YES;
[(KAIBatteryCell *)self.kaiCell updateInfo];
}
%end
%hook KAICSTarget //Again, not a class