From f30b2c6954338f607d94dd094b08b5e2d7951fe3 Mon Sep 17 00:00:00 2001 From: Burrit0z Date: Wed, 3 Jun 2020 09:24:24 -0400 Subject: [PATCH] vibeok --- KAIBatteryPlatter.mm | 2 ++ Kai.h | 1 + Kai.xm | 13 ++++++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/KAIBatteryPlatter.mm b/KAIBatteryPlatter.mm index 4d23f56..801ddb2 100755 --- a/KAIBatteryPlatter.mm +++ b/KAIBatteryPlatter.mm @@ -191,6 +191,8 @@ long long lastPercentage; if(self.number==0) { [(UIStackView *)(self.superview) removeArrangedSubview:self]; + } else if(self.number!=0 && !self.superview) { + [[[objc_getClass("CSAdjunctListView") class] sharedListViewForKai] addArrangedSubview:self]; } } diff --git a/Kai.h b/Kai.h index 08ae1f8..032fe0d 100755 --- a/Kai.h +++ b/Kai.h @@ -15,6 +15,7 @@ -(UIStackView *)stackView; -(void)_layoutStackView; -(void)setStackView:(UIStackView *)arg1; ++(id)sharedListViewForKai; @end @interface CALayer (kai) diff --git a/Kai.xm b/Kai.xm index 806053c..d575f93 100755 --- a/Kai.xm +++ b/Kai.xm @@ -1,5 +1,7 @@ #import "Kai.h" +CSAdjunctListView *list; + %group main %hook KAITarget //This class is defined in %ctor, KAITarget is not a class name. @@ -15,7 +17,7 @@ //and insert into last slot. [[self stackView] removeArrangedSubview:[KAIBatteryPlatter sharedInstance]]; [[self stackView] insertArrangedSubview:[KAIBatteryPlatter sharedInstance] atIndex:lastSlot]; - } else if([[self stackView].subviews objectAtIndex:0] != [KAIBatteryPlatter sharedInstance] && !belowMusic) { + } else if(!belowMusic && ![[self stackView].subviews containsObject:[KAIBatteryPlatter sharedInstance]]) { [[self stackView] removeArrangedSubview:[KAIBatteryPlatter sharedInstance]]; [[self stackView] insertArrangedSubview:[KAIBatteryPlatter sharedInstance] atIndex:0]; } @@ -42,6 +44,9 @@ -(void)setStackView:(UIStackView *)arg1 { if(!KAISelf.hasKai) { + + list = self; + KAIBatteryPlatter *battery = [[KAIBatteryPlatter alloc] initWithFrame:[self stackView].frame]; //Add noti observer @@ -92,6 +97,12 @@ } } + +%new ++(id)sharedListViewForKai { + return list; +} + %end