123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- //
- // editAPPBottomView.m
- // 双子星云手机
- //
- // Created by xd h on 2025/3/14.
- //
- #import "editAPPBottomView.h"
- #import "nasDownloadFileManager.h"
- @interface editAPPBottomView ()
- @property(nonatomic,strong) UIButton*oneButton;
- @property(nonatomic,strong) UIImageView*oneImageV;
- @property(nonatomic,strong) UILabel *oneLabel;
- @property(nonatomic,strong) UIButton*twoButton;
- @property(nonatomic,strong) UIImageView*twoImageV;
- @property(nonatomic,strong) UILabel *twoLabel;
- @property(nonatomic,strong) UIButton*threeButton;
- @property(nonatomic,strong) UIImageView*threeImageV;
- @property(nonatomic,strong) UILabel *threeLabel;
- @property(nonatomic,strong) UIButton*fourButton;
- @property(nonatomic,strong) UIImageView*fourImageV;
- @property(nonatomic,strong) UILabel *fourLabel;
- @end
- @implementation editAPPBottomView
- - (id)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- self.backgroundColor = [UIColor whiteColor];
- [self drawAnyView];
- return self;
- }
- - (void)drawAnyView{
-
- CGFloat curButFullWidth = SCREEN_W/3.0;
-
- _oneButton = [[UIButton alloc] init];
- [_oneButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- _oneButton.tag = 1;
- [self addSubview:_oneButton];
-
- [_oneButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.left.mas_equalTo(0);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
-
- _oneImageV = [[UIImageView alloc] init];
- _oneImageV.image = [UIImage imageNamed:@"edit_download_icon"];
- [_oneButton addSubview:_oneImageV];
-
- [_oneImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(25);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_oneButton.mas_centerX);
- make.centerY.equalTo(_oneButton.mas_centerY).offset(-10);
- }];
-
- _oneLabel = [[UILabel alloc] init];
- _oneLabel.textColor = [UIColor hwColor:@"#0A132B"];
- _oneLabel.textAlignment = NSTextAlignmentCenter;
- _oneLabel.font = [UIFont systemFontOfSize:12.0];
- _oneLabel.text = NSLocalizedString(@"my_set_no_File_download",nil);
- [_oneButton addSubview:_oneLabel];
-
- [_oneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_oneButton.mas_centerX);
- make.centerY.equalTo(_oneButton.mas_centerY).offset(10);
- }];
-
- _twoButton = [[UIButton alloc] init];
- [_twoButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- _twoButton.tag = 2;
- [self addSubview:_twoButton];
-
- [_twoButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.left.mas_equalTo(curButFullWidth);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
-
- _twoImageV = [[UIImageView alloc] init];
- _twoImageV.image = [UIImage imageNamed:@"edit_share_icon"];
- [_twoButton addSubview:_twoImageV];
-
- [_twoImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(25);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_twoButton.mas_centerX);
- make.centerY.equalTo(_twoButton.mas_centerY).offset(-10);
- }];
-
- _twoLabel = [[UILabel alloc] init];
- _twoLabel.textColor = [UIColor hwColor:@"#0A132B"];
- _twoLabel.textAlignment = NSTextAlignmentCenter;
- _twoLabel.font = [UIFont systemFontOfSize:12.0];
- _twoLabel.text = NSLocalizedString(@"common_edit_share",nil);
- [_twoButton addSubview:_twoLabel];
-
- [_twoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_twoButton.mas_centerX);
- make.centerY.equalTo(_twoButton.mas_centerY).offset(10);
- }];
-
-
- _threeButton = [[UIButton alloc] init];
- [_threeButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- _threeButton.tag = 3;
- [self addSubview:_threeButton];
-
- [_threeButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
-
- _threeImageV = [[UIImageView alloc] init];
- _threeImageV.image = [UIImage imageNamed:@"edit_del_icon"];
- [_threeButton addSubview:_threeImageV];
-
- [_threeImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(25);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_threeButton.mas_centerX);
- make.centerY.equalTo(_threeButton.mas_centerY).offset(-10);
- }];
-
- _threeLabel = [[UILabel alloc] init];
- _threeLabel.textColor = [UIColor hwColor:@"#0A132B"];
- _threeLabel.textAlignment = NSTextAlignmentCenter;
- _threeLabel.font = [UIFont systemFontOfSize:12.0];
- _threeLabel.text = NSLocalizedString(@"File_upload_Record_delete",nil);
- [_threeButton addSubview:_threeLabel];
-
- [_threeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_threeButton.mas_centerX);
- make.centerY.equalTo(_threeButton.mas_centerY).offset(10);
- }];
- //
-
- _fourButton = [[UIButton alloc] init];
- [_fourButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
- _fourButton.tag = 4;
- [self addSubview:_fourButton];
-
- [_fourButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
-
- _fourImageV = [[UIImageView alloc] init];
- _fourImageV.image = [UIImage imageNamed:@"edit_TV_icon"];
- [_fourButton addSubview:_fourImageV];
-
- [_fourImageV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(25);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_fourButton.mas_centerX);
- make.centerY.equalTo(_fourButton.mas_centerY).offset(-10);
- }];
-
- _fourLabel = [[UILabel alloc] init];
- _fourLabel.textColor = [UIColor hwColor:@"#0A132B"];
- _fourLabel.textAlignment = NSTextAlignmentCenter;
- _fourLabel.font = [UIFont systemFontOfSize:12.0];
- _fourLabel.text = NSLocalizedString(@"edit_install_TV_title",nil);
- [_fourButton addSubview:_fourLabel];
-
- [_fourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.height.mas_equalTo(25);
- make.centerX.equalTo(_fourButton.mas_centerX);
- make.centerY.equalTo(_fourButton.mas_centerY).offset(10);
- }];
- }
- - (void)didClickButFun:(UIButton*)but
- {
- NSInteger tag = but.tag;
-
- if(tag == 1){
- //1.4.3 新需求 有传输任务超过200个时 不给上传
- if([nasDownloadFileManager shareInstance].downLoadFileModelDataArr.count >= 200){
- [[iToast makeText:NSLocalizedString(@"download_task_not_done_tip",nil)] show];
- return;
- }
- }
-
- if(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- - (void)setIsCanShareType:(BOOL)isCanShareType
- {
- _isCanShareType = isCanShareType;
- [self updateUIFun];
- }
- - (void)setIsCanDeleteType:(BOOL)isCanDeleteType
- {
- _isCanDeleteType = isCanDeleteType;
- [self updateUIFun];
- }
- - (void)setButtonStateFunBy:(BOOL)canClick
- {
- CGFloat alpha = canClick ? 1.0 : 0.5;
- _oneButton.enabled = canClick;
- _twoButton.enabled = canClick;
- _threeButton.enabled = canClick;
- _fourButton.enabled = canClick;
-
- _oneButton.alpha = alpha;
- _twoButton.alpha = alpha;
- _threeButton.alpha = alpha;
- _fourButton.alpha = alpha;
- }
- - (void)updateUIFun
- {
- //test code
- //canShare = NO;
-
- NSInteger butNumber = 4;
- _twoButton.hidden = !_isCanShareType;
- _threeButton.hidden = !_isCanDeleteType;
-
- if(!_isCanShareType){
- butNumber -= 1;
- }
-
- if(!_isCanDeleteType){
- butNumber -= 1;
- }
-
- CGFloat curButFullWidth = SCREEN_W/butNumber;
-
- [_oneButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.left.mas_equalTo(0);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
-
- if (_isCanShareType) {
- [_twoButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.left.mas_equalTo(curButFullWidth);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
- }
-
-
- [_fourButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.right.mas_equalTo(0);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
-
- if (_isCanDeleteType) {
- [_threeButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(curButFullWidth);
- make.right.mas_equalTo(-curButFullWidth);
- make.height.mas_equalTo(60);
- make.top.mas_equalTo(0);
- }];
- }
-
- // if(canShare){
- // CGFloat curButFullWidth = SCREEN_W/3.0;
- // [_leftButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(curButFullWidth);
- // make.left.mas_equalTo(0);
- // make.height.mas_equalTo(60);
- // make.top.mas_equalTo(0);
- // }];
- //
- // [_midButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(curButFullWidth);
- // make.left.mas_equalTo(curButFullWidth);
- // make.height.mas_equalTo(60);
- // make.top.mas_equalTo(0);
- // }];
- //
- // [_rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(curButFullWidth);
- // make.right.mas_equalTo(0);
- // make.height.mas_equalTo(60);
- // make.top.mas_equalTo(0);
- // }];
- // }
- // else{
- // CGFloat curButFullWidth = SCREEN_W/2.0;
- // [_leftButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(curButFullWidth);
- // make.left.mas_equalTo(0);
- // make.height.mas_equalTo(60);
- // make.top.mas_equalTo(0);
- // }];
- //
- //// [_midButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- //// make.width.mas_equalTo(curButFullWidth);
- //// make.left.mas_equalTo(curButFullWidth);
- //// make.height.mas_equalTo(60);
- //// make.top.mas_equalTo(0);
- //// }];
- //
- // [_rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
- // make.width.mas_equalTo(curButFullWidth);
- // make.right.mas_equalTo(0);
- // make.height.mas_equalTo(60);
- // make.top.mas_equalTo(0);
- // }];
- // }
- }
- - (void)setIsBlackType:(BOOL)isBlackType
- {
- // _isBlackType = isBlackType;
- // if(isBlackType){
- // self.backgroundColor = [UIColor clearColor];
- //
- // // gradient
- // CAGradientLayer *gl = [CAGradientLayer layer];
- // gl.frame = CGRectMake(0,0,SCREEN_W,60 + AdaptTabHeight);
- // gl.startPoint = CGPointMake(0.5, 0);
- // gl.endPoint = CGPointMake(0.5, 1);
- // gl.colors = @[(__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0].CGColor, (__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor];
- // gl.locations = @[@(0), @(1.0f)];
- // //[self.layer addSublayer:gl];
- // [self.layer insertSublayer:gl atIndex:0];
- //
- // self.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0200].CGColor;
- // self.layer.shadowOffset = CGSizeMake(0,-1);
- // self.layer.shadowOpacity = 1;
- // self.layer.shadowRadius = 1;
- //
- // //
- // _leftImageV.image = [UIImage imageNamed:@"edit_download_white_icon"];
- // _leftLabel.textColor = [UIColor whiteColor];
- //
- // _midImageV.image = [UIImage imageNamed:@"edit_share_white_icon"];
- // _midLabel.textColor = [UIColor whiteColor];
- //
- // _rightImageV.image = [UIImage imageNamed:@"edit_del_white_icon"];
- // _rightLabel.textColor = [UIColor whiteColor];
- // }
- }
- @end
|