mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
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 <gurayaparneet@gmail.com> --------- Signed-off-by: parneet-guraya <gurayaparneet@gmail.com> Co-authored-by: bxy379987 <bxy379987@gmail.com> Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
9a876fa5e2
commit
3bfa3612c6
3 changed files with 38 additions and 35 deletions
|
|
@ -46,7 +46,8 @@ public class ContributionController {
|
|||
private boolean isInAppCameraUpload;
|
||||
public LocationPermissionCallback locationPermissionCallback;
|
||||
private LocationPermissionsHelper locationPermissionsHelper;
|
||||
LiveData<PagedList<Contribution>> failedAndPendingContributionList;
|
||||
// Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
|
||||
// LiveData<PagedList<Contribution>> failedAndPendingContributionList;
|
||||
LiveData<PagedList<Contribution>> pendingContributionList;
|
||||
LiveData<PagedList<Contribution>> failedContributionList;
|
||||
|
||||
|
|
@ -383,21 +384,22 @@ public class ContributionController {
|
|||
}
|
||||
|
||||
/**
|
||||
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
|
||||
* Fetches the contributions with the state "IN_PROGRESS", "QUEUED", "PAUSED" and "FAILED" and
|
||||
* then it populates the `failedAndPendingContributionList`.
|
||||
**/
|
||||
void getFailedAndPendingContributions() {
|
||||
final PagedList.Config pagedListConfig =
|
||||
(new PagedList.Config.Builder())
|
||||
.setPrefetchDistance(50)
|
||||
.setPageSize(10).build();
|
||||
Factory<Integer, Contribution> 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<Integer, Contribution> 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();
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,16 +303,17 @@ public class ContributionsFragment
|
|||
}
|
||||
|
||||
/**
|
||||
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
|
||||
* Sets the visibility of the upload icon based on the number of failed and pending
|
||||
* contributions.
|
||||
*/
|
||||
public void setUploadIconVisibility() {
|
||||
contributionController.getFailedAndPendingContributions();
|
||||
contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
|
||||
list -> {
|
||||
updateUploadIcon(list.size());
|
||||
});
|
||||
}
|
||||
// public void setUploadIconVisibility() {
|
||||
// contributionController.getFailedAndPendingContributions();
|
||||
// contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
|
||||
// list -> {
|
||||
// updateUploadIcon(list.size());
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Sets the count for the upload icon based on the number of pending and failed contributions.
|
||||
|
|
@ -531,7 +532,8 @@ public class ContributionsFragment
|
|||
if (!isUserProfile) {
|
||||
setNotificationCount();
|
||||
fetchCampaigns();
|
||||
setUploadIconVisibility();
|
||||
// Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
|
||||
// setUploadIconVisibility();
|
||||
setUploadIconCount();
|
||||
}
|
||||
}
|
||||
|
|
@ -757,19 +759,18 @@ public class ContributionsFragment
|
|||
}
|
||||
|
||||
/**
|
||||
* Updates the visibility of the pending uploads ImageView based on the given count.
|
||||
*
|
||||
* Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
|
||||
* @param count The number of pending uploads.
|
||||
*/
|
||||
public void updateUploadIcon(int count) {
|
||||
if (pendingUploadsImageView != null) {
|
||||
if (count != 0) {
|
||||
pendingUploadsImageView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
pendingUploadsImageView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
// public void updateUploadIcon(int count) {
|
||||
// if (pendingUploadsImageView != null) {
|
||||
// if (count != 0) {
|
||||
// pendingUploadsImageView.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// pendingUploadsImageView.setVisibility(View.GONE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Replace whatever is in the current contributionsFragmentContainer view with
|
||||
|
|
|
|||
|
|
@ -14,10 +14,10 @@
|
|||
android:id="@+id/pending_uploads_image_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginEnd="@dimen/activity_margin_horizontal"
|
||||
android:layout_marginRight="@dimen/activity_margin_horizontal"
|
||||
android:gravity="center"
|
||||
android:visibility="visible"
|
||||
app:srcCompat="?attr/upload_icon_drawable" />
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue