1
1
package com.xiasuhuei321.gank_kotlin.datasource.remote
2
2
3
- import com.xiasuhuei321.gank_kotlin.datasource.net.ApiStore
4
3
import com.xiasuhuei321.gank_kotlin.datasource.bean.GankData
5
4
import com.xiasuhuei321.gank_kotlin.datasource.bean.JsonResult
6
- import com.xiasuhuei321.gank_kotlin.datasource.bean.TechBean
7
- import com.xiasuhuei321.gank_kotlin.datasource.net.ReHelper
8
- import com.xiasuhuei321.gank_kotlin.extension.io_main
5
+ import com.xiasuhuei321.gank_kotlin.datasource.net.Network
9
6
import io.reactivex.Observable
10
7
11
8
@@ -14,22 +11,14 @@ import io.reactivex.Observable
14
11
* author:luo
15
12
16
13
*/
17
- class RemoteDataImpl private constructor(): RemoteDataSource {
14
+ class RemoteDataImpl : RemoteDataSource {
18
15
19
- private var apiStore: ApiStore ? = null
16
+ override fun getRemoteData (type : String , count : Int , pageIndex : Int ):
17
+ Observable <JsonResult <List <GankData >>> {
20
18
21
- init {
22
- if (apiStore== null ) apiStore = ReHelper .getInstance().create(ApiStore ::class .java)
23
- }
24
-
25
- companion object {
26
- val INSTANCE : RemoteDataImpl by lazy { this .INSTANCE }
27
- }
19
+ return Network .service
20
+ .getCategoricalData(type,count = count.toString(),pageIndex = pageIndex.toString())
28
21
29
- override fun getRemoteData (type : String , count : Int , pageIndex : Int ): Observable <JsonResult <List <GankData >>> {
30
- return apiStore!! .getCategoricalData(type,count.toString(),pageIndex.toString())
31
22
}
32
23
33
-
34
-
35
24
}
0 commit comments