18
18
19
19
import com .loopj .android .http .RequestParams ;
20
20
21
- import net .coding .program .common .BlankViewDisplay ;
22
- import net .coding .program .common .network .NetworkImpl ;
23
- import net .coding .program .common .util .DensityUtil ;
24
21
import net .coding .program .MyApp ;
25
22
import net .coding .program .R ;
23
+ import net .coding .program .common .BlankViewDisplay ;
26
24
import net .coding .program .common .ClickSmallImage ;
27
25
import net .coding .program .common .Global ;
28
26
import net .coding .program .common .LongClickLinkMovementMethod ;
32
30
import net .coding .program .common .comment .BaseCommentParam ;
33
31
import net .coding .program .common .htmltext .URLSpanNoUnderline ;
34
32
import net .coding .program .common .network .MyAsyncHttpClient ;
33
+ import net .coding .program .common .network .NetworkImpl ;
35
34
import net .coding .program .common .ui .BackActivity ;
36
35
import net .coding .program .common .umeng .UmengEvent ;
36
+ import net .coding .program .common .util .DensityUtil ;
37
37
import net .coding .program .common .widget .DataAdapter ;
38
38
import net .coding .program .common .widget .ListItem1 ;
39
39
import net .coding .program .model .BaseComment ;
@@ -77,7 +77,7 @@ public class MergeDetailActivity extends BackActivity {
77
77
public static final int RESULT_MERGE = 2 ;
78
78
public static final int RESULT_RESUSE_REFRESOURCE = 3 ;
79
79
80
- // private static final String HOST_MERGE_COMMENTS = "HOST_MERGE_COMMENTS";
80
+ // private static final String HOST_MERGE_COMMENTS = "HOST_MERGE_COMMENTS";
81
81
private static final String HOST_MERGE_REFUSE = "HOST_MERGE_REFUSE" ;
82
82
private static final String HOST_MERGE_CANNEL = "HOST_MERGE_CANNEL" ;
83
83
private static final String HOST_MERGE_DETAIL = "HOST_MERGE_DETAIL" ;
@@ -87,26 +87,16 @@ public class MergeDetailActivity extends BackActivity {
87
87
88
88
@ Extra
89
89
ProjectObject mProject ;
90
+
90
91
@ Extra
91
92
Merge mMerge ;
92
93
93
94
@ Extra
94
95
String mMergeUrl ;
95
96
96
97
@ ViewById
97
- View actionLayout ;
98
- @ ViewById
99
- View actionAccept ;
100
- @ ViewById
101
- View actionRefuse ;
102
- @ ViewById
103
- View actionCancel ;
104
- @ ViewById
105
- View actionAuth ;
106
- @ ViewById
107
- View actionCancelAuth ;
108
- @ ViewById
109
- View blankLayout ;
98
+ View actionLayout , actionAccept , actionRefuse , actionCancel , actionAuth , actionCancelAuth , blankLayout ;
99
+
110
100
@ ViewById
111
101
ListView listView ;
112
102
@@ -117,24 +107,16 @@ public class MergeDetailActivity extends BackActivity {
117
107
private ArrayList <Merge .Reviewer > reviewerList = new ArrayList <>();
118
108
private ArrayList <DynamicObject .DynamicMergeRequest > dynamicList = new ArrayList <>();
119
109
120
- Comparator <DynamicObject .DynamicBaseObject > mDynamicSorter = new Comparator <DynamicObject .DynamicBaseObject >() {
121
- @ Override
122
- public int compare (DynamicObject .DynamicBaseObject lhs , DynamicObject .DynamicBaseObject rhs ) {
123
- return (int ) (lhs .created_at - rhs .created_at );
124
- }
125
- };
110
+ Comparator <DynamicObject .DynamicBaseObject > mDynamicSorter = (lhs , rhs ) -> (int ) (lhs .created_at - rhs .created_at );
126
111
127
112
View .OnClickListener mOnClickItem = new View .OnClickListener () {
128
113
@ Override
129
114
public void onClick (View v ) {
130
115
final BaseComment item = (BaseComment ) v .getTag ();
131
116
if (item .isMy ()) {
132
- showDialog ("merge" , "删除评论?" , new DialogInterface .OnClickListener () {
133
- @ Override
134
- public void onClick (DialogInterface dialog , int which ) {
135
- String url = mMerge .getHttpDeleteComment (item .id );
136
- deleteNetwork (url , HOST_DELETE_COMMENT , item );
137
- }
117
+ showDialog ("merge" , "删除评论?" , (dialog , which ) -> {
118
+ String url = mMerge .getHttpDeleteComment (item .id );
119
+ deleteNetwork (url , HOST_DELETE_COMMENT , item );
138
120
});
139
121
} else {
140
122
String name = item .owner .name ;
@@ -220,18 +202,15 @@ public View getView(int position, View convertView, ViewGroup parent) {
220
202
if (type == 2 ) {
221
203
holder .mContent2 .setText (data .content (myImageGetter ));
222
204
holder .mContent2 .setVisibility (View .VISIBLE );
223
- holder .mContent2 .setOnClickListener (new View .OnClickListener () {
224
- @ Override
225
- public void onClick (View v ) {
226
- DiffFile .DiffSingleFile fileData =
227
- ((DynamicObject .DynamicMergeRequestCommentCommit ) data ).getDiffSingleFile ();
228
- MergeFileDetailActivity_
229
- .intent (MergeDetailActivity .this )
230
- .mProjectPath (mMerge .getProjectPath ())
231
- .mergeIid (mMerge .getIid ())
232
- .mSingleFile (fileData )
233
- .start ();
234
- }
205
+ holder .mContent2 .setOnClickListener (v -> {
206
+ DiffFile .DiffSingleFile fileData =
207
+ ((DynamicObject .DynamicMergeRequestCommentCommit ) data ).getDiffSingleFile ();
208
+ MergeFileDetailActivity_
209
+ .intent (MergeDetailActivity .this )
210
+ .mProjectPath (mMerge .getProjectPath ())
211
+ .mergeIid (mMerge .getIid ())
212
+ .mSingleFile (fileData )
213
+ .start ();
235
214
});
236
215
} else {
237
216
holder .mContent2 .setVisibility (View .GONE );
@@ -247,6 +226,7 @@ class DynamicHolder {
247
226
public TextView mContent2 ;
248
227
private View timeLineUp ;
249
228
private View timeLineDown ;
229
+
250
230
public DynamicHolder (View convertView ) {
251
231
mIcon = (ImageView ) convertView .findViewById (R .id .icon );
252
232
mContent = (TextView ) convertView .findViewById (R .id .content );
@@ -362,7 +342,7 @@ private void updateBottomBarStyle() {
362
342
int granted = mMerge .getGranted ();
363
343
364
344
boolean showCancel = mMerge .authorIsMe ();
365
- boolean showMerge = canEdit || ( granted == 1 && mMerge .authorIsMe ());
345
+ boolean showMerge = canEdit || (granted == 1 && mMerge .authorIsMe ());
366
346
boolean showRefuse = canEdit ;
367
347
boolean showAuth = canEdit && granted == 0 && !mMerge .authorIsMe () && !mMergeDetail .authorCanEdit ();
368
348
boolean showCancelAuth = canEdit && granted == 1 && !mMerge .authorIsMe () && !mMergeDetail .authorCanEdit ();
@@ -378,7 +358,7 @@ private void updateBottomBarStyle() {
378
358
379
359
380
360
/**
381
- * @param accept 这个参数可以为 null,代表不可合并,但是显示合并按钮,并 50% 透明
361
+ * @param accept 这个参数可以为 null,代表不可合并,但是显示合并按钮,并 50% 透明
382
362
*/
383
363
private void setActionStyle (Boolean accept , boolean refuse , boolean cancel , boolean auth , boolean cancelAuth ) {
384
364
if (!refuse && accept != null && !accept && !cancel && !auth && !cancelAuth ) {
@@ -405,7 +385,7 @@ private void setActionStyle(Boolean accept, boolean refuse, boolean cancel, bool
405
385
protected final void actionAccept (View view ) {
406
386
if (view .getTag () == null ) {
407
387
MergeAcceptActivity_ .intent (this ).mMergeDetail (mMergeDetail ).startForResult (RESULT_MERGE );
408
- } else {
388
+ } else {
409
389
showDialog ("提示" , "Coding 不能帮你在线自动合并这个请求。" , null , null , "知道了" , null );
410
390
}
411
391
}
@@ -759,9 +739,9 @@ public void onMySuccess(JSONObject response) {
759
739
activityJson = ((JSONArray ) object ).getJSONObject (0 );
760
740
if (activityJson .has ("diff_html" )) {
761
741
isCommentCommit = true ;
762
- activityJson .put ("action" , "comment_commit" );
742
+ activityJson .put ("action" , "comment_commit" );
763
743
} else {
764
- activityJson .put ("action" , "comment" );
744
+ activityJson .put ("action" , "comment" );
765
745
}
766
746
} else if (object instanceof JSONObject ) { // activity 的结构是 data : [ activity , activity]
767
747
activityJson = (JSONObject ) object ;
@@ -927,7 +907,7 @@ public void onClick(View v) {
927
907
} else {
928
908
shouldShowCount = reviewerList .size ();
929
909
}
930
- for (int i = 0 ; i < shouldShowCount ; i ++) {
910
+ for (int i = 0 ; i < shouldShowCount ; i ++) {
931
911
Merge .Reviewer reviewer = reviewerList .get (i );
932
912
if (reviewer .user .global_key .equals (mMerge .getAuthor ().global_key )) {
933
913
continue ;
@@ -951,7 +931,7 @@ public void onClick(View v) {
951
931
} else {
952
932
reviewersLayout .addView (circleImageView , lp );
953
933
}
954
- addedCount ++;
934
+ addedCount ++;
955
935
iconfromNetwork (circleImageView , reviewer .user .avatar );
956
936
}
957
937
if (shouldShowMore ) {
0 commit comments