| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,11 +68,12 @@ - (void)viewDidLoad { | |||
| 68 | 68 | weakSelf.selectedIndex = selectIndex; | |
| 69 | 69 | } | |
| 70 | 70 | }; | |
| 71 | + | ||
| 72 | + [self refresh]; | ||
| 71 | 73 | } | |
| 72 | 74 | ||
| 73 | 75 | - (void)viewWillAppear:(BOOL)animated{ | |
| 74 | 76 | [super viewWillAppear:animated]; | |
| 75 | - [self refresh]; | ||
| 76 | 77 | } | |
| 77 | 78 | ||
| 78 | 79 | - (void)viewWillDisappear:(BOOL)animated{ | |
@@ -102,15 +103,15 @@ - (void)setSelectedIndex:(NSInteger)selectedIndex{ | |||
| 102 | 103 | } | |
| 103 | 104 | ||
| 104 | 105 | - (NSArray *)titleList{ | |
| 105 | - NSArray *titleList = (_isMR? @[@"全部", | ||
| 106 | + NSArray *titleList = (_isMR? @[@"默认", | ||
| 106 | 107 | @"可合并", | |
| 107 | 108 | @"不可自动合并", | |
| 108 | 109 | @"已拒绝", | |
| 109 | 110 | @"已合并", | |
| 110 | 111 | ]: | |
| 111 | - @[@"全部", | ||
| 112 | - @"未处理", | ||
| 112 | + @[@"未处理", | ||
| 113 | 113 | @"已处理", | |
| 114 | + @"全部", | ||
| 114 | 115 | ]); | |
| 115 | 116 | return titleList; | |
| 116 | 117 | } | |
@@ -125,9 +126,6 @@ - (void)setupTitleBtn{ | |||
| 125 | 126 | } | |
| 126 | 127 | ||
| 127 | 128 | NSString *titleStr = [self titleList][_selectedIndex]; | |
| 128 | - if ([titleStr isEqualToString:@"全部"]) { | ||
| 129 | - titleStr = [titleStr stringByAppendingString:_isMR? @" MR": @"PR"]; | ||
| 130 | - } | ||
| 131 | 129 | CGFloat titleWidth = [titleStr getWidthWithFont:_titleBtn.titleLabel.font constrainedToSize:CGSizeMake(kScreen_Width, 30)]; | |
| 132 | 130 | CGFloat imageWidth = 12; | |
| 133 | 131 | CGFloat btnWidth = titleWidth +imageWidth; | |
@@ -153,7 +151,7 @@ - (MRPRS *)curMRPRS{ | |||
| 153 | 151 | MRPRS *curMRPRS = [_dataDict objectForKey:@(_selectedIndex)]; | |
| 154 | 152 | if (!curMRPRS) { | |
| 155 | 153 | ||
| 156 | - curMRPRS = [[MRPRS alloc] initWithType:_isMR? _selectedIndex: _selectedIndex + MRPRSTypePRAll userGK:_curProject.owner_user_name projectName:_curProject.name]; | ||
| 154 | + curMRPRS = [[MRPRS alloc] initWithType:_isMR? _selectedIndex: _selectedIndex + MRPRSTypePROpen userGK:_curProject.owner_user_name projectName:_curProject.name]; | ||
| 157 | 155 | [_dataDict setObject:curMRPRS forKey:@(_selectedIndex)]; | |
| 158 | 156 | } | |
| 159 | 157 | return curMRPRS; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,14 +10,14 @@ | |||
| 10 | 10 | #import "MRPR.h" | |
| 11 | 11 | ||
| 12 | 12 | typedef NS_ENUM(NSInteger, MRPRSType) { | |
| 13 | - MRPRSTypeMRAll = 0, | ||
| 13 | + MRPRSTypeMRDefault = 0, | ||
| 14 | 14 | MRPRSTypeMRCanMerge, | |
| 15 | 15 | MRPRSTypeMRCannotMerge, | |
| 16 | 16 | MRPRSTypeMRRefused, | |
| 17 | 17 | MRPRSTypeMRAccepted, | |
| 18 | - MRPRSTypePRAll, | ||
| 19 | 18 | MRPRSTypePROpen, | |
| 20 | - MRPRSTypePRClosed | ||
| 19 | + MRPRSTypePRClosed, | ||
| 20 | + MRPRSTypePRAll, | ||
| 21 | 21 | }; | |
| 22 | 22 | ||
| 23 | 23 | @interface MRPRS : NSObject | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,16 +45,12 @@ - (NSDictionary *)toParams{ | |||
| 45 | 45 | } | |
| 46 | 46 | - (NSString *)toPath{ | |
| 47 | 47 | NSString *typeStr; | |
| 48 | - if (_type < MRPRSTypePRAll) { | ||
| 49 | - if (_type == MRPRSTypeMRAll) { | ||
| 50 | - typeStr = @"merges/all"; | ||
| 51 | - }else{ | ||
| 52 | - typeStr = @"merges/filter"; | ||
| 53 | - } | ||
| 48 | + if (_type < MRPRSTypePROpen) { | ||
| 49 | + typeStr = @"merges/filter"; | ||
| 54 | 50 | }else{ | |
| 55 | - typeStr = (_type == MRPRSTypePRAll? @"pulls/all": | ||
| 56 | - _type == MRPRSTypePROpen? @"pulls/open": | ||
| 51 | + typeStr = (_type == MRPRSTypePROpen? @"pulls/open": | ||
| 57 | 52 | _type == MRPRSTypePRClosed? @"pulls/closed": | |
| 53 | + _type == MRPRSTypePRAll? @"pulls/all": | ||
| 58 | 54 | @""); | |
| 59 | 55 | } | |
| 60 | 56 | return [NSString stringWithFormat:@"api/user/%@/project/%@/git/%@", _user_gk, _project_name, typeStr]; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,7 +94,7 @@ - (void)setCurMRPR:(MRPR *)curMRPR{ | |||
| 94 | 94 | _titleL.text = _curMRPR.title; | |
| 95 | 95 | _numL.text = [NSString stringWithFormat:@"#%@", _curMRPR.iid.stringValue ?: @""]; | |
| 96 | 96 | _authorL.text = _curMRPR.author.name; | |
| 97 | - _timeL.text = [_curMRPR.created_at stringTimesAgo]; | ||
| 97 | + _timeL.text = [_curMRPR.created_at stringDisplay_HHmm]; | ||
| 98 | 98 | _commentCountL.text = _curMRPR.comment_count.stringValue; | |
| 99 | 99 | _commentCountL.hidden = _commentIcon.hidden = (_curMRPR.comment_count == nil); | |
| 100 | 100 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -133,7 +133,11 @@ - (void)setCurMRPRInfo:(MRPRBaseInfo *)curMRPRInfo{ | |||
| 133 | 133 | ||
| 134 | 134 | _timeL.attributedText = [self attributeTail]; | |
| 135 | 135 | _statusL.text = _curMRPRInfo.mrpr.statusDisplay; | |
| 136 | - | ||
| 136 | + _statusL.textColor = [UIColor colorWithHexString:(_curMRPRInfo.mrpr.status == MRPRStatusCanMerge? @"0x666666": | ||
| 137 | + _curMRPRInfo.mrpr.status == MRPRStatusCannotMerge? @"0xB89FDA": | ||
| 138 | + _curMRPRInfo.mrpr.status == MRPRStatusAccepted? @"0x32BE77": | ||
| 139 | + _curMRPRInfo.mrpr.status == MRPRStatusRefused? @"0xF56061": | ||
| 140 | + @"0xF56061")]; | ||
| 137 | 141 | NSString *fromStr, *toStr; | |
| 138 | 142 | if (_curMRPRInfo.mrpr.isMR) { | |
| 139 | 143 | fromStr = [NSString stringWithFormat:@" %@ ", _curMRPRInfo.mrpr.srcBranch]; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -90,9 +90,10 @@ - (UIView *)myContentView{ | |||
| 90 | 90 | - (UITableView *)myTableView{ | |
| 91 | 91 | if (!_myTableView) { | |
| 92 | 92 | _myTableView = ({ | |
| 93 | - UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; | ||
| 93 | + UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; | ||
| 94 | + tableView.backgroundColor = [UIColor whiteColor]; | ||
| 94 | 95 | [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellIdentifier_BranchTag]; | |
| 95 | - tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; | ||
| 96 | + tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
| 96 | 97 | tableView.dataSource = self; | |
| 97 | 98 | tableView.delegate = self; | |
| 98 | 99 | tableView; | |
@@ -135,6 +136,11 @@ - (void)loadUIElement{ | |||
| 135 | 136 | [self.myContentView addSubview:self.mySegmentedControl]; | |
| 136 | 137 | ||
| 137 | 138 | self.mySegmentedControl.frame = CGRectMake(12, (kCodeBranchTagButton_NavHeight - 30)/2, kScreen_Width - 2*12, 30); | |
| 139 | + { | ||
| 140 | + UIView *lineV = [[UIView alloc] initWithFrame:CGRectMake(0, kCodeBranchTagButton_NavHeight, kScreen_Width, 1.0/[UIScreen mainScreen].scale)]; | ||
| 141 | + lineV.backgroundColor = kColorDDD; | ||
| 142 | + [self.myContentView addSubview:lineV]; | ||
| 143 | + } | ||
| 138 | 144 | self.myContentView.frame = CGRectMake(0, 0, kScreen_Width, 0); | |
| 139 | 145 | self.myTableView.frame = CGRectMake(0, kCodeBranchTagButton_NavHeight, kScreen_Width, 0); | |
| 140 | 146 | ||
@@ -151,7 +157,7 @@ - (void)changeShowing{ | |||
| 151 | 157 | [self loadUIElement]; | |
| 152 | 158 | } | |
| 153 | 159 | CGPoint origin = [self convertPoint:CGPointMake(0, CGRectGetHeight(self.bounds)) toView:self.showingContainerView]; | |
| 154 | - CGFloat contentHeight = self.isShowing? 0: kCodeBranchTagButton_ContentHeight; | ||
| 160 | + CGFloat contentHeight = self.isShowing? 0: CGRectGetHeight(self.showingContainerView.bounds) - origin.y; | ||
| 155 | 161 | if (self.isShowing) {//隐藏 | |
| 156 | 162 | self.enabled = NO; | |
| 157 | 163 | [UIView animateWithDuration:0.3 animations:^{ | |
@@ -255,26 +261,30 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger | |||
| 255 | 261 | return [self.dataList count]; | |
| 256 | 262 | } | |
| 257 | 263 | ||
| 258 | - - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ | ||
| 259 | - return 0.5; | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | - - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | ||
| 263 | - return 0.5; | ||
| 264 | - } | ||
| 265 | - | ||
| 266 | 264 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 267 | 265 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_BranchTag forIndexPath:indexPath]; | |
| 268 | - cell.textLabel.textColor = [UIColor blackColor]; | ||
| 269 | 266 | cell.textLabel.font = [UIFont systemFontOfSize:15]; | |
| 270 | - | ||
| 267 | + cell.backgroundColor = [UIColor whiteColor]; | ||
| 268 | + cell.tintColor = kColorBrandGreen; | ||
| 269 | + | ||
| 271 | 270 | CodeBranchOrTag *curBranchOrTag = [self.dataList objectAtIndex:indexPath.row]; | |
| 272 | 271 | cell.textLabel.text = curBranchOrTag.name; | |
| 273 | 272 | ||
| 274 | 273 | if ([curBranchOrTag.name isEqualToString:self.titleStr]) { | |
| 275 | - cell.backgroundColor = [UIColor colorWithHexString:@"0xf3f3f3"]; | ||
| 274 | + cell.textLabel.textColor = kColorBrandGreen; | ||
| 275 | + cell.accessoryType = UITableViewCellAccessoryCheckmark; | ||
| 276 | 276 | }else{ | |
| 277 | - cell.backgroundColor = [UIColor whiteColor]; | ||
| 277 | + cell.textLabel.textColor = [UIColor blackColor]; | ||
| 278 | + cell.accessoryType = UITableViewCellAccessoryNone; | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + static NSInteger lineTag = 11011; | ||
| 282 | + if (![cell.contentView viewWithTag:lineTag]) { | ||
| 283 | + CGFloat lineH = 1.0/[UIScreen mainScreen].scale; | ||
| 284 | + UIView *lineV = [[UIView alloc] initWithFrame:CGRectMake(15, 44 - lineH, kScreen_Width, lineH)]; | ||
| 285 | + lineV.tag = lineTag; | ||
| 286 | + lineV.backgroundColor = kColorDDD; | ||
| 287 | + [cell.contentView addSubview:lineV]; | ||
| 278 | 288 | } | |
| 279 | 289 | return cell; | |
| 280 | 290 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments