|
|
|
|
|
|
|
|
self.displayingDevices = [[NSMutableArray alloc] init]; |
|
|
self.displayingDevices = [[NSMutableArray alloc] init]; |
|
|
self.axis = 1; |
|
|
self.axis = 1; |
|
|
self.distribution = 0; |
|
|
self.distribution = 0; |
|
|
self.spacing = spacing; |
|
|
|
|
|
|
|
|
self.spacing = 0; |
|
|
self.alignment = 0; |
|
|
self.alignment = 0; |
|
|
self.oldCountOfDevices = -100; |
|
|
self.oldCountOfDevices = -100; |
|
|
self.queued = NO; |
|
|
self.queued = NO; |
|
|
|
|
|
|
|
|
self.heightConstraint.active = YES; |
|
|
self.heightConstraint.active = YES; |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
int height = (arg1 * (bannerHeight + spacing)) - spacing; |
|
|
|
|
|
|
|
|
int height; |
|
|
|
|
|
/*if([self.superview.subviews objectAtIndex:([self.superview.subviews count] - 1)] == self) { |
|
|
|
|
|
height = (self.number * (bannerHeight + spacing)); |
|
|
|
|
|
} else {*/ |
|
|
|
|
|
height = (self.number * (bannerHeight + spacing)) - spacing; |
|
|
|
|
|
//} |
|
|
self.heightConstraint.constant = height; |
|
|
self.heightConstraint.constant = height; |
|
|
|
|
|
|
|
|
UIStackView *s = (UIStackView *)(self.superview); |
|
|
UIStackView *s = (UIStackView *)(self.superview); |
|
|
|
|
|
|
|
|
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; |
|
|
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[UIView animateWithDuration:0.3 animations:^{ |
|
|
|
|
|
|
|
|
|
|
|
if(!self.heightConstraint) { |
|
|
|
|
|
|
|
|
|
|
|
self.heightConstraint.active = NO; |
|
|
|
|
|
self.heightConstraint = [self.heightAnchor constraintEqualToConstant:(self.number * (bannerHeight + spacing))]; |
|
|
|
|
|
//set an initial constraint |
|
|
|
|
|
self.heightConstraint.active = YES; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
int height = (self.number * (bannerHeight + spacing)) - spacing; //big brain math |
|
|
|
|
|
//self.heightConstraint.active = NO; //deactivation |
|
|
|
|
|
self.heightConstraint.constant = height; |
|
|
|
|
|
//self.heightConstraint.active = YES; //forcing reactivation |
|
|
|
|
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
//literally does nothing but makes the stack view lay itself out (doesnt adjust frame because translatesAutoreszingMaskIntoConstraints = NO on stack views) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
|
|
|
|
|
|
if(textColor==0) { |
|
|
if(textColor==0) { |
|
|
KAIBatteryCell *cell = (KAIBatteryCell *)view; |
|
|
KAIBatteryCell *cell = (KAIBatteryCell *)view; |
|
|
if(@available(iOS 12.0, *)) { |
|
|
if(@available(iOS 12.0, *)) { |
|
|
|
|
|
|
|
|
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; |
|
|
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[UIView animateWithDuration:0.3 animations:^{ |
|
|
|
|
|
|
|
|
|
|
|
if(!self.heightConstraint) { |
|
|
|
|
|
|
|
|
|
|
|
self.heightConstraint.active = NO; |
|
|
|
|
|
self.heightConstraint = [self.heightAnchor constraintEqualToConstant:(self.number * (bannerHeight + spacing))]; |
|
|
|
|
|
//set an initial constraint |
|
|
|
|
|
self.heightConstraint.active = YES; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
int height = (self.number * (bannerHeight + spacing)) - spacing; //big brain math |
|
|
|
|
|
//self.heightConstraint.active = NO; //deactivation |
|
|
|
|
|
self.heightConstraint.constant = height; |
|
|
|
|
|
//self.heightConstraint.active = YES; //forcing reactivation |
|
|
|
|
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
//literally does nothing but makes the stack view lay itself out (doesnt adjust frame because translatesAutoreszingMaskIntoConstraints = NO on stack views) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}]; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
-(void)refreshForPrefs { |
|
|
-(void)refreshForPrefs { |
|
|
|
|
|
|
|
|
for(BCBatteryDevice *device in devices) { |
|
|
for(BCBatteryDevice *device in devices) { |
|
|
[device resetKaiCellForNewPrefs]; |
|
|
[device resetKaiCellForNewPrefs]; |
|
|
} |
|
|
} |
|
|
self.spacing = spacing; |
|
|
|
|
|
|
|
|
//self.spacing = spacing; |
|
|
[self updateBattery]; |
|
|
[self updateBattery]; |
|
|
} |
|
|
} |
|
|
|
|
|
|