Skip to content

Commit 3bfa361

Browse files
parneet-gurayabxy379987nicolas-raoul
authored
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 9a876fa commit 3bfa361

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
@@ -303,16 +303,17 @@ public void setNotificationCount() {
303303
}
304304

305305
/**
306+
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
306307
* Sets the visibility of the upload icon based on the number of failed and pending
307308
* contributions.
308309
*/
309-
public void setUploadIconVisibility() {
310-
contributionController.getFailedAndPendingContributions();
311-
contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
312-
list -> {
313-
updateUploadIcon(list.size());
314-
});
315-
}
310+
// public void setUploadIconVisibility() {
311+
// contributionController.getFailedAndPendingContributions();
312+
// contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
313+
// list -> {
314+
// updateUploadIcon(list.size());
315+
// });
316+
// }
316317

317318
/**
318319
* Sets the count for the upload icon based on the number of pending and failed contributions.
@@ -531,7 +532,8 @@ public void onResume() {
531532
if (!isUserProfile) {
532533
setNotificationCount();
533534
fetchCampaigns();
534-
setUploadIconVisibility();
535+
// Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
536+
// setUploadIconVisibility();
535537
setUploadIconCount();
536538
}
537539
}
@@ -757,19 +759,18 @@ public void updateErrorIcon(int errorCount) {
757759
}
758760

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

774775
/**
775776
* 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)