CYGroupNameRankViewController.m 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. //
  2. // CYGroupNameRankViewController.m
  3. // shiku_im
  4. //
  5. // Created by Ron on 2019/11/14.
  6. // Copyright © 2019 Reese. All rights reserved.
  7. //
  8. #import "CYGroupNameRankViewController.h"
  9. #import "CYActiveTitleViewController.h"
  10. #import "JXRoomRemind.h"
  11. #define HEIGHT 50
  12. //#define IMGSIZE 150
  13. #define TopHeight 7
  14. #define CellHeight 45
  15. @interface CYGroupNameRankViewController ()
  16. @property (nonatomic,strong) UIImageView * memberView;
  17. @property (nonatomic,strong) UILabel * musicTypeLabel;
  18. @end
  19. @implementation CYGroupNameRankViewController{
  20. UISwitch *_topSwitch;
  21. UISwitch *_tipSwitch;
  22. }
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. // Do any additional setup after loading the view.self.isGotoBack = YES;
  26. self.isGotoBack = YES;
  27. self.title = @"群头衔";
  28. self.heightFooter = 0;
  29. self.heightHeader = JX_SCREEN_TOP;
  30. [self createHeadAndFoot];
  31. self.tableBody.scrollEnabled = YES;
  32. self.tableBody.contentSize = CGSizeMake(self_width, JX_SCREEN_HEIGHT - JX_SCREEN_TOP);
  33. self.tableBody.showsVerticalScrollIndicator = YES;
  34. int h = 0;
  35. [_memberView removeFromSuperview];
  36. _memberView = [[UIImageView alloc] initWithFrame:CGRectMake(0, h, JX_SCREEN_WIDTH, self.tableBody.frame.size.height)];
  37. _memberView.userInteractionEnabled = YES;
  38. _memberView.backgroundColor = HEXCOLOR(0xf0eff4);;
  39. [self.tableBody addSubview:_memberView];
  40. UIImageView *iv =[[UIImageView alloc] init];
  41. iv.backgroundColor = HEXCOLOR(0xf0eff4);
  42. iv = [self createButton:@"聊天窗口显示成员头衔" drawTop:YES drawBottom:YES must:NO click:nil superView:_memberView];
  43. iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
  44. _topSwitch = [[UISwitch alloc] init];
  45. _topSwitch.onTintColor = THEMECOLOR;
  46. _topSwitch.frame = CGRectMake(JX_SCREEN_WIDTH-INSETS-51, 6, 0, 0);
  47. _topSwitch.on = _isOpenIntegral;
  48. _topSwitch.center = CGPointMake(_topSwitch.center.x, iv.frame.size.height/2);
  49. [_topSwitch addTarget:self action:@selector(topSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
  50. // [_topSwitch setOn:self.user.topTime];
  51. [iv addSubview:_topSwitch];
  52. h+=iv.frame.size.height;
  53. // UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, h, JX_SCREEN_WIDTH -40, 100)];
  54. // label.backgroundColor = [UIColor clearColor];
  55. // label.numberOfLines = 0;
  56. // label.textColor = UIColor.blackColor;
  57. // label.textAlignment = NSTextAlignmentLeft;
  58. // label.text = @"开启后,好友将收藏至【特别关心】列表中,好友消息/生活圈将有声音提醒和特别提醒。特别关心的好友消息置顶";
  59. // [_memberView addSubview:label];
  60. //
  61. // h+=label.frame.size.height;
  62. // iv = [self createButton:@"好友消息特别提醒" drawTop:YES drawBottom:YES must:NO click:nil superView:_memberView];
  63. // iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
  64. // _tipSwitch = [[UISwitch alloc] init];
  65. // _tipSwitch.onTintColor = THEMECOLOR;
  66. // _tipSwitch.frame = CGRectMake(JX_SCREEN_WIDTH-INSETS-51, 6, 0, 0);
  67. // _tipSwitch.center = CGPointMake(_tipSwitch.center.x, iv.frame.size.height/2);
  68. // [_tipSwitch addTarget:self action:@selector(tipSwitchAction:) forControlEvents:UIControlEventTouchUpInside];
  69. // // [_topSwitch setOn:self.user.topTime];
  70. // [iv addSubview:_tipSwitch];
  71. // h+=iv.frame.size.height;
  72. iv = [self createButton:@"活跃头衔" drawTop:YES drawBottom:YES must:NO click:@selector(activeRankClick) superView:_memberView];
  73. iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT);
  74. // _musicTypeLabel = [self createLabel:iv default:@"叮咚"];
  75. // [iv addSubview:_musicTypeLabel];
  76. h+=iv.frame.size.height;
  77. // CGRect memFrame = _memberView.frame;
  78. // memFrame.size.height = h;
  79. // _memberView.frame = memFrame;
  80. [_memberView addSubview:iv];
  81. // return membHeight;
  82. }
  83. -(void)topSwitchAction:(UISwitch *)send{
  84. // printf();
  85. // NSLog(@"%lu",(unsigned long)_topSwitch.state);
  86. self.room.isOpenIntegral = send.on;
  87. [g_server updateRoomShowRead:self.room key:@"isOpenIntegral" value:self.room.isOpenIntegral toView:self]
  88. ;
  89. }
  90. //-(void)tipSwitchAction:(UISwitch *)send{
  91. //
  92. // // printf();
  93. // NSLog(@"%lu",(unsigned long)_tipSwitch.state);
  94. //}
  95. -(void)activeRankClick{
  96. CYActiveTitleViewController *VC =[[CYActiveTitleViewController alloc] init];
  97. VC.room = self.room;
  98. [g_navigation pushViewController:VC animated:true];
  99. }
  100. -(JXImageView*)createButton:(NSString*)title drawTop:(BOOL)drawTop drawBottom:(BOOL)drawBottom must:(BOOL)must click:(SEL)click superView:(UIView *)superView{
  101. JXImageView* btn = [[JXImageView alloc] init];
  102. btn.backgroundColor = [UIColor whiteColor];
  103. btn.userInteractionEnabled = YES;
  104. btn.didTouch = click;
  105. btn.delegate = self;
  106. [superView addSubview:btn];
  107. // [btn release];
  108. if(must){
  109. UILabel* p = [[UILabel alloc] initWithFrame:CGRectMake(INSETS, 5, 20, HEIGHT-5)];
  110. p.text = @"*";
  111. p.font = g_factory.font18;
  112. p.backgroundColor = [UIColor clearColor];
  113. p.textColor = [UIColor redColor];
  114. p.textAlignment = NSTextAlignmentCenter;
  115. [btn addSubview:p];
  116. // [p release];
  117. }
  118. JXLabel* p = [[JXLabel alloc] initWithFrame:CGRectMake(20, 0, 200, HEIGHT)];
  119. p.text = title;
  120. p.font = g_factory.font15;
  121. p.backgroundColor = [UIColor clearColor];
  122. p.textColor = [UIColor blackColor];
  123. [btn addSubview:p];
  124. // if (@selector(onRemark) == click) {
  125. // _labelLab = p;
  126. // }
  127. if(drawTop){
  128. UIView* line = [[UIView alloc] initWithFrame:CGRectMake(0,0,JX_SCREEN_WIDTH,0.3)];
  129. line.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1];
  130. [btn addSubview:line];
  131. }
  132. if(drawBottom){
  133. UIView* line = [[UIView alloc]initWithFrame:CGRectMake(0,HEIGHT-0.5,JX_SCREEN_WIDTH,0.3)];
  134. line.backgroundColor = [UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1];
  135. [btn addSubview:line];
  136. }
  137. //这个选择器仅用于判断,之后会修改为不可点击
  138. SEL check = @selector(switchAction:);
  139. //创建switch
  140. if(click == check){
  141. UISwitch * switchView = [[UISwitch alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-INSETS-51, 6, 20, 20)];
  142. if ([title isEqualToString:Localized(@"JX_MessageFree")]) {
  143. // _messageFreeSwitch = switchView;
  144. // if ([user.offlineNoPushMsg intValue] == 1) {
  145. // [_messageFreeSwitch setOn:YES];
  146. // }else {
  147. // [_messageFreeSwitch setOn:NO];
  148. // }
  149. }
  150. switchView.onTintColor = THEMECOLOR;
  151. [switchView addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventTouchUpInside];
  152. [btn addSubview:switchView];
  153. //取消调用switchAction
  154. btn.didTouch = @selector(hideKeyboard);
  155. }else if(click){
  156. btn.frame = CGRectMake(btn.frame.origin.x -20, btn.frame.origin.y, btn.frame.size.width, btn.frame.size.height);
  157. UIImageView* iv;
  158. iv = [[UIImageView alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH-INSETS-20-3, 15, 20, 20)];
  159. iv.image = [UIImage imageNamed:@"set_list_next"];
  160. [btn addSubview:iv];
  161. // [iv release];
  162. }
  163. return btn;
  164. }
  165. -(UILabel*)createLabel:(UIView*)parent default:(NSString*)s{
  166. UILabel* p = [[UILabel alloc] initWithFrame:CGRectMake(JX_SCREEN_WIDTH/2,INSETS,JX_SCREEN_WIDTH/2 - INSETS - 20 - 5,HEIGHT-INSETS*2)];
  167. p.userInteractionEnabled = NO;
  168. p.text = s;
  169. p.font = g_factory.font15;
  170. p.textAlignment = NSTextAlignmentRight;
  171. [parent addSubview:p];
  172. // [p release];
  173. return p;
  174. }
  175. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  176. [_wait stop];
  177. if( [aDownload.action isEqualToString:act_roomSet] ){
  178. JXUserObject * user = [[JXUserObject alloc]init];
  179. user = [user getUserById:self.room.roomJid];
  180. user.showRead = [NSNumber numberWithBool:self.room.showRead];
  181. user.showMember = [NSNumber numberWithBool:self.room.showMember];
  182. user.allowSendCard = [NSNumber numberWithBool:self.room.allowSendCard];
  183. user.chatRecordTimeOut = self.room.chatRecordTimeOut;
  184. user.talkTime = [NSNumber numberWithLong:self.room.talkTime];
  185. user.allowInviteFriend = [NSNumber numberWithBool:self.room.allowInviteFriend];
  186. user.allowUploadFile = [NSNumber numberWithBool:self.room.allowUploadFile];
  187. user.allowConference = [NSNumber numberWithBool:self.room.allowConference];
  188. user.allowSpeakCourse = [NSNumber numberWithBool:self.room.allowSpeakCourse];
  189. user.isNeedVerify = [NSNumber numberWithBool:self.room.isNeedVerify];
  190. [user update];
  191. JXRoomRemind* p = [[JXRoomRemind alloc] init];
  192. p.objectId = self.room.roomJid;
  193. p.type = [NSNumber numberWithInt:kRoomRemind_RoomIsOpenIntegral];
  194. p.content = [NSString stringWithFormat:@"%d",self.room.isOpenIntegral];
  195. [p notify];
  196. [g_App showAlert:Localized(@"JXAlert_UpdateOK")];
  197. }
  198. }
  199. /*
  200. #pragma mark - Navigation
  201. // In a storyboard-based application, you will often want to do a little preparation before navigation
  202. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  203. // Get the new view controller using [segue destinationViewController].
  204. // Pass the selected object to the new view controller.
  205. }
  206. */
  207. @end