mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 22:03: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()
|
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 = {}){
|
fun refreshList(onRefreshFinish: () -> Unit = {}){
|
||||||
if (sessionManager.userName != null) {
|
if (sessionManager.userName != null) {
|
||||||
mediaClient.resetUserNameContinuation(sessionManager.userName!!)
|
mediaClient.resetUserNameContinuation(sessionManager.userName!!)
|
||||||
|
|
@ -56,6 +62,9 @@ class ContributionBoundaryCallback
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches contributions using the MediaWiki API
|
* Fetches contributions using the MediaWiki API
|
||||||
|
*
|
||||||
|
* @param onRefreshFinish callback to invoke when operations finishes
|
||||||
|
* with either error or success.
|
||||||
*/
|
*/
|
||||||
private fun fetchContributions(onRefreshFinish: () -> Unit = {}) {
|
private fun fetchContributions(onRefreshFinish: () -> Unit = {}) {
|
||||||
if (sessionManager.userName != null) {
|
if (sessionManager.userName != null) {
|
||||||
|
|
@ -89,6 +98,8 @@ class ContributionBoundaryCallback
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the contributions the the local DB
|
* 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) {
|
private fun saveContributionsToDB(contributions: List<Contribution>, onRefreshFinish: () -> Unit) {
|
||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
|
|
|
||||||
|
|
@ -20,5 +20,6 @@ public class ContributionsListContract {
|
||||||
public interface UserActionListener extends BasePresenter<View> {
|
public interface UserActionListener extends BasePresenter<View> {
|
||||||
|
|
||||||
void refreshList(SwipeRefreshLayout swipeRefreshLayout);
|
void refreshList(SwipeRefreshLayout swipeRefreshLayout);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,8 +96,14 @@ public class ContributionsListPresenter implements UserActionListener {
|
||||||
contributionBoundaryCallback.dispose();
|
contributionBoundaryCallback.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It is used to refresh list.
|
||||||
|
*
|
||||||
|
* @param swipeRefreshLayout used to stop refresh animation when
|
||||||
|
* refresh finishes.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void refreshList(SwipeRefreshLayout swipeRefreshLayout) {
|
public void refreshList(final SwipeRefreshLayout swipeRefreshLayout) {
|
||||||
contributionBoundaryCallback.refreshList(() -> {
|
contributionBoundaryCallback.refreshList(() -> {
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
return Unit.INSTANCE;
|
return Unit.INSTANCE;
|
||||||
|
|
|
||||||
|
|
@ -125,5 +125,5 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
|
||||||
|
|
||||||
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue