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; | ||||
} | } | ||||
[self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES; | [self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES; | ||||
[self.widthAnchor constraintEqualToAnchor:blurPlatter.widthAnchor].active = YES; | |||||
} | } | ||||
[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]; | ||||
} | } | ||||
} | } | ||||
-(void)calculateHeight { | -(void)calculateHeight { | ||||
self.number = [self.stack.subviews count]; | self.number = [self.stack.subviews count]; | ||||
if(self.number==0) { | if(self.number==0) { | ||||
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; | ||||
} 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)); | ||||
} | } | ||||
for(BCBatteryDevice *device in devices) { | for(BCBatteryDevice *device in devices) { | ||||
[device resetKaiCellForNewPrefs]; | [device resetKaiCellForNewPrefs]; | ||||
} | } | ||||
//self.spacing = spacing; | |||||
[self updateBattery]; | [self updateBattery]; | ||||
} | } | ||||
@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> |
{ Filter = { Bundles = ( "com.apple.springboard" ); }; } | |||||
{ Filter = { Bundles = ( "com.apple.springboard", "com.apple.BatteryCenter" ); }; } |
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 |