Skip to content

Commit 91e41c4

Browse files
parneet-gurayabxy379987nicolas-raoul
authored andcommitted
Always show upload icon (#6022)
* fix issue5847 as owner required: make the icon always visible and just adjust the count accordingly,comment the setVisibility method and make pending_upload_icon always visible * set pending_upload_icon android visible level: visible and tool visible level: gone * 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. * refactor Signed-off-by: parneet-guraya <[email protected]> --------- Signed-off-by: parneet-guraya <[email protected]> Co-authored-by: bxy379987 <[email protected]> Co-authored-by: Nicolas Raoul <[email protected]>
1 parent b714b45 commit 91e41c4

File tree

3 files changed

+38
-35
lines changed

3 files changed

+38
-35
lines changed

app/src/main/java/fr/free/nrw/commons/contributions/ContributionController.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class ContributionController {
4646
private boolean isInAppCameraUpload;
4747
public LocationPermissionCallback locationPermissionCallback;
4848
private LocationPermissionsHelper locationPermissionsHelper;
49-
LiveData<PagedList<Contribution>> failedAndPendingContributionList;
49+
// Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
50+
// LiveData<PagedList<Contribution>> failedAndPendingContributionList;
5051
LiveData<PagedList<Contribution>> pendingContributionList;
5152
LiveData<PagedList<Contribution>> failedContributionList;
5253

@@ -383,21 +384,22 @@ void getFailedContributions() {
383384
}
384385

385386
/**
387+
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
386388
* Fetches the contributions with the state "IN_PROGRESS", "QUEUED", "PAUSED" and "FAILED" and
387389
* then it populates the `failedAndPendingContributionList`.
388390
**/
389-
void getFailedAndPendingContributions() {
390-
final PagedList.Config pagedListConfig =
391-
(new PagedList.Config.Builder())
392-
.setPrefetchDistance(50)
393-
.setPageSize(10).build();
394-
Factory<Integer, Contribution> factory;
395-
factory = repository.fetchContributionsWithStates(
396-
Arrays.asList(Contribution.STATE_IN_PROGRESS, Contribution.STATE_QUEUED,
397-
Contribution.STATE_PAUSED, Contribution.STATE_FAILED));
398-
399-
LivePagedListBuilder livePagedListBuilder = new LivePagedListBuilder(factory,
400-
pagedListConfig);
401-
failedAndPendingContributionList = livePagedListBuilder.build();
402-
}
391+
// void getFailedAndPendingContributions() {
392+
// final PagedList.Config pagedListConfig =
393+
// (new PagedList.Config.Builder())
394+
// .setPrefetchDistance(50)
395+
// .setPageSize(10).build();
396+
// Factory<Integer, Contribution> factory;
397+
// factory = repository.fetchContributionsWithStates(
398+
// Arrays.asList(Contribution.STATE_IN_PROGRESS, Contribution.STATE_QUEUED,
399+
// Contribution.STATE_PAUSED, Contribution.STATE_FAILED));
400+
//
401+
// LivePagedListBuilder livePagedListBuilder = new LivePagedListBuilder(factory,
402+
// pagedListConfig);
403+
// failedAndPendingContributionList = livePagedListBuilder.build();
404+
// }
403405
}

app/src/main/java/fr/free/nrw/commons/contributions/ContributionsFragment.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -307,16 +307,17 @@ public void setNotificationCount() {
307307
}
308308

309309
/**
310+
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
310311
* Sets the visibility of the upload icon based on the number of failed and pending
311312
* contributions.
312313
*/
313-
public void setUploadIconVisibility() {
314-
contributionController.getFailedAndPendingContributions();
315-
contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
316-
list -> {
317-
updateUploadIcon(list.size());
318-
});
319-
}
314+
// public void setUploadIconVisibility() {
315+
// contributionController.getFailedAndPendingContributions();
316+
// contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
317+
// list -> {
318+
// updateUploadIcon(list.size());
319+
// });
320+
// }
320321

321322
/**
322323
* Sets the count for the upload icon based on the number of pending and failed contributions.
@@ -535,7 +536,8 @@ public void onResume() {
535536
if (!isUserProfile) {
536537
setNotificationCount();
537538
fetchCampaigns();
538-
setUploadIconVisibility();
539+
// Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
540+
// setUploadIconVisibility();
539541
setUploadIconCount();
540542
}
541543
}
@@ -761,19 +763,18 @@ public void updateErrorIcon(int errorCount) {
761763
}
762764

763765
/**
764-
* Updates the visibility of the pending uploads ImageView based on the given count.
765-
*
766+
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
766767
* @param count The number of pending uploads.
767768
*/
768-
public void updateUploadIcon(int count) {
769-
if (pendingUploadsImageView != null) {
770-
if (count != 0) {
771-
pendingUploadsImageView.setVisibility(View.VISIBLE);
772-
} else {
773-
pendingUploadsImageView.setVisibility(View.GONE);
774-
}
775-
}
776-
}
769+
// public void updateUploadIcon(int count) {
770+
// if (pendingUploadsImageView != null) {
771+
// if (count != 0) {
772+
// pendingUploadsImageView.setVisibility(View.VISIBLE);
773+
// } else {
774+
// pendingUploadsImageView.setVisibility(View.GONE);
775+
// }
776+
// }
777+
// }
777778

778779
/**
779780
* Replace whatever is in the current contributionsFragmentContainer view with

app/src/main/res/layout/pending_uploads_icon.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
android:id="@+id/pending_uploads_image_view"
1515
android:layout_width="wrap_content"
1616
android:layout_height="wrap_content"
17-
android:visibility="gone"
1817
android:layout_marginEnd="@dimen/activity_margin_horizontal"
1918
android:layout_marginRight="@dimen/activity_margin_horizontal"
2019
android:gravity="center"
20+
android:visibility="visible"
2121
app:srcCompat="?attr/upload_icon_drawable" />
2222

2323
<TextView

0 commit comments

Comments
 (0)