diff --git a/KAIBattery.mm b/KAIBattery.mm index fb43d1d..4d913d0 100644 --- a/KAIBattery.mm +++ b/KAIBattery.mm @@ -114,11 +114,11 @@ long long lastPercentage; blank.translatesAutoresizingMaskIntoConstraints = NO; if(bannerAlign==2) { //center - [blank.centerXAnchor constraintEqualToAnchor:self.centerXAnchor].active = YES; + [blank.centerXAnchor constraintEqualToAnchor:self.centerXAnchor constant:horizontalOffset].active = YES; } else if(bannerAlign==1) { //left - [blank.leftAnchor constraintEqualToAnchor:self.leftAnchor].active = YES; + [blank.leftAnchor constraintEqualToAnchor:self.leftAnchor constant:horizontalOffset].active = YES; } else if(bannerAlign==3) { //right - [blank.rightAnchor constraintEqualToAnchor:self.rightAnchor].active = YES; + [blank.rightAnchor constraintEqualToAnchor:self.rightAnchor constant:horizontalOffset].active = YES; } [blank.topAnchor constraintEqualToAnchor:self.topAnchor constant:y].active = YES; [blank.widthAnchor constraintEqualToConstant:((self.superview.bounds.size.width - 16) + bannerWidthFactor)].active = YES; @@ -129,14 +129,14 @@ long long lastPercentage; percentLabel.translatesAutoresizingMaskIntoConstraints = NO; [percentLabel.leftAnchor constraintEqualToAnchor:blank.rightAnchor constant:(- 94)].active = YES; [percentLabel.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; - [percentLabel.widthAnchor constraintEqualToConstant:36].active = YES; + [percentLabel.widthAnchor constraintEqualToConstant:35].active = YES; [percentLabel.heightAnchor constraintEqualToConstant:12].active = YES; //label.frame = CGRectMake(65.5,27.5 + y,275,25); label.translatesAutoresizingMaskIntoConstraints = NO; [label.leftAnchor constraintEqualToAnchor:glyphView.rightAnchor constant:4.5].active = YES; [label.centerYAnchor constraintEqualToAnchor:blank.centerYAnchor].active = YES; - [label.rightAnchor constraintEqualToAnchor:percentLabel.leftAnchor constant:7].active = YES; + [label.rightAnchor constraintEqualToAnchor:percentLabel.leftAnchor constant:-4.5].active = YES; [label.heightAnchor constraintEqualToConstant:25].active = YES; //glyphView.frame = CGRectMake(20.5,18.5 + y,40,40); diff --git a/Kai.h b/Kai.h index 4375804..0b96558 100644 --- a/Kai.h +++ b/Kai.h @@ -55,6 +55,7 @@ double glyphSize; double bannerHeight; double cornerRadius; double bannerWidthFactor; +double horizontalOffset; #import "KAIBattery.mm" @@ -106,7 +107,7 @@ static void preferencesChanged() enabled = boolValueForKey(@"enabled", YES); spacing = numberForValue(@"spacing", 5); - glyphSize = numberForValue(@"glyphSize", 40); + glyphSize = numberForValue(@"glyphSize", 35); bannerHeight = numberForValue(@"bannerHeight", 80); cornerRadius = numberForValue(@"cornerRadius", 13); disableGlyphs = boolValueForKey(@"disableGlyphs", NO); @@ -116,6 +117,7 @@ static void preferencesChanged() bannerWidthFactor = numberForValue(@"bannerWidthFactor", 0); hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO); bannerAlign = numberForValue(@"bannerAlign", 2); + horizontalOffset = numberForValue(@"horizontalOffset", 0); if(disableGlyphs) { glyphSize = 0; diff --git a/Kai.xm b/Kai.xm index 9f19908..90536b7 100644 --- a/Kai.xm +++ b/Kai.xm @@ -101,11 +101,16 @@ } %end -%hook _CSSingleBatteryChargingView +%hook CSBatteryChargingView --(void)initWithFrame:(CGRect)arg1 { - %orig; - [self removeFromSuperview]; ++(id)batteryChargingViewWithSingleBattery { + //NSLog(@"kai: here bro: %@", [NSThread callStackSymbols]); + //[UIPasteboard generalPasteboard].string = [NSString stringWithFormat:@"kai: here bro: %@", [NSThread callStackSymbols]]; + return nil; +} + ++(id)batteryChargingViewWithDoubleBattery { + return nil; } -(CGFloat)desiredVisibilityDuration { diff --git a/control b/control index 53741ac..41ce080 100644 --- a/control +++ b/control @@ -1,6 +1,6 @@ Package: com.burritoz.kai Name: Kai -Version: 0.1.0~alpha +Version: 0.1.1~alpha Architecture: iphoneos-arm Description: Show charging banners on your lock screen! Maintainer: burrit0z diff --git a/kaiprefs/Resources/Root.plist b/kaiprefs/Resources/Root.plist index 468c2fe..195ebac 100644 --- a/kaiprefs/Resources/Root.plist +++ b/kaiprefs/Resources/Root.plist @@ -208,11 +208,35 @@ cell PSGroupCell label - Glyph Size (40) + Horizontal Axis Manual Offset (0) default - 40 + 0 + cell + PSSliderCell + min + -300.0 + max + 300 + isSegmented + + showValue + + defaults + com.burritoz.kaiprefs + key + horizontalOffset + + + cell + PSGroupCell + label + Glyph Size (35) + + + default + 35 cell PSSliderCell min