mirror of
				https://github.com/Burrit0z/kai
				synced 2025-11-04 05:06:19 +00:00 
			
		
		
		
	push before break
This commit is contained in:
		@ -24,6 +24,7 @@
 | 
				
			|||||||
@interface KAIBattery : UIView
 | 
					@interface KAIBattery : UIView
 | 
				
			||||||
@property (nonatomic, strong) NSArray *devices;
 | 
					@property (nonatomic, strong) NSArray *devices;
 | 
				
			||||||
@property (nonatomic, assign) NSInteger number;
 | 
					@property (nonatomic, assign) NSInteger number;
 | 
				
			||||||
 | 
					@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
 | 
				
			||||||
@property (nonatomic, assign) BOOL isUpdating;
 | 
					@property (nonatomic, assign) BOOL isUpdating;
 | 
				
			||||||
+(KAIBattery *)sharedInstance;
 | 
					+(KAIBattery *)sharedInstance;
 | 
				
			||||||
-(void)darkLightMode;
 | 
					-(void)darkLightMode;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										54
									
								
								Kai.xm
									
									
									
									
									
								
							
							
						
						
									
										54
									
								
								Kai.xm
									
									
									
									
									
								
							@ -25,9 +25,12 @@
 | 
				
			|||||||
@interface _CSSingleBatteryChargingView : UIView
 | 
					@interface _CSSingleBatteryChargingView : UIView
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@interface NCNotificationListView : UIView
 | 
					@interface NSLayoutConstraint (Kai)
 | 
				
			||||||
 | 
					+(id)constraintWithAnchor:(id)arg1 relatedBy:(long long)arg2 toAnchor:(id)arg3 multiplier:(double)arg4 constant:(double)arg5 ;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//NSLayoutConstraint *globalC;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CGRect original = CGRectMake(0,0,0,0);
 | 
					CGRect original = CGRectMake(0,0,0,0);
 | 
				
			||||||
CGRect originalBattery;
 | 
					CGRect originalBattery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -48,7 +51,7 @@ CGRect originalBattery;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if(!self.hasKai) {
 | 
						if(!self.hasKai) {
 | 
				
			||||||
		KAIBattery *battery = [[KAIBattery alloc] init];
 | 
							KAIBattery *battery = [[KAIBattery alloc] init];
 | 
				
			||||||
		battery.translatesAutoresizingMaskIntoConstraints = NO;
 | 
							//battery.translatesAutoresizingMaskIntoConstraints = NO;
 | 
				
			||||||
        //[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
 | 
					        //[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
 | 
				
			||||||
		//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
 | 
							//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
 | 
				
			||||||
		//[battery.heightAnchor constraintEqualToConstant:100].active = YES;
 | 
							//[battery.heightAnchor constraintEqualToConstant:100].active = YES;
 | 
				
			||||||
@ -80,25 +83,50 @@ CGRect originalBattery;
 | 
				
			|||||||
	[[KAIBattery sharedInstance] darkLightMode];
 | 
						[[KAIBattery sharedInstance] darkLightMode];
 | 
				
			||||||
	KAIBattery *battery = [KAIBattery sharedInstance];
 | 
						KAIBattery *battery = [KAIBattery sharedInstance];
 | 
				
			||||||
	//battery.translatesAutoresizingMaskIntoConstraints = YES;
 | 
						//battery.translatesAutoresizingMaskIntoConstraints = YES;
 | 
				
			||||||
	/*battery.frame = CGRectMake(
 | 
					 | 
				
			||||||
		originalBattery.origin.x,
 | 
					 | 
				
			||||||
		originalBattery.origin.y,
 | 
					 | 
				
			||||||
		originalBattery.size.width,
 | 
					 | 
				
			||||||
		(battery.number * 85)
 | 
					 | 
				
			||||||
	);*/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	battery.translatesAutoresizingMaskIntoConstraints = NO;
 | 
						battery.translatesAutoresizingMaskIntoConstraints = NO;
 | 
				
			||||||
        //[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
 | 
					        //[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	[[self stackView] removeArrangedSubview:battery];
 | 
						[UIView animateWithDuration:0.3 animations:^{
 | 
				
			||||||
		int height = (battery.number * 85);
 | 
							/*if (battery.heightConstraint == nil) {
 | 
				
			||||||
		[battery.heightAnchor constraintEqualToConstant:height].active = YES;
 | 
								battery.heightConstraint = [NSLayoutConstraint constraintWithAnchor:battery.heightAnchor relatedBy:NSLayoutRelationEqual toAnchor:battery.heightAnchor multiplier:0 constant:(battery.number * 85)];
 | 
				
			||||||
	[[self stackView] addArrangedSubview:battery];
 | 
								battery.heightConstraint.active = YES;
 | 
				
			||||||
 | 
								[self addConstraint:battery.heightConstraint];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (battery.heightConstraint.active == YES) {
 | 
				
			||||||
 | 
								battery.heightConstraint.active = NO;
 | 
				
			||||||
 | 
								[self removeConstraint:battery.heightConstraint];
 | 
				
			||||||
 | 
								battery.heightConstraint = [NSLayoutConstraint constraintWithAnchor:battery.heightAnchor relatedBy:NSLayoutRelationEqual toAnchor:battery.heightAnchor multiplier:0 constant:(battery.number * 85)];
 | 
				
			||||||
 | 
								[self addConstraint:battery.heightConstraint];	
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (globalC == nil) {
 | 
				
			||||||
 | 
								globalC = [NSLayoutConstraint constraintWithAnchor:battery.heightAnchor relatedBy:NSLayoutRelationEqual toAnchor:battery.heightAnchor multiplier:0 constant:(battery.number * 85)];
 | 
				
			||||||
 | 
								globalC.active = YES;
 | 
				
			||||||
 | 
								[[self stackView] addConstraint:globalC];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (globalC.active == YES) {
 | 
				
			||||||
 | 
								globalC.active = NO;
 | 
				
			||||||
 | 
								[[self stackView] removeConstraint:globalC];
 | 
				
			||||||
 | 
								globalC = [NSLayoutConstraint constraintWithAnchor:battery.heightAnchor relatedBy:NSLayoutRelationEqual toAnchor:battery.heightAnchor multiplier:0 constant:(battery.number * 85)];
 | 
				
			||||||
 | 
								[[self stackView] addConstraint:globalC];	
 | 
				
			||||||
 | 
							}*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							//[battery.widthAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							/*battery.frame = CGRectMake(
 | 
				
			||||||
 | 
							originalBattery.origin.x,
 | 
				
			||||||
 | 
							originalBattery.origin.y,
 | 
				
			||||||
 | 
							originalBattery.size.width,
 | 
				
			||||||
 | 
							(battery.number * 85)
 | 
				
			||||||
 | 
							);*/
 | 
				
			||||||
 | 
						}];
 | 
				
			||||||
 | 
						
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%new
 | 
					%new
 | 
				
			||||||
-(void)KaiInfo {
 | 
					-(void)KaiInfo {
 | 
				
			||||||
	NSLog(@"Kai: Updating Info");
 | 
						//NSLog(@"Kai: Updating Info");
 | 
				
			||||||
	[[KAIBattery sharedInstance] updateBattery];
 | 
						[[KAIBattery sharedInstance] updateBattery];
 | 
				
			||||||
	[self KaiUpdate];
 | 
						[self KaiUpdate];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user