mirror of
				https://github.com/Burrit0z/kai
				synced 2025-10-31 16:26:19 +00:00 
			
		
		
		
	bro not trash i swear
This commit is contained in:
		| @ -11,6 +11,7 @@ KAIBattery *instance; | |||||||
|     if (self) { |     if (self) { | ||||||
|         self.displayingDevices = [[NSMutableArray alloc] init]; |         self.displayingDevices = [[NSMutableArray alloc] init]; | ||||||
|         [self updateBattery]; |         [self updateBattery]; | ||||||
|  |         self.clipsToBounds = YES; | ||||||
|         self.userInteractionEnabled = NO; |         self.userInteractionEnabled = NO; | ||||||
|     } |     } | ||||||
|     return self; |     return self; | ||||||
| @ -32,13 +33,17 @@ long long lastPercentage; | |||||||
|             if([devices count]!=0) { |             if([devices count]!=0) { | ||||||
|                 //NSLog(@"kai: info is good, will proceed"); |                 //NSLog(@"kai: info is good, will proceed"); | ||||||
|  |  | ||||||
|             __block float ytwo = 0; |             float ytwo = 0; | ||||||
|  |  | ||||||
|             for(KAIBatteryCell *cell in self.subviews) { |             for(KAIBatteryCell *cell in self.subviews) { | ||||||
|                 if([cell respondsToSelector:@selector(updateInfo)] && ![devices containsObject:cell.device]) { //to confirm is a cell and battery device does not exist |                 if([cell respondsToSelector:@selector(updateInfo)] && ![devices containsObject:cell.device]) { //to confirm is a cell and battery device does not exist | ||||||
|                     dispatch_async(dispatch_get_main_queue(), ^{ |                     //dispatch_async(dispatch_get_main_queue(), ^{ | ||||||
|                         [cell removeFromSuperview]; |                         [UIView animateWithDuration:0.2 animations:^{ | ||||||
|                     }); |                             cell.alpha = 0; | ||||||
|  |                         } completion:^(BOOL finished){ | ||||||
|  |                             [cell removeFromSuperview]; | ||||||
|  |                         }]; | ||||||
|  |                     //}); | ||||||
|                 } else if([cell respondsToSelector:@selector(updateInfo)]) { |                 } else if([cell respondsToSelector:@selector(updateInfo)]) { | ||||||
|                         cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); |                         cell.frame = CGRectMake(0, y, self.frame.size.width, bannerHeight); | ||||||
|                         [cell updateInfo]; |                         [cell updateInfo]; | ||||||
| @ -75,16 +80,22 @@ long long lastPercentage; | |||||||
|                 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); | ||||||
|                         dispatch_async(dispatch_get_main_queue(), ^{ |                         cell.alpha = 0; | ||||||
|                             [self addSubview:cell]; |                         [self addSubview:cell]; | ||||||
|                         }); |                         [UIView animateWithDuration:0.3 animations:^{ | ||||||
|  |                             cell.alpha = 1; | ||||||
|  |                         }]; | ||||||
|                     } |                     } | ||||||
|                     y+=bannerHeight + spacing; |                     y+=bannerHeight + spacing; | ||||||
|  |  | ||||||
|                 } else if(!shouldAdd) { |                 } else if(!shouldAdd) { | ||||||
|                     dispatch_async(dispatch_get_main_queue(), ^{ |                     //dispatch_async(dispatch_get_main_queue(), ^{ | ||||||
|                         [cell removeFromSuperview]; |                         [UIView animateWithDuration:0.2 animations:^{ | ||||||
|                     }); |                             cell.alpha = 0; | ||||||
|  |                         } completion:^(BOOL finished){ | ||||||
|  |                             [cell removeFromSuperview]; | ||||||
|  |                         }]; | ||||||
|  |                     //}); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             //[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; |             //[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES; | ||||||
| @ -93,7 +104,8 @@ long long lastPercentage; | |||||||
|             } |             } | ||||||
|             self.isUpdating = NO; |             self.isUpdating = NO; | ||||||
|             //NSLog(@"kai: finished update"); |             //NSLog(@"kai: finished update"); | ||||||
|             [(CSAdjunctListView *)self.superview.superview KaiUpdate]; |             //[(CSAdjunctListView *)self.superview.superview KaiUpdate]; | ||||||
|  |             [(CSAdjunctListView *)self.superview.superview performSelector:@selector(KaiUpdate) withObject:(CSAdjunctListView *)self.superview.superview afterDelay:0.2]; | ||||||
|         } |         } | ||||||
|     }); |     }); | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										1
									
								
								Kai.xm
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								Kai.xm
									
									
									
									
									
								
							| @ -48,6 +48,7 @@ | |||||||
| %new | %new | ||||||
| -(void)KaiUpdate { | -(void)KaiUpdate { | ||||||
| 	KAIBattery *battery = [KAIBattery sharedInstance]; | 	KAIBattery *battery = [KAIBattery sharedInstance]; | ||||||
|  | 	battery.number = [battery.subviews count]; | ||||||
|  |  | ||||||
| 	[UIView animateWithDuration:0.3 animations:^{ | 	[UIView animateWithDuration:0.3 animations:^{ | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| Package: com.burritoz.kai | Package: com.burritoz.kai | ||||||
| Name: Kai | Name: Kai | ||||||
| Version: 0.1.5~alpha | Version: 0.2.0~alpha | ||||||
| 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