@@ -238,18 +238,18 @@ private void setAchievements() {
238238 // achievements calculator to fail in some cases, for more details
239239 // refer Issue: #3295
240240 if (numberOfEdits <= 150000 ) {
241- showSnackBarWithRetry ();
241+ showSnackBarWithRetry (false );
242242 } else {
243- showSnackBarUltimateAchievementWithRetry ( );
243+ showSnackBarWithRetry ( true );
244244 }
245245 }
246246 },
247247 t -> {
248248 Timber .e (t , "Fetching achievements statistics failed" );
249249 if (numberOfEdits <= 150000 ) {
250- showSnackBarWithRetry ();
250+ showSnackBarWithRetry (false );
251251 } else {
252- showSnackBarUltimateAchievementWithRetry ( );
252+ showSnackBarWithRetry ( true );
253253 }
254254 }
255255 ));
@@ -275,7 +275,7 @@ private void setWikidataEditCount() {
275275 .subscribeOn (Schedulers .io ())
276276 .observeOn (AndroidSchedulers .mainThread ())
277277 .subscribe (edits -> {
278- numberOfEdits + = edits ;
278+ numberOfEdits = edits ;
279279 wikidataEditsText .setText (String .valueOf (edits ));
280280 }, e -> {
281281 Timber .e ("Error:" + e );
@@ -285,22 +285,20 @@ private void setWikidataEditCount() {
285285 /**
286286 * Shows a snack bar which has an action button which on click dismisses the snackbar and invokes the
287287 * listener passed
288+ * @param tooManyAchievements if this value is true it means that the number of achievements of the
289+ * user are so high that it wrecks havoc with the Achievements calculator due to which request may time
290+ * out. Well this is the Ultimate Achievement
288291 */
289- private void showSnackBarWithRetry () {
290- progressBar .setVisibility (View .GONE );
291- ViewUtil .showDismissibleSnackBar (findViewById (android .R .id .content ),
292- R .string .achievements_fetch_failed , R .string .retry , view -> setAchievements ());
293- }
294-
295- /**
296- * Shows a snack bar which tells the users that their wiki edit count is so high that it (in some cases)
297- * wreks havoc with the Achievements calculator due to which request may time out
298- * Well this is the Ultimate Achievement
299- */
300- private void showSnackBarUltimateAchievementWithRetry () {
301- progressBar .setVisibility (View .GONE );
302- ViewUtil .showDismissibleSnackBar (findViewById (android .R .id .content ),
303- R .string .achievements_fetch_failed_ultimate_achievement , R .string .retry , view -> setAchievements ());
292+ private void showSnackBarWithRetry (boolean tooManyAchievements ) {
293+ if (tooManyAchievements ) {
294+ progressBar .setVisibility (View .GONE );
295+ ViewUtil .showDismissibleSnackBar (findViewById (android .R .id .content ),
296+ R .string .achievements_fetch_failed_ultimate_achievement , R .string .retry , view -> setAchievements ());
297+ } else {
298+ progressBar .setVisibility (View .GONE );
299+ ViewUtil .showDismissibleSnackBar (findViewById (android .R .id .content ),
300+ R .string .achievements_fetch_failed , R .string .retry , view -> setAchievements ());
301+ }
304302 }
305303
306304 /**
@@ -533,4 +531,4 @@ private boolean checkAccount(){
533531 return true ;
534532 }
535533
536- }
534+ }
0 commit comments