Sfoglia il codice sorgente

ALMOST WORK

pull/1/head
Burrit0z 4 anni fa
parent
commit
70efe3ecb7
3 ha cambiato i file con 20 aggiunte e 29 eliminazioni
  1. +1
    -1
      KAIBattery.h
  2. +2
    -2
      KAIBattery.mm
  3. +17
    -26
      Kai.xm

+ 1
- 1
KAIBattery.h Vedi File

@@ -27,6 +27,6 @@
@property (nonatomic, assign) BOOL isUpdating;
+(KAIBattery *)sharedInstance;
-(void)darkLightMode;
-(instancetype)initWithFrame:(CGRect)arg1;
-(instancetype)init;
-(void)updateBattery;
@end

+ 2
- 2
KAIBattery.mm Vedi File

@@ -3,8 +3,8 @@
KAIBattery *instance;
@implementation KAIBattery

-(instancetype)initWithFrame:(CGRect)arg1 {
self = [super initWithFrame:arg1];
-(instancetype)init {
self = [super init];
instance = self;
if (self) {
/*self.translatesAutoresizingMaskIntoConstraints = NO;

+ 17
- 26
Kai.xm Vedi File

@@ -13,7 +13,6 @@

@interface CSAdjunctListView : UIView
@property (nonatomic, assign) BOOL hasKai;
@property (nonatomic, assign) NSInteger previousKaiCount;
-(UIStackView *)stackView;
-(void)setStackView:(UIStackView *)arg1;
-(void)KaiUpdate;
@@ -29,14 +28,12 @@
@interface NCNotificationListView : UIView
@end

BOOL setFrame = NO;
CGRect original = CGRectMake(0,0,0,0);
CGRect originalBattery;


%hook CSAdjunctListView
%property (nonatomic, assign) BOOL hasKai;
%property (nonatomic, assign) NSInteger previousKaiCount;

-(void)_layoutStackView {

@@ -48,38 +45,34 @@ CGRect originalBattery;
}

-(void)setStackView:(UIStackView *)arg1 {
//NSLog(@"Kai: Updating setting stack view");

if(!self.hasKai) {
KAIBattery *battery = [[KAIBattery alloc] initWithFrame:CGRectMake(8, 0, UIScreen.mainScreen.bounds.size.width, 85)];
KAIBattery *battery = [[KAIBattery alloc] init];
battery.translatesAutoresizingMaskIntoConstraints = NO;
[battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES;
[battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
[battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
//[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
[battery.heightAnchor constraintEqualToConstant:100].active = YES;
originalBattery = battery.frame;
original = [self stackView].frame;
setFrame = YES;
self.previousKaiCount = 0;
self.hasKai = YES;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(KaiInfo)
name:@"KaiInfoChanged"
object:nil];
//[self addSubview:[KAIBattery sharedInstance]];
self.hasKai = YES;
[[KAIBattery sharedInstance] darkLightMode];
}

UIStackView *newView = arg1;

if(![arg1.subviews containsObject:[KAIBattery sharedInstance]]) {
[newView addArrangedSubview:[KAIBattery sharedInstance]];
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
[view setBackgroundColor:[UIColor redColor]];
//[view setIntrinsicContentSize:CGSizeMake(359,80)];
[newView addArrangedSubview:view];
if(![arg1.subviews containsObject:battery]) {
[newView addArrangedSubview:battery];
//UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0,0,359,80)];
//[view setBackgroundColor:[UIColor redColor]];
//[newView addArrangedSubview:view];
}

%orig(newView);
//%orig(arg1);

}
}

%new
@@ -87,18 +80,16 @@ CGRect originalBattery;
[[KAIBattery sharedInstance] darkLightMode];
KAIBattery *battery = [KAIBattery sharedInstance];
//battery.translatesAutoresizingMaskIntoConstraints = YES;
battery.frame = CGRectMake(
/*battery.frame = CGRectMake(
originalBattery.origin.x,
originalBattery.origin.y,
originalBattery.size.width,
(battery.number * 85)
);
);*/

battery.translatesAutoresizingMaskIntoConstraints = NO;
[battery.leftAnchor constraintEqualToAnchor:battery.leftAnchor constant:0].active = YES;
[battery.topAnchor constraintEqualToAnchor:battery.topAnchor constant:0].active = YES;
[battery.widthAnchor constraintEqualToConstant:[self stackView].frame.size.width - 16].active = YES;
[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
//[battery.widthAnchor constraintEqualToAnchor:[self stackView].widthAnchor].active = YES;
//[battery.heightAnchor constraintEqualToConstant:(battery.number * 85)].active = YES;
}

%new

Loading…
Annulla
Salva