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
3e852281
Commit
3e852281
authored
Dec 17, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户版首頁mvp绑定view
parent
fbb25365
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
262 additions
and
252 deletions
+262
-252
HomePresenterImpl.kt
m-home/src/ydl/java/com/yidianling/home/presenter/HomePresenterImpl.kt
+19
-9
home_fragment.xml
m-home/src/ydl/res/layout/home_fragment.xml
+243
-243
No files found.
m-home/src/ydl/java/com/yidianling/home/presenter/HomePresenterImpl.kt
View file @
3e852281
...
...
@@ -3,6 +3,7 @@ package com.yidianling.home.presenter
import
android.annotation.SuppressLint
import
com.google.gson.Gson
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.utils.SharedPreferencesEditor
...
...
@@ -42,7 +43,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
val
homeList
:
MutableList
<
HomePagerDataBean
>
=
mutableListOf
()
LogUtil
.
d
(
"mConsultType-loadHomeData:$mConsultType"
)
Observable
.
mergeArray
(
mModel
.
headerRequest
().
map
{
it
->
mModel
.
headerRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
it
->
//首页头部数据 分类 & Banner
homeList
.
add
(
getHomeItemFromTempData
(
...
...
@@ -64,20 +66,24 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
ModularServiceManager
.
provide
(
IConsultantService
::
class
.
java
).
setHotSearch
(
it
)
}
},
mModel
.
consultRequest
(
mConsultType
).
map
{
mModel
.
consultRequest
(
mConsultType
)
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页咨询数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
CONSULT_VIEW
))
},
//GoodType为空 获取默认类型
mModel
.
confideRequest
(
mConfideType
).
map
{
mModel
.
confideRequest
(
mConfideType
)
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页倾述数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
CONFIDE_VIEW
))
},
mModel
.
courseRequest
().
map
{
mModel
.
courseRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页课程数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
COURSE_VIEW
))
},
mModel
.
testRequest
().
map
{
mModel
.
testRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页测试数据
val
homeTestBean
=
HomeTestBean
()
homeTestBean
.
testItemList
=
it
.
data
...
...
@@ -88,7 +94,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
)
)
},
mModel
.
askRequest
().
map
{
mModel
.
askRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页问答数据
homeList
.
add
(
getHomeItemFromTempData
(
...
...
@@ -97,11 +104,13 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
)
)
},
mModel
.
museRequest
().
map
{
mModel
.
museRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页冥想数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
MUSE_VIEW
))
},
mModel
.
fmRequest
().
map
{
mModel
.
fmRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页电台数据
homeList
.
add
(
getHomeItemFromTempData
(
...
...
@@ -110,7 +119,8 @@ class HomePresenterImpl: BaseHomePresenterImpl<IHomeContract.View, IHomeContract
)
)
},
mModel
.
articleRequest
().
map
{
mModel
.
articleRequest
()
.
compose
(
RxUtils
.
applySchedulers
(
mView
)).
map
{
//首页文章数据
homeList
.
add
(
getHomeItemFromTempData
(
it
,
YdlHomeViewHolderConstract
.
ARTICLE_VIEW
))
homeList
.
add
(
HomePagerDataBean
(
YdlHomeViewHolderConstract
.
FOOTER_VIEW
))
...
...
m-home/src/ydl/res/layout/home_fragment.xml
View file @
3e852281
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:cube_ptr=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/platform_white"
android:orientation=
"vertical"
>
<android.support.v4.widget.SwipeRefreshLayout
android:id=
"@+id/home_swipe_refresh_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/home_module_fragment_recycler"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/platform_white"
android:divider=
"@null"
android:overScrollMode=
"never"
/>
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<View
android:id=
"@+id/view_rl_top_bg"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/home_background_home_pager_top"
/>
<RelativeLayout
android:id=
"@+id/rl_top"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
>
<LinearLayout
android:id=
"@+id/ll_top_function"
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:layout_marginTop=
"7dp"
android:layout_marginBottom=
"5dp"
android:paddingRight=
"10dp"
android:gravity=
"center_vertical|right"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_consult"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
android:text=
"咨询"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<TextView
android:id=
"@+id/tv_confide"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:gravity=
"center_vertical"
android:text=
"倾诉"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<TextView
android:id=
"@+id/tv_course"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:gravity=
"center_vertical"
android:text=
"课程"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<TextView
android:id=
"@+id/tv_test"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:gravity=
"center_vertical"
android:text=
"测评"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<RelativeLayout
android:id=
"@+id/rl_backTop"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_18"
>
<ImageView
android:id=
"@+id/imgTop"
android:layout_width=
"14dp"
android:layout_height=
"9dp"
android:layout_centerHorizontal=
"true"
android:background=
"@drawable/home_back_top"
/>
<TextView
android:id=
"@+id/tv_returnTop"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/imgTop"
android:gravity=
"center"
android:text=
"回顶部"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_9"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:layout_marginLeft=
"15dp"
android:layout_marginTop=
"4dp"
android:layout_marginRight=
"15dp"
android:layout_marginBottom=
"5dp"
android:id=
"@+id/rl_search"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/img_ad"
android:layout_width=
"64dp"
android:layout_height=
"34dp"
android:layout_marginRight=
"10dp"
android:visibility=
"gone"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<View
android:id=
"@+id/view_search_input_bg"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/home_bg_home_search_input"
android:tag=
"tag_search_input_bg"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_search_icon"
android:layout_width=
"12dp"
android:layout_height=
"12dp"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"12dp"
android:src=
"@drawable/home_icon_search"
/>
<TextView
android:id=
"@+id/home_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"8dp"
android:layout_weight=
"1"
android:gravity=
"center_vertical"
android:text=
"@string/
search_hint"
android:textColor=
"#999999"
android:textSize=
"@dimen/platform_default_text_size_small"
android:textStyle=
"normal"
android:typeface=
"sans"
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<ImageView
android:id=
"@+id/home_service_call"
android:layout_width=
"@dimen/platform_dp_34"
android:layout_height=
"@dimen/platform_dp_34"
android:layout_gravity=
"center_vertical"
android:layout_marginTop=
"7dp"
android:layout_marginRight=
"12dp"
android:layout_toRightOf=
"@+id/rl_search"
android:background=
"?android:attr/selectableItemBackground"
android:contentDescription=
"@null"
android:src=
"@drawable/home_search_phone"
android:visibility=
"gone"
/>
</RelativeLayout>
<LinearLayout
android:id=
"@+id/ll_layout"
android:layout_width=
"match_parent"
android:layout_height=
"41dp"
android:layout_below=
"@+id/rl_top"
android:orientation=
"vertical"
android:visibility=
"gone"
>
<android.support.design.widget.TabLayout
android:id=
"@+id/tab_layout"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:background=
"@color/platform_white"
android:visibility=
"visible"
app:tabGravity=
"fill"
app:tabIndicatorHeight=
"0dp"
app:tabMode=
"scrollable"
app:tabSelectedTextColor=
"@color/platform_color_242424"
app:tabTextAppearance=
"@style/TabLayoutTextSize"
app:tabTextColor=
"#333"
/>
<View
style=
"@style/viewline"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_consultLayout"
android:layout_width=
"match_parent"
android:layout_height=
"41dp"
android:layout_below=
"@+id/rl_top"
android:orientation=
"vertical"
android:visibility=
"gone"
>
<android.support.design.widget.TabLayout
android:id=
"@+id/tab_consultLayout"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:background=
"@color/platform_white"
android:visibility=
"visible"
app:tabGravity=
"fill"
app:tabIndicatorHeight=
"0dp"
app:tabMode=
"scrollable"
app:tabSelectedTextColor=
"@color/platform_color_242424"
app:tabTextAppearance=
"@style/TabLayoutTextSize"
app:tabTextColor=
"#333"
/>
<View
style=
"@style/viewline"
/>
</LinearLayout>
</RelativeLayout>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:cube_ptr=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/platform_white"
android:orientation=
"vertical"
>
<android.support.v4.widget.SwipeRefreshLayout
android:id=
"@+id/home_swipe_refresh_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/home_module_fragment_recycler"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/platform_white"
android:divider=
"@null"
android:overScrollMode=
"never"
/>
</android.support.v4.widget.SwipeRefreshLayout>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<View
android:id=
"@+id/view_rl_top_bg"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/home_background_home_pager_top"
/>
<RelativeLayout
android:id=
"@+id/rl_top"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
>
<LinearLayout
android:id=
"@+id/ll_top_function"
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:layout_marginTop=
"7dp"
android:layout_marginBottom=
"5dp"
android:paddingRight=
"10dp"
android:gravity=
"center_vertical|right"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/tv_consult"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center_vertical"
android:text=
"咨询"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<TextView
android:id=
"@+id/tv_confide"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:gravity=
"center_vertical"
android:text=
"倾诉"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<TextView
android:id=
"@+id/tv_course"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:gravity=
"center_vertical"
android:text=
"课程"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<TextView
android:id=
"@+id/tv_test"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_16"
android:gravity=
"center_vertical"
android:text=
"测评"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
cube_ptr:ignore=
"SpUsage"
/>
<RelativeLayout
android:id=
"@+id/rl_backTop"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"@dimen/platform_dp_18"
>
<ImageView
android:id=
"@+id/imgTop"
android:layout_width=
"14dp"
android:layout_height=
"9dp"
android:layout_centerHorizontal=
"true"
android:background=
"@drawable/home_back_top"
/>
<TextView
android:id=
"@+id/tv_returnTop"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_below=
"@+id/imgTop"
android:gravity=
"center"
android:text=
"回顶部"
android:textColor=
"@color/platform_white"
android:textSize=
"@dimen/platform_dp_9"
/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"34dp"
android:layout_marginLeft=
"15dp"
android:layout_marginTop=
"4dp"
android:layout_marginRight=
"15dp"
android:layout_marginBottom=
"5dp"
android:id=
"@+id/rl_search"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/img_ad"
android:layout_width=
"64dp"
android:layout_height=
"34dp"
android:layout_marginRight=
"10dp"
android:visibility=
"gone"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<View
android:id=
"@+id/view_search_input_bg"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/home_bg_home_search_input"
android:tag=
"tag_search_input_bg"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/iv_search_icon"
android:layout_width=
"12dp"
android:layout_height=
"12dp"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"12dp"
android:src=
"@drawable/home_icon_search"
/>
<TextView
android:id=
"@+id/home_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginLeft=
"8dp"
android:layout_weight=
"1"
android:gravity=
"center_vertical"
android:text=
"@string/
home_search_hint"
android:textColor=
"#999999"
android:textSize=
"@dimen/platform_default_text_size_small"
android:textStyle=
"normal"
android:typeface=
"sans"
/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<ImageView
android:id=
"@+id/home_service_call"
android:layout_width=
"@dimen/platform_dp_34"
android:layout_height=
"@dimen/platform_dp_34"
android:layout_gravity=
"center_vertical"
android:layout_marginTop=
"7dp"
android:layout_marginRight=
"12dp"
android:layout_toRightOf=
"@+id/rl_search"
android:background=
"?android:attr/selectableItemBackground"
android:contentDescription=
"@null"
android:src=
"@drawable/home_search_phone"
android:visibility=
"gone"
/>
</RelativeLayout>
<LinearLayout
android:id=
"@+id/ll_layout"
android:layout_width=
"match_parent"
android:layout_height=
"41dp"
android:layout_below=
"@+id/rl_top"
android:orientation=
"vertical"
android:visibility=
"gone"
>
<android.support.design.widget.TabLayout
android:id=
"@+id/tab_layout"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:background=
"@color/platform_white"
android:visibility=
"visible"
app:tabGravity=
"fill"
app:tabIndicatorHeight=
"0dp"
app:tabMode=
"scrollable"
app:tabSelectedTextColor=
"@color/platform_color_242424"
app:tabTextAppearance=
"@style/TabLayoutTextSize"
app:tabTextColor=
"#333"
/>
<View
style=
"@style/viewline"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_consultLayout"
android:layout_width=
"match_parent"
android:layout_height=
"41dp"
android:layout_below=
"@+id/rl_top"
android:orientation=
"vertical"
android:visibility=
"gone"
>
<android.support.design.widget.TabLayout
android:id=
"@+id/tab_consultLayout"
android:layout_width=
"match_parent"
android:layout_height=
"40dp"
android:background=
"@color/platform_white"
android:visibility=
"visible"
app:tabGravity=
"fill"
app:tabIndicatorHeight=
"0dp"
app:tabMode=
"scrollable"
app:tabSelectedTextColor=
"@color/platform_color_242424"
app:tabTextAppearance=
"@style/TabLayoutTextSize"
app:tabTextColor=
"#333"
/>
<View
style=
"@style/viewline"
/>
</LinearLayout>
</RelativeLayout>
</FrameLayout>
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