summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2018-02-17 14:43:12 +0100
committerstom79 <tschneider.ac@gmail.com>2018-02-17 14:43:12 +0100
commit3ca1e3b402d61ea84ae15d321fe45d73ecbe1864 (patch)
treeea7954fb40c241e7bfaa828713170c1d152677dd /app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
parent87d244be1b7dadec74d9700b711f06779d78859f (diff)
Adds filters
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java')
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
index 12e1cbe93..67e20ee90 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/asynctasks/RetrieveFeedsAsyncTask.java
@@ -24,6 +24,7 @@ import java.util.List;
import fr.gouv.etalab.mastodon.client.API;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Status;
+import fr.gouv.etalab.mastodon.helper.FilterToots;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
@@ -46,6 +47,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
private boolean showMediaOnly = false;
private boolean showPinned = false;
private WeakReference<Context> contextReference;
+ private FilterToots filterToots;
public enum Type{
HOME,
@@ -62,6 +64,15 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
CACHE_STATUS
}
+
+ public RetrieveFeedsAsyncTask(Context context, FilterToots filterToots, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
+ this.contextReference = new WeakReference<>(context);
+ this.action = Type.CACHE_STATUS;
+ this.max_id = max_id;
+ this.listener = onRetrieveFeedsInterface;
+ this.filterToots = filterToots;
+ }
+
public RetrieveFeedsAsyncTask(Context context, Type action, String max_id, OnRetrieveFeedsInterface onRetrieveFeedsInterface){
this.contextReference = new WeakReference<>(context);
this.action = action;
@@ -127,7 +138,7 @@ public class RetrieveFeedsAsyncTask extends AsyncTask<Void, Void, Void> {
case CACHE_STATUS:
apiResponse = new APIResponse();
db = Sqlite.getInstance(contextReference.get(), Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
- statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, max_id);
+ statuses = new StatusCacheDAO(contextReference.get(), db).getStatusFromID(StatusCacheDAO.ARCHIVE_CACHE, filterToots, max_id);
if( statuses != null && statuses.size() > 0) {
apiResponse.setStatuses(statuses);
apiResponse.setMax_id(statuses.get(0).getId());