123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- //
- // playerSetView.m
- // 双子星云手机
- //
- // Created by xd h on 2024/6/24.
- //
- #import "playerSetView.h"
- #import "SYJUISwitch.h"
- @interface playerSetView ()
- @property(nonatomic, strong) SYJUISwitch * bottomNavSwitch;//底部导航栏开关
- @property(nonatomic, strong) SYJUISwitch * fullScreenSwitch;//全面屏开关
- @property(nonatomic, strong) UIButton *TVButton;
- @end
- @implementation playerSetView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getCouldPhoneTvStatusFun:) name:getCouldPhoneTvStatusNotification object:nil];
-
- [self drawAnyView];
-
- return self;
- }
- - (void)drawAnyView{
-
- //扩大金融云机范围按钮
- UIButton *bigButton = [[UIButton alloc] init];
- bigButton.tag = 1;
- [bigButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [self addSubview:bigButton];
- //bigButton.backgroundColor = [UIColor greenColor];
-
- [bigButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(0);
- make.right.mas_equalTo(0);
- make.left.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- }];
-
- UIView* blackBgView = [UIView new];
- blackBgView.layer.cornerRadius = 20;
- blackBgView.backgroundColor = [UIColor hwColor:@"#202630"];
- [self addSubview:blackBgView];
-
- [blackBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(256);
- make.width.mas_equalTo(245);
- make.centerX.mas_equalTo(0.f);
- make.centerY.mas_equalTo(00.f);
- }];
-
- UIView *bg1View = [UIView new];
- bg1View.layer.cornerRadius = 12;
- bg1View.backgroundColor = [UIColor hwColor:@"#29313D"];
- [blackBgView addSubview:bg1View];
-
- [bg1View mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(74);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.top.mas_equalTo(16.f);
- }];
-
- //底部导航栏开关
- _bottomNavSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
- _bottomNavSwitch.onTintColor = HW13B2EBColor;
- _bottomNavSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
- [_bottomNavSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
- [bg1View addSubview:_bottomNavSwitch];
- [_bottomNavSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(35.f);
- make.top.mas_equalTo(16.f);
- make.width.mas_equalTo(44.f);
- make.height.mas_equalTo(22.f);
- }];
-
-
- UILabel *navSwitchTipLabel = [[UILabel alloc] init];
- navSwitchTipLabel.text = NSLocalizedString(@"cloudPhone_nav_show_tip",nil);
- navSwitchTipLabel.textAlignment = NSTextAlignmentCenter;
- navSwitchTipLabel.textColor = [UIColor whiteColor];
- navSwitchTipLabel.font = [UIFont systemFontOfSize:10.0];
- [bg1View addSubview:navSwitchTipLabel];
-
- [navSwitchTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(bg1View.mas_centerX).offset(-10.f);
- make.left.mas_equalTo(10);
- make.top.equalTo(_bottomNavSwitch.mas_bottom).offset(6);
- }];
-
- //全面屏开关
- _fullScreenSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
- _fullScreenSwitch.onTintColor = HW13B2EBColor;
- _fullScreenSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
- [_fullScreenSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
- [bg1View addSubview:_fullScreenSwitch];
- [_fullScreenSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-35.f);
- make.top.mas_equalTo(16.f);
- make.width.mas_equalTo(44.f);
- make.height.mas_equalTo(22.f);
- }];
-
- UILabel *fullScreenTipLabel = [[UILabel alloc] init];
- fullScreenTipLabel.text = NSLocalizedString(@"cloudPhone_fullScreen_show_tip",nil);
- fullScreenTipLabel.textAlignment = NSTextAlignmentCenter;
- fullScreenTipLabel.textColor = [UIColor whiteColor];
- fullScreenTipLabel.font = [UIFont systemFontOfSize:10.0];
- [bg1View addSubview:fullScreenTipLabel];
-
- [fullScreenTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(bg1View.mas_centerX).offset(10.f);
- make.right.mas_equalTo(-10);
- make.top.equalTo(_bottomNavSwitch.mas_bottom).offset(6);
- }];
-
- KWeakSelf
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.05 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf setAllSwitchFun];
- });
-
- /**********************************************************************************/
- UIView *bg2View = [UIView new];
- bg2View.layer.cornerRadius = 12;
- bg2View.backgroundColor = [UIColor hwColor:@"#29313D"];
- [blackBgView addSubview:bg2View];
-
- [bg2View mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(74);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.top.equalTo(bg1View.mas_bottom).offset(12);
- }];
-
-
- NSArray *titleArr = @[//NSLocalizedString(@"cloudPhone_set_screenshot_tip",nil),
- NSLocalizedString(@"my_set_no_restart_phone",nil),
- NSLocalizedString(@"cloudPhone_set_exit_tip",nil),
- ];
-
- NSArray *imageArr = @[//@"cloudPhone_set_screenshot",
- @"cloudPhone_set_restart",
- @"cloudPhone_set_exit",
- ];
-
- CGFloat butTopY = 15.0;
- CGFloat imageWH = 24.0;
-
- CGFloat butHeight = imageWH +20 +5;
- //CGFloat butWidth = (245 -12*2)/3.0; //70.0;
- CGFloat butWidth = (245 -12*2)/2.0; //70.0;
- CGFloat butSpace = 0.0; //(245 - butWidth*3)/3.0;
-
- for (int i=0; i<titleArr.count; i++) {
-
- UIButton *but = [[UIButton alloc] init];
- //but.tag = 10+i;
- but.tag = 11+i;
- [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [bg2View addSubview:but];
- //but.backgroundColor = [UIColor greenColor];
-
- [but mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(butSpace + (butWidth+butSpace)*(i%4));
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(butHeight);
- make.top.mas_equalTo(butTopY + (i/4)* (butHeight + 25) );
- }];
-
- UIImageView *imageV = [[UIImageView alloc] init];
- imageV.image = [UIImage imageNamed:imageArr[i]];
- [but addSubview:imageV];
-
- [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(imageWH);
- make.height.mas_equalTo(imageWH);
- make.top.mas_equalTo(0);
- }];
-
- UILabel *textLabel = [[UILabel alloc] init];
- textLabel.textAlignment = NSTextAlignmentCenter;
- textLabel.font = [UIFont systemFontOfSize:10.0];
- textLabel.textColor = [UIColor whiteColor];
- textLabel.text = titleArr[i];
- [but addSubview:textLabel];
- //textLabel.backgroundColor = [UIColor redColor];
-
- [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(0);
- make.width.mas_equalTo(butWidth);
- make.height.mas_equalTo(20);
- make.top.equalTo(imageV.mas_bottom).offset(5);
- }];
-
- }
-
- /**********************************************************************************/
- _TVButton = [[UIButton alloc] init];
- _TVButton.tag = 100;
- [_TVButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [_TVButton setTitle:NSLocalizedString(@"my_set_no_TV_p2p",nil) forState:(UIControlStateNormal)];
- [_TVButton setTitle:NSLocalizedString(@"my_set_no_close_TV_p2p",nil) forState:(UIControlStateSelected)];
- _TVButton.layer.cornerRadius = 12;
- [_TVButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f]];
- _TVButton.backgroundColor = [UIColor hwColor:@"#29313D"];
- [blackBgView addSubview:_TVButton];
-
- if(ksharedAppDelegate.TvStatusMod.isTVShowType){
- _TVButton.selected = YES;
- }
-
- [_TVButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(50);
- make.left.mas_equalTo(12);
- make.right.mas_equalTo(-12);
- make.top.equalTo(bg2View.mas_bottom).offset(12);
- }];
- }
- - (void)setAllSwitchFun
- {
- BOOL haveShowBottonNavType = ![HWDataManager getBoolWithKey:Consn_player_Nav_hide];
- [_bottomNavSwitch setOn:haveShowBottonNavType];
- }
- - (void)maskSwitchPressed:(SYJUISwitch *)maskSwitch{
-
- if(_bottomNavSwitch == maskSwitch){
- if (maskSwitch.on) {
- [HWDataManager setBoolWithKey:Consn_player_Nav_hide value:NO];
- }
- else{
- [HWDataManager setBoolWithKey:Consn_player_Nav_hide value:YES];
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:getPlayerBottomNavNotification object:nil];
- }
-
-
- }
- #pragma mark 按钮事件
- - (void)didClickButtonFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
- HLog(@"%ld",tag);
-
- [self removeFun];
- if(tag == 1){
- return;
- }
-
- if(tag == 100 && but.selected){
- tag = 101;
- }
-
- if(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- - (void)removeFun
- {
- [self removeFromSuperview];
- }
- - (void)getCouldPhoneTvStatusFun:(NSNotification*)not
- {
- if(ksharedAppDelegate.TvStatusMod.isTVShowType){
- _TVButton.selected = YES;
- }
- else{
- _TVButton.selected = NO;
- }
- }
- @end
|