mirror of
https://github.com/Burrit0z/kai
synced 2025-07-01 07:26:47 +00:00
yes bro
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
@interface MTMaterialView : UIView
|
||||
@property (nonatomic, assign) BOOL recipeDynamic;
|
||||
-(id)_initWithRecipe:(NSInteger)arg1 configuration:(NSInteger)arg2 initialWeighting:(CGFloat)arg3 scaleAdjustment:(id)arg4;
|
||||
+(id)materialViewWithRecipe:(NSInteger)arg1 options:(NSInteger)arg2 initialWeighting:(CGFloat)arg3 scaleAdjustment:(id)arg4;
|
||||
@end
|
||||
|
||||
@interface BCBatteryDeviceController
|
||||
|
@ -7,14 +7,8 @@ KAIBattery *instance;
|
||||
self = [super init];
|
||||
instance = self;
|
||||
if (self) {
|
||||
/*self.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
[self.leftAnchor constraintEqualToAnchor:self.leftAnchor constant:8].active = YES;
|
||||
[self.topAnchor constraintEqualToAnchor:self.topAnchor constant:arg1.origin.y].active = YES;
|
||||
[self.widthAnchor constraintEqualToConstant:UIScreen.mainScreen.bounds.size.width - 16].active = YES;
|
||||
[self.heightAnchor constraintEqualToConstant:(self.number * 85)].active = YES;*/
|
||||
[self updateBattery];
|
||||
self.userInteractionEnabled = NO;
|
||||
//[self addSubview:self.batteryLabel];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -56,7 +50,11 @@ long long lastPercentage;
|
||||
if(shouldAdd) {
|
||||
UIView *blank;
|
||||
if(bannerStyle==1) {
|
||||
blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil];
|
||||
if(kCFCoreFoundationVersionNumber > 1600) {
|
||||
blank = [[[objc_getClass("MTMaterialView") class] alloc] _initWithRecipe:1 configuration:1 initialWeighting:1 scaleAdjustment:nil];
|
||||
} else if(kCFCoreFoundationVersionNumber < 1600) {
|
||||
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
|
||||
}
|
||||
} else if(bannerStyle==2) {
|
||||
blank = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
|
||||
} else if(bannerStyle==3) {
|
||||
|
4
Kai.h
4
Kai.h
@ -47,6 +47,7 @@ BOOL enabled;
|
||||
BOOL disableGlyphs;
|
||||
BOOL hidePercent;
|
||||
BOOL showAll;
|
||||
BOOL belowMusic;
|
||||
BOOL hideDeviceLabel;
|
||||
NSInteger bannerStyle;
|
||||
NSInteger bannerAlign;
|
||||
@ -107,7 +108,7 @@ static void preferencesChanged()
|
||||
|
||||
enabled = boolValueForKey(@"enabled", YES);
|
||||
spacing = numberForValue(@"spacing", 5);
|
||||
glyphSize = numberForValue(@"glyphSize", 35);
|
||||
glyphSize = numberForValue(@"glyphSize", 30);
|
||||
bannerHeight = numberForValue(@"bannerHeight", 80);
|
||||
cornerRadius = numberForValue(@"cornerRadius", 13);
|
||||
disableGlyphs = boolValueForKey(@"disableGlyphs", NO);
|
||||
@ -118,6 +119,7 @@ static void preferencesChanged()
|
||||
hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO);
|
||||
bannerAlign = numberForValue(@"bannerAlign", 2);
|
||||
horizontalOffset = numberForValue(@"horizontalOffset", 0);
|
||||
belowMusic = boolValueForKey(@"belowMusic", NO);
|
||||
|
||||
if(disableGlyphs) {
|
||||
glyphSize = 0;
|
||||
|
18
Kai.xm
18
Kai.xm
@ -5,7 +5,11 @@
|
||||
|
||||
-(void)_layoutStackView {
|
||||
|
||||
//NSLog(@"Kai: Laying out stack view");
|
||||
NSInteger lastSlot = [[self stackView].subviews count] -1;
|
||||
if([[self stackView].subviews objectAtIndex:lastSlot] != [KAIBattery sharedInstance] && belowMusic) {
|
||||
[[self stackView] removeArrangedSubview:[KAIBattery sharedInstance]];
|
||||
[[self stackView] insertArrangedSubview:[KAIBattery sharedInstance] atIndex:lastSlot];
|
||||
}
|
||||
|
||||
[self KaiUpdate];
|
||||
|
||||
@ -42,14 +46,12 @@
|
||||
if(!battery.heightConstraint) {
|
||||
|
||||
battery.heightConstraint.active = NO;
|
||||
NSLog(@"kai: 1st time, assigning to %d", 500);
|
||||
battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:500];
|
||||
battery.heightConstraint = [battery.heightAnchor constraintEqualToConstant:85];
|
||||
battery.heightConstraint.active = YES;
|
||||
|
||||
} else {
|
||||
int height = (battery.number * (bannerHeight + spacing));
|
||||
int height = (battery.number * ((bannerHeight + spacing) - spacing + 5));
|
||||
battery.heightConstraint.active = NO;
|
||||
NSLog(@"kai: setting to %d", height);
|
||||
battery.heightConstraint.constant = height;
|
||||
battery.heightConstraint.active = YES;
|
||||
|
||||
@ -104,12 +106,14 @@
|
||||
%hook CSBatteryChargingView
|
||||
|
||||
+(id)batteryChargingViewWithSingleBattery {
|
||||
//NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]);
|
||||
//[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]];
|
||||
NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]);
|
||||
[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]];
|
||||
return nil;
|
||||
}
|
||||
|
||||
+(id)batteryChargingViewWithDoubleBattery {
|
||||
NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]);
|
||||
[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]];
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
2
control
2
control
@ -1,6 +1,6 @@
|
||||
Package: com.burritoz.kai
|
||||
Name: Kai
|
||||
Version: 0.1.1~alpha
|
||||
Version: 0.1.2~alpha
|
||||
Architecture: iphoneos-arm
|
||||
Description: Show charging banners on your lock screen!
|
||||
Maintainer: burrit0z
|
||||
|
@ -70,13 +70,13 @@ NSBundle *tweakBundle;
|
||||
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.burritoz.kaiprefs/reload"), nil, nil, true);
|
||||
|
||||
UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Kai"
|
||||
message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes."
|
||||
message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes. \n Note the option to put kai below music requires a respring."
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Amazing!" style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action) {}];
|
||||
[alert addAction:defaultAction];
|
||||
|
||||
|
||||
[self presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,18 @@
|
||||
<string>Right</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSSwitchCell</string>
|
||||
<key>default</key>
|
||||
<false/>
|
||||
<key>defaults</key>
|
||||
<string>com.burritoz.kaiprefs</string>
|
||||
<key>key</key>
|
||||
<string>belowMusic</string>
|
||||
<key>label</key>
|
||||
<string>Show kai Below Music</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
@ -232,17 +244,17 @@
|
||||
<key>cell</key>
|
||||
<string>PSGroupCell</string>
|
||||
<key>label</key>
|
||||
<string>Glyph Size (35)</string>
|
||||
<string>Glyph Size (30)</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>default</key>
|
||||
<real>35</real>
|
||||
<real>30</real>
|
||||
<key>cell</key>
|
||||
<string>PSSliderCell</string>
|
||||
<key>min</key>
|
||||
<real>10</real>
|
||||
<key>max</key>
|
||||
<real>100</real>
|
||||
<real>60</real>
|
||||
<key>isSegmented</key>
|
||||
<false/>
|
||||
<key>showValue</key>
|
||||
|
Reference in New Issue
Block a user