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
0667eb51
Commit
0667eb51
authored
Dec 13, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页组件化基本完成(剩余部分todo)
parent
e24853f5
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
40 additions
and
93 deletions
+40
-93
home_data_xlzx.json
m-home/src/main/assets/home_data_xlzx.json
+0
-0
IHomeBaseContract.kt
m-home/src/main/java/com/yidianling/home/constants/IHomeBaseContract.kt
+1
-1
BaseHomePresenterImpl.kt
m-home/src/main/java/com/yidianling/home/presenter/BaseHomePresenterImpl.kt
+2
-2
YdlHomeAdapter.kt
m-home/src/xlzx/java/com/yidianling/home/adapter/YdlHomeAdapter.kt
+2
-30
YdlHomeViewHolderConstract.kt
m-home/src/xlzx/java/com/yidianling/home/constract/YdlHomeViewHolderConstract.kt
+8
-15
HomeImpl.kt
m-home/src/xlzx/java/com/yidianling/home/event/HomeImpl.kt
+0
-18
IHomeEvent.kt
m-home/src/xlzx/java/com/yidianling/home/event/IHomeEvent.kt
+0
-4
HomePresenterImpl.kt
m-home/src/xlzx/java/com/yidianling/home/presenter/HomePresenterImpl.kt
+22
-19
YdlHomeFragment.kt
m-home/src/xlzx/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
+2
-2
HomeConfideView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConfideView.kt
+2
-1
YdlHomeFragment.kt
m-home/src/ydl/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
+1
-1
No files found.
m-home/src/main/assets/home_data_xlzx.json
0 → 100644
View file @
0667eb51
This source diff could not be displayed because it is too large. You can
view the blob
instead.
m-home/src/main/java/com/yidianling/home/constants/IHomeBaseContract.kt
View file @
0667eb51
...
...
@@ -85,7 +85,7 @@ class IHomeBaseContract {
/**
* 获取首页本地缓存
*/
fun
localHomeData
(
context
:
Context
)
fun
localHomeData
(
context
:
Context
,
fileName
:
String
)
/**
* 刷新首页数据请求
...
...
m-home/src/main/java/com/yidianling/home/presenter/BaseHomePresenterImpl.kt
View file @
0667eb51
...
...
@@ -72,7 +72,7 @@ abstract class BaseHomePresenterImpl< V : IHomeBaseContract.View,M : IHomeBaseC
/**
* 加载本地缓存
*/
override
fun
localHomeData
(
context
:
Context
)
{
override
fun
localHomeData
(
context
:
Context
,
fileName
:
String
)
{
YDLAsyncUtils
.
asyncAsResult
(
object
:
YDLAsyncUtils
.
AsyncObjecyerResult
{
override
fun
doAsyncAction
():
Any
{
...
...
@@ -96,7 +96,7 @@ abstract class BaseHomePresenterImpl< V : IHomeBaseContract.View,M : IHomeBaseC
if
(
cacheHomeData
.
isEmpty
())
{
//第一次安装使用本地临时数据
cacheHomeData
=
String
(
HomeFileUtils
.
getAssertsFile
(
context
,
"home_data.json"
)
!!
)
String
(
HomeFileUtils
.
getAssertsFile
(
context
,
fileName
)
!!
)
}
return
cacheHomeData
...
...
m-home/src/xlzx/java/com/yidianling/home/adapter/YdlHomeAdapter.kt
View file @
0667eb51
...
...
@@ -101,10 +101,6 @@ class YdlHomeAdapter(private val mContext: Context,
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
?,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
when
(
viewType
)
{
//顶部ViewPager与分类模块
// YdlHomeViewHolderConstract.PAGER_BANNER_VIEW -> {
// return HomePagerBannerViewHolder(HomePagerBannerView(mContext, homeEvent))
// }
//顶部预约专家,即时倾诉,心理测试按钮模块
YdlHomeViewHolderConstract
.
BUTTON_BANNER_VIEW
->
{
return
HomeButtonBannerViewHolder
(
HomeButtonBannerView
(
mContext
,
homeEvent
))
...
...
@@ -121,10 +117,6 @@ class YdlHomeAdapter(private val mContext: Context,
YdlHomeViewHolderConstract
.
ASSUAGE_GRIEF_VIEW
->
{
return
HomeAssuageGriefViewHolder
(
HomeAssuageGriefView
(
mContext
,
homeEvent
))
}
//心灵*电台模块
YdlHomeViewHolderConstract
.
INTELLIGENT_VIEW
->
{
return
HomeIntelligentViewHolder
(
HomeIntelligentView
(
mContext
,
homeEvent
))
}
//文章*阅读模块
YdlHomeViewHolderConstract
.
ARTICLE_VIEW
->
{
return
HomeArticleViewHolder
(
HomeArticleView
(
mContext
,
homeEvent
))
...
...
@@ -147,10 +139,6 @@ class YdlHomeAdapter(private val mContext: Context,
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
{
when
(
holder
)
{
// //顶部ViewPager与分类模块
// is HomePagerBannerViewHolder -> {
// holder.pagerBannerView.initData(list[position].headerBean)
// }
//顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块
is
HomeButtonBannerViewHolder
->
{
holder
.
buttonBannerView
.
initData
(
list
[
position
].
headerBean
?.
homeSaleData
,
list
[
position
].
headerBean
?.
askCategoryData
)
...
...
@@ -169,18 +157,14 @@ class YdlHomeAdapter(private val mContext: Context,
is
HomeAssuageGriefViewHolder
->
{
holder
.
assuageGriefViewView
.
initData
(
position
,
list
[
position
].
askBean
?.
data
)
}
//心灵*电台模块
is
HomeIntelligentViewHolder
->
{
holder
.
intelligentViewView
.
initData
(
list
[
position
].
fmBean
?.
list
)
}
//文章*阅读模块
is
HomeArticleViewHolder
->
{
holder
.
articleViewView
.
initData
(
list
[
position
].
articleBean
?.
list
)
}
//咨询模块
is
HomeConsultViewHolder
->
{
holder
.
consultView
.
setTitle
(
list
[
position
].
headerBean
!!
.
consultCategoryData
,
consultSelectPosition
)
holder
.
consultView
.
setConsultInfoView
(
list
[
position
].
consultBean
?.
list
,
list
[
position
].
headerBean
!!
.
consultCategoryData
?.
get
(
consultSelectPosition
))
holder
.
consultView
.
setTitle
(
list
[
position
].
headerBean
?
.
consultCategoryData
,
consultSelectPosition
)
holder
.
consultView
.
setConsultInfoView
(
list
[
position
].
consultBean
?.
list
,
list
[
position
].
headerBean
?
.
consultCategoryData
?.
get
(
consultSelectPosition
))
consultPosition
=
position
}
//测试模块
...
...
@@ -193,12 +177,6 @@ class YdlHomeAdapter(private val mContext: Context,
override
fun
getItemCount
():
Int
{
return
list
.
size
}
/**
* 顶部ViewPager与分类模块 ViewHolder
*/
// inner class HomePagerBannerViewHolder(val pagerBannerView: HomePagerBannerView) : RecyclerView.ViewHolder(pagerBannerView)
/**
* 顶部预约专家,即时倾诉,心理测试按钮模块 ViewHolder
*/
...
...
@@ -228,12 +206,6 @@ class YdlHomeAdapter(private val mContext: Context,
* 解忧*问答模块 ViewHolder
*/
inner
class
HomeAssuageGriefViewHolder
(
val
assuageGriefViewView
:
HomeAssuageGriefView
)
:
RecyclerView
.
ViewHolder
(
assuageGriefViewView
)
/**
* 心灵*电台模块 ViewHolder
*/
inner
class
HomeIntelligentViewHolder
(
val
intelligentViewView
:
HomeIntelligentView
)
:
RecyclerView
.
ViewHolder
(
intelligentViewView
)
/**
* 文章*阅读模块 ViewHolder
*/
...
...
m-home/src/xlzx/java/com/yidianling/home/constract/YdlHomeViewHolderConstract.kt
View file @
0667eb51
...
...
@@ -22,22 +22,21 @@ class YdlHomeViewHolderConstract {
*/
val
CONSULT_VIEW
=
10003
/**
*
课程*成长
模块
*
倾诉*排解
模块
*/
val
CO
URS
E_VIEW
=
10004
val
CO
NFID
E_VIEW
=
10004
/**
*
倾诉*排解
模块
*
课程*成长
模块
*/
val
CONFIDE_VIEW
=
10005
val
COURSE_VIEW
=
10005
/**
*
解忧*问答
模块
*
测试
模块
*/
val
ASSUAGE_GRIEF
_VIEW
=
10006
val
TEST
_VIEW
=
10006
/**
*
心灵*电台
模块
*
解忧*问答
模块
*/
val
INTELLIGENT
_VIEW
=
10007
val
ASSUAGE_GRIEF
_VIEW
=
10007
/**
* 文章*阅读模块
*/
...
...
@@ -46,10 +45,5 @@ class YdlHomeViewHolderConstract {
* 底部提示语模块
*/
val
FOOTER_VIEW
=
10009
/**
* 测试模块
*/
val
TEST_VIEW
=
10010
}
}
\ No newline at end of file
m-home/src/xlzx/java/com/yidianling/home/event/HomeImpl.kt
View file @
0667eb51
...
...
@@ -52,24 +52,6 @@ class HomeImpl(context: Context, homeView: IHomeContract.View) : HomeBaseImpl(co
private
var
lastVoiceView
:
ImageView
?
=
null
private
var
floatViewClickListener
:
PlayerFloatView
.
FloatViewPlayListener
?
=
null
override
fun
rightPlayClick
(
rightPlayView
:
ImageView
)
{
// if (MyPlayer.getInstance().isPlaying!!) {
// //FM播放页
// val bundle = Bundle()
// bundle.putInt("id", MyPlayer.getInstance().fmId)
//
// ARouter.getInstance()
// .build("/fm/detail")
// .withBundle("bundle", bundle)
// .navigation()
// } else if (CoursePlayer.isPlaying()) {
// //课程播放页
// CoursePlayer.startCoursePlayActivity(mContext, 2)
// } else {
// rightPlayView.visibility = View.GONE
// }
}
override
fun
clickEnsure
(
list
:
List
<
CouponBean
>):
CouponDialog
.
OnClickEnsureListener
{
return
object
:
CouponDialog
.
OnClickEnsureListener
{
override
fun
clickEnsure
(
status
:
Int
)
{
...
...
m-home/src/xlzx/java/com/yidianling/home/event/IHomeEvent.kt
View file @
0667eb51
...
...
@@ -14,10 +14,6 @@ import com.yidianling.home.ui.view.CouponDialog
* @date 2019/02/13
*/
interface
IHomeEvent
{
/**
* 搜索框播放时间
*/
fun
rightPlayClick
(
home_right_play
:
ImageView
)
/**
* 点击优惠券确定事件
...
...
m-home/src/xlzx/java/com/yidianling/home/presenter/HomePresenterImpl.kt
View file @
0667eb51
...
...
@@ -55,10 +55,17 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
.
setHotSearch
(
it
)
}
}
//BUTTON_BANNER_VIEW的数据与PAGER_BANNER_VIEW一致,不需要再次设置
// YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW -> {
// homeBean.headerBean = dataBean.headerBean
// }
YdlHomeViewHolderConstract
.
CONSULT_VIEW
->
{
homeBean
.
headerBean
=
dataBean
.
headerBean
homeBean
.
consultBean
=
dataBean
.
consultBean
}
YdlHomeViewHolderConstract
.
CONFIDE_VIEW
->
{
homeBean
.
headerBean
=
dataBean
.
headerBean
homeBean
.
confideBean
=
dataBean
.
confideBean
}
YdlHomeViewHolderConstract
.
COURSE_VIEW
->
{
...
...
@@ -71,9 +78,6 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
mHomeAskBean
=
dataBean
.
askBean
homeBean
.
askBean
=
dataBean
.
askBean
}
YdlHomeViewHolderConstract
.
INTELLIGENT_VIEW
->
{
homeBean
.
fmBean
=
dataBean
.
fmBean
}
YdlHomeViewHolderConstract
.
ARTICLE_VIEW
->
{
homeBean
.
articleBean
=
dataBean
.
articleBean
}
...
...
@@ -113,13 +117,19 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
item
.
headerBean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeHeaderBean
)
homeTempData
.
headerBean
else
dataBean
}
YdlHomeViewHolderConstract
.
BUTTON_BANNER_VIEW
->
{
item
.
headerBean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeHeaderBean
)
homeTempData
.
headerBean
else
dataBean
}
YdlHomeViewHolderConstract
.
CONSULT_VIEW
->
{
item
.
consultBean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeConsultBean
)
homeTempData
.
consultBean
else
dataBean
item
.
headerBean
=
homeTempData
.
headerBean
}
YdlHomeViewHolderConstract
.
CONFIDE_VIEW
->
{
item
.
confideBean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeConfideBean
)
homeTempData
.
confideBean
else
dataBean
item
.
headerBean
=
homeTempData
.
headerBean
}
YdlHomeViewHolderConstract
.
COURSE_VIEW
->
{
item
.
courseBean
=
...
...
@@ -134,10 +144,6 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeAskBean
)
homeTempData
.
askBean
else
dataBean
mHomeAskBean
=
item
.
askBean
}
YdlHomeViewHolderConstract
.
INTELLIGENT_VIEW
->
{
item
.
fmBean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeFMBean
)
homeTempData
.
fmBean
else
dataBean
}
YdlHomeViewHolderConstract
.
ARTICLE_VIEW
->
{
item
.
articleBean
=
if
(
dataBean
.
isRealEmpty
||
dataBean
!
is
HomeArticleBean
)
homeTempData
.
articleBean
else
dataBean
...
...
@@ -163,6 +169,12 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
YdlHomeViewHolderConstract
.
PAGER_BANNER_VIEW
)
)
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
BUTTON_BANNER_VIEW
)
)
mView
.
homeHeadResponse
(
it
)
//获取咨询分类后,再次请求咨询模块数据,防止出现默认分类为空,数据不对
if
(
it
.
consultCategoryData
!=
null
&&
it
.
consultCategoryData
!!
.
isNotEmpty
())
{
...
...
@@ -171,7 +183,7 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
getConsultData
(
"${it.consultCategoryData!![0].id}"
,
0
)
}
}
homeList
.
add
(
HomePagerDataBean
(
YdlHomeViewHolderConstract
.
BUTTON_BANNER_VIEW
))
//
homeList.add(HomePagerDataBean(YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW))
//保存热门搜索列表
it
.
keywordData
?.
let
{
ModularServiceManager
.
provide
(
IConsultantService
::
class
.
java
).
setHotSearch
(
it
)
...
...
@@ -210,15 +222,6 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
)
)
},
mModel
.
fmRequest
().
map
{
//首页电台数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
INTELLIGENT_VIEW
)
)
},
mModel
.
articleRequest
().
map
{
//首页文章数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
ARTICLE_VIEW
))
...
...
@@ -232,9 +235,9 @@ class HomePresenterImpl : BaseHomePresenterImpl<IHomeContract.View, IHomeContrac
}
},
Action
{
homeList
.
sortWith
(
compareBy
{
it
.
type
})
mView
.
homeDataResponse
(
homeList
)
//更新本地缓存数据
//更新本地缓存数据,这边顶部数据保存了两份,一个10001,一个10002,防止第二次进来读取的时候homeDataResponse回调中的remove(0)把10002删除
SharedPreferencesEditor
.
putString
(
CACHE_HOME_PAGER_DATA
,
Gson
().
toJson
(
homeList
))
mView
.
homeDataResponse
(
homeList
)
SharedPreferencesEditor
.
putString
(
IS_NEW_CACHE_HOME_PAGER_DATA
,
true
.
toString
())
SharedPreferencesEditor
.
putString
(
HOME_PAGER_DATA_CACHE_VERISON
,
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
View file @
0667eb51
...
...
@@ -84,7 +84,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
}
private
fun
initAdapter
()
{
mPresenter
?.
localHomeData
(
this
.
context
)
mPresenter
?.
localHomeData
(
this
.
context
,
"home_data_xlzx.json"
)
adapter
=
YdlHomeAdapter
(
context
,
homeEvent
!!
,
ArrayList
())
val
layoutManager
=
LinearLayoutManager
(
context
)
home_module_fragment_recycler
.
layoutManager
=
layoutManager
...
...
@@ -99,7 +99,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
home_swipe_refresh_layout
.
setColorSchemeColors
(
ContextCompat
.
getColor
(
context
,
R
.
color
.
platform_main_theme_blue
))
home_swipe_refresh_layout
.
setProgressViewOffset
(
false
,
0
,
200
)
home_swipe_refresh_layout
.
isEnabled
=
false
etSearch
.
setOnClickListener
{
homeEvent
?.
searchTvClick
()
}
etSearch
.
setOnClickListener
{
homeEvent
?.
searchTvClick
(
""
)
}
val
inputLayoutParams
=
ll_search
.
layoutParams
as
CoordinatorLayout
.
LayoutParams
val
inputOriginMargin
=
inputLayoutParams
.
leftMargin
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConfideView.kt
View file @
0667eb51
...
...
@@ -12,6 +12,7 @@ import android.widget.LinearLayout
import
android.widget.TextView
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.home.R
import
com.yidianling.home.event.HomeImpl
import
com.yidianling.home.event.IHomeBaseEvent
import
com.yidianling.home.model.bean.HomeConfideBean
import
com.yidianling.home.model.bean.HomeHeaderBean
...
...
@@ -24,7 +25,7 @@ import kotlinx.android.synthetic.xlzx.home_module_confide_view.view.*
* @Company 壹点灵
* @date 2019/02/13
*/
class
HomeConfideView
(
private
val
mContext
:
Context
,
private
var
homeEvent
:
IHomeBaseEvent
?)
:
class
HomeConfideView
(
private
val
mContext
:
Context
,
private
var
homeEvent
:
HomeImpl
?)
:
LinearLayout
(
mContext
)
{
private
var
mLastPosition
:
Int
=
0
/**
...
...
m-home/src/ydl/java/com/yidianling/home/ui/fragment/YdlHomeFragment.kt
View file @
0667eb51
...
...
@@ -132,7 +132,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
}
private
fun
initAdapter
()
{
mPresenter
?.
localHomeData
(
this
.
context
)
mPresenter
?.
localHomeData
(
this
.
context
,
"home_data.json"
)
adapter
=
YdlHomeAdapter
(
context
,
homeEvent
!!
,
ArrayList
())
val
layoutManager
=
LinearLayoutManager
(
context
)
home_module_fragment_recycler
.
layoutManager
=
layoutManager
...
...
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