-
Notifications
You must be signed in to change notification settings - Fork 4
/
Tweak.xm
69 lines (56 loc) · 1.82 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
62
63
64
65
66
67
68
69
@interface SBIconListView : UIView
-(CGSize)defaultIconSize;
-(UIInterfaceOrientation)orientation;
@end
@interface SBRootIconListView : SBIconListView
@end
@interface SBDockIconListView : SBRootIconListView
@end
@interface SBWallpaperEffectView : UIView
@end
@interface SBDockView : UIView
@end
%hook SBDockView
-(void)layoutSubviews {
%orig();
UIImageView *_backgroundImageView = MSHookIvar<UIImageView *>(self, "_backgroundImageView");
if (_backgroundImageView != nil) {
_backgroundImageView.layer.cornerRadius = 10;
_backgroundImageView.layer.masksToBounds = YES;
CGRect frame = _backgroundImageView.frame;
frame.origin.x = 10;
frame.origin.y = 10;
frame.size.width = self.frame.size.width - 20;
frame.size.height = self.frame.size.height - 20;
_backgroundImageView.frame = frame;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
_backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; // fix for weird looking dock background in landscape mode
}
}
SBWallpaperEffectView *_backgroundView = MSHookIvar<SBWallpaperEffectView *>(self, "_backgroundView");
if (_backgroundView != nil) {
_backgroundView.layer.cornerRadius = 10;
_backgroundView.layer.masksToBounds = YES;
CGRect frame = _backgroundView.frame;
frame.origin.x = 10;
frame.origin.y = 10;
frame.size.width = self.frame.size.width - 20;
frame.size.height = self.frame.size.height - 20;
_backgroundView.frame = frame;
}
}
%end
%hook SBDockIconListView
+(CGFloat)defaultHeight {
return %orig() + 10;
}
-(void)layoutSubviews {
%orig();
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsLandscape([self orientation])) {
CGSize iconSize = [self defaultIconSize];
CGRect frame = self.frame;
frame.origin.x = (iconSize.height - iconSize.width) / 2;
self.frame = frame;
}
}
%end