Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
5bd67337
Commit
5bd67337
authored
Mar 23, 2020
by
konghaorui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改homeFragment sp缓存写入逻辑
parent
9a1babae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
HomePresenterImpl.kt
m-home/src/ydl/java/com/yidianling/home/presenter/HomePresenterImpl.kt
+15
-18
No files found.
m-home/src/ydl/java/com/yidianling/home/presenter/HomePresenterImpl.kt
View file @
5bd67337
...
...
@@ -15,7 +15,6 @@ import com.yidianling.home.constract.HomeViewConfig
import
com.yidianling.home.constract.IHomeContract
import
com.yidianling.home.model.HomeModelImpl
import
com.yidianling.home.model.bean.*
import
com.yidianling.home.utils.HomeLogPrinter
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.functions.Action
...
...
@@ -169,19 +168,6 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
Observable
.
mergeArray
(*
mergeArrays
.
toTypedArray
())
.
subscribeOn
(
Schedulers
.
newThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnComplete
{
if
(
homeList
.
size
==
mergeArrays
.
size
){
ThreadUtils
.
doOnThread
(
object
:
ThreadUtils
.
ThreadTask
{
override
fun
doOnThread
()
{
SharedPreferencesEditor
.
putString
(
CACHE_HOME_PAGER_DATA
,
Gson
().
toJson
(
homeList
))
SharedPreferencesEditor
.
putString
(
HOME_PAGER_DATA_CACHE_VERISON
,
RxAppTool
.
getAppVersionCode
(
BaseApp
.
getApp
()).
toString
()
)
}
})
}
}
.
subscribe
(
Consumer
{},
object
:
ThrowableConsumer
()
{
override
fun
accept
(
msg
:
String
)
{
mView
.
homeDataFail
(
msg
)
...
...
@@ -205,10 +191,21 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
mView
.
homeDataResponse
(
homeList
)
//更新本地缓存数据
HomeLogPrinter
.
printLongLog
(
HomePresenterImpl
::
class
.
java
.
simpleName
,
Gson
().
toJson
(
homeList
)
)
ThreadUtils
.
doOnThread
(
object
:
ThreadUtils
.
ThreadTask
{
override
fun
doOnThread
()
{
SharedPreferencesEditor
.
putString
(
CACHE_HOME_PAGER_DATA
,
Gson
().
toJson
(
homeList
))
SharedPreferencesEditor
.
putString
(
HOME_PAGER_DATA_CACHE_VERISON
,
RxAppTool
.
getAppVersionCode
(
BaseApp
.
getApp
()).
toString
()
)
}
})
//长日志打印
// HomeLogPrinter.printLongLog(
// HomePresenterImpl::class.java.simpleName,
// Gson().toJson(homeList)
// )
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment