diff --git a/KAIBatteryCell.mm b/KAIBatteryCell.mm index 488a4e7..2d8cbc4 100755 --- a/KAIBatteryCell.mm +++ b/KAIBatteryCell.mm @@ -88,16 +88,19 @@ blurPlatter.translatesAutoresizingMaskIntoConstraints = NO; 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 - [blurPlatter.leftAnchor constraintEqualToAnchor:self.leftAnchor constant:horizontalOffset].active = YES; + [blurPlatter.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES; } 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.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; + [self.widthAnchor constraintEqualToAnchor:blurPlatter.widthAnchor].active = YES; + blur.translatesAutoresizingMaskIntoConstraints = NO; [blur.centerXAnchor constraintEqualToAnchor:blurPlatter.centerXAnchor].active = YES; [blur.topAnchor constraintEqualToAnchor:blurPlatter.topAnchor].active = YES; @@ -142,7 +145,6 @@ } [self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES; - [self.widthAnchor constraintEqualToAnchor:blurPlatter.widthAnchor].active = YES; } diff --git a/KAIBatteryPlatter.mm b/KAIBatteryPlatter.mm index 62e570d..8fadeac 100755 --- a/KAIBatteryPlatter.mm +++ b/KAIBatteryPlatter.mm @@ -21,7 +21,6 @@ NSTimer *queueTimer = nil; [self addSubview:self.stack]; [self setContentSize:self.stack.frame.size]; [self setContentOffset:CGPointMake(0,0)]; - //[self setDelegate:self]; [self updateBattery]; } @@ -129,6 +128,7 @@ long long lastPercentage; } -(void)calculateHeight { + self.number = [self.stack.subviews count]; if(self.number==0) { @@ -160,7 +160,8 @@ long long lastPercentage; self.stack.heightConstraint.active = YES; [self setContentSize:self.stack.frame.size]; 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 { self.widthConstraint = [self.widthAnchor constraintEqualToConstant:(self.number * (self.frame.size.width + bannerWidthFactor))]; self.widthConstraint.active = YES; @@ -168,7 +169,9 @@ long long lastPercentage; } else { int height = (self.number * (bannerHeight + spacing)); - if(kaiAlign!=0) { + if(kaiAlign==0) { + //self.stack.widthConstraint.constant = bannerWidthFactor; + } else { height = bannerHeight + spacing; self.widthConstraint.constant = (self.number * (self.frame.size.width + bannerWidthFactor)); } @@ -206,7 +209,7 @@ long long lastPercentage; for(BCBatteryDevice *device in devices) { [device resetKaiCellForNewPrefs]; } - //self.spacing = spacing; + [self updateBattery]; } diff --git a/KAIStackView.h b/KAIStackView.h index fdabf55..04112aa 100644 --- a/KAIStackView.h +++ b/KAIStackView.h @@ -1,5 +1,7 @@ @interface KAIStackView : UIStackView @property (nonatomic, strong) NSLayoutConstraint *heightConstraint; +@property (nonatomic, strong) NSLayoutConstraint *widthConstraint; +@property (nonatomic, strong) NSLayoutConstraint *aligner; @end @interface KAIBatteryPlatter : UIScrollView diff --git a/Kai.plist b/Kai.plist index 10dc654..075ea36 100755 --- a/Kai.plist +++ b/Kai.plist @@ -1 +1 @@ -{ Filter = { Bundles = ( "com.apple.springboard" ); }; } +{ Filter = { Bundles = ( "com.apple.springboard", "com.apple.BatteryCenter" ); }; } diff --git a/Layout/DEBIAN/control b/Layout/DEBIAN/control index 025cc6a..da5daf4 100644 --- a/Layout/DEBIAN/control +++ b/Layout/DEBIAN/control @@ -1,6 +1,6 @@ Package: com.burritoz.kai Name: Kai -Version: 0.9.9~4 +Version: 0.9.95 Architecture: iphoneos-arm Description: Show charging banners on your lock screen! Maintainer: burrit0z