From cbbbb6c8275a1a04c82608e7c41569b008417e4e Mon Sep 17 00:00:00 2001 From: Burrit0z Date: Sat, 30 May 2020 01:03:15 -0400 Subject: [PATCH] almost --- DragonMake | 0 KAIBatteryCell.h | 0 KAIBatteryCell.mm | 10 ++++-- KAIBatteryStack copy.mm | 0 KAIBatteryStack.h | 0 KAIBatteryStack.mm | 24 ++++++++------ Kai.h | 2 ++ Kai.plist | 0 Kai.xm | 3 +- Layout/DEBIAN/control | 4 +-- MobileGestalt.h | 0 NSTask.h | 0 kaiprefs/KAIRootListController.h | 4 +++ kaiprefs/KAIRootListController.m | 54 +++++++++++++++++++++++++------- kaiprefs/Resources/Root.plist | 20 ++++++++++++ 15 files changed, 95 insertions(+), 26 deletions(-) mode change 100644 => 100755 DragonMake mode change 100644 => 100755 KAIBatteryCell.h mode change 100644 => 100755 KAIBatteryCell.mm mode change 100644 => 100755 KAIBatteryStack copy.mm mode change 100644 => 100755 KAIBatteryStack.h mode change 100644 => 100755 KAIBatteryStack.mm mode change 100644 => 100755 Kai.h mode change 100644 => 100755 Kai.plist mode change 100644 => 100755 Kai.xm mode change 100644 => 100755 MobileGestalt.h mode change 100644 => 100755 NSTask.h diff --git a/DragonMake b/DragonMake old mode 100644 new mode 100755 diff --git a/KAIBatteryCell.h b/KAIBatteryCell.h old mode 100644 new mode 100755 diff --git a/KAIBatteryCell.mm b/KAIBatteryCell.mm old mode 100644 new mode 100755 index fce536f..4372cce --- a/KAIBatteryCell.mm +++ b/KAIBatteryCell.mm @@ -113,7 +113,9 @@ self.label.translatesAutoresizingMaskIntoConstraints = NO; [self.label.leftAnchor constraintEqualToAnchor:self.glyphView.rightAnchor constant:4.5].active = YES; [self.label.centerYAnchor constraintEqualToAnchor:blurPlatter.centerYAnchor].active = YES; - [self.label.rightAnchor constraintEqualToAnchor:self.percentLabel.leftAnchor constant:-4.5].active = YES; + if(!hidePercent) { + [self.label.rightAnchor constraintEqualToAnchor:self.percentLabel.leftAnchor constant:-4.5].active = YES; + } [self.label.heightAnchor constraintEqualToConstant:25].active = YES; self.glyphView.translatesAutoresizingMaskIntoConstraints = NO; @@ -128,6 +130,10 @@ [self.battery.widthAnchor constraintEqualToConstant:20].active = YES; [self.battery.heightAnchor constraintEqualToConstant:10].active = YES; + if(hidePercent) { + [self.label.rightAnchor constraintEqualToAnchor:self.battery.leftAnchor constant:-4.5].active = YES; + } + } return self; @@ -170,7 +176,7 @@ self.battery.chargePercent = (batteryPercentage*0.01); [self.glyphView setImage:[self.device glyph]]; - [self.heightAnchor constraintEqualToConstant:(bannerHeight + spacing)].active = YES; + [self.heightAnchor constraintEqualToConstant:(bannerHeight)].active = YES; /*if(!self.height) { diff --git a/KAIBatteryStack copy.mm b/KAIBatteryStack copy.mm old mode 100644 new mode 100755 diff --git a/KAIBatteryStack.h b/KAIBatteryStack.h old mode 100644 new mode 100755 diff --git a/KAIBatteryStack.mm b/KAIBatteryStack.mm old mode 100644 new mode 100755 index 0e581fe..709d663 --- 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 = 0; + self.spacing = spacing; self.alignment = 0; self.oldCountOfDevices = -100; self.queued = NO; @@ -99,6 +99,15 @@ long long lastPercentage; self.number = [self.subviews count]; + if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) { + [(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; + } + }); + +} + +-(void)setNumber:(NSInteger)arg1 { + _number = arg1; [UIView animateWithDuration:0.3 animations:^{ if(!self.heightConstraint) { @@ -107,7 +116,7 @@ long long lastPercentage; self.heightConstraint.active = YES; } else { - int height = (self.number * (bannerHeight + spacing)); + int height = (arg1 * (bannerHeight + spacing)) - spacing; self.heightConstraint.constant = height; UIStackView *s = (UIStackView *)(self.superview); @@ -116,11 +125,6 @@ long long lastPercentage; } }]; - if([self.superview.superview.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) { - [(NCNotificationListView *)(self.superview.superview.superview) fixComplicationsViewFrame]; - } - }); - } -(void)addArrangedSubview:(UIView *)view { @@ -140,7 +144,7 @@ long long lastPercentage; self.heightConstraint.active = YES; } else { - int height = (self.number * (bannerHeight + spacing)); //big brain math + 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 @@ -183,7 +187,7 @@ long long lastPercentage; self.heightConstraint.active = YES; } else { - int height = (self.number * (bannerHeight + spacing)); //big brain math + 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 @@ -210,7 +214,7 @@ long long lastPercentage; for(BCBatteryDevice *device in devices) { [device resetKaiCellForNewPrefs]; } - + self.spacing = spacing; [self updateBattery]; } diff --git a/Kai.h b/Kai.h old mode 100644 new mode 100755 index 304ab54..e5b52e6 --- a/Kai.h +++ b/Kai.h @@ -13,6 +13,7 @@ @interface CSAdjunctListView : UIView @property (nonatomic, assign) BOOL hasKai; -(UIStackView *)stackView; +-(void)_layoutStackView; -(void)setStackView:(UIStackView *)arg1; @end @@ -138,6 +139,7 @@ static void applyPrefs() isUpdating = YES; [[KAIBatteryStack sharedInstance] refreshForPrefs]; //so hard (not) + [(CSAdjunctListView *)([KAIBatteryStack sharedInstance].superview.superview) _layoutStackView]; isUpdating = NO; diff --git a/Kai.plist b/Kai.plist old mode 100644 new mode 100755 diff --git a/Kai.xm b/Kai.xm old mode 100644 new mode 100755 index 7b27937..6c28441 --- a/Kai.xm +++ b/Kai.xm @@ -60,7 +60,8 @@ [[KAIBatteryStack sharedInstance] updateBattery]; if([KAISelf.superview respondsToSelector:@selector(fixComplicationsViewFrame)]) { - [KAISelf.superview performSelector:@selector(fixComplicationsViewFrame) withObject:KAISelf.superview afterDelay:0.2]; + [KAISelf.superview performSelector:@selector(fixComplicationsViewFrame) withObject:KAISelf.superview afterDelay:0.35]; + //[KAISelf.superview performSelector:@selector(fixComplicationsViewFrame) withObject:KAISelf.superview afterDelay:0.5]; } isUpdating = NO; diff --git a/Layout/DEBIAN/control b/Layout/DEBIAN/control index 99a13c3..b7c92b3 100644 --- a/Layout/DEBIAN/control +++ b/Layout/DEBIAN/control @@ -1,9 +1,9 @@ Package: com.burritoz.kai Name: Kai -Version: 0.2.6~alpha4 +Version: 0.9.9~1 Architecture: iphoneos-arm Description: Show charging banners on your lock screen! Maintainer: burrit0z Author: burrit0z Section: Tweaks -Depends: mobilesubstrate (>= 0.9.5000), preferenceloader +Depends: mobilesubstrate (>= 0.9.5000), preferenceloader, xyz.burritoz.thomz.multipla (>=1.2.0) diff --git a/MobileGestalt.h b/MobileGestalt.h old mode 100644 new mode 100755 diff --git a/NSTask.h b/NSTask.h old mode 100644 new mode 100755 diff --git a/kaiprefs/KAIRootListController.h b/kaiprefs/KAIRootListController.h index b031eb2..c6096c2 100644 --- a/kaiprefs/KAIRootListController.h +++ b/kaiprefs/KAIRootListController.h @@ -19,6 +19,10 @@ @interface KAIRootListController : PSListController @property (nonatomic, strong) UILabel *titleLabel; @property (nonatomic, strong) UIImageView *iconView; +-(void)followMeOnRedditBurritoz; +@end + +@interface Thomz_TwitterCell : PSTableCell @end @protocol PreferencesTableCustomView diff --git a/kaiprefs/KAIRootListController.m b/kaiprefs/KAIRootListController.m index 7bb6cf4..e3154f8 100644 --- a/kaiprefs/KAIRootListController.m +++ b/kaiprefs/KAIRootListController.m @@ -13,10 +13,6 @@ NSBundle *tweakBundle; } -(void)viewWillAppear:(BOOL)arg1 { - self.navigationController.navigationController.navigationBar.barTintColor = [UIColor colorWithRed: 0.00 green: 0.735 blue: 0.965 alpha: 1.00]; - [self.navigationController.navigationController.navigationBar setShadowImage: [UIImage new]]; - self.navigationController.navigationController.navigationBar.tintColor = [UIColor whiteColor]; - self.navigationController.navigationController.navigationBar.translucent = NO; [[UISegmentedControl appearanceWhenContainedInInstancesOfClasses:@[self.class]] setTintColor:[UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00]]; [[UISwitch appearanceWhenContainedInInstancesOfClasses:@[self.class]] setOnTintColor:[UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00]]; @@ -24,12 +20,9 @@ NSBundle *tweakBundle; } -- (void)viewWillDisappear:(BOOL)animated { - - [super viewWillDisappear:animated]; - - [self.navigationController.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}]; - +-(void)viewWillDisappear:(BOOL)arg1 { + [super viewWillDisappear:arg1]; + //[NSException raise:@"DE" format:@"DEU"]; } -(void)viewDidLoad { @@ -96,6 +89,10 @@ NSBundle *tweakBundle; } } +-(void)followMeOnRedditBurritoz { + [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"https://reddit.com/user/Burrit0z_dev"]]; +} + @end @implementation KaiHeaderCell // Header Cell @@ -124,7 +121,7 @@ NSBundle *tweakBundle; [versionLabel setFont:[UIFont systemFontOfSize:22 weight: UIFontWeightMedium] ]; versionLabel.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.8]; versionLabel.alpha = 0.8; - versionLabel.text = @"alpha"; + versionLabel.text = @"1.0.0"; NSBundle *bundle = [[NSBundle alloc]initWithPath:@"/Library/PreferenceBundles/kaiPrefs.bundle"]; UIImage *phone = [UIImage imageWithContentsOfFile:[bundle pathForResource:@"kai" ofType:@"png"]]; @@ -185,3 +182,38 @@ NSBundle *tweakBundle; } @end + +@implementation Thomz_TwitterCell // lil copy of HBTwitterCell from Cephei +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier specifier:(PSSpecifier *)specifier { + + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier specifier:specifier]; + + if (self) + { + UILabel *User = [[UILabel alloc] initWithFrame:CGRectMake(70,15,200,20)]; + [User setText:specifier.properties[@"user"]]; + [User setFont:[User.font fontWithSize:15]]; + + UILabel *Description = [[UILabel alloc]initWithFrame:CGRectMake(70,35,200,20)]; + [Description setText:specifier.properties[@"description"]]; + [Description setFont:[Description.font fontWithSize:10]]; + + NSBundle *bundle = [[NSBundle alloc]initWithPath:@"/Library/PreferenceBundles/MultiplaPrefs.bundle"]; + + UIImage *profilePicture; + profilePicture = [UIImage imageWithContentsOfFile:[bundle pathForResource:specifier.properties[@"image"] ofType:@"jpg"]]; + UIImageView *profilePictureView = [[UIImageView alloc] initWithImage:profilePicture]; + [profilePictureView.layer setMasksToBounds:YES]; + [profilePictureView.layer setCornerRadius:20]; + [profilePictureView setFrame:CGRectMake(15,15,40,40)]; + + [self addSubview:User]; + [self addSubview:Description]; + [self addSubview:profilePictureView]; + + } + + return self; +} + +@end \ No newline at end of file diff --git a/kaiprefs/Resources/Root.plist b/kaiprefs/Resources/Root.plist index 9990b6c..0418109 100644 --- a/kaiprefs/Resources/Root.plist +++ b/kaiprefs/Resources/Root.plist @@ -366,6 +366,26 @@ key bannerAlpha + + cell + PSGroupCell + + + cell + PSButtonCell + cellClass + Thomz_TwitterCell + user + Burrit0z + description + Developer + height + 70 + image + burritoz + action + followMeOnRedditBurritoz + title kai