@@ -14,31 +14,22 @@ import io.reactivex.Observable
14
14
* author:luo
15
15
16
16
*/
17
- class RemoteDataImpl : RemoteDataSource {
17
+ class RemoteDataImpl private constructor() : RemoteDataSource {
18
18
19
19
private var apiStore: ApiStore ? = null
20
20
21
21
init {
22
- if (apiStore== null ) ReHelper .getInstance().create(ApiStore ::class .java)
22
+ if (apiStore== null ) apiStore = ReHelper .getInstance().create(ApiStore ::class .java)
23
23
}
24
24
25
25
companion object {
26
- val INSTANCE : RemoteDataImpl by lazy { this .INSTANCE }
26
+ val INSTANCE : RemoteDataImpl by lazy { this .INSTANCE }
27
27
}
28
28
29
29
override fun getRemoteData (type : String , count : Int , pageIndex : Int ): Observable <JsonResult <List <GankData >>> {
30
- return apiStore!! .getCategoricalData(type,count.toString(),pageIndex.toString()).io_main()
30
+ return apiStore!! .getCategoricalData(type,count.toString(),pageIndex.toString())
31
31
}
32
32
33
- override fun getRemoteTechBeanStaredList (type : String , count : Int , pageIndex : Int ): Observable <TechBean > {
34
- // val retrofit = Retrofit.Builder()
35
- // .baseUrl("http://gank.io/api/")
36
- // .addConverterFactory(GsonConverterFactory.create())
37
- // .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
38
- // .build()
39
- val newCount = count.toString()
40
- val newPageIndex = pageIndex.toString()
41
- return apiStore!! .getData(type, newCount, newPageIndex)
42
- }
33
+
43
34
44
35
}
0 commit comments