mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-07 22:31:17 -04:00
Android New download URL and extra file attributes #309
This commit is contained in:
parent
e0677c75f4
commit
a7bbe10c00
@ -37,10 +37,10 @@ dependencies {
|
|||||||
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
|
compile 'com.yahoo.squidb:squidb-annotations:2.0.0'
|
||||||
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
|
apt 'com.yahoo.squidb:squidb-processor:2.0.0'
|
||||||
|
|
||||||
compile 'com.squareup.okhttp3:okhttp:3.2.0'
|
compile 'com.squareup.okhttp3:okhttp:3.4.1'
|
||||||
compile 'com.squareup.retrofit2:retrofit:2.0.2'
|
compile 'com.squareup.retrofit2:retrofit:2.1.0'
|
||||||
compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2'
|
compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
|
||||||
compile('com.squareup.retrofit2:converter-simplexml:2.0.2') {
|
compile('com.squareup.retrofit2:converter-simplexml:2.1.0') {
|
||||||
exclude group: 'xpp3', module: 'xpp3'
|
exclude group: 'xpp3', module: 'xpp3'
|
||||||
exclude group: 'stax', module: 'stax-api'
|
exclude group: 'stax', module: 'stax-api'
|
||||||
exclude group: 'stax', module: 'stax'
|
exclude group: 'stax', module: 'stax'
|
||||||
|
@ -11,16 +11,18 @@ import rx.schedulers.Schedulers;
|
|||||||
public class KiwixApplication extends Application {
|
public class KiwixApplication extends Application {
|
||||||
|
|
||||||
private static KiwixService service;
|
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() {
|
@Override public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
createRetrofitService();
|
createRetrofitService();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createRetrofitService() {
|
private void createRetrofitService() {
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
.baseUrl("http://kiwix.org/")
|
.baseUrl("http://download.kiwix.org/")
|
||||||
|
.client(client)
|
||||||
.addConverterFactory(SimpleXmlConverterFactory.create())
|
.addConverterFactory(SimpleXmlConverterFactory.create())
|
||||||
.addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()))
|
.addCallAdapterFactory(RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io()))
|
||||||
.build();
|
.build();
|
||||||
|
@ -84,6 +84,12 @@ public class LibraryNetworkEntity {
|
|||||||
@Attribute(name = "size", required = false)
|
@Attribute(name = "size", required = false)
|
||||||
public String size;
|
public String size;
|
||||||
|
|
||||||
|
@Attribute(name = "name", required = false)
|
||||||
|
public String bookName;
|
||||||
|
|
||||||
|
@Attribute(name = "tags", required = false)
|
||||||
|
public String tags;
|
||||||
|
|
||||||
public boolean downloaded = false;
|
public boolean downloaded = false;
|
||||||
|
|
||||||
public int searchMatches = 0;
|
public int searchMatches = 0;
|
||||||
|
@ -7,7 +7,7 @@ import retrofit2.http.Url;
|
|||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
|
|
||||||
public interface KiwixService {
|
public interface KiwixService {
|
||||||
@GET("/library.xml") Observable<LibraryNetworkEntity> getLibrary();
|
@GET("/library/library.xml") Observable<LibraryNetworkEntity> getLibrary();
|
||||||
|
|
||||||
@GET Observable<MetaLinkNetworkEntity> getMetaLinks(@Url String url);
|
@GET Observable<MetaLinkNetworkEntity> getMetaLinks(@Url String url);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user