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.

This commit is contained in:
bxy379987 2024-11-08 04:56:49 +11:00
parent 1c6b367e24
commit 5089cca649
2 changed files with 27 additions and 21 deletions

View file

@ -45,7 +45,8 @@ public class ContributionController {
private boolean isInAppCameraUpload; private boolean isInAppCameraUpload;
public LocationPermissionCallback locationPermissionCallback; public LocationPermissionCallback locationPermissionCallback;
private LocationPermissionsHelper locationPermissionsHelper; private LocationPermissionsHelper locationPermissionsHelper;
LiveData<PagedList<Contribution>> failedAndPendingContributionList; // originally called by function getFailedAndPendingContributions,comment out to make the Upload Icon always visible(Issue 5847),
// LiveData<PagedList<Contribution>> failedAndPendingContributionList;
LiveData<PagedList<Contribution>> pendingContributionList; LiveData<PagedList<Contribution>> pendingContributionList;
LiveData<PagedList<Contribution>> failedContributionList; LiveData<PagedList<Contribution>> 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`. * 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() { // void getFailedAndPendingContributions() {
final PagedList.Config pagedListConfig = // final PagedList.Config pagedListConfig =
(new PagedList.Config.Builder()) // (new PagedList.Config.Builder())
.setPrefetchDistance(50) // .setPrefetchDistance(50)
.setPageSize(10).build(); // .setPageSize(10).build();
Factory<Integer, Contribution> factory; // Factory<Integer, Contribution> factory;
factory = repository.fetchContributionsWithStates( // factory = repository.fetchContributionsWithStates(
Arrays.asList(Contribution.STATE_IN_PROGRESS, Contribution.STATE_QUEUED, // Arrays.asList(Contribution.STATE_IN_PROGRESS, Contribution.STATE_QUEUED,
Contribution.STATE_PAUSED, Contribution.STATE_FAILED)); // Contribution.STATE_PAUSED, Contribution.STATE_FAILED));
//
LivePagedListBuilder livePagedListBuilder = new LivePagedListBuilder(factory, // LivePagedListBuilder livePagedListBuilder = new LivePagedListBuilder(factory,
pagedListConfig); // pagedListConfig);
failedAndPendingContributionList = livePagedListBuilder.build(); // failedAndPendingContributionList = livePagedListBuilder.build();
} // }
} }

View file

@ -307,8 +307,9 @@ public class ContributionsFragment
} }
/** /**
* Sets the visibility of the upload icon based on the number of failed and pending * This section of code was originally used to set the visibility of the upload icon based on the number of failed and pending
* contributions. * 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() { // public void setUploadIconVisibility() {
// contributionController.getFailedAndPendingContributions(); // contributionController.getFailedAndPendingContributions();
@ -535,7 +536,8 @@ public class ContributionsFragment
if (!isUserProfile) { if (!isUserProfile) {
setNotificationCount(); setNotificationCount();
fetchCampaigns(); fetchCampaigns();
// setUploadIconVisibility(); //Comment out this function to make the UploadIcon always visible(Issue 5847).
// setUploadIconVisibility();
setUploadIconCount(); 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. * @param count The number of pending uploads.
*/ */
// public void updateUploadIcon(int count) { // public void updateUploadIcon(int count) {