mirror of
https://github.com/Burrit0z/kai
synced 2025-07-04 13:56:47 +00:00
work
This commit is contained in:
@ -16,6 +16,14 @@ NSTimer *queueTimer = nil;
|
|||||||
self.stack.alignment = 0;
|
self.stack.alignment = 0;
|
||||||
self.oldCountOfDevices = -100;
|
self.oldCountOfDevices = -100;
|
||||||
self.queued = NO;
|
self.queued = NO;
|
||||||
|
|
||||||
|
if(bannerAlign==2) { //center
|
||||||
|
self.stack.alignment = UIStackViewAlignmentLeading;
|
||||||
|
} else if(bannerAlign==1) { //left
|
||||||
|
self.stack.alignment = UIStackViewAlignmentCenter;
|
||||||
|
} else if(bannerAlign==3) { //right
|
||||||
|
self.stack.alignment = UIStackViewAlignmentTrailing;
|
||||||
|
}
|
||||||
|
|
||||||
[self setMinimumZoomScale:1];
|
[self setMinimumZoomScale:1];
|
||||||
[self setMaximumZoomScale:1];
|
[self setMaximumZoomScale:1];
|
||||||
@ -28,21 +36,10 @@ NSTimer *queueTimer = nil;
|
|||||||
//https://cdn.discordapp.com/attachments/683698397634756646/718122118990266518/unknown.png
|
//https://cdn.discordapp.com/attachments/683698397634756646/718122118990266518/unknown.png
|
||||||
|
|
||||||
self.stackHolder.translatesAutoresizingMaskIntoConstraints = NO;
|
self.stackHolder.translatesAutoresizingMaskIntoConstraints = NO;
|
||||||
|
|
||||||
if(bannerAlign==2) { //center
|
|
||||||
self.subviewAligner = [self.stackHolder.centerXAnchor constraintEqualToAnchor:self.centerXAnchor];
|
|
||||||
} else if(bannerAlign==1) { //left
|
|
||||||
self.subviewAligner = [self.stackHolder.leftAnchor constraintEqualToAnchor:self.leftAnchor];
|
|
||||||
} else if(bannerAlign==3) { //right
|
|
||||||
self.subviewAligner = [self.stackHolder.rightAnchor constraintEqualToAnchor:self.rightAnchor];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self.stackHolder.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
|
[self.stackHolder.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
|
||||||
[self.stackHolder.widthAnchor constraintEqualToAnchor:self.stack.widthAnchor].active = YES;
|
[self.stackHolder.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
|
||||||
[self.stackHolder.centerYAnchor constraintEqualToAnchor:self.centerYAnchor].active = YES;
|
[self.stackHolder.centerYAnchor constraintEqualToAnchor:self.centerYAnchor].active = YES;
|
||||||
|
|
||||||
self.subviewAligner.active = YES;
|
|
||||||
|
|
||||||
[self updateBattery];
|
[self updateBattery];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@ -54,6 +51,9 @@ long long lastPercentage;
|
|||||||
-(void)updateBattery {
|
-(void)updateBattery {
|
||||||
if(!self.stack.widthAnchor) {
|
if(!self.stack.widthAnchor) {
|
||||||
[self.stack.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
|
[self.stack.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
|
||||||
|
[self.stack.heightAnchor constraintEqualToAnchor:self.heightAnchor].active = YES;
|
||||||
|
[self.stack.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES;
|
||||||
|
[self.stack.centerYAnchor constraintEqualToAnchor:self.centerYAnchor].active = YES;
|
||||||
}
|
}
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
|
BCBatteryDeviceController *bcb = [BCBatteryDeviceController sharedInstance];
|
||||||
@ -234,18 +234,6 @@ long long lastPercentage;
|
|||||||
[device resetKaiCellForNewPrefs];
|
[device resetKaiCellForNewPrefs];
|
||||||
}
|
}
|
||||||
|
|
||||||
self.subviewAligner.active = NO;
|
|
||||||
[self.stackHolder removeConstraint:self.subviewAligner];
|
|
||||||
if(bannerAlign==2) { //center
|
|
||||||
self.subviewAligner = [self.stackHolder.centerXAnchor constraintEqualToAnchor:self.centerXAnchor];
|
|
||||||
} else if(bannerAlign==1) { //left
|
|
||||||
self.subviewAligner = [self.stackHolder.leftAnchor constraintEqualToAnchor:self.leftAnchor];
|
|
||||||
} else if(bannerAlign==3) { //right
|
|
||||||
self.subviewAligner = [self.stackHolder.rightAnchor constraintEqualToAnchor:self.rightAnchor];
|
|
||||||
}
|
|
||||||
|
|
||||||
self.subviewAligner.active = YES;
|
|
||||||
|
|
||||||
[self updateBattery];
|
[self updateBattery];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,4 +254,8 @@ long long lastPercentage;
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//This is for compatibility (did i spell that right?)
|
||||||
|
|
||||||
|
-(void)setSizeToMimic:(CGSize)arg1 {}
|
||||||
|
|
||||||
@end
|
@end
|
@ -8,7 +8,6 @@
|
|||||||
@property (nonatomic, assign) NSInteger oldCountOfDevices;
|
@property (nonatomic, assign) NSInteger oldCountOfDevices;
|
||||||
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
|
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
|
||||||
@property (nonatomic, strong) NSLayoutConstraint *widthConstraint;
|
@property (nonatomic, strong) NSLayoutConstraint *widthConstraint;
|
||||||
@property (nonatomic, strong) NSLayoutConstraint *subviewAligner;
|
|
||||||
@property (nonatomic, strong) KAIStackView *stack;
|
@property (nonatomic, strong) KAIStackView *stack;
|
||||||
@property (nonatomic, assign) BOOL isUpdating;
|
@property (nonatomic, assign) BOOL isUpdating;
|
||||||
@property (nonatomic, assign) BOOL queued;
|
@property (nonatomic, assign) BOOL queued;
|
||||||
|
2
Kai.xm
2
Kai.xm
@ -104,6 +104,8 @@ CSAdjunctListView *list;
|
|||||||
[self addObserver:self forKeyPath:@"batterySaverModeActive" options:NSKeyValueObservingOptionNew context:nil];
|
[self addObserver:self forKeyPath:@"batterySaverModeActive" options:NSKeyValueObservingOptionNew context:nil];
|
||||||
[self addObserver:self forKeyPath:@"percentCharge" options:NSKeyValueObservingOptionNew context:nil];
|
[self addObserver:self forKeyPath:@"percentCharge" options:NSKeyValueObservingOptionNew context:nil];
|
||||||
|
|
||||||
|
//[NSException raise:@"This is a message only I, the developer, would understand, so pls send to me." format:@"Hooked"];
|
||||||
|
|
||||||
return %orig;
|
return %orig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user