15
15
import android .widget .ImageView ;
16
16
import android .widget .RelativeLayout ;
17
17
import android .widget .TextView ;
18
- import com .dinuscxj .progressbar .CircleProgressBar ;
19
18
19
+ import com .dinuscxj .progressbar .CircleProgressBar ;
20
20
21
21
import org .json .JSONException ;
22
22
import org .json .JSONObject ;
@@ -59,6 +59,8 @@ public class AchievementsActivity extends NavigationBaseActivity {
59
59
CircleProgressBar imagesUploadedProgressbar ;
60
60
@ BindView (R .id .images_used_by_wiki_progressbar )
61
61
CircleProgressBar imagesUsedByWikiProgessbar ;
62
+ @ BindView (R .id .image_featured )
63
+ TextView imagesFeatured ;
62
64
@ Inject
63
65
SessionManager sessionManager ;
64
66
@ Inject
@@ -158,6 +160,9 @@ private void setAchievements() {
158
160
));
159
161
}
160
162
163
+ /**
164
+ * used to the count of images uploaded by user
165
+ */
161
166
private void setUploadCount () {
162
167
compositeDisposable .add (mediaWikiApi
163
168
.getUploadCount (sessionManager .getCurrentAccount ().name )
@@ -169,7 +174,12 @@ private void setUploadCount() {
169
174
));
170
175
}
171
176
177
+ /**
178
+ * used to the uploaded images progressbar
179
+ * @param uploadCount
180
+ */
172
181
private void setUploadProgress ( int uploadCount ){
182
+ Log .i ("uploadCount" ,Integer .toString (uploadCount ));
173
183
imagesUploadedProgressbar .setProgress (100 *uploadCount /25 );
174
184
imagesUploadedProgressbar .setProgressTextFormatPattern (uploadCount +"/25" );
175
185
}
@@ -186,17 +196,26 @@ private void parseJson(JSONObject object) {
186
196
achievements .setArticlesUsingImages (object .getInt ("articlesUsingImages" ));
187
197
achievements .setThanksReceived (object .getInt ("thanksReceived" ));
188
198
achievements .setImagesEditedBySomeoneElse (object .getInt ("imagesEditedBySomeoneElse" ));
199
+ JSONObject featuredImages = object .getJSONObject ("featuredImages" );
200
+ achievements .setFeaturedImages
201
+ (featuredImages .getInt ("Quality_images" ) +
202
+ featuredImages .getInt ("Featured_pictures_on_Wikimedia_Commons" ));
189
203
190
204
} catch (JSONException e ) {
191
205
e .printStackTrace ();
192
206
}
193
207
inflateAchievements (achievements );
194
208
}
195
209
210
+ /**
211
+ * Used the inflate the fetched statistics of the images uploaded by user
212
+ * @param achievements
213
+ */
196
214
private void inflateAchievements ( Achievements achievements ){
197
215
thanksReceived .setText (Integer .toString (achievements .getThanksReceived ()));
198
216
imagesUsedByWikiProgessbar .setProgress (100 *achievements .getUniqueUsedImages ()/25 );
199
217
imagesUsedByWikiProgessbar .setProgressTextFormatPattern (achievements .getUniqueUsedImages () + "/25" );
218
+ imagesFeatured .setText (Integer .toString (achievements .getFeaturedImages ()));
200
219
}
201
220
202
221
/**
0 commit comments