|
|
|
|
|
|
|
|
long long lastPercentage; |
|
|
long long lastPercentage; |
|
|
|
|
|
|
|
|
-(void)updateBattery { |
|
|
-(void)updateBattery { |
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
|
|
|
|
|
//dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
//NSLog(@"kai: battery platter called to update"); |
|
|
//NSLog(@"kai: battery platter called to update"); |
|
|
if(!self.isUpdating) { |
|
|
if(!self.isUpdating) { |
|
|
self.isUpdating = YES; |
|
|
self.isUpdating = YES; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KAIBatteryCell *cell = [KAIBatteryCell cellForDeviceIfExists:device frameToCreateNew:CGRectMake(0, y, self.frame.size.width, bannerHeight)]; |
|
|
KAIBatteryCell *cell = [KAIBatteryCell cellForDeviceIfExists:device frameToCreateNew:CGRectMake(0, y, self.frame.size.width, bannerHeight)]; |
|
|
|
|
|
|
|
|
|
|
|
if(cell) { |
|
|
|
|
|
cell.device = device; |
|
|
|
|
|
cell.frame = cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); //bro im like creating my own stack view |
|
|
|
|
|
[cell updateInfo]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(shouldAdd && [deviceName length]!=0) { |
|
|
if(shouldAdd && [deviceName length]!=0) { |
|
|
if(![self.subviews containsObject:cell]) { |
|
|
if(![self.subviews containsObject:cell]) { |
|
|
cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); |
|
|
cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); |
|
|
|
|
|
|
|
|
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; |
|
|
//[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; |
|
|
self.isUpdating = NO; |
|
|
self.isUpdating = NO; |
|
|
self.number = [self.subviews count]; |
|
|
self.number = [self.subviews count]; |
|
|
|
|
|
[(CSAdjunctListView *)self.superview KaiUpdate]; |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
//}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
-(void)removeAllAndRefresh { |
|
|
-(void)removeAllAndRefresh { |