123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340 |
- //
- // 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;
- @property(nonatomic, strong) UILabel *TVShowLabel;
- @property(nonatomic, strong) UIButton *exitPhoneButton;
- @property(nonatomic, strong) UILabel *delayedLabel;//延时
- @property(nonatomic, strong) UILabel *PacketLossLabel;//丢包
- @property(nonatomic, strong) UILabel *speedLabel;//速度(带宽)
- @property(nonatomic, strong) UILabel *fpsLabel;
- @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(202);//(256);
- make.width.mas_equalTo(320);//(245);
- make.centerX.mas_equalTo(0.f);
- make.centerY.mas_equalTo(0.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];
- // });
-
- /***************************顶部按钮显示*******************************************************/
-
- // UILabel * delayedTipLabel = [UILabel a]
- // @property(nonatomic, strong) UILabel *delayedLabel;//延时
- // @property(nonatomic, strong) UILabel *PacketLossLabel;//丢包
- // @property(nonatomic, strong) UILabel *speedLabel;//速度(带宽)
- // @property(nonatomic, strong) UILabel *fpsLabel;
-
- /**********************************************************************************/
- 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(72);
- make.left.mas_equalTo(15);
- make.right.mas_equalTo(-15);
- //make.top.equalTo(bg1View.mas_bottom).offset(12);
- make.top.mas_equalTo(52);
- }];
-
-
- NSArray *titleArr = @[NSLocalizedString(@"cloudPhone_set_screenshot_tip",nil),
- NSLocalizedString(@"my_set_no_TV_p2p",nil),//my_set_no_close_TV_p2p
- NSLocalizedString(@"my_set_no_restart_phone",nil),
- //NSLocalizedString(@"cloudPhone_set_exit_tip",nil),
- ];
-
- NSArray *imageArr = @[@"cloudPhone_set_screenshot",
- @"cloudPhone_set_TV",
- @"cloudPhone_set_restart",
- //@"cloudPhone_set_exit",
- ];
-
-
- CGFloat butTopY = 15.0;
- CGFloat imageWH = 24.0;
-
- CGFloat butHeight = imageWH +20 +5;
- CGFloat butWidth = (320 -15*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 = 200+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(0);
- }];
-
- if(i==1){
- _TVButton = but;
- _TVShowLabel = textLabel;
-
- [self getCouldPhoneTvStatusFun:nil];
- }
-
- }
-
- /**********************************************************************************/
-
- NSString *titleStr = [[NSString alloc] initWithFormat:@" %@",NSLocalizedString(@"cloudPhone_set_exit_tip",nil)];
- _exitPhoneButton = [[UIButton alloc] init];
- _exitPhoneButton.tag = 100;
- [_exitPhoneButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
- [_exitPhoneButton setTitle:titleStr forState:(UIControlStateNormal)];
- [_exitPhoneButton setImage:[UIImage imageNamed:@"cloudPhone_set_exit"] forState:UIControlStateNormal];
- _exitPhoneButton.layer.cornerRadius = 12;
- [_exitPhoneButton.titleLabel setFont:[UIFont systemFontOfSize:12.f]];
- _exitPhoneButton.backgroundColor = [UIColor hwColor:@"#29313D"];
- [blackBgView addSubview:_exitPhoneButton];
-
- // if(ksharedAppDelegate.TvStatusMod.isTVShowType){
- // _TVButton.selected = YES;
- // }
-
- [_exitPhoneButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.height.mas_equalTo(42);
- 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];
-
- BOOL fullscreenType = [HWDataManager getBoolWithKey:Consn_player_full_screen_show];
- [_fullScreenSwitch setOn:fullscreenType];
- }
- - (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];
- }
- else if (_fullScreenSwitch == maskSwitch){
-
- BOOL isTVShowType = ksharedAppDelegate.TvStatusMod.isTVShowType;
- if(isTVShowType){
- [[iToast makeText:NSLocalizedString(@"cloudPhone_tvShow_before_fullscreen_tip",nil)] show];
- [self removeFun];
- return;
- }
-
- if (maskSwitch.on) {
- [HWDataManager setBoolWithKey:Consn_player_full_screen_show value:YES];
- //数据埋点
- [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_on"];
- }
- else{
- [HWDataManager setBoolWithKey:Consn_player_full_screen_show value:NO];
- //数据埋点
- [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Cloud_full_screen_off"];
- }
-
- [[NSNotificationCenter defaultCenter] postNotificationName:setPlayerFullScreenNotification object:nil];
- }
-
- [self removeFun];
- }
- #pragma mark 按钮事件
- - (void)didClickButtonFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
- HLog(@"%ld",tag);
-
- [self removeFun];
- if(tag == 1){
- return;
- }
-
- if(tag == 201 && but.selected){
- tag = 301;
- }
-
- if(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- - (void)removeFun
- {
- [self removeFromSuperview];
- }
- - (void)getCouldPhoneTvStatusFun:(NSNotification*)not
- {
- if(ksharedAppDelegate.TvStatusMod.isTVShowType){
- _TVButton.selected = YES;
- _TVShowLabel.text = NSLocalizedString(@"my_set_no_close_TV_p2p",nil);
- }
- else{
- _TVButton.selected = NO;
- _TVShowLabel.text = NSLocalizedString(@"my_set_no_TV_p2p",nil);
- }
- }
- @end
|