mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +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
b714b45bfd
commit
91e41c4c18
3 changed files with 38 additions and 35 deletions
|
|
@ -46,7 +46,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;
|
// 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>> pendingContributionList;
|
||||||
LiveData<PagedList<Contribution>> failedContributionList;
|
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
|
* Fetches the contributions with the state "IN_PROGRESS", "QUEUED", "PAUSED" and "FAILED" and
|
||||||
* then it populates the `failedAndPendingContributionList`.
|
* then it populates the `failedAndPendingContributionList`.
|
||||||
**/
|
**/
|
||||||
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();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -307,16 +307,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
|
* Sets the visibility of the upload icon based on the number of failed and pending
|
||||||
* contributions.
|
* contributions.
|
||||||
*/
|
*/
|
||||||
public void setUploadIconVisibility() {
|
// public void setUploadIconVisibility() {
|
||||||
contributionController.getFailedAndPendingContributions();
|
// contributionController.getFailedAndPendingContributions();
|
||||||
contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
|
// contributionController.failedAndPendingContributionList.observe(getViewLifecycleOwner(),
|
||||||
list -> {
|
// list -> {
|
||||||
updateUploadIcon(list.size());
|
// updateUploadIcon(list.size());
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the count for the upload icon based on the number of pending and failed contributions.
|
* Sets the count for the upload icon based on the number of pending and failed contributions.
|
||||||
|
|
@ -535,7 +536,8 @@ public class ContributionsFragment
|
||||||
if (!isUserProfile) {
|
if (!isUserProfile) {
|
||||||
setNotificationCount();
|
setNotificationCount();
|
||||||
fetchCampaigns();
|
fetchCampaigns();
|
||||||
setUploadIconVisibility();
|
// Temporarily disabled, see issue [https://github.com/commons-app/apps-android-commons/issues/5847]
|
||||||
|
// setUploadIconVisibility();
|
||||||
setUploadIconCount();
|
setUploadIconCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -761,19 +763,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.
|
* @param count The number of pending uploads.
|
||||||
*/
|
*/
|
||||||
public void updateUploadIcon(int count) {
|
// public void updateUploadIcon(int count) {
|
||||||
if (pendingUploadsImageView != null) {
|
// if (pendingUploadsImageView != null) {
|
||||||
if (count != 0) {
|
// if (count != 0) {
|
||||||
pendingUploadsImageView.setVisibility(View.VISIBLE);
|
// pendingUploadsImageView.setVisibility(View.VISIBLE);
|
||||||
} else {
|
// } else {
|
||||||
pendingUploadsImageView.setVisibility(View.GONE);
|
// pendingUploadsImageView.setVisibility(View.GONE);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace whatever is in the current contributionsFragmentContainer view with
|
* Replace whatever is in the current contributionsFragmentContainer view with
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
android:id="@+id/pending_uploads_image_view"
|
android:id="@+id/pending_uploads_image_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_marginEnd="@dimen/activity_margin_horizontal"
|
android:layout_marginEnd="@dimen/activity_margin_horizontal"
|
||||||
android:layout_marginRight="@dimen/activity_margin_horizontal"
|
android:layout_marginRight="@dimen/activity_margin_horizontal"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:visibility="visible"
|
||||||
app:srcCompat="?attr/upload_icon_drawable" />
|
app:srcCompat="?attr/upload_icon_drawable" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue