From 846e54966fde16c9a4afb48678ec912da3d7a1f6 Mon Sep 17 00:00:00 2001 From: Burrit0z Date: Sat, 30 May 2020 10:28:10 -0400 Subject: [PATCH] alpha 0.9.9 2 --- KAIBatteryCell.mm | 12 +++++----- KAIBatteryStack.mm | 54 +++++++------------------------------------ Kai.xm | 2 ++ Layout/DEBIAN/control | 2 +- 4 files changed, 17 insertions(+), 53 deletions(-) diff --git a/KAIBatteryCell.mm b/KAIBatteryCell.mm index 4372cce..dbb9972 100755 --- a/KAIBatteryCell.mm +++ b/KAIBatteryCell.mm @@ -176,18 +176,18 @@ self.battery.chargePercent = (batteryPercentage*0.01); [self.glyphView setImage:[self.device glyph]]; - [self.heightAnchor constraintEqualToConstant:(bannerHeight)].active = YES; + //[self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES; - /*if(!self.height) { + if(!self.height) { self.height.active = NO; self.height = [self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)]; self.height.active = YES; - }*/ //else { - //int height = (bannerHeight + spacing); - //self.height.constant = height; - //} + } else { + int height = (bannerHeight + spacing); + self.height.constant = height; + } if(!self.width) { diff --git a/KAIBatteryStack.mm b/KAIBatteryStack.mm index 709d663..0ed9eaa 100755 --- a/KAIBatteryStack.mm +++ b/KAIBatteryStack.mm @@ -13,7 +13,7 @@ NSTimer *queueTimer = nil; self.displayingDevices = [[NSMutableArray alloc] init]; self.axis = 1; self.distribution = 0; - self.spacing = spacing; + self.spacing = 0; self.alignment = 0; self.oldCountOfDevices = -100; self.queued = NO; @@ -116,7 +116,12 @@ long long lastPercentage; self.heightConstraint.active = YES; } else { - int height = (arg1 * (bannerHeight + spacing)) - spacing; + int height; + /*if([self.superview.subviews objectAtIndex:([self.superview.subviews count] - 1)] == self) { + height = (self.number * (bannerHeight + spacing)); + } else {*/ + height = (self.number * (bannerHeight + spacing)) - spacing; + //} self.heightConstraint.constant = height; UIStackView *s = (UIStackView *)(self.superview); @@ -134,28 +139,6 @@ long long lastPercentage; [(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; } - [UIView animateWithDuration:0.3 animations:^{ - - if(!self.heightConstraint) { - - self.heightConstraint.active = NO; - self.heightConstraint = [self.heightAnchor constraintEqualToConstant:(self.number * (bannerHeight + spacing))]; - //set an initial constraint - self.heightConstraint.active = YES; - - } else { - int height = (self.number * (bannerHeight + spacing)) - spacing; //big brain math - //self.heightConstraint.active = NO; //deactivation - self.heightConstraint.constant = height; - //self.heightConstraint.active = YES; //forcing reactivation - - UIStackView *s = (UIStackView *)(self.superview); - s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1)); - //literally does nothing but makes the stack view lay itself out (doesnt adjust frame because translatesAutoreszingMaskIntoConstraints = NO on stack views) - } - - }]; - if(textColor==0) { KAIBatteryCell *cell = (KAIBatteryCell *)view; if(@available(iOS 12.0, *)) { @@ -177,27 +160,6 @@ long long lastPercentage; [(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; } - [UIView animateWithDuration:0.3 animations:^{ - - if(!self.heightConstraint) { - - self.heightConstraint.active = NO; - self.heightConstraint = [self.heightAnchor constraintEqualToConstant:(self.number * (bannerHeight + spacing))]; - //set an initial constraint - self.heightConstraint.active = YES; - - } else { - int height = (self.number * (bannerHeight + spacing)) - spacing; //big brain math - //self.heightConstraint.active = NO; //deactivation - self.heightConstraint.constant = height; - //self.heightConstraint.active = YES; //forcing reactivation - - UIStackView *s = (UIStackView *)(self.superview); - s.frame = CGRectMake(s.frame.origin.x, s.frame.origin.y, s.frame.size.width, (s.frame.size.height - 1)); - //literally does nothing but makes the stack view lay itself out (doesnt adjust frame because translatesAutoreszingMaskIntoConstraints = NO on stack views) - } - - }]; } -(void)refreshForPrefs { @@ -214,7 +176,7 @@ long long lastPercentage; for(BCBatteryDevice *device in devices) { [device resetKaiCellForNewPrefs]; } - self.spacing = spacing; + //self.spacing = spacing; [self updateBattery]; } diff --git a/Kai.xm b/Kai.xm index 6c28441..429d455 100755 --- a/Kai.xm +++ b/Kai.xm @@ -21,6 +21,8 @@ [(NCNotificationListView *)(KAISelf.superview) fixComplicationsViewFrame]; } + [[KAIBatteryStack sharedInstance] setNumber:[KAIBatteryStack sharedInstance].number]; + %orig; } diff --git a/Layout/DEBIAN/control b/Layout/DEBIAN/control index b7c92b3..bd7a75b 100644 --- a/Layout/DEBIAN/control +++ b/Layout/DEBIAN/control @@ -1,6 +1,6 @@ Package: com.burritoz.kai Name: Kai -Version: 0.9.9~1 +Version: 0.9.9~2 Architecture: iphoneos-arm Description: Show charging banners on your lock screen! Maintainer: burrit0z