mirror of
https://github.com/Burrit0z/kai
synced 2025-07-04 00:26:48 +00:00
bro why am i trash
This commit is contained in:
@ -142,6 +142,28 @@ NSMutableArray *deviceInstances = [[NSMutableArray alloc] init];
|
|||||||
|
|
||||||
[self.glyphView setImage:[self.device glyph]];
|
[self.glyphView setImage:[self.device glyph]];
|
||||||
|
|
||||||
|
if(!self.height) {
|
||||||
|
|
||||||
|
self.height.active = NO;
|
||||||
|
self.height = [self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)];
|
||||||
|
self.height.active = YES;
|
||||||
|
|
||||||
|
} //else {
|
||||||
|
//int height = (bannerHeight + spacing);
|
||||||
|
//self.height.constant = height;
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(!self.width) {
|
||||||
|
|
||||||
|
self.width.active = NO;
|
||||||
|
self.width = [self.widthAnchor constraintEqualToConstant:(self.frame.size.width)];
|
||||||
|
self.width.active = YES;
|
||||||
|
|
||||||
|
} //else {
|
||||||
|
//int width = self.frame.size.width;
|
||||||
|
//self.width.constant = width;
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+(instancetype)cellForDeviceIfExists:(BCBatteryDevice *)device frameToCreateNew:(CGRect)arg2 {
|
+(instancetype)cellForDeviceIfExists:(BCBatteryDevice *)device frameToCreateNew:(CGRect)arg2 {
|
||||||
|
@ -38,11 +38,6 @@ long long lastPercentage;
|
|||||||
|
|
||||||
NSLog(@"kai: devices are %@", devices);
|
NSLog(@"kai: devices are %@", devices);
|
||||||
|
|
||||||
for(KAIBatteryCell *cell in self.subviews) {
|
|
||||||
//BCBatteryDevice *device = cell.device;
|
|
||||||
[cell updateInfo];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (BCBatteryDevice *device in devices) {
|
for (BCBatteryDevice *device in devices) {
|
||||||
KAIBatteryCell *cell = [device kaiCellForDevice];
|
KAIBatteryCell *cell = [device kaiCellForDevice];
|
||||||
|
|
||||||
@ -56,41 +51,25 @@ long long lastPercentage;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(![self.subviews containsObject:cell] && shouldAdd && [devices containsObject:device]) {
|
if(![self.subviews containsObject:cell] && shouldAdd && [devices containsObject:device]) {
|
||||||
[cell setFrame:CGRectMake(0,0,self.frame.size.width, bannerHeight + spacing)];
|
//[cell setFrame:CGRectMake(0,0,self.frame.size.width, bannerHeight + spacing)];
|
||||||
|
[self addSubview:cell];
|
||||||
[self addArrangedSubview:cell];
|
[self addArrangedSubview:cell];
|
||||||
} else {
|
} else if([self.subviews containsObject:cell] && !shouldAdd){
|
||||||
|
[cell removeFromSuperview];
|
||||||
[self removeArrangedSubview:cell];
|
[self removeArrangedSubview:cell];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cell.height) {
|
|
||||||
|
|
||||||
cell.height.active = NO;
|
|
||||||
cell.height = [cell.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)];
|
|
||||||
cell.height.active = YES;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
int height = (bannerHeight + spacing);
|
|
||||||
cell.height.constant = height;
|
|
||||||
|
|
||||||
UIStackView *s = self;
|
|
||||||
s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!cell.width) {
|
|
||||||
|
|
||||||
cell.width.active = NO;
|
|
||||||
cell.width = [cell.widthAnchor constraintEqualToConstant:(self.frame.size.width)];
|
|
||||||
cell.width.active = YES;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
int width = self.frame.size.width;
|
|
||||||
cell.width.constant = width;
|
|
||||||
|
|
||||||
UIStackView *s = self;
|
|
||||||
s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(KAIBatteryCell *cell in self.subviews) {
|
||||||
|
//BCBatteryDevice *device = cell.device;
|
||||||
|
[cell updateInfo];
|
||||||
|
if(![devices containsObject:cell.device]) {
|
||||||
|
[cell removeFromSuperview];
|
||||||
|
[self removeArrangedSubview:cell];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self.number = [self.subviews count];
|
self.number = [self.subviews count];
|
||||||
}
|
}
|
||||||
self.isUpdating = NO;
|
self.isUpdating = NO;
|
||||||
|
6
Kai.xm
6
Kai.xm
@ -49,11 +49,11 @@
|
|||||||
%new
|
%new
|
||||||
-(void)KaiUpdate {
|
-(void)KaiUpdate {
|
||||||
KAIBatteryStack *battery = [KAIBatteryStack sharedInstance];
|
KAIBatteryStack *battery = [KAIBatteryStack sharedInstance];
|
||||||
battery.number = [battery.subviews count];
|
//battery.number = [battery.subviews count];
|
||||||
|
|
||||||
[UIView animateWithDuration:0.3 animations:^{
|
[UIView animateWithDuration:0.3 animations:^{
|
||||||
|
|
||||||
if(!battery.heightConstraint) {
|
/*if(!battery.heightConstraint) {
|
||||||
|
|
||||||
battery.heightConstraint.active = NO;
|
battery.heightConstraint.active = NO;
|
||||||
battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:85];
|
battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:85];
|
||||||
@ -69,7 +69,7 @@
|
|||||||
UIStackView *s = [self stackView];
|
UIStackView *s = [self stackView];
|
||||||
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));
|
||||||
//literally does nothing but makes the stack view lay itself out (doesnt adjust frame because translatesAutoreszingMaskIntoConstraints = NO on stack views)
|
//literally does nothing but makes the stack view lay itself out (doesnt adjust frame because translatesAutoreszingMaskIntoConstraints = NO on stack views)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user