sdf
This commit is contained in:
84
app/src/main/java/my_loader/Loader.java
Normal file
84
app/src/main/java/my_loader/Loader.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package my_loader;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import http.ObjectLoader;
|
||||
import http.RetrofitServiceManager;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Url;
|
||||
import rx.Observable;
|
||||
import rx.functions.Func1;
|
||||
|
||||
/**
|
||||
* Created by 90432 on 2017/12/23.
|
||||
*/
|
||||
|
||||
public class Loader extends ObjectLoader {
|
||||
private LoaderService mMovieService;
|
||||
|
||||
|
||||
public Loader(){
|
||||
mMovieService = RetrofitServiceManager.getInstance().create(LoaderService.class);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电影列表
|
||||
* @param start
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
public Observable<Resultcode> getMovie(String start, Map<String,String> count){
|
||||
return observe(mMovieService.getTop250(start,count))
|
||||
|
||||
.map(new Func1<Resultcode, Resultcode>() {
|
||||
|
||||
@Override
|
||||
public Resultcode call(Resultcode resultcode) {
|
||||
return resultcode;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电影列表
|
||||
* @param
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
/* public Observable<String> getWeatherList(String cityId,String key){
|
||||
return observe(mMovieService.getWeather(cityId,key)).map(new Func1<String, String>() {
|
||||
@Override
|
||||
public String call(String s) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
public interface LoaderService{
|
||||
|
||||
//获取豆瓣Top250 榜单appid以及type
|
||||
/* @GET("top250")
|
||||
Observable<Resultcode> getTop250(@Query("appid") String start, @Query("type") int type);*/
|
||||
@FormUrlEncoded
|
||||
/* @POST("api/user/getVerificationCode")*/
|
||||
|
||||
@POST()
|
||||
Observable<Resultcode> getTop250(@Url String url, @FieldMap Map<String, String> params);
|
||||
|
||||
/* @FormUrlEncoded
|
||||
@POST("/x3/weather")
|
||||
//@Multipart
|
||||
//Observable<String> getWeather(@Field("cityId") String cityId, @Field("key") String key, @Part MultipartBody.Part file);
|
||||
Observable<String> getWeather(@Field("cityId") String cityId, @Field("key") String key);*/
|
||||
|
||||
|
||||
|
||||
|
||||
}}
|
||||
15
app/src/main/java/my_loader/Resultcode.java
Normal file
15
app/src/main/java/my_loader/Resultcode.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package my_loader;
|
||||
|
||||
/**
|
||||
* Created by 90432 on 2017/12/23.
|
||||
*/
|
||||
|
||||
public class Resultcode<T> {
|
||||
public int status ;
|
||||
|
||||
public String msg;
|
||||
public Object data;
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user