2
2
3
3
import android .app .AlertDialog ;
4
4
import android .os .Bundle ;
5
+ import android .text .TextUtils ;
5
6
import android .view .LayoutInflater ;
6
7
import android .view .View ;
7
8
import android .view .ViewGroup ;
10
11
11
12
import com .facebook .drawee .view .SimpleDraweeView ;
12
13
14
+ import java .util .ArrayList ;
15
+
13
16
import fr .free .nrw .commons .R ;
14
17
import fr .free .nrw .commons .Utils ;
15
18
import fr .free .nrw .commons .di .CommonsDaggerSupportFragment ;
@@ -26,7 +29,8 @@ public class ReviewImageFragment extends CommonsDaggerSupportFragment {
26
29
27
30
private int position ;
28
31
private String fileName ;
29
- private View textView ;
32
+ private String catString ;
33
+ private View catsView ;
30
34
private SimpleDraweeView simpleDraweeView ;
31
35
32
36
public void update (int position , String fileName ) {
@@ -38,6 +42,13 @@ public void update(int position, String fileName) {
38
42
}
39
43
}
40
44
45
+ public void updateCategories (Iterable <String > categories ) {
46
+ catString = TextUtils .join (", " , categories );
47
+ if (catsView != null ) {
48
+ ((TextView ) catsView ).setText (catString );
49
+ }
50
+ }
51
+
41
52
@ Override
42
53
public void onCreate (Bundle savedInstanceState ) {
43
54
super .onCreate (savedInstanceState );
@@ -49,14 +60,16 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
49
60
position = getArguments ().getInt ("position" );
50
61
View layoutView = inflater .inflate (R .layout .fragment_review_image , container ,
51
62
false );
52
- textView = layoutView .findViewById (R .id .reviewQuestion );
63
+ View textView = layoutView .findViewById (R .id .reviewQuestion );
64
+ catsView = layoutView .findViewById (R .id .reviewCategories );
53
65
String question ;
54
66
switch (position ) {
55
67
case COPYRIGHT :
56
68
question = getString (R .string .review_copyright );
57
69
break ;
58
70
case CATEGORY :
59
71
question = getString (R .string .review_category );
72
+ catsView .setVisibility (View .VISIBLE );
60
73
break ;
61
74
case SPAM :
62
75
question = getString (R .string .review_spam );
@@ -66,6 +79,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
66
79
}
67
80
((TextView ) textView ).setText (question );
68
81
simpleDraweeView = layoutView .findViewById (R .id .imageView );
82
+
83
+ if (fileName != null ) {
84
+ simpleDraweeView .setImageURI (Utils .makeThumbBaseUrl (fileName ));
85
+ }
86
+ if (catString != null ) {
87
+ ((TextView ) catsView ).setText (catString );
88
+ }
69
89
return layoutView ;
70
90
}
71
91
0 commit comments