1
0
mirror of https://github.com/Burrit0z/kai synced 2025-07-03 04:36:48 +00:00
This commit is contained in:
Burrit0z
2020-06-03 20:07:43 -04:00
parent 53a8ed1005
commit d6545a96f7
5 changed files with 18 additions and 11 deletions

View File

@ -88,16 +88,19 @@
blurPlatter.translatesAutoresizingMaskIntoConstraints = NO; blurPlatter.translatesAutoresizingMaskIntoConstraints = NO;
if(bannerAlign==2) { //center if(bannerAlign==2) { //center
[blurPlatter.centerXAnchor constraintEqualToAnchor:self.centerXAnchor constant:horizontalOffset].active = YES; [blurPlatter.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES;
} else if(bannerAlign==1) { //left } else if(bannerAlign==1) { //left
[blurPlatter.leftAnchor constraintEqualToAnchor:self.leftAnchor constant:horizontalOffset].active = YES; [blurPlatter.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES;
} else if(bannerAlign==3) { //right } else if(bannerAlign==3) { //right
[blurPlatter.rightAnchor constraintEqualToAnchor:self.rightAnchor constant:horizontalOffset].active = YES; [blurPlatter.rightAnchor constraintEqualToAnchor:self.rightAnchor].active = YES;
} }
[blurPlatter.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES; [blurPlatter.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
[blurPlatter.widthAnchor constraintEqualToConstant:((self.frame.size.width) + bannerWidthFactor)].active = YES; [blurPlatter.widthAnchor constraintEqualToConstant:(([[[objc_getClass("CSAdjunctListView") class] sharedListViewForKai] stackView].frame.size.width - 16) + bannerWidthFactor)].active = YES;
[blurPlatter.heightAnchor constraintEqualToConstant:bannerHeight].active = YES; [blurPlatter.heightAnchor constraintEqualToConstant:bannerHeight].active = YES;
[self.widthAnchor constraintEqualToAnchor:blurPlatter.widthAnchor].active = YES;
blur.translatesAutoresizingMaskIntoConstraints = NO; blur.translatesAutoresizingMaskIntoConstraints = NO;
[blur.centerXAnchor constraintEqualToAnchor:blurPlatter.centerXAnchor].active = YES; [blur.centerXAnchor constraintEqualToAnchor:blurPlatter.centerXAnchor].active = YES;
[blur.topAnchor constraintEqualToAnchor:blurPlatter.topAnchor].active = YES; [blur.topAnchor constraintEqualToAnchor:blurPlatter.topAnchor].active = YES;
@ -142,7 +145,6 @@
} }
[self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES; [self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES;
[self.widthAnchor constraintEqualToAnchor:blurPlatter.widthAnchor].active = YES;
} }

View File

@ -21,7 +21,6 @@ NSTimer *queueTimer = nil;
[self addSubview:self.stack]; [self addSubview:self.stack];
[self setContentSize:self.stack.frame.size]; [self setContentSize:self.stack.frame.size];
[self setContentOffset:CGPointMake(0,0)]; [self setContentOffset:CGPointMake(0,0)];
//[self setDelegate:self];
[self updateBattery]; [self updateBattery];
} }
@ -129,6 +128,7 @@ long long lastPercentage;
} }
-(void)calculateHeight { -(void)calculateHeight {
self.number = [self.stack.subviews count]; self.number = [self.stack.subviews count];
if(self.number==0) { if(self.number==0) {
@ -160,7 +160,8 @@ long long lastPercentage;
self.stack.heightConstraint.active = YES; self.stack.heightConstraint.active = YES;
[self setContentSize:self.stack.frame.size]; [self setContentSize:self.stack.frame.size];
if(kaiAlign==0) { if(kaiAlign==0) {
[self.stack.widthAnchor constraintEqualToAnchor:self.widthAnchor].active = YES; /*self.stack.widthConstraint = [self.stack.widthAnchor constraintEqualToAnchor:self.widthAnchor constant:bannerWidthFactor];
self.stack.widthConstraint.active = YES;*/
} else { } else {
self.widthConstraint = [self.widthAnchor constraintEqualToConstant:(self.number * (self.frame.size.width + bannerWidthFactor))]; self.widthConstraint = [self.widthAnchor constraintEqualToConstant:(self.number * (self.frame.size.width + bannerWidthFactor))];
self.widthConstraint.active = YES; self.widthConstraint.active = YES;
@ -168,7 +169,9 @@ long long lastPercentage;
} else { } else {
int height = (self.number * (bannerHeight + spacing)); int height = (self.number * (bannerHeight + spacing));
if(kaiAlign!=0) { if(kaiAlign==0) {
//self.stack.widthConstraint.constant = bannerWidthFactor;
} else {
height = bannerHeight + spacing; height = bannerHeight + spacing;
self.widthConstraint.constant = (self.number * (self.frame.size.width + bannerWidthFactor)); self.widthConstraint.constant = (self.number * (self.frame.size.width + bannerWidthFactor));
} }
@ -206,7 +209,7 @@ long long lastPercentage;
for(BCBatteryDevice *device in devices) { for(BCBatteryDevice *device in devices) {
[device resetKaiCellForNewPrefs]; [device resetKaiCellForNewPrefs];
} }
//self.spacing = spacing;
[self updateBattery]; [self updateBattery];
} }

View File

@ -1,5 +1,7 @@
@interface KAIStackView : UIStackView @interface KAIStackView : UIStackView
@property (nonatomic, strong) NSLayoutConstraint *heightConstraint; @property (nonatomic, strong) NSLayoutConstraint *heightConstraint;
@property (nonatomic, strong) NSLayoutConstraint *widthConstraint;
@property (nonatomic, strong) NSLayoutConstraint *aligner;
@end @end
@interface KAIBatteryPlatter : UIScrollView <UIScrollViewDelegate> @interface KAIBatteryPlatter : UIScrollView <UIScrollViewDelegate>

View File

@ -1 +1 @@
{ Filter = { Bundles = ( "com.apple.springboard" ); }; } { Filter = { Bundles = ( "com.apple.springboard", "com.apple.BatteryCenter" ); }; }

View File

@ -1,6 +1,6 @@
Package: com.burritoz.kai Package: com.burritoz.kai
Name: Kai Name: Kai
Version: 0.9.9~4 Version: 0.9.95
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