parent
843e8ffb27
commit
ba79414412
@ -0,0 +1,15 @@
|
||||
package com.common.commonlibtest.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.common.commonlib.net.bean.BaseResponse
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class CollectionData(var curPage: Int = 0) : Parcelable {
|
||||
var datas: List<Article>? = null
|
||||
var offset: Int = 0
|
||||
var over: Boolean = false
|
||||
var pageCount: Int = 0
|
||||
var size: Int = 0
|
||||
var total: Int = 0
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.common.commonlibtest.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.common.commonlib.net.bean.BaseResponse
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class CollectionResponse(var data: CollectionData) : BaseResponse(), Parcelable
|
@ -0,0 +1,29 @@
|
||||
package com.common.commonlibtest.manager
|
||||
|
||||
import com.common.commonlib.net.BaseObserve
|
||||
import com.common.commonlib.net.RequestCallBack
|
||||
import com.common.commonlibtest.bean.CollectionResponse
|
||||
import io.reactivex.Observable
|
||||
import okhttp3.Interceptor
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.Path
|
||||
|
||||
class CollectionLoader(interceptors: List<Interceptor>) :
|
||||
BaseObserve<CollectionLoader.CollectionApi>() {
|
||||
private val api: CollectionApi
|
||||
|
||||
init {
|
||||
api = initService(CollectionApi::class.java, interceptors)
|
||||
}
|
||||
|
||||
fun getCollections(pageName: Int, callBack: RequestCallBack<CollectionResponse>) {
|
||||
observe(api.getCollections(pageName), callBack)
|
||||
}
|
||||
|
||||
interface CollectionApi {
|
||||
@Headers("baseurl:debug1")
|
||||
@GET("/lg/collect/list/{pageNum}/json")
|
||||
fun getCollections(@Path("pageNum") pageNum: Int): Observable<CollectionResponse>
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue