1
0
mirror of https://github.com/Burrit0z/kai synced 2025-07-01 21:36:46 +00:00

prefs, a shit ton

This commit is contained in:
Burrit0z
2020-05-20 11:27:44 -04:00
parent 38dce47564
commit 168bd6d3dc
13 changed files with 346 additions and 228 deletions

View File

@ -0,0 +1,24 @@
#import <Preferences/PSListController.h>
#import <Preferences/PSTableCell.h>
#import <Preferences/PSSpecifier.h>
#import <Preferences/PSListItemsController.h>
#import <Foundation/NSUserDefaults.h>
@interface PSListController (kai)
-(void)setFrame:(CGRect)frame;
@end
@interface KAIRootListController : PSListController
@end
@protocol PreferencesTableCustomView
- (id)initWithSpecifier:(id)arg1;
@end
@interface KaiHeaderCell : PSTableCell <PreferencesTableCustomView> {
UIView *bgView;
UILabel *packageNameLabel;
UILabel *developerLabel;
UILabel *versionLabel;
}
@end

View File

@ -0,0 +1,122 @@
#include "KAIRootListController.h"
NSBundle *tweakBundle;
@implementation KAIRootListController
- (NSArray *)specifiers {
if (!_specifiers) {
_specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
}
return _specifiers;
}
-(void)viewWillAppear:(BOOL)arg1 {
self.navigationController.navigationController.navigationBar.barTintColor = [UIColor colorWithRed: 0.00 green: 0.77 blue: 0.95 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]];
[[UISlider appearanceWhenContainedInInstancesOfClasses:@[self.class]] setTintColor:[UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00]];
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}];
}
@end
@implementation KaiHeaderCell // Header Cell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(id)reuseIdentifier specifier:(id)specifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier specifier:specifier];
if (self) {
packageNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,90,self.contentView.bounds.size.width+30,50)];
[packageNameLabel setTextAlignment:NSTextAlignmentRight];
[packageNameLabel setFont:[UIFont systemFontOfSize:50 weight: UIFontWeightSemibold] ];
packageNameLabel.textColor = [UIColor whiteColor];
packageNameLabel.text = @"kai";
developerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,50,self.contentView.bounds.size.width+30,50)];
[developerLabel setTextAlignment:NSTextAlignmentRight];
[developerLabel setFont:[UIFont systemFontOfSize:22.5 weight: UIFontWeightMedium] ];
developerLabel.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.85];
developerLabel.alpha = 0.8;
developerLabel.text = @"Burrit0z";
versionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,130,self.contentView.bounds.size.width+30,50)];
[versionLabel setTextAlignment:NSTextAlignmentRight];
[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";
NSBundle *bundle = [[NSBundle alloc]initWithPath:@"/Library/PreferenceBundles/KaiPrefs.bundle"];
UIImage *phone = [UIImage imageWithContentsOfFile:[bundle pathForResource:@"kai" ofType:@"png"]];
UIImageView *phoneImage = [[UIImageView alloc]initWithImage:phone];
[phoneImage setFrame:self.frame];
bgView.backgroundColor = [UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00];
[self addSubview:packageNameLabel];
[self addSubview:developerLabel];
[self addSubview:versionLabel];
[self addSubview:phoneImage];
}
return self;
}
- (instancetype)initWithSpecifier:(PSSpecifier *)specifier {
return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"KaiHeaderCell" specifier:specifier];
}
- (void)setFrame:(CGRect)frame {
frame.origin.x = 0;
//frame.origin.y = 43;
[super setFrame:frame];
}
- (CGFloat)preferredHeightForWidth:(CGFloat)arg1{
return 200.0f;
}
-(void)layoutSubviews{
[super layoutSubviews];
bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.bounds.size.width, 200)];
UIColor *topColor = [UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00];
UIColor *bottomColor = [UIColor colorWithRed: 0.23 green: 0.48 blue: 0.84 alpha: 1.00];
CAGradientLayer *theViewGradient = [CAGradientLayer layer];
theViewGradient.colors = [NSArray arrayWithObjects: (id)topColor.CGColor, (id)bottomColor.CGColor, nil];
theViewGradient.startPoint = CGPointMake(0.5, 0.0);
theViewGradient.endPoint = CGPointMake(0.5, 1.0);
theViewGradient.frame = bgView.bounds;
//Add gradient to view
[bgView.layer insertSublayer:theViewGradient atIndex:0];
[self insertSubview:bgView atIndex:0];
}
- (CGFloat)preferredHeightForWidth:(CGFloat)width inTableView:(id)tableView {
return [self preferredHeightForWidth:width];
}
@end

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>kaiPrefs</string>
<key>CFBundleIdentifier</key>
<string>com.burritoz.kaiprefs</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSPrincipalClass</key>
<string>KAIRootListController</string>
</dict>
</plist>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>cell</key>
<string>PSGroupCell</string>
<key>headerCellClass</key>
<string>KaiHeaderCell</string>
<key>height</key>
<integer>175</integer>
</dict>
<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.burritoz.kaiprefs</string>
<key>key</key>
<string>enabled</string>
<key>label</key>
<string>Enable</string>
</dict>
</array>
<key>title</key>
<string>kai</string>
</dict>
</plist>

BIN
kaiprefs/Resources/kai.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

21
kaiprefs/entry.plist Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>entry</key>
<dict>
<key>bundle</key>
<string>kaiPrefs</string>
<key>cell</key>
<string>PSLinkCell</string>
<key>detail</key>
<string>KAIRootListController</string>
<key>icon</key>
<string>icon.png</string>
<key>isController</key>
<true/>
<key>label</key>
<string>kai</string>
</dict>
</dict>
</plist>