From a29700aea567cac307cc213e86cef890f7faa095 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 31 Aug 2018 19:04:16 +0200 Subject: [PATCH] Made method call more clear --- .../comunic/client/ui/asynctasks/GetLatestPostsTask.java | 8 ++++++-- .../comunic/client/ui/fragments/LatestPostsFragment.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/asynctasks/GetLatestPostsTask.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/asynctasks/GetLatestPostsTask.java index 3a6f216..b46b121 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/asynctasks/GetLatestPostsTask.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/asynctasks/GetLatestPostsTask.java @@ -22,10 +22,14 @@ public class GetLatestPostsTask extends SafeAsyncTask protected PostsList doInBackground(Integer... integers) { PostsHelper helper = new PostsHelper(getContext()); + PostsList list; //Get the list of posts - int from = integers[0] == 0 ? -1 : integers[0]; - PostsList list = helper.get_latest(from); + if(integers.length == 0) + list = helper.get_latest(); + else + list = helper.get_latest(integers[0]); + if(list == null) return null; //Load related information diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/LatestPostsFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/LatestPostsFragment.java index 67d991b..7183524 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/LatestPostsFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/LatestPostsFragment.java @@ -78,7 +78,7 @@ public class LatestPostsFragment extends AbstractPostsListFragment { onGotNewPosts(posts); } }); - mGetLatestPostsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, 0); + mGetLatestPostsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @Override