1
0
mirror of https://github.com/gilshahar7/AVLock.git synced 2025-06-28 00:46:45 +00:00

Add files via upload

This commit is contained in:
2018-03-31 16:59:14 +03:00
committed by GitHub
parent 92e99bc39c
commit b20bcebdf2
2 changed files with 28 additions and 10 deletions

View File

@ -10,12 +10,29 @@
@end
@interface AVButton : UIView
@end
@interface AVTransportControlsView : UIView
-(void)deviceOrientationDidChange;
//@property (assign, nonatomic) AVButton *skipBackButton;
@property (assign, nonatomic) AVButton *skipBackButton;
@end
@interface AVPlaybackControlsView
@property (assign, nonatomic) AVTransportControlsView *transportControlsView;
@end
@interface AVPlayerViewControllerContentView
@property (assign, nonatomic) AVPlaybackControlsView *playbackControlsView;
@end
@interface AVFullScreenViewController
@property (assign, nonatomic) AVPlayerViewControllerContentView *contentView;
@end
extern "C" CFNotificationCenterRef CFNotificationCenterGetDistributedCenter(void);
static UIButton *button = nil;
@ -51,6 +68,12 @@ static void firstUpdate(CFNotificationCenterRef center, void *observer, CFString
}
%hook AVFullScreenViewController
-(void)viewDidLayoutSubviews{
%orig;
[self.contentView.playbackControlsView.transportControlsView deviceOrientationDidChange];
}
%end
%hook SBOrientationLockManager
-(SBOrientationLockManager*)init{
@ -113,13 +136,6 @@ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("avlock.firstUpdate"), (void*)myObserver, NULL, true);
button.contentMode = UIViewContentModeScaleAspectFit;
UIInterfaceOrientation orientation =[UIApplication sharedApplication].statusBarOrientation;
if (orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationLandscapeLeft){
button.frame = CGRectMake(6.5, -40, 46, 46);
}
else if(orientation == UIInterfaceOrientationPortrait){
button.frame = CGRectMake(([UIScreen mainScreen].bounds.size.width / 2) - 142.5, 43, 46, 46);
}
button.imageEdgeInsets = UIEdgeInsetsMake(10, 10, 10, 10);
[self addSubview:button];
@ -136,14 +152,16 @@ CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
CFNotificationCenterRemoveObserver ( CFNotificationCenterGetDarwinNotifyCenter(), (void*)myObserver, NULL, NULL);
}
%new
-(void)deviceOrientationDidChange{
UIInterfaceOrientation orientation =[UIApplication sharedApplication].statusBarOrientation;
if (orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationLandscapeLeft){
button.frame = CGRectMake(6.5, -40, 46, 46);
button.frame = CGRectMake(self.skipBackButton.frame.origin.x-13.5, -40, 46, 46);
}
else if(orientation == UIInterfaceOrientationPortrait){
button.frame = CGRectMake((self.frame.size.width / 2) - 115.5, 43, 46, 46);
button.frame = CGRectMake((self.skipBackButton.frame.origin.x - 62), self.skipBackButton.frame.origin.y, 46, 46);
}
}

Binary file not shown.