mirror of https://github.com/kurisufriend/Clover
Refactoring around Site and ChanLoaders. Inject FilterEngine.multisite
parent
6a6055ea98
commit
aa4f96cacf
@ -0,0 +1,33 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.chan; |
||||||
|
|
||||||
|
|
||||||
|
import com.android.volley.Request; |
||||||
|
|
||||||
|
public class ChanLoaderRequest { |
||||||
|
private Request<ChanLoaderResponse> volleyRequest; |
||||||
|
|
||||||
|
public ChanLoaderRequest(Request<ChanLoaderResponse> volleyRequest) { |
||||||
|
this.volleyRequest = volleyRequest; |
||||||
|
} |
||||||
|
|
||||||
|
public Request<ChanLoaderResponse> getVolleyRequest() { |
||||||
|
return volleyRequest; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,62 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.chan; |
||||||
|
|
||||||
|
|
||||||
|
import com.android.volley.Response; |
||||||
|
|
||||||
|
import org.floens.chan.core.model.Loadable; |
||||||
|
import org.floens.chan.core.model.Post; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* A request from ChanLoader to load something. |
||||||
|
*/ |
||||||
|
public class ChanLoaderRequestParams { |
||||||
|
/** |
||||||
|
* Related loadable for the request. |
||||||
|
*/ |
||||||
|
public final Loadable loadable; |
||||||
|
|
||||||
|
/** |
||||||
|
* Cached Post objects from previous loads, or an empty list. |
||||||
|
*/ |
||||||
|
public final List<Post> cached; |
||||||
|
|
||||||
|
/** |
||||||
|
* Success listener. |
||||||
|
*/ |
||||||
|
public final Response.Listener<ChanLoaderResponse> listener; |
||||||
|
|
||||||
|
/** |
||||||
|
* Error listener. |
||||||
|
*/ |
||||||
|
public final Response.ErrorListener errorListener; |
||||||
|
|
||||||
|
public ChanLoaderRequestParams(Loadable loadable, |
||||||
|
List<Post> cached, |
||||||
|
Response.Listener<ChanLoaderResponse> listener, |
||||||
|
Response.ErrorListener errorListener) { |
||||||
|
|
||||||
|
this.loadable = loadable; |
||||||
|
this.cached = cached; |
||||||
|
this.listener = listener; |
||||||
|
this.errorListener = errorListener; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.chan; |
||||||
|
|
||||||
|
import org.floens.chan.core.model.Post; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class ChanLoaderResponse { |
||||||
|
// Op Post that is created new each time.
|
||||||
|
// Used to later copy members like image count to the real op on the main thread.
|
||||||
|
public final Post.Builder op; |
||||||
|
public final List<Post> posts; |
||||||
|
|
||||||
|
public ChanLoaderResponse(Post.Builder op, List<Post> posts) { |
||||||
|
this.op = op; |
||||||
|
this.posts = posts; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
/* |
||||||
|
* Clover - 4chan browser https://github.com/Floens/Clover/
|
||||||
|
* Copyright (C) 2014 Floens |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/ |
||||||
|
package org.floens.chan.core.model; |
||||||
|
|
||||||
|
|
||||||
|
import org.floens.chan.core.site.Site; |
||||||
|
|
||||||
|
public interface SiteReference { |
||||||
|
/** |
||||||
|
* Get the Site object that this model references. |
||||||
|
* |
||||||
|
* @return a {@link Site} |
||||||
|
*/ |
||||||
|
Site getSite(); |
||||||
|
} |
Loading…
Reference in new issue