diff --git a/app/build.gradle b/app/build.gradle index ae91b633..0080fa7a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -30,12 +30,20 @@ dependencies { compile 'com.android.support:appcompat-v7:25.3.0' compile 'com.github.bumptech.glide:glide:3.7.0' + compile 'io.reactivex.rxjava2:rxandroid:2.0.1' + compile 'io.reactivex.rxjava2:rxjava:2.0.1' compile 'com.squareup.retrofit2:retrofit:2.2.0' compile 'com.squareup.retrofit2:converter-gson:2.2.0' + compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0' + compile 'com.github.satyan:sugar:1.4' compile 'com.jakewharton:butterknife:8.5.1' annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1' + debugCompile 'com.facebook.stetho:stetho:1.4.2' + debugCompile 'com.facebook.stetho:stetho-okhttp:1.4.2' + debugCompile 'com.facebook.stetho:stetho-okhttp3:1.4.2' + testCompile 'junit:junit:4.12' androidTestCompile 'junit:junit:4.12' androidTestCompile ('com.android.support.test:runner:0.5') { diff --git a/app/src/main/java/de/nicidienase/chaosflix/ChaosflixApplication.java b/app/src/main/java/de/nicidienase/chaosflix/ChaosflixApplication.java index 9c9070ab..80c687ca 100644 --- a/app/src/main/java/de/nicidienase/chaosflix/ChaosflixApplication.java +++ b/app/src/main/java/de/nicidienase/chaosflix/ChaosflixApplication.java @@ -17,4 +17,10 @@ public class ChaosflixApplication extends Application { super.onCreate(); SugarContext.init(this); } + + @Override + public void onTerminate() { + SugarContext.terminate(); + super.onTerminate(); + } } diff --git a/app/src/main/java/de/nicidienase/chaosflix/network/MediaApiService.java b/app/src/main/java/de/nicidienase/chaosflix/network/MediaApiService.java new file mode 100644 index 00000000..cad31d61 --- /dev/null +++ b/app/src/main/java/de/nicidienase/chaosflix/network/MediaApiService.java @@ -0,0 +1,44 @@ +package de.nicidienase.chaosflix.network; + +import android.app.Service; +import android.content.Intent; +import android.os.Binder; +import android.os.IBinder; +import android.support.annotation.Nullable; + +import de.nicidienase.chaosflix.R; +import retrofit2.Retrofit; +import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; +import retrofit2.converter.gson.GsonConverterFactory; + +/** + * Created by felix on 24.03.17. + */ + +public class MediaApiService extends Service { + + private final IBinder mBinder = new LocalBinder(); + private final MediaCCCService mApiService; + + public class LocalBinder extends Binder { + MediaApiService getService() { + return MediaApiService.this; + } + } + + public MediaApiService(){ + Retrofit retrofit = new Retrofit.Builder() + .baseUrl(getString(R.string.api_media_ccc_url)) + .addConverterFactory(GsonConverterFactory.create()) + .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + .build(); + mApiService = retrofit.create(MediaCCCService.class); + } + + @Nullable + @Override + public IBinder onBind(Intent intent) { + return mBinder; + } + +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ed253d5e..316e8aba 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -38,4 +38,6 @@ Oops Random Talks in the same Track Other random Talks at this Conference + https://api.media.ccc.de + https://streaming.media.ccc.de