1
0
mirror of https://github.com/Burrit0z/kai synced 2025-06-30 21:06:46 +00:00
This commit is contained in:
Burrit0z
2020-05-19 14:34:42 -04:00
parent ac26d297fa
commit 2e22429510

32
Kai.xm
View File

@ -52,10 +52,10 @@ CGRect originalBattery;
if(!self.hasKai) { if(!self.hasKai) {
KAIBattery *battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, 0, UIScreen.mainScreen.bounds.size.width, 85)]; KAIBattery *battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, 0, UIScreen.mainScreen.bounds.size.width, 85)];
/*battery.translatesAutoresizingMaskIntoConstraints = NO; battery.translatesAutoresizingMaskIntoConstraints = NO;
[battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES; [battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES;
[battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES; [battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
[battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;*/ [battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
originalBattery = battery.frame; originalBattery = battery.frame;
original = [self stackView].frame; original = [self stackView].frame;
setFrame = YES; setFrame = YES;
@ -65,20 +65,18 @@ CGRect originalBattery;
selector:@selector(KaiInfo) selector:@selector(KaiInfo)
name:@"KaiInfoChanged" name:@"KaiInfoChanged"
object:nil]; object:nil];
[self addSubview:[KAIBattery sharedInstance]]; //[self addSubview:[KAIBattery sharedInstance]];
[[KAIBattery sharedInstance] darkLightMode]; [[KAIBattery sharedInstance] darkLightMode];
} }
UIStackView *newView = arg1; UIStackView *newView = arg1;
if(![arg1.subviews containsObject:[KAIBattery sharedInstance]]) { if(![arg1.subviews containsObject:[KAIBattery sharedInstance]]) {
UIView *placeholder = [[UIView alloc] initWithFrame:CGRectMake(0,0,0,0)]; [newView addArrangedSubview:[KAIBattery sharedInstance]];
[newView addArrangedSubview:placeholder]; UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
placeholder.translatesAutoresizingMaskIntoConstraints = NO; [view setBackgroundColor:[UIColor redColor]];
[placeholder.leftAnchor constraintEqualToAnchor:placeholder.leftAnchor constant:0].active = YES; //[view setIntrinsicContentSize:CGSizeMake(359,80)];
[placeholder.topAnchor constraintEqualToAnchor:placeholder.topAnchor constant:0].active = YES; [newView addArrangedSubview:view];
[placeholder.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
[placeholder.heightAnchor constraintEqualToConstant:[KAIBattery sharedInstance].frame.size.height].active = YES;
} }
%orig(newView); %orig(newView);
//%orig(arg1); //%orig(arg1);
@ -96,15 +94,11 @@ CGRect originalBattery;
(battery.number * 85) (battery.number * 85)
); );
UIStackView *stack = [self stackView]; battery.translatesAutoresizingMaskIntoConstraints = NO;
stack.frame = CGRectMake( [battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES;
stack.frame.origin.x, [battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
original.origin.y + (battery.number * 85), [battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
stack.frame.size.width, [battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
stack.frame.size.height
);
[[[self stackView].subviews objectAtIndex:0].heightAnchor constraintEqualToConstant:[KAIBattery sharedInstance].frame.size.height].active = YES;
} }
%new %new