|
|
@ -15,7 +15,7 @@ |
|
|
|
* You should have received a copy of the GNU General Public License |
|
|
|
* You should have received a copy of the GNU General Public License |
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package org.floens.chan.core.site.sites.chan8; |
|
|
|
package org.floens.chan.core.site.sites.vichan; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.support.annotation.Nullable; |
|
|
|
import android.support.annotation.Nullable; |
|
|
@ -51,25 +51,23 @@ import okhttp3.Request; |
|
|
|
|
|
|
|
|
|
|
|
import static org.floens.chan.Chan.injector; |
|
|
|
import static org.floens.chan.Chan.injector; |
|
|
|
|
|
|
|
|
|
|
|
public class Chan8 extends SiteBase { |
|
|
|
public class ViChan extends SiteBase { |
|
|
|
private static final String TAG = "Chan8"; |
|
|
|
private static final String TAG = "ViChan"; |
|
|
|
|
|
|
|
|
|
|
|
public static final Resolvable RESOLVABLE = new Resolvable() { |
|
|
|
public static final Resolvable RESOLVABLE = new Resolvable() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ResolveResult matchesName(String value) { |
|
|
|
public Class<? extends Site> getSiteClass() { |
|
|
|
switch (value) { |
|
|
|
return ViChan.class; |
|
|
|
case "8chan": |
|
|
|
|
|
|
|
return ResolveResult.NAME_MATCH; |
|
|
|
|
|
|
|
case "https://8ch.net/": |
|
|
|
|
|
|
|
return ResolveResult.FULL_MATCH; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return ResolveResult.NO; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean matchesName(String value) { |
|
|
|
|
|
|
|
return value.equals("8chan") || value.equals("8ch"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Class<? extends Site> getSiteClass() { |
|
|
|
public boolean respondsTo(HttpUrl url) { |
|
|
|
return Chan8.class; |
|
|
|
return url.host().equals("8ch.net"); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -187,13 +185,12 @@ public class Chan8 extends SiteBase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean respondsTo(HttpUrl url) { |
|
|
|
public Resolvable resolvable() { |
|
|
|
return url.host().equals("8ch.net"); |
|
|
|
return RESOLVABLE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Loadable resolve(HttpUrl url) { |
|
|
|
public Loadable resolveLoadable(HttpUrl url) { |
|
|
|
if (respondsTo(url)) { |
|
|
|
|
|
|
|
List<String> parts = url.pathSegments(); |
|
|
|
List<String> parts = url.pathSegments(); |
|
|
|
|
|
|
|
|
|
|
|
if (!parts.isEmpty()) { |
|
|
|
if (!parts.isEmpty()) { |
|
|
@ -232,7 +229,6 @@ public class Chan8 extends SiteBase { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -278,7 +274,7 @@ public class Chan8 extends SiteBase { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public ChanReader chanReader() { |
|
|
|
public ChanReader chanReader() { |
|
|
|
FutabaChanParser parser = new FutabaChanParser(new Chan8ParserHandler()); |
|
|
|
FutabaChanParser parser = new FutabaChanParser(new ViChanParserHandler()); |
|
|
|
return new FutabaChanReader(parser); |
|
|
|
return new FutabaChanReader(parser); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -286,7 +282,7 @@ public class Chan8 extends SiteBase { |
|
|
|
public void post(Reply reply, final PostListener postListener) { |
|
|
|
public void post(Reply reply, final PostListener postListener) { |
|
|
|
// TODO
|
|
|
|
// TODO
|
|
|
|
HttpCallManager httpCallManager = injector().instance(HttpCallManager.class); |
|
|
|
HttpCallManager httpCallManager = injector().instance(HttpCallManager.class); |
|
|
|
httpCallManager.makeHttpCall(new Chan8ReplyHttpCall(this, reply), |
|
|
|
httpCallManager.makeHttpCall(new ViChanReplyHttpCall(this, reply), |
|
|
|
new HttpCall.HttpCallback<CommonReplyHttpCall>() { |
|
|
|
new HttpCall.HttpCallback<CommonReplyHttpCall>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void onHttpSuccess(CommonReplyHttpCall httpPost) { |
|
|
|
public void onHttpSuccess(CommonReplyHttpCall httpPost) { |