mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
add kdoc
Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parent
8eed7ee554
commit
8792e04ce2
4 changed files with 20 additions and 2 deletions
|
|
@ -47,6 +47,12 @@ class ContributionBoundaryCallback
|
|||
fetchContributions()
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch list from network and save it to local DB.
|
||||
*
|
||||
* @param onRefreshFinish callback to invoke when operations finishes
|
||||
* with either error or success.
|
||||
*/
|
||||
fun refreshList(onRefreshFinish: () -> Unit = {}){
|
||||
if (sessionManager.userName != null) {
|
||||
mediaClient.resetUserNameContinuation(sessionManager.userName!!)
|
||||
|
|
@ -56,6 +62,9 @@ class ContributionBoundaryCallback
|
|||
|
||||
/**
|
||||
* Fetches contributions using the MediaWiki API
|
||||
*
|
||||
* @param onRefreshFinish callback to invoke when operations finishes
|
||||
* with either error or success.
|
||||
*/
|
||||
private fun fetchContributions(onRefreshFinish: () -> Unit = {}) {
|
||||
if (sessionManager.userName != null) {
|
||||
|
|
@ -89,6 +98,8 @@ class ContributionBoundaryCallback
|
|||
|
||||
/**
|
||||
* Saves the contributions the the local DB
|
||||
*
|
||||
* @param onRefreshFinish callback to invoke when successfully saved to DB.
|
||||
*/
|
||||
private fun saveContributionsToDB(contributions: List<Contribution>, onRefreshFinish: () -> Unit) {
|
||||
compositeDisposable.add(
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@ public class ContributionsListContract {
|
|||
public interface UserActionListener extends BasePresenter<View> {
|
||||
|
||||
void refreshList(SwipeRefreshLayout swipeRefreshLayout);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,8 +96,14 @@ public class ContributionsListPresenter implements UserActionListener {
|
|||
contributionBoundaryCallback.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* It is used to refresh list.
|
||||
*
|
||||
* @param swipeRefreshLayout used to stop refresh animation when
|
||||
* refresh finishes.
|
||||
*/
|
||||
@Override
|
||||
public void refreshList(SwipeRefreshLayout swipeRefreshLayout) {
|
||||
public void refreshList(final SwipeRefreshLayout swipeRefreshLayout) {
|
||||
contributionBoundaryCallback.refreshList(() -> {
|
||||
swipeRefreshLayout.setRefreshing(false);
|
||||
return Unit.INSTANCE;
|
||||
|
|
|
|||
|
|
@ -125,5 +125,5 @@
|
|||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue