Device battery indicators on your Lock Screen
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #include <CoreFoundation/CoreFoundation.h>
  2. #import <Foundation/Foundation.h>
  3. #include <stdio.h>
  4. #import <objc/runtime.h>
  5. #import <UIKit/UIKit.h>
  6. #import "KAIBattery.mm"
  7. @interface UIApplication (Kai)
  8. +(id)sharedApplication;
  9. -(BOOL)launchApplicationWithIdentifier:(id)arg1 suspended:(BOOL)arg2;
  10. @end
  11. @interface CSMainPageView : UIView
  12. @property (nonatomic, strong) KAIBattery *battery;
  13. -(void)updateForPresentation:(id)arg1;
  14. -(void)KaiUpdate;
  15. @end
  16. BOOL setFrame = NO;
  17. CSMainPageView *batteryWidget;
  18. CGRect original;
  19. CGRect originalBattery;
  20. /*
  21. - (void)addObserver:(NSObject *)observer
  22. forKeyPath:(NSString *)keyPath
  23. options:(NSKeyValueObservingOptions)options
  24. context:(void *)context*/
  25. /*
  26. %hook BCBatterDeviceController
  27. +(id)sharedInstance {
  28. [%orig addObserver:self forKeyPath:@"sortedDevices" options:NSKeyValueObservingOptionNew context:nil];
  29. return %orig;
  30. }
  31. -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
  32. if ([keyPath isEqualToString:@"sortedDevices"]) {
  33. [[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.apple.weather" suspended:NO];
  34. }
  35. }
  36. %end*/
  37. %hook SBCoverSheetPrimarySlidingViewController
  38. -(void)viewWillAppear:(BOOL)arg1 {
  39. %orig;
  40. [batteryWidget.battery updateBattery];
  41. [batteryWidget KaiUpdate];
  42. }
  43. /*
  44. -(void)viewWillDisappear:(BOOL)arg1 {
  45. %orig;
  46. [batteryWidget.battery updateBattery];
  47. [batteryWidget KaiUpdate];
  48. }*/
  49. %end
  50. %hook CSMainPageView
  51. %property (nonatomic, strong) KAIBattery *battery;
  52. -(void)updateForPresentation:(id)arg1 {
  53. %orig;
  54. if(!setFrame) {
  55. original = self.frame;
  56. self.battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, self.frame.origin.y + 150, self.frame.size.width - 16, self.frame.size.height)];
  57. originalBattery = self.battery.frame;
  58. [self addSubview:self.battery];
  59. setFrame = YES;
  60. batteryWidget = self;
  61. }
  62. [self.battery updateBattery];
  63. [self KaiUpdate];
  64. }
  65. %new
  66. -(void)KaiUpdate {
  67. self.frame = CGRectMake(
  68. original.origin.x,
  69. original.origin.y + (self.battery.number * 85),
  70. original.size.width,
  71. original.size.height
  72. );
  73. self.battery.frame = CGRectMake(
  74. originalBattery.origin.x,
  75. originalBattery.origin.y - (self.battery.number * 85) + 85,
  76. originalBattery.size.width,
  77. originalBattery.size.height
  78. );
  79. }
  80. %end