mirror of
https://github.com/Burrit0z/kai
synced 2025-06-30 21:16:48 +00:00
new stuff
This commit is contained in:
@ -32,19 +32,12 @@ long long lastPercentage;
|
|||||||
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
|
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
|
||||||
NSArray *devices = MSHookIvar<NSArray *>(bcb, "_sortedDevices");
|
NSArray *devices = MSHookIvar<NSArray *>(bcb, "_sortedDevices");
|
||||||
|
|
||||||
/*if(self.oldCountOfDevices == -100) {
|
if(self.oldCountOfDevices == -100) {
|
||||||
self.oldCountOfDevices = [devices count] + 1;
|
self.oldCountOfDevices = [devices count] + 1;
|
||||||
}
|
}
|
||||||
self.oldCountOfDevices = [devices count];
|
|
||||||
|
|
||||||
for (BCBatteryDevice *device in devices) {
|
if(!self.isUpdating && self.oldCountOfDevices != 0 && ([devices count] + 1 == self.oldCountOfDevices || [devices count] - 1 == self.oldCountOfDevices || [devices count] == self.oldCountOfDevices)) {
|
||||||
KAIBatteryCell *cell = [device kaiCellForDevice];
|
//if(!self.isUpdating) {
|
||||||
|
|
||||||
[cell updateInfo];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!self.isUpdating && self.oldCountOfDevices != 0 && ([devices count] + 1 == self.oldCountOfDevices || [devices count] - 1 == self.oldCountOfDevices || [devices count] == self.oldCountOfDevices)) {*/
|
|
||||||
if(!self.isUpdating) {
|
|
||||||
|
|
||||||
self.isUpdating = YES;
|
self.isUpdating = YES;
|
||||||
|
|
||||||
@ -95,29 +88,27 @@ long long lastPercentage;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//queueTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(dispatchQueue) userInfo:nil repeats:NO];
|
queueTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(dispatchQueue) userInfo:nil repeats:NO];
|
||||||
self.isUpdating = NO;
|
self.isUpdating = NO;
|
||||||
|
|
||||||
} else if(self.isUpdating) {
|
} else if(self.isUpdating) {
|
||||||
self.queued = YES;
|
self.queued = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.oldCountOfDevices = [devices count];
|
||||||
|
|
||||||
self.number = [self.subviews count];
|
self.number = [self.subviews count];
|
||||||
|
|
||||||
[UIView animateWithDuration:0.3 animations:^{
|
[UIView animateWithDuration:0.3 animations:^{
|
||||||
|
|
||||||
if(!self.heightConstraint) {
|
if(!self.heightConstraint) {
|
||||||
|
|
||||||
self.heightConstraint.active = NO;
|
|
||||||
self.heightConstraint = [self.heightAnchor constraintEqualToConstant:(self.number * (bannerHeight + spacing))];
|
self.heightConstraint = [self.heightAnchor constraintEqualToConstant:(self.number * (bannerHeight + spacing))];
|
||||||
//set an initial constraint
|
|
||||||
self.heightConstraint.active = YES;
|
self.heightConstraint.active = YES;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int height = (self.number * (bannerHeight + spacing)); //big brain math
|
int height = (self.number * (bannerHeight + spacing));
|
||||||
//self.heightConstraint.active = NO; //deactivation
|
|
||||||
self.heightConstraint.constant = height;
|
self.heightConstraint.constant = height;
|
||||||
//self.heightConstraint.active = YES; //forcing reactivation
|
|
||||||
|
|
||||||
UIStackView *s = (UIStackView *)(self.superview);
|
UIStackView *s = (UIStackView *)(self.superview);
|
||||||
s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1));
|
s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1));
|
||||||
@ -227,6 +218,9 @@ long long lastPercentage;
|
|||||||
self.isUpdating = NO;
|
self.isUpdating = NO;
|
||||||
if(self.queued) {
|
if(self.queued) {
|
||||||
[self updateBattery];
|
[self updateBattery];
|
||||||
|
if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) {
|
||||||
|
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame];
|
||||||
|
}
|
||||||
self.queued = NO;
|
self.queued = NO;
|
||||||
}
|
}
|
||||||
[queueTimer invalidate];
|
[queueTimer invalidate];
|
||||||
|
5
Kai.xm
5
Kai.xm
@ -17,6 +17,10 @@
|
|||||||
[[self stackView] insertArrangedSubview:[KAIBatteryStack sharedInstance] atIndex:lastSlot];
|
[[self stackView] insertArrangedSubview:[KAIBatteryStack sharedInstance] atIndex:lastSlot];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if([KAISelf.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) {
|
||||||
|
[(NCNotificationListView *)(KAISelf.superview) fixComplicationsViewFrame];
|
||||||
|
}
|
||||||
|
|
||||||
%orig;
|
%orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,6 +59,7 @@
|
|||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
|
||||||
[[KAIBatteryStack sharedInstance] updateBattery];
|
[[KAIBatteryStack sharedInstance] updateBattery];
|
||||||
|
[KAISelf.superview performSelector:@selector(fixComplicationsViewFrame) withObject:KAISelf.superview afterDelay:0.2];
|
||||||
|
|
||||||
isUpdating = NO;
|
isUpdating = NO;
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Package: com.burritoz.kai
|
Package: com.burritoz.kai
|
||||||
Name: Kai
|
Name: Kai
|
||||||
Version: 0.2.6~alpha3
|
Version: 0.2.6~alpha4
|
||||||
Architecture: iphoneos-arm
|
Architecture: iphoneos-arm
|
||||||
Description: Show charging banners on your lock screen!
|
Description: Show charging banners on your lock screen!
|
||||||
Maintainer: burrit0z
|
Maintainer: burrit0z
|
||||||
|
Reference in New Issue
Block a user