From 5089cca6496dbf2987919fe42624f7f9af6cac08 Mon Sep 17 00:00:00 2001 From: bxy379987 Date: Fri, 8 Nov 2024 04:56:49 +1100 Subject: [PATCH] fix issue 5847, The upload icon is now set to always be visible, while the original code has been commented out and retained with a note for potential re-use in the future. --- .../contributions/ContributionController.java | 35 ++++++++++--------- .../contributions/ContributionsFragment.java | 13 ++++--- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java index 1251d1027..ce0938001 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java @@ -45,7 +45,8 @@ public class ContributionController { private boolean isInAppCameraUpload; public LocationPermissionCallback locationPermissionCallback; private LocationPermissionsHelper locationPermissionsHelper; - LiveData> failedAndPendingContributionList; + // originally called by function getFailedAndPendingContributions,comment out to make the Upload Icon always visible(Issue 5847), + // LiveData> failedAndPendingContributionList; LiveData> pendingContributionList; LiveData> failedContributionList; @@ -358,21 +359,23 @@ public class ContributionController { } /** - * Fetches the contributions with the state "IN_PROGRESS", "QUEUED", "PAUSED" and "FAILED" and + * This section of code was originally used to fetch the contributions with the state "IN_PROGRESS", "QUEUED", "PAUSED" and "FAILED" and * then it populates the `failedAndPendingContributionList`. + * According to Issue5847 and the owner's request: "make the upload icon always visible and adjust the count accordingly," + * This section of code has been temporarily commented out **/ - void getFailedAndPendingContributions() { - final PagedList.Config pagedListConfig = - (new PagedList.Config.Builder()) - .setPrefetchDistance(50) - .setPageSize(10).build(); - Factory factory; - factory = repository.fetchContributionsWithStates( - Arrays.asList(Contribution.STATE_IN_PROGRESS, Contribution.STATE_QUEUED, - Contribution.STATE_PAUSED, Contribution.STATE_FAILED)); - - LivePagedListBuilder livePagedListBuilder = new LivePagedListBuilder(factory, - pagedListConfig); - failedAndPendingContributionList = livePagedListBuilder.build(); - } +// void getFailedAndPendingContributions() { +// final PagedList.Config pagedListConfig = +// (new PagedList.Config.Builder()) +// .setPrefetchDistance(50) +// .setPageSize(10).build(); +// Factory factory; +// factory = repository.fetchContributionsWithStates( +// Arrays.asList(Contribution.STATE_IN_PROGRESS, Contribution.STATE_QUEUED, +// Contribution.STATE_PAUSED, Contribution.STATE_FAILED)); +// +// LivePagedListBuilder livePagedListBuilder = new LivePagedListBuilder(factory, +// pagedListConfig); +// failedAndPendingContributionList = livePagedListBuilder.build(); +// } } diff --git a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java index 52ee4f2c1..c446892fb 100644 --- a/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java +++ b/app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java @@ -307,8 +307,9 @@ public class ContributionsFragment } /** - * Sets the visibility of the upload icon based on the number of failed and pending - * contributions. + * This section of code was originally used to set the visibility of the upload icon based on the number of failed and pending + * According to Issue5847 and the owner's request: "make the upload icon always visible and adjust the count accordingly," + * This section of code has been temporarily commented out */ // public void setUploadIconVisibility() { // contributionController.getFailedAndPendingContributions(); @@ -535,7 +536,8 @@ public class ContributionsFragment if (!isUserProfile) { setNotificationCount(); fetchCampaigns(); -// setUploadIconVisibility(); + //Comment out this function to make the UploadIcon always visible(Issue 5847). + // setUploadIconVisibility(); setUploadIconCount(); } } @@ -761,8 +763,9 @@ public class ContributionsFragment } /** - * Updates the visibility of the pending uploads ImageView based on the given count. - * + * This section of code was originally used to update the visibility of the pending uploads ImageView based on the given count. + * According to Issue5847 and the owner's request: "make the upload icon always visible and adjust the count accordingly," + * This section of code has been temporarily commented out. * @param count The number of pending uploads. */ // public void updateUploadIcon(int count) {