1
0
mirror of https://github.com/Burrit0z/kai synced 2025-07-01 07:06:48 +00:00

FIX IT NOT APPEARING

This commit is contained in:
Burrit0z
2020-06-03 10:34:34 -04:00
parent 51daca3535
commit 11abdb72f2
3 changed files with 26 additions and 39 deletions

View File

@ -107,7 +107,7 @@ long long lastPercentage;
self.oldCountOfDevices = [devices count]; self.oldCountOfDevices = [devices count];
self.number = [self.stack.subviews count]; [self calculateHeight];
if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) { if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) {
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; [(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame];
@ -121,29 +121,6 @@ long long lastPercentage;
[super setContentOffset:CGPointMake(arg1.x, 0)]; [super setContentOffset:CGPointMake(arg1.x, 0)];
} }
-(void)addSubview:(UIView *)view {
[super addSubview:view];
self.number = [self.stack.subviews count];
if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) {
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame];
}
if(textColor==0 && [view respondsToSelector:@selector(updateInfo)]) {
KAIBatteryCell *cell = (KAIBatteryCell *)view;
if(@available(iOS 12.0, *)) {
if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
[cell.label setTextColor:[UIColor whiteColor]];
[cell.percentLabel setTextColor:[UIColor whiteColor]];
} else if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
[cell.label setTextColor:[UIColor blackColor]];
[cell.percentLabel setTextColor:[UIColor blackColor]];
}
}
}
[self setContentSize:self.stack.frame.size];
}
-(void)layoutSubviews { -(void)layoutSubviews {
if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) { if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) {
[(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; [(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame];
@ -154,6 +131,14 @@ long long lastPercentage;
-(void)calculateHeight { -(void)calculateHeight {
self.number = [self.stack.subviews count]; self.number = [self.stack.subviews count];
if(self.number==0) {
[(UIStackView *)(self.superview) removeArrangedSubview:self];
} else if(self.number!=0 && self.superview == nil) {
[[[[objc_getClass("CSAdjunctListView") class] sharedListViewForKai] stackView] addArrangedSubview:self];
//[self performSelector:@selector(calculateHeight) withObject:self afterDelay:0.1];
}
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
if(!self.heightConstraint) { if(!self.heightConstraint) {
@ -182,13 +167,6 @@ long long lastPercentage;
} }
}]; }];
if(self.number==0) {
[(UIStackView *)(self.superview) removeArrangedSubview:self];
} else if(self.number!=0 && !self.superview) {
[[[[objc_getClass("CSAdjunctListView") class] sharedListViewForKai] stackView] addArrangedSubview:self];
[self performSelector:@selector(calculateHeight) withObject:self afterDelay:0.1];
}
} }
-(void)refreshForPrefs { -(void)refreshForPrefs {

View File

@ -8,9 +8,22 @@
return self; return self;
} }
-(void)addSubview:(UIView *)arg1 { -(void)addSubview:(UIView *)view {
[super addSubview:arg1]; [super addSubview:view];
[(UIScrollView *)self.superview setContentSize:self.frame.size]; [(UIScrollView *)self.superview setContentSize:self.frame.size];
if(textColor==0 && [view respondsToSelector:@selector(updateInfo)]) {
KAIBatteryCell *cell = (KAIBatteryCell *)view;
if(@available(iOS 12.0, *)) {
if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
[cell.label setTextColor:[UIColor whiteColor]];
[cell.percentLabel setTextColor:[UIColor whiteColor]];
} else if(self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
[cell.label setTextColor:[UIColor blackColor]];
[cell.percentLabel setTextColor:[UIColor blackColor]];
}
}
}
} }
-(void)layoutSubviews { -(void)layoutSubviews {

8
Kai.xm
View File

@ -10,16 +10,12 @@ CSAdjunctListView *list;
-(void)_layoutStackView { -(void)_layoutStackView {
NSInteger lastSlot = [[self stackView].subviews count] -1;
//this code is used to determine if kai is at the bottom of the stack view //this code is used to determine if kai is at the bottom of the stack view
if([[self stackView].subviews objectAtIndex:lastSlot] != [KAIBatteryPlatter sharedInstance] && belowMusic) { if([[self stackView].subviews objectAtIndex:([[self stackView].subviews count] -1)] != [KAIBatteryPlatter sharedInstance] && belowMusic) {
//if it is not, but the option to have kai below music is on, i simply remove from it's current pos. //if it is not, but the option to have kai below music is on, i simply remove from it's current pos.
//and insert into last slot. //and insert into last slot.
[[self stackView] removeArrangedSubview:[KAIBatteryPlatter sharedInstance]]; [[self stackView] removeArrangedSubview:[KAIBatteryPlatter sharedInstance]];
[[self stackView] insertArrangedSubview:[KAIBatteryPlatter sharedInstance] atIndex:lastSlot]; [[self stackView] insertArrangedSubview:[KAIBatteryPlatter sharedInstance] atIndex:([[self stackView].subviews count] -1)];
} else if(!belowMusic && ![[self stackView].subviews containsObject:[KAIBatteryPlatter sharedInstance]]) {
[[self stackView] removeArrangedSubview:[KAIBatteryPlatter sharedInstance]];
[[self stackView] insertArrangedSubview:[KAIBatteryPlatter sharedInstance] atIndex:0];
} }
if([KAISelf.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) { if([KAISelf.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) {