30 lines
		
	
	
		
			913 B
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			30 lines
		
	
	
		
			913 B
		
	
	
	
		
			Plaintext
		
	
	
	
|  | package com.novelbook.android.netsubscribe; | |||
|  | 
 | |||
|  | 
 | |||
|  | import com.novelbook.android.netutils.HttpMethods; | |||
|  | 
 | |||
|  | import java.util.HashMap; | |||
|  | import java.util.Map; | |||
|  | 
 | |||
|  | import io.reactivex.Observable; | |||
|  | import io.reactivex.observers.DisposableObserver; | |||
|  | import okhttp3.ResponseBody; | |||
|  | 
 | |||
|  | /** | |||
|  |  * Created by 眼神 on 2018/3/27. | |||
|  |  * 建议:把功能模块来分别存放不同的请求方法,比如登录注册类LoginSubscribe、电影类MovieSubscribe | |||
|  |         */ | |||
|  | 
 | |||
|  | public class MovieSubscribe { | |||
|  |     /** | |||
|  |      * 获取数据 | |||
|  |      */ | |||
|  |     public static void getData(int pageNumber, int count,DisposableObserver<ResponseBody> subscriber) { | |||
|  |         Map<String,Integer> map = new HashMap<>(); | |||
|  |         map.put("start",pageNumber); | |||
|  |         map.put("count",count); | |||
|  |         Observable<ResponseBody> observable =  HttpMethods.getInstance().getHttpApi().getDataForMap(map); | |||
|  |         HttpMethods.getInstance().toSubscribe(observable, subscriber); | |||
|  |     } | |||
|  | } |