Since smaller zipped file will be needed to update, create custom retrofit converter to handle task. Started laying out api code.
This commit is contained in:
@@ -2,6 +2,8 @@ package com.magnatune.eyecreate.companionformagnatune;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.magnatune.eyecreate.companionformagnatune.api.data_api;
|
||||
|
||||
public class MagnatuneCompainionApplication extends Application {
|
||||
|
||||
private static MagnatuneCompainionApplication instance;
|
||||
@@ -15,4 +17,9 @@ public class MagnatuneCompainionApplication extends Application {
|
||||
public static Application getApplication() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static data_api getDataApi() {
|
||||
//TODO:implement
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.magnatune.eyecreate.companionformagnatune.api;
|
||||
|
||||
import com.magnatune.eyecreate.companionformagnatune.model.AlbumResponse;
|
||||
import com.squareup.okhttp.ResponseBody;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import retrofit.Converter;
|
||||
|
||||
public class MagnatuneAlbumsConverter implements Converter<ResponseBody,AlbumResponse> {
|
||||
@Override
|
||||
public AlbumResponse convert(ResponseBody value) throws IOException {
|
||||
//TODO:convert from zip to xml to object
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.magnatune.eyecreate.companionformagnatune.api;
|
||||
|
||||
import com.magnatune.eyecreate.companionformagnatune.model.AlbumResponse;
|
||||
import com.squareup.okhttp.ResponseBody;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import retrofit.Converter;
|
||||
|
||||
public class MagnatuneAlbumsConverterFactory extends Converter.Factory {
|
||||
@Override
|
||||
public Converter<ResponseBody, ?> fromResponseBody(Type type, Annotation[] annotations) {
|
||||
if(AlbumResponse.class.equals(type)) {
|
||||
return new MagnatuneAlbumsConverter();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.magnatune.eyecreate.companionformagnatune.api;
|
||||
|
||||
import com.magnatune.eyecreate.companionformagnatune.model.AlbumResponse;
|
||||
|
||||
import retrofit.Call;
|
||||
import retrofit.http.GET;
|
||||
|
||||
public interface data_api {
|
||||
@GET("/info/album_info.xml")
|
||||
Call<AlbumResponse> getAlbumList();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.magnatune.eyecreate.companionformagnatune.model;
|
||||
|
||||
import io.realm.RealmObject;
|
||||
|
||||
public class Album extends RealmObject {
|
||||
//TODO:fill
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.magnatune.eyecreate.companionformagnatune.model;
|
||||
|
||||
public class AlbumResponse {
|
||||
//TODO:fill
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.magnatune.eyecreate.companionformagnatune.model;
|
||||
|
||||
import io.realm.RealmObject;
|
||||
|
||||
public class Track extends RealmObject {
|
||||
//TODO:fill
|
||||
}
|
||||
Reference in New Issue
Block a user