Private
Public Access
1
0

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:
Kevin Whitaker
2015-11-18 00:20:13 -05:00
parent 36c9db71b8
commit 6a44b8c969
7 changed files with 73 additions and 0 deletions

View File

@@ -2,6 +2,8 @@ package com.magnatune.eyecreate.companionformagnatune;
import android.app.Application; import android.app.Application;
import com.magnatune.eyecreate.companionformagnatune.api.data_api;
public class MagnatuneCompainionApplication extends Application { public class MagnatuneCompainionApplication extends Application {
private static MagnatuneCompainionApplication instance; private static MagnatuneCompainionApplication instance;
@@ -15,4 +17,9 @@ public class MagnatuneCompainionApplication extends Application {
public static Application getApplication() { public static Application getApplication() {
return instance; return instance;
} }
public static data_api getDataApi() {
//TODO:implement
return null;
}
} }

View File

@@ -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;
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}

View File

@@ -0,0 +1,7 @@
package com.magnatune.eyecreate.companionformagnatune.model;
import io.realm.RealmObject;
public class Album extends RealmObject {
//TODO:fill
}

View File

@@ -0,0 +1,5 @@
package com.magnatune.eyecreate.companionformagnatune.model;
public class AlbumResponse {
//TODO:fill
}

View File

@@ -0,0 +1,7 @@
package com.magnatune.eyecreate.companionformagnatune.model;
import io.realm.RealmObject;
public class Track extends RealmObject {
//TODO:fill
}