editAPPBottomView.m 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. //
  2. // editAPPBottomView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2025/3/14.
  6. //
  7. #import "editAPPBottomView.h"
  8. #import "nasDownloadFileManager.h"
  9. @interface editAPPBottomView ()
  10. @property(nonatomic,strong) UIButton*oneButton;
  11. @property(nonatomic,strong) UIImageView*oneImageV;
  12. @property(nonatomic,strong) UILabel *oneLabel;
  13. @property(nonatomic,strong) UIButton*twoButton;
  14. @property(nonatomic,strong) UIImageView*twoImageV;
  15. @property(nonatomic,strong) UILabel *twoLabel;
  16. @property(nonatomic,strong) UIButton*threeButton;
  17. @property(nonatomic,strong) UIImageView*threeImageV;
  18. @property(nonatomic,strong) UILabel *threeLabel;
  19. @property(nonatomic,strong) UIButton*fourButton;
  20. @property(nonatomic,strong) UIImageView*fourImageV;
  21. @property(nonatomic,strong) UILabel *fourLabel;
  22. @end
  23. @implementation editAPPBottomView
  24. - (id)initWithFrame:(CGRect)frame{
  25. self = [super initWithFrame:frame];
  26. self.backgroundColor = [UIColor whiteColor];
  27. [self drawAnyView];
  28. return self;
  29. }
  30. - (void)drawAnyView{
  31. CGFloat curButFullWidth = SCREEN_W/3.0;
  32. _oneButton = [[UIButton alloc] init];
  33. [_oneButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  34. _oneButton.tag = 1;
  35. [self addSubview:_oneButton];
  36. [_oneButton mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.width.mas_equalTo(curButFullWidth);
  38. make.left.mas_equalTo(0);
  39. make.height.mas_equalTo(60);
  40. make.top.mas_equalTo(0);
  41. }];
  42. _oneImageV = [[UIImageView alloc] init];
  43. _oneImageV.image = [UIImage imageNamed:@"edit_download_icon"];
  44. [_oneButton addSubview:_oneImageV];
  45. [_oneImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.width.mas_equalTo(25);
  47. make.height.mas_equalTo(25);
  48. make.centerX.equalTo(_oneButton.mas_centerX);
  49. make.centerY.equalTo(_oneButton.mas_centerY).offset(-10);
  50. }];
  51. _oneLabel = [[UILabel alloc] init];
  52. _oneLabel.textColor = [UIColor hwColor:@"#0A132B"];
  53. _oneLabel.textAlignment = NSTextAlignmentCenter;
  54. _oneLabel.font = [UIFont systemFontOfSize:12.0];
  55. _oneLabel.text = NSLocalizedString(@"my_set_no_File_download",nil);
  56. [_oneButton addSubview:_oneLabel];
  57. [_oneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  58. make.width.mas_equalTo(curButFullWidth);
  59. make.height.mas_equalTo(25);
  60. make.centerX.equalTo(_oneButton.mas_centerX);
  61. make.centerY.equalTo(_oneButton.mas_centerY).offset(10);
  62. }];
  63. _twoButton = [[UIButton alloc] init];
  64. [_twoButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  65. _twoButton.tag = 2;
  66. [self addSubview:_twoButton];
  67. [_twoButton mas_makeConstraints:^(MASConstraintMaker *make) {
  68. make.width.mas_equalTo(curButFullWidth);
  69. make.left.mas_equalTo(curButFullWidth);
  70. make.height.mas_equalTo(60);
  71. make.top.mas_equalTo(0);
  72. }];
  73. _twoImageV = [[UIImageView alloc] init];
  74. _twoImageV.image = [UIImage imageNamed:@"edit_share_icon"];
  75. [_twoButton addSubview:_twoImageV];
  76. [_twoImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  77. make.width.mas_equalTo(25);
  78. make.height.mas_equalTo(25);
  79. make.centerX.equalTo(_twoButton.mas_centerX);
  80. make.centerY.equalTo(_twoButton.mas_centerY).offset(-10);
  81. }];
  82. _twoLabel = [[UILabel alloc] init];
  83. _twoLabel.textColor = [UIColor hwColor:@"#0A132B"];
  84. _twoLabel.textAlignment = NSTextAlignmentCenter;
  85. _twoLabel.font = [UIFont systemFontOfSize:12.0];
  86. _twoLabel.text = NSLocalizedString(@"common_edit_share",nil);
  87. [_twoButton addSubview:_twoLabel];
  88. [_twoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  89. make.width.mas_equalTo(curButFullWidth);
  90. make.height.mas_equalTo(25);
  91. make.centerX.equalTo(_twoButton.mas_centerX);
  92. make.centerY.equalTo(_twoButton.mas_centerY).offset(10);
  93. }];
  94. _threeButton = [[UIButton alloc] init];
  95. [_threeButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  96. _threeButton.tag = 3;
  97. [self addSubview:_threeButton];
  98. [_threeButton mas_makeConstraints:^(MASConstraintMaker *make) {
  99. make.width.mas_equalTo(curButFullWidth);
  100. make.right.mas_equalTo(0);
  101. make.height.mas_equalTo(60);
  102. make.top.mas_equalTo(0);
  103. }];
  104. _threeImageV = [[UIImageView alloc] init];
  105. _threeImageV.image = [UIImage imageNamed:@"edit_del_icon"];
  106. [_threeButton addSubview:_threeImageV];
  107. [_threeImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  108. make.width.mas_equalTo(25);
  109. make.height.mas_equalTo(25);
  110. make.centerX.equalTo(_threeButton.mas_centerX);
  111. make.centerY.equalTo(_threeButton.mas_centerY).offset(-10);
  112. }];
  113. _threeLabel = [[UILabel alloc] init];
  114. _threeLabel.textColor = [UIColor hwColor:@"#0A132B"];
  115. _threeLabel.textAlignment = NSTextAlignmentCenter;
  116. _threeLabel.font = [UIFont systemFontOfSize:12.0];
  117. _threeLabel.text = NSLocalizedString(@"File_upload_Record_delete",nil);
  118. [_threeButton addSubview:_threeLabel];
  119. [_threeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  120. make.width.mas_equalTo(curButFullWidth);
  121. make.height.mas_equalTo(25);
  122. make.centerX.equalTo(_threeButton.mas_centerX);
  123. make.centerY.equalTo(_threeButton.mas_centerY).offset(10);
  124. }];
  125. //
  126. _fourButton = [[UIButton alloc] init];
  127. [_fourButton addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  128. _fourButton.tag = 4;
  129. [self addSubview:_fourButton];
  130. [_fourButton mas_makeConstraints:^(MASConstraintMaker *make) {
  131. make.width.mas_equalTo(curButFullWidth);
  132. make.right.mas_equalTo(0);
  133. make.height.mas_equalTo(60);
  134. make.top.mas_equalTo(0);
  135. }];
  136. _fourImageV = [[UIImageView alloc] init];
  137. _fourImageV.image = [UIImage imageNamed:@"edit_TV_icon"];
  138. [_fourButton addSubview:_fourImageV];
  139. [_fourImageV mas_makeConstraints:^(MASConstraintMaker *make) {
  140. make.width.mas_equalTo(25);
  141. make.height.mas_equalTo(25);
  142. make.centerX.equalTo(_fourButton.mas_centerX);
  143. make.centerY.equalTo(_fourButton.mas_centerY).offset(-10);
  144. }];
  145. _fourLabel = [[UILabel alloc] init];
  146. _fourLabel.textColor = [UIColor hwColor:@"#0A132B"];
  147. _fourLabel.textAlignment = NSTextAlignmentCenter;
  148. _fourLabel.font = [UIFont systemFontOfSize:12.0];
  149. _fourLabel.text = NSLocalizedString(@"edit_install_TV_title",nil);
  150. [_fourButton addSubview:_fourLabel];
  151. [_fourLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  152. make.width.mas_equalTo(curButFullWidth);
  153. make.height.mas_equalTo(25);
  154. make.centerX.equalTo(_fourButton.mas_centerX);
  155. make.centerY.equalTo(_fourButton.mas_centerY).offset(10);
  156. }];
  157. }
  158. - (void)didClickButFun:(UIButton*)but
  159. {
  160. NSInteger tag = but.tag;
  161. if(tag == 1){
  162. //1.4.3 新需求 有传输任务超过200个时 不给上传
  163. if([nasDownloadFileManager shareInstance].downLoadFileModelDataArr.count >= 200){
  164. [[iToast makeText:NSLocalizedString(@"download_task_not_done_tip",nil)] show];
  165. return;
  166. }
  167. }
  168. if(_didClickButtonFun){
  169. _didClickButtonFun(tag);
  170. }
  171. }
  172. - (void)setIsCanShareType:(BOOL)isCanShareType
  173. {
  174. _isCanShareType = isCanShareType;
  175. [self updateUIFun];
  176. }
  177. - (void)setIsCanDeleteType:(BOOL)isCanDeleteType
  178. {
  179. _isCanDeleteType = isCanDeleteType;
  180. [self updateUIFun];
  181. }
  182. - (void)setButtonStateFunBy:(BOOL)canClick
  183. {
  184. CGFloat alpha = canClick ? 1.0 : 0.5;
  185. _oneButton.enabled = canClick;
  186. _twoButton.enabled = canClick;
  187. _threeButton.enabled = canClick;
  188. _fourButton.enabled = canClick;
  189. _oneButton.alpha = alpha;
  190. _twoButton.alpha = alpha;
  191. _threeButton.alpha = alpha;
  192. _fourButton.alpha = alpha;
  193. }
  194. - (void)updateUIFun
  195. {
  196. //test code
  197. //canShare = NO;
  198. NSInteger butNumber = 4;
  199. _twoButton.hidden = !_isCanShareType;
  200. _threeButton.hidden = !_isCanDeleteType;
  201. if(!_isCanShareType){
  202. butNumber -= 1;
  203. }
  204. if(!_isCanDeleteType){
  205. butNumber -= 1;
  206. }
  207. CGFloat curButFullWidth = SCREEN_W/butNumber;
  208. [_oneButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  209. make.width.mas_equalTo(curButFullWidth);
  210. make.left.mas_equalTo(0);
  211. make.height.mas_equalTo(60);
  212. make.top.mas_equalTo(0);
  213. }];
  214. if (_isCanShareType) {
  215. [_twoButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  216. make.width.mas_equalTo(curButFullWidth);
  217. make.left.mas_equalTo(curButFullWidth);
  218. make.height.mas_equalTo(60);
  219. make.top.mas_equalTo(0);
  220. }];
  221. }
  222. [_fourButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  223. make.width.mas_equalTo(curButFullWidth);
  224. make.right.mas_equalTo(0);
  225. make.height.mas_equalTo(60);
  226. make.top.mas_equalTo(0);
  227. }];
  228. if (_isCanDeleteType) {
  229. [_threeButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  230. make.width.mas_equalTo(curButFullWidth);
  231. make.right.mas_equalTo(-curButFullWidth);
  232. make.height.mas_equalTo(60);
  233. make.top.mas_equalTo(0);
  234. }];
  235. }
  236. // if(canShare){
  237. // CGFloat curButFullWidth = SCREEN_W/3.0;
  238. // [_leftButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  239. // make.width.mas_equalTo(curButFullWidth);
  240. // make.left.mas_equalTo(0);
  241. // make.height.mas_equalTo(60);
  242. // make.top.mas_equalTo(0);
  243. // }];
  244. //
  245. // [_midButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  246. // make.width.mas_equalTo(curButFullWidth);
  247. // make.left.mas_equalTo(curButFullWidth);
  248. // make.height.mas_equalTo(60);
  249. // make.top.mas_equalTo(0);
  250. // }];
  251. //
  252. // [_rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  253. // make.width.mas_equalTo(curButFullWidth);
  254. // make.right.mas_equalTo(0);
  255. // make.height.mas_equalTo(60);
  256. // make.top.mas_equalTo(0);
  257. // }];
  258. // }
  259. // else{
  260. // CGFloat curButFullWidth = SCREEN_W/2.0;
  261. // [_leftButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  262. // make.width.mas_equalTo(curButFullWidth);
  263. // make.left.mas_equalTo(0);
  264. // make.height.mas_equalTo(60);
  265. // make.top.mas_equalTo(0);
  266. // }];
  267. //
  268. //// [_midButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  269. //// make.width.mas_equalTo(curButFullWidth);
  270. //// make.left.mas_equalTo(curButFullWidth);
  271. //// make.height.mas_equalTo(60);
  272. //// make.top.mas_equalTo(0);
  273. //// }];
  274. //
  275. // [_rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  276. // make.width.mas_equalTo(curButFullWidth);
  277. // make.right.mas_equalTo(0);
  278. // make.height.mas_equalTo(60);
  279. // make.top.mas_equalTo(0);
  280. // }];
  281. // }
  282. }
  283. - (void)setIsBlackType:(BOOL)isBlackType
  284. {
  285. // _isBlackType = isBlackType;
  286. // if(isBlackType){
  287. // self.backgroundColor = [UIColor clearColor];
  288. //
  289. // // gradient
  290. // CAGradientLayer *gl = [CAGradientLayer layer];
  291. // gl.frame = CGRectMake(0,0,SCREEN_W,60 + AdaptTabHeight);
  292. // gl.startPoint = CGPointMake(0.5, 0);
  293. // gl.endPoint = CGPointMake(0.5, 1);
  294. // 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];
  295. // gl.locations = @[@(0), @(1.0f)];
  296. // //[self.layer addSublayer:gl];
  297. // [self.layer insertSublayer:gl atIndex:0];
  298. //
  299. // self.layer.shadowColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0200].CGColor;
  300. // self.layer.shadowOffset = CGSizeMake(0,-1);
  301. // self.layer.shadowOpacity = 1;
  302. // self.layer.shadowRadius = 1;
  303. //
  304. // //
  305. // _leftImageV.image = [UIImage imageNamed:@"edit_download_white_icon"];
  306. // _leftLabel.textColor = [UIColor whiteColor];
  307. //
  308. // _midImageV.image = [UIImage imageNamed:@"edit_share_white_icon"];
  309. // _midLabel.textColor = [UIColor whiteColor];
  310. //
  311. // _rightImageV.image = [UIImage imageNamed:@"edit_del_white_icon"];
  312. // _rightLabel.textColor = [UIColor whiteColor];
  313. // }
  314. }
  315. @end