Skip to content

Commit 3aaf10f

Browse files
committed
改来改去改 UI
1 parent 1410024 commit 3aaf10f

File tree

6 files changed

+44
-36
lines changed

6 files changed

+44
-36
lines changed

Coding_iOS/Controllers/MRPRListViewController.m

+6-8
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ - (void)viewDidLoad {
6868
weakSelf.selectedIndex = selectIndex;
6969
}
7070
};
71+
72+
[self refresh];
7173
}
7274

7375
- (void)viewWillAppear:(BOOL)animated{
7476
[super viewWillAppear:animated];
75-
[self refresh];
7677
}
7778

7879
- (void)viewWillDisappear:(BOOL)animated{
@@ -102,15 +103,15 @@ - (void)setSelectedIndex:(NSInteger)selectedIndex{
102103
}
103104

104105
- (NSArray *)titleList{
105-
NSArray *titleList = (_isMR? @[@"全部",
106+
NSArray *titleList = (_isMR? @[@"默认",
106107
@"可合并",
107108
@"不可自动合并",
108109
@"已拒绝",
109110
@"已合并",
110111
]:
111-
@[@"全部",
112-
@"未处理",
112+
@[@"未处理",
113113
@"已处理",
114+
@"全部",
114115
]);
115116
return titleList;
116117
}
@@ -125,9 +126,6 @@ - (void)setupTitleBtn{
125126
}
126127

127128
NSString *titleStr = [self titleList][_selectedIndex];
128-
if ([titleStr isEqualToString:@"全部"]) {
129-
titleStr = [titleStr stringByAppendingString:_isMR? @" MR": @"PR"];
130-
}
131129
CGFloat titleWidth = [titleStr getWidthWithFont:_titleBtn.titleLabel.font constrainedToSize:CGSizeMake(kScreen_Width, 30)];
132130
CGFloat imageWidth = 12;
133131
CGFloat btnWidth = titleWidth +imageWidth;
@@ -153,7 +151,7 @@ - (MRPRS *)curMRPRS{
153151
MRPRS *curMRPRS = [_dataDict objectForKey:@(_selectedIndex)];
154152
if (!curMRPRS) {
155153

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];
157155
[_dataDict setObject:curMRPRS forKey:@(_selectedIndex)];
158156
}
159157
return curMRPRS;

Coding_iOS/Models/MRPRS.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#import "MRPR.h"
1111

1212
typedef NS_ENUM(NSInteger, MRPRSType) {
13-
MRPRSTypeMRAll = 0,
13+
MRPRSTypeMRDefault = 0,
1414
MRPRSTypeMRCanMerge,
1515
MRPRSTypeMRCannotMerge,
1616
MRPRSTypeMRRefused,
1717
MRPRSTypeMRAccepted,
18-
MRPRSTypePRAll,
1918
MRPRSTypePROpen,
20-
MRPRSTypePRClosed
19+
MRPRSTypePRClosed,
20+
MRPRSTypePRAll,
2121
};
2222

2323
@interface MRPRS : NSObject

Coding_iOS/Models/MRPRS.m

+4-8
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,12 @@ - (NSDictionary *)toParams{
4545
}
4646
- (NSString *)toPath{
4747
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";
5450
}else{
55-
typeStr = (_type == MRPRSTypePRAll? @"pulls/all":
56-
_type == MRPRSTypePROpen? @"pulls/open":
51+
typeStr = (_type == MRPRSTypePROpen? @"pulls/open":
5752
_type == MRPRSTypePRClosed? @"pulls/closed":
53+
_type == MRPRSTypePRAll? @"pulls/all":
5854
@"");
5955
}
6056
return [NSString stringWithFormat:@"api/user/%@/project/%@/git/%@", _user_gk, _project_name, typeStr];

Coding_iOS/Views/Cell/MRPRListCell.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ - (void)setCurMRPR:(MRPR *)curMRPR{
9494
_titleL.text = _curMRPR.title;
9595
_numL.text = [NSString stringWithFormat:@"#%@", _curMRPR.iid.stringValue ?: @""];
9696
_authorL.text = _curMRPR.author.name;
97-
_timeL.text = [_curMRPR.created_at stringTimesAgo];
97+
_timeL.text = [_curMRPR.created_at stringDisplay_HHmm];
9898
_commentCountL.text = _curMRPR.comment_count.stringValue;
9999
_commentCountL.hidden = _commentIcon.hidden = (_curMRPR.comment_count == nil);
100100

Coding_iOS/Views/Cell/MRPRTopCell.m

+5-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ - (void)setCurMRPRInfo:(MRPRBaseInfo *)curMRPRInfo{
133133

134134
_timeL.attributedText = [self attributeTail];
135135
_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")];
137141
NSString *fromStr, *toStr;
138142
if (_curMRPRInfo.mrpr.isMR) {
139143
fromStr = [NSString stringWithFormat:@" %@ ", _curMRPRInfo.mrpr.srcBranch];

Coding_iOS/Views/CodeBranchTagButton.m

+25-15
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ - (UIView *)myContentView{
9090
- (UITableView *)myTableView{
9191
if (!_myTableView) {
9292
_myTableView = ({
93-
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
93+
UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
94+
tableView.backgroundColor = [UIColor whiteColor];
9495
[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellIdentifier_BranchTag];
95-
tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
96+
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
9697
tableView.dataSource = self;
9798
tableView.delegate = self;
9899
tableView;
@@ -135,6 +136,11 @@ - (void)loadUIElement{
135136
[self.myContentView addSubview:self.mySegmentedControl];
136137

137138
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+
}
138144
self.myContentView.frame = CGRectMake(0, 0, kScreen_Width, 0);
139145
self.myTableView.frame = CGRectMake(0, kCodeBranchTagButton_NavHeight, kScreen_Width, 0);
140146

@@ -151,7 +157,7 @@ - (void)changeShowing{
151157
[self loadUIElement];
152158
}
153159
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;
155161
if (self.isShowing) {//隐藏
156162
self.enabled = NO;
157163
[UIView animateWithDuration:0.3 animations:^{
@@ -255,26 +261,30 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
255261
return [self.dataList count];
256262
}
257263

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-
266264
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
267265
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier_BranchTag forIndexPath:indexPath];
268-
cell.textLabel.textColor = [UIColor blackColor];
269266
cell.textLabel.font = [UIFont systemFontOfSize:15];
270-
267+
cell.backgroundColor = [UIColor whiteColor];
268+
cell.tintColor = kColorBrandGreen;
269+
271270
CodeBranchOrTag *curBranchOrTag = [self.dataList objectAtIndex:indexPath.row];
272271
cell.textLabel.text = curBranchOrTag.name;
273272

274273
if ([curBranchOrTag.name isEqualToString:self.titleStr]) {
275-
cell.backgroundColor = [UIColor colorWithHexString:@"0xf3f3f3"];
274+
cell.textLabel.textColor = kColorBrandGreen;
275+
cell.accessoryType = UITableViewCellAccessoryCheckmark;
276276
}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];
278288
}
279289
return cell;
280290
}

0 commit comments

Comments
 (0)