forked from M4cs/DarkSwitcher-Lite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTweak.xm
61 lines (56 loc) · 1.46 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
@interface SBAppSwitcherScrollView: UIScrollView
@end
// define our view
SBAppSwitcherScrollView *switcherView = nil;
// define our fade duration using a double
CGFloat fadeDuration = 0.3f;
//hooking our class from BSUIScrollView which is a subclass of UIScrollView
%hook SBAppSwitcherScrollView
-(void)layoutSubviews{
%orig;
if (switcherView == nil){
switcherView = self;
switcherView.backgroundColor = [UIColor blackColor]; // here we define our color
}
switcherView.alpha = 0.68f;
[UIView animateWithDuration:fadeDuration
animations:^{
switcherView.alpha = 0.72f;
}
];
}
%end
//hooking the app switcher view controller for methods of closing
%hook SBDeckSwitcherViewController
//created fade for tapping outside a card
-(void)_handleDismissTapGesture:(id)arg1{
%orig;
[UIView animateWithDuration:fadeDuration
animations:^{
switcherView.alpha = 0.0f;
}
];
}
//creates fade when leaving app switcher
- (void)willMoveToParentViewController:(id)arg1{
%orig;
dispatch_async(dispatch_get_main_queue(), ^(void){
[UIView animateWithDuration:fadeDuration
animations:^{
switcherView.alpha = 0.0f;
}
];
});
}
//creates fade for when you press home button
-(bool)handleHomeButtonSinglePressUp{
dispatch_async(dispatch_get_main_queue(), ^(void){
[UIView animateWithDuration:fadeDuration
animations:^{
switcherView.alpha = 0.0f;
}
];
});
return %orig;
}
%end