Android New download URL and extra file attributes #309

This commit is contained in:
Isaac 2016-09-11 22:46:33 +01:00
parent e0677c75f4
commit a7bbe10c00
4 changed files with 15 additions and 7 deletions

View File

@ -37,10 +37,10 @@ dependencies {
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
compile('com.squareup.retrofit2:converter-simplexml:2.0.2') {
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
compile('com.squareup.retrofit2:converter-simplexml:2.1.0') {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'

View File

@ -11,16 +11,18 @@ import rx.schedulers.Schedulers;
public class KiwixApplication extends Application {
private static KiwixService service;
private static OkHttpClient client = new OkHttpClient();
private static OkHttpClient client = new OkHttpClient().newBuilder().followRedirects(true).followSslRedirects(true).build();
@Override public void onCreate() {
super.onCreate();
createRetrofitService();
}
private void createRetrofitService() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("http://kiwix.org/")
.baseUrl("http://download.kiwix.org/")
.client(client)
.addConverterFactory(SimpleXmlConverterFactory.create())
.addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()))
.build();

View File

@ -84,6 +84,12 @@ public class LibraryNetworkEntity {
@Attribute(name = "size", required = false)
public String size;
@Attribute(name = "name", required = false)
public String bookName;
@Attribute(name = "tags", required = false)
public String tags;
public boolean downloaded = false;
public int searchMatches = 0;

View File

@ -7,7 +7,7 @@ import retrofit2.http.Url;
import rx.Observable;
public interface KiwixService {
@GET("/library.xml") Observable<LibraryNetworkEntity> getLibrary();
@GET("/library/library.xml") Observable<LibraryNetworkEntity> getLibrary();
@GET Observable<MetaLinkNetworkEntity> getMetaLinks(@Url String url);
}