Device battery indicators on your Lock Screen
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

KAIRootListController.m 8.8KB

il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. #include "KAIRootListController.h"
  2. NSBundle *tweakBundle;
  3. @implementation KAIRootListController
  4. - (NSArray *)specifiers {
  5. if (!_specifiers) {
  6. _specifiers = [self loadSpecifiersFromPlistName:@"Root" target:self];
  7. }
  8. return _specifiers;
  9. }
  10. -(void)viewWillAppear:(BOOL)arg1 {
  11. [[UISegmentedControl appearanceWhenContainedInInstancesOfClasses:@[self.class]] setTintColor:[UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00]];
  12. [[UISwitch appearanceWhenContainedInInstancesOfClasses:@[self.class]] setOnTintColor:[UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00]];
  13. [[UISlider appearanceWhenContainedInInstancesOfClasses:@[self.class]] setTintColor:[UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00]];
  14. }
  15. -(void)viewWillDisappear:(BOOL)arg1 {
  16. [super viewWillDisappear:arg1];
  17. //[NSException raise:@"DE" format:@"DEU"];
  18. }
  19. -(void)viewDidLoad {
  20. [super viewDidLoad];
  21. UIBarButtonItem *applyButton = [[UIBarButtonItem alloc] initWithTitle:@"Apply" style:UIBarButtonItemStylePlain target:self action:@selector(respring:)];
  22. self.navigationItem.rightBarButtonItem = applyButton;
  23. self.navigationItem.titleView = [UIView new];
  24. self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0,10,10)];
  25. self.titleLabel.font = [UIFont systemFontOfSize:17.5];
  26. self.titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
  27. self.titleLabel.text = @"kai";
  28. self.titleLabel.alpha = 0.0;
  29. self.titleLabel.textAlignment = NSTextAlignmentCenter;
  30. [self.navigationItem.titleView addSubview:self.titleLabel];
  31. self.iconView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,10,10)];
  32. self.iconView.contentMode = UIViewContentModeScaleAspectFit;
  33. self.iconView.image = [UIImage imageWithContentsOfFile:@"/Library/PreferenceBundles/kaiPrefs.bundle/icon.png"];
  34. self.iconView.translatesAutoresizingMaskIntoConstraints = NO;
  35. self.iconView.alpha = 1.0;
  36. [self.navigationItem.titleView addSubview:self.iconView];
  37. [NSLayoutConstraint activateConstraints:@[
  38. [self.titleLabel.topAnchor constraintEqualToAnchor:self.navigationItem.titleView.topAnchor],
  39. [self.titleLabel.leadingAnchor constraintEqualToAnchor:self.navigationItem.titleView.leadingAnchor],
  40. [self.titleLabel.trailingAnchor constraintEqualToAnchor:self.navigationItem.titleView.trailingAnchor],
  41. [self.titleLabel.bottomAnchor constraintEqualToAnchor:self.navigationItem.titleView.bottomAnchor],
  42. [self.iconView.topAnchor constraintEqualToAnchor:self.navigationItem.titleView.topAnchor],
  43. [self.iconView.leadingAnchor constraintEqualToAnchor:self.navigationItem.titleView.leadingAnchor],
  44. [self.iconView.trailingAnchor constraintEqualToAnchor:self.navigationItem.titleView.trailingAnchor],
  45. [self.iconView.bottomAnchor constraintEqualToAnchor:self.navigationItem.titleView.bottomAnchor],
  46. ]];
  47. }
  48. -(void)respring:(id)sender {
  49. CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("com.burritoz.kaiprefs/reload"), nil, nil, true);
  50. UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Kai"
  51. message:@"Your settings have been applied. You can now go back to your lockscreen (CoverSheet) to see the changes. \n \n If some of your options did not apply, a respring might be necessary."
  52. preferredStyle:UIAlertControllerStyleAlert];
  53. UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"Amazing!" style:UIAlertActionStyleDefault
  54. handler:^(UIAlertAction * action) {}];
  55. [alert addAction:defaultAction];
  56. [self presentViewController:alert animated:YES completion:nil];
  57. }
  58. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  59. CGFloat offsetY = scrollView.contentOffset.y;
  60. if (offsetY > 120) {
  61. [UIView animateWithDuration:0.2 animations:^{
  62. self.iconView.alpha = 1.0;
  63. self.titleLabel.alpha = 0.0;
  64. }];
  65. } else {
  66. [UIView animateWithDuration:0.2 animations:^{
  67. self.iconView.alpha = 0.0;
  68. self.titleLabel.alpha = 1.0;
  69. }];
  70. }
  71. }
  72. -(void)followMeOnRedditBurritoz {
  73. [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"https://reddit.com/user/Burrit0z_dev"]];
  74. }
  75. @end
  76. @implementation KaiHeaderCell // Header Cell
  77. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(id)reuseIdentifier specifier:(id)specifier {
  78. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier specifier:specifier];
  79. if (self) {
  80. packageNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,90,self.contentView.bounds.size.width+30,50)];
  81. [packageNameLabel setTextAlignment:NSTextAlignmentRight];
  82. [packageNameLabel setFont:[UIFont systemFontOfSize:50 weight: UIFontWeightSemibold] ];
  83. packageNameLabel.textColor = [UIColor whiteColor];
  84. packageNameLabel.text = @"kai";
  85. developerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,50,self.contentView.bounds.size.width+30,50)];
  86. [developerLabel setTextAlignment:NSTextAlignmentRight];
  87. [developerLabel setFont:[UIFont systemFontOfSize:22.5 weight: UIFontWeightMedium] ];
  88. developerLabel.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.85];
  89. developerLabel.alpha = 0.8;
  90. developerLabel.text = @"Burrit0z";
  91. versionLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,130,self.contentView.bounds.size.width+30,50)];
  92. [versionLabel setTextAlignment:NSTextAlignmentRight];
  93. [versionLabel setFont:[UIFont systemFontOfSize:22 weight: UIFontWeightMedium] ];
  94. versionLabel.textColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.8];
  95. versionLabel.alpha = 0.8;
  96. versionLabel.text = @"1.0.0";
  97. NSBundle *bundle = [[NSBundle alloc]initWithPath:@"/Library/PreferenceBundles/kaiPrefs.bundle"];
  98. UIImage *phone = [UIImage imageWithContentsOfFile:[bundle pathForResource:@"kai" ofType:@"png"]];
  99. UIImageView *phoneImage = [[UIImageView alloc]initWithImage:phone];
  100. [phoneImage setFrame:CGRectMake(40,40,190,160)];
  101. phoneImage.clipsToBounds = YES;
  102. bgView.backgroundColor = [UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00];
  103. [self addSubview:packageNameLabel];
  104. [self addSubview:developerLabel];
  105. [self addSubview:versionLabel];
  106. [self addSubview:phoneImage];
  107. }
  108. return self;
  109. }
  110. - (instancetype)initWithSpecifier:(PSSpecifier *)specifier {
  111. return [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"KaiHeaderCell" specifier:specifier];
  112. }
  113. - (void)setFrame:(CGRect)frame {
  114. frame.origin.x = 0;
  115. //frame.origin.y = 43;
  116. [super setFrame:frame];
  117. }
  118. - (CGFloat)preferredHeightForWidth:(CGFloat)arg1{
  119. return 200.0f;
  120. }
  121. -(void)layoutSubviews{
  122. [super layoutSubviews];
  123. bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.bounds.size.width, 200)];
  124. UIColor *topColor = [UIColor colorWithRed: 0.00 green: 0.82 blue: 1.00 alpha: 1.00];
  125. UIColor *bottomColor = [UIColor colorWithRed: 0.23 green: 0.48 blue: 0.84 alpha: 1.00];
  126. CAGradientLayer *theViewGradient = [CAGradientLayer layer];
  127. theViewGradient.colors = [NSArray arrayWithObjects: (id)topColor.CGColor, (id)bottomColor.CGColor, nil];
  128. theViewGradient.startPoint = CGPointMake(0.5, 0.0);
  129. theViewGradient.endPoint = CGPointMake(0.5, 1.0);
  130. theViewGradient.frame = bgView.bounds;
  131. //Add gradient to view
  132. [bgView.layer insertSublayer:theViewGradient atIndex:0];
  133. [self insertSubview:bgView atIndex:0];
  134. }
  135. - (CGFloat)preferredHeightForWidth:(CGFloat)width inTableView:(id)tableView {
  136. return [self preferredHeightForWidth:width];
  137. }
  138. @end
  139. @implementation Thomz_TwitterCell // lil copy of HBTwitterCell from Cephei
  140. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier specifier:(PSSpecifier *)specifier {
  141. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier specifier:specifier];
  142. if (self)
  143. {
  144. UILabel *User = [[UILabel alloc] initWithFrame:CGRectMake(70,15,200,20)];
  145. [User setText:specifier.properties[@"user"]];
  146. [User setFont:[User.font fontWithSize:15]];
  147. UILabel *Description = [[UILabel alloc]initWithFrame:CGRectMake(70,35,200,20)];
  148. [Description setText:specifier.properties[@"description"]];
  149. [Description setFont:[Description.font fontWithSize:10]];
  150. NSBundle *bundle = [[NSBundle alloc]initWithPath:@"/Library/PreferenceBundles/MultiplaPrefs.bundle"];
  151. UIImage *profilePicture;
  152. profilePicture = [UIImage imageWithContentsOfFile:[bundle pathForResource:specifier.properties[@"image"] ofType:@"jpg"]];
  153. UIImageView *profilePictureView = [[UIImageView alloc] initWithImage:profilePicture];
  154. [profilePictureView.layer setMasksToBounds:YES];
  155. [profilePictureView.layer setCornerRadius:20];
  156. [profilePictureView setFrame:CGRectMake(15,15,40,40)];
  157. [self addSubview:User];
  158. [self addSubview:Description];
  159. [self addSubview:profilePictureView];
  160. }
  161. return self;
  162. }
  163. @end