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
fbf458b1
Commit
fbf458b1
authored
May 11, 2020
by
ydl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页改版部分布局修改
parent
4b50b6e0
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
161 additions
and
479 deletions
+161
-479
config.gradle
config.gradle
+1
-1
YdlHomeAdapter.kt
m-home/src/xlzx/java/com/yidianling/home/adapter/YdlHomeAdapter.kt
+0
-1
HomeArticleView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeArticleView.kt
+2
-1
HomeButtonBannerView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeButtonBannerView.kt
+4
-117
HomeCommonTitleView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeCommonTitleView.kt
+5
-7
HomeConfideView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConfideView.kt
+1
-1
HomeConsultView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConsultView.kt
+2
-1
HomeCourseView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeCourseView.kt
+2
-1
HomePagerBannerView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomePagerBannerView.kt
+0
-11
HomeTestItemView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeTestItemView.kt
+3
-9
HomeTestTopItemView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeTestTopItemView.kt
+3
-40
HomeTestView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeTestView.kt
+2
-1
HomeModuleCategoryView.kt
m-home/src/xlzx/java/com/yidianling/home/ui/widget/HomeModuleCategoryView.kt
+21
-80
home_banner_first_icon.png
m-home/src/xlzx/res/drawable-xhdpi/home_banner_first_icon.png
+0
-0
home_banner_fourth_icon.png
m-home/src/xlzx/res/drawable-xhdpi/home_banner_fourth_icon.png
+0
-0
home_banner_second_icon.png
m-home/src/xlzx/res/drawable-xhdpi/home_banner_second_icon.png
+0
-0
home_banner_third_icon.png
m-home/src/xlzx/res/drawable-xhdpi/home_banner_third_icon.png
+0
-0
home_show_more_line.xml
m-home/src/xlzx/res/drawable/home_show_more_line.xml
+2
-1
home_test_top_btn_bg.xml
m-home/src/xlzx/res/drawable/home_test_top_btn_bg.xml
+10
-0
home_test_top_view_layout_back.xml
m-home/src/xlzx/res/drawable/home_test_top_view_layout_back.xml
+6
-4
home_button_banner_view.xml
m-home/src/xlzx/res/layout/home_button_banner_view.xml
+57
-86
home_common_title_view.xml
m-home/src/xlzx/res/layout/home_common_title_view.xml
+16
-28
home_test_top_item_view.xml
m-home/src/xlzx/res/layout/home_test_top_item_view.xml
+24
-89
No files found.
config.gradle
View file @
fbf458b1
ext
{
kotlin_version
=
"1.3.21"
dev_mode
=
fals
e
dev_mode
=
tru
e
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
...
...
m-home/src/xlzx/java/com/yidianling/home/adapter/YdlHomeAdapter.kt
View file @
fbf458b1
...
...
@@ -146,7 +146,6 @@ class YdlHomeAdapter(
//顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块
is
HomeButtonBannerViewHolder
->
{
holder
.
buttonBannerView
.
initData
(
list
[
position
].
headerBean
?.
homeSaleData
,
list
[
position
].
headerBean
?.
askCategoryData
)
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeArticleView.kt
View file @
fbf458b1
...
...
@@ -34,7 +34,8 @@ class HomeArticleView(private val mContext: Context, private var homeEvent: IHom
)
layoutParams
=
params
View
.
inflate
(
mContext
,
R
.
layout
.
home_article_view
,
this
)
homeModuleArticleViewHomeCommonTitleView
.
setTitle
(
"文章·阅读"
)
homeModuleArticleViewHomeCommonTitleView
.
setTitle
(
"主题阅读"
)
homeModuleArticleViewHomeCommonTitleView
.
setMoreText
(
"更多阅读"
)
homeModuleArticleViewHomeCommonTitleView
.
setOnClickListener
{
homeEvent
?.
articleMoreClick
()
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeButtonBannerView.kt
View file @
fbf458b1
...
...
@@ -25,26 +25,6 @@ import kotlinx.android.synthetic.xlzx.home_button_banner_view.view.*
*/
class
HomeButtonBannerView
(
private
val
mContext
:
Context
,
private
var
homeEvent
:
IHomeBaseEvent
?)
:
LinearLayout
(
mContext
)
{
/**
* 数据缓存
*/
var
mDataList
:
ArrayList
<
HomeHeaderBean
.
AskCategoryDataBean
>?
=
null
/**
* 间隔
*/
var
margin
:
Int
=
0
/**
* 是否添加了实时测试状态View
*/
var
hasRealTestView
:
Boolean
=
false
private
var
realTestView
:
HomePagerBannerRealView
?
=
null
/**
* 线
*/
private
var
lineView
:
View
?
=
null
private
var
buttonParams
:
LinearLayout
.
LayoutParams
?
=
null
init
{
initView
()
...
...
@@ -58,46 +38,14 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
layoutParams
=
params
View
.
inflate
(
mContext
,
R
.
layout
.
home_button_banner_view
,
this
)
// initButtonView()
val
ffrom
=
PlatformDataManager
.
getRam
().
getChannelName
()
if
(!
TextUtils
.
isEmpty
(
ffrom
)
&&
ffrom
.
endsWith
(
"huawei"
))
{
homeModuleButtonBannerThird
.
visibility
=
View
.
GONE
homeModuleButtonBannerSecond
.
visibility
=
View
.
GONE
homeModuleButtonBannerFirst
.
background
=
resources
.
getDrawable
(
R
.
drawable
.
home_dcotor_bt_bg_huawei
)
homeModuleButtonBannerSecond
.
background
=
resources
.
getDrawable
(
R
.
drawable
.
home_test_bt_bg_hauwei
)
homeModuleButtonBannerThird
.
background
=
resources
.
getDrawable
(
R
.
drawable
.
home_course_bt_bg_huawei
)
homeModuleButtonBannerFourth
.
background
=
resources
.
getDrawable
(
R
.
drawable
.
home_listen_bt_bg_huawei
)
homeModuleButtonBannerFirstTitle
.
setTextColor
(
Color
.
WHITE
)
tv_first_text
.
setTextColor
(
Color
.
WHITE
)
homeModuleButtonBannerFourthTitle
.
setTextColor
(
Color
.
WHITE
)
tv_second_text
.
setTextColor
(
Color
.
WHITE
)
homeModuleButtonBannerThirdTitle
.
setTextColor
(
Color
.
WHITE
)
tv_third_text
.
setTextColor
(
Color
.
WHITE
)
homeModuleButtonBannerSecondTitle
.
setTextColor
(
Color
.
WHITE
)
tv_fourth_text
.
setTextColor
(
Color
.
WHITE
)
homeModuleButtonBannerFirstTitle
.
textSize
=
18f
tv_first_text
.
textSize
=
13f
homeModuleButtonBannerFourthTitle
.
textSize
=
18f
tv_second_text
.
textSize
=
13f
}
homeModuleButtonBannerFirst
.
setOnClickListener
{
homeEvent
?.
reservationExpertsClick
()
}
homeModuleButtonBannerSecond
.
setOnClickListener
{
homeEvent
?.
nowConfid
eClick
()
homeEvent
?.
askMor
eClick
()
}
homeModuleButtonBannerThird
.
setOnClickListener
{
homeEvent
?.
psychologyClass
Click
()
homeEvent
?.
articleMore
Click
()
}
homeModuleButtonBannerFourth
.
setOnClickListener
{
homeEvent
?.
psychologyTestClick
()
...
...
@@ -106,71 +54,11 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
fun
initData
(
homeSaleData
:
List
<
HomeHeaderBean
.
HomeSaleDataBean
>?,
homeCategory
:
List
<
HomeHeaderBean
.
AskCategoryDataBean
>?
)
{
setRealTextView
(
homeSaleData
)
homeEvent
?.
let
{
home_category_view
.
setEvent
(
it
)
}
home_category_view
.
initData
(
homeCategory
)
val
ffrom
=
PlatformDataManager
.
getRam
().
getChannelName
()
if
(!
TextUtils
.
isEmpty
(
ffrom
)
&&
ffrom
.
endsWith
(
"huawei"
))
{
home_category_view
.
visibility
=
View
.
GONE
}
else
{
homeEvent
?.
let
{
home_category_view
.
setEvent
(
it
)
}
home_category_view
.
initData
(
homeCategory
)
}
}
/**
* 初始化实时测评状态View
*/
private
fun
initRealTextView
()
{
if
(
null
==
realTestView
)
{
var
realTestParam
=
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
realTestView
=
HomePagerBannerRealView
(
context
,
homeEvent
!!
)
realTestView
!!
.
layoutParams
=
realTestParam
}
}
private
fun
initLineView
()
{
var
lineParam
=
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dip2px
(
0.5f
))
var
dp15
=
RxImageTool
.
dip2px
(
15f
)
lineParam
.
leftMargin
=
dp15
lineParam
.
rightMargin
=
dp15
lineView
=
View
(
context
)
lineView
!!
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
home_category_view_test_line
))
lineView
!!
.
layoutParams
=
lineParam
}
/**
* 实时测评状态赋值
*/
private
fun
setRealTextView
(
list
:
List
<
HomeHeaderBean
.
HomeSaleDataBean
>?)
{
if
(!
hasRealTestView
)
{
initLineView
()
ll_home_module_button
.
addView
(
lineView
)
initRealTextView
()
ll_home_module_button
.
addView
(
realTestView
)
val
cutOffParams
=
FrameLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
RxImageTool
.
dip2px
(
0.5f
)
)
cutOffParams
.
height
=
RxImageTool
.
dip2px
(
10f
)
val
cutOffView
=
View
(
context
)
cutOffView
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
home_colorBg
))
cutOffView
.
layoutParams
=
cutOffParams
ll_home_module_button
.
addView
(
cutOffView
)
hasRealTestView
=
true
}
realTestView
!!
.
initData
(
list
)
}
}
\ No newline at end of file
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeCommonTitleView.kt
View file @
fbf458b1
...
...
@@ -30,13 +30,10 @@ class HomeCommonTitleView(private val mContext: Context, private val attributeSe
fun
setTitle
(
title
:
String
)
{
homeModuleCommonTitleViewTitle
.
text
=
title
}
val
isFromXinliZiXunHuawei
=
!
TextUtils
.
isEmpty
(
ffrom
)
&&
ffrom
.
startsWith
(
"ATK_7"
)
&&
ffrom
.
endsWith
(
"huawei"
)
if
(
isFromXinliZiXunHuawei
)
{
view_line
.
visibility
=
View
.
GONE
}
fun
setMoreText
(
text
:
String
)
{
homeModuleCommonTitleViewMorell
.
visibility
=
View
.
VISIBLE
homeModuleCommonTitleViewMoreText
.
text
=
text
}
}
\ No newline at end of file
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConfideView.kt
View file @
fbf458b1
...
...
@@ -49,7 +49,7 @@ class HomeConfideView(private val mContext: Context, private var homeEvent: Home
layoutParams
=
params
orientation
=
VERTICAL
View
.
inflate
(
mContext
,
R
.
layout
.
home_confide_view
,
this
)
homeModuleConfideViewHomeCommonTitleView
.
setTitle
(
"
倾诉·排解
"
)
homeModuleConfideViewHomeCommonTitleView
.
setTitle
(
"
人生答疑
"
)
homeModuleConfideViewHomeCommonTitleView
.
setOnClickListener
{
homeEvent
?.
confideMoreClick
()
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeConsultView.kt
View file @
fbf458b1
...
...
@@ -48,7 +48,8 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
layoutParams
=
params
orientation
=
VERTICAL
View
.
inflate
(
mContext
,
R
.
layout
.
home_confide_view
,
this
)
homeModuleConfideViewHomeCommonTitleView
.
setTitle
(
"咨询·理解"
)
homeModuleConfideViewHomeCommonTitleView
.
setTitle
(
"心理咨询"
)
homeModuleConfideViewHomeCommonTitleView
.
setMoreText
(
"更多咨询"
)
homeModuleConfideViewHomeCommonTitleView
.
setOnClickListener
{
homeEvent
?.
consultMoreClick
()
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeCourseView.kt
View file @
fbf458b1
...
...
@@ -33,7 +33,8 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome
)
layoutParams
=
params
View
.
inflate
(
mContext
,
R
.
layout
.
home_course_view
,
this
)
homeModuleCourseViewHomeCommonTitleView
.
setTitle
(
"学习·成长"
)
homeModuleCourseViewHomeCommonTitleView
.
setTitle
(
"未知潜能"
)
homeModuleCourseViewHomeCommonTitleView
.
setMoreText
(
"更多课程"
)
homeModuleCourseViewHomeCommonTitleView
.
setOnClickListener
{
homeEvent
?.
courseMreClick
()
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomePagerBannerView.kt
View file @
fbf458b1
...
...
@@ -39,20 +39,9 @@ class HomePagerBannerView(private val mContext: Context, private var homeEvent:
View
.
inflate
(
mContext
,
R
.
layout
.
home_pager_banner_view
,
this
)
initBannerLayout
()
// val addLayoutParams = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
// addLayoutParams.setMargins(0, (ScreenUtil.screenWidth * (356f / 750f)).toInt(),0,0)
// homeModulePagerBannerViewAddLayout.layoutParams = addLayoutParams
// if (null == homePagerBannerCategoryView) {
// homePagerBannerCategoryView = HomePagerBannerCategoryView(mContext, homeEvent!!)
// homeModulePagerBannerViewAddLayout.addView(homePagerBannerCategoryView)
// }
}
private
fun
initBannerLayout
()
{
// var screenWidth = RxDeviceTool.getScreenWidth(mContext)
// var viewHeight = screenWidth * 508 / 750
// val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, viewHeight)
// homeModulePagerBannerViewBanner.layoutParams = params
homeModulePagerBannerViewBanner
.
setIndicatorBottomPadding
(
50
)
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeTestItemView.kt
View file @
fbf458b1
...
...
@@ -15,15 +15,14 @@ import kotlinx.android.synthetic.xlzx.home_test_item_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述:
心灵电台
模块item
* @描述:
测评
模块item
* @Copyright Copyright (c) 2019
* @Company 壹点灵
* @date 2019/02/14
*/
class
HomeTestItemView
(
private
val
mContext
:
Context
,
private
var
homeEvent
:
IHomeBaseEvent
?)
:
LinearLayout
(
mContext
)
{
private
val
ffrom
=
PlatformDataManager
.
getRam
().
getChannelName
()
private
var
params
:
LinearLayout
.
LayoutParams
?
=
null
private
var
params
:
LayoutParams
?
=
null
init
{
initView
()
...
...
@@ -31,17 +30,12 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo
private
fun
initView
()
{
orientation
=
VERTICAL
params
=
L
inearLayout
.
L
ayoutParams
(
params
=
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
layoutParams
=
params
View
.
inflate
(
mContext
,
R
.
layout
.
home_test_item_view
,
this
)
val
isFromXinliZiXunHuawei
=
!
TextUtils
.
isEmpty
(
ffrom
)
&&
ffrom
.
startsWith
(
"ATK_7"
)
&&
ffrom
.
endsWith
(
"huawei"
)
if
(
isFromXinliZiXunHuawei
)
{
tv_go
.
visibility
=
View
.
GONE
}
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeTestTopItemView.kt
View file @
fbf458b1
package
com.yidianling.home.ui.view
import
android.content.Context
import
android.text.TextUtils
import
android.view.View
import
android.widget.LinearLayout
import
com.ydl.ydl_image.config.ISimpleImageOpConfig
import
com.ydl.ydl_image.config.SimpleImageOpConfiger
import
com.ydl.ydl_image.manager.YDLImageCacheManager
import
com.ydl.ydlcommon.data.PlatformDataManager
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.home.R
import
com.yidianling.home.event.IHomeBaseEvent
import
com.yidianling.home.model.bean.HomeTestItemBean
...
...
@@ -17,59 +10,29 @@ import kotlinx.android.synthetic.xlzx.home_test_top_item_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述:
心灵电台
模块item--顶部item
* @描述:
测评
模块item--顶部item
* @Copyright Copyright (c) 2019
* @Company 壹点灵
* @date 2019/02/15
*/
class
HomeTestTopItemView
(
private
val
mContext
:
Context
,
private
var
homeEvent
:
IHomeBaseEvent
?)
:
LinearLayout
(
mContext
)
{
private
val
ffrom
=
PlatformDataManager
.
getRam
().
getChannelName
()
init
{
initView
()
}
private
fun
initView
()
{
orientation
=
VERTICAL
var
screenWidth
=
RxDeviceTool
.
getScreenWidth
(
mContext
)
var
viewWidth
=
(
screenWidth
-
2
*
15
*
RxDeviceTool
.
getScreenDensity
(
mContext
)).
toInt
()
var
viewHeight
=
viewWidth
*
143
/
345
val
params
=
LinearLayout
.
LayoutParams
(
viewWidth
,
viewHeight
)
layoutParams
=
params
View
.
inflate
(
mContext
,
R
.
layout
.
home_test_top_item_view
,
this
)
val
isFromXinliZiXunHuawei
=
!
TextUtils
.
isEmpty
(
ffrom
)
&&
ffrom
.
startsWith
(
"ATK_7"
)
&&
ffrom
.
endsWith
(
"huawei"
)
if
(
isFromXinliZiXunHuawei
)
{
ll_day_test
.
visibility
=
View
.
GONE
}
}
/**
* 刷新数据
*/
fun
updateData
(
bean
:
HomeTestItemBean
)
{
var
screenWidth
=
RxDeviceTool
.
getScreenWidth
(
mContext
)
var
viewWidth
=
(
screenWidth
-
RxImageTool
.
dip2px
(
30f
))
var
viewHeight
=
viewWidth
*
143
/
345
val
sp
=
SimpleImageOpConfiger
()
sp
.
loadingPic
=
R
.
drawable
.
platform_default_img
sp
.
errorPic
=
R
.
drawable
.
platform_default_img
sp
.
scaleType
=
ISimpleImageOpConfig
.
CENTER_CROP
sp
.
isCacheOnDisk
=
true
YDLImageCacheManager
.
showImage
(
mContext
,
bean
?.
shareImage
,
homeModuleIntelligentTopViewImage
,
viewWidth
,
viewHeight
,
sp
)
homeModule
Intelligen
tTopViewTitle
.
text
=
bean
.
name
homeModule
IntelligentTopViewHits
.
text
=
bean
.
testNum
.
toString
()
homeModule
Tes
tTopViewTitle
.
text
=
bean
.
name
homeModule
TestTopViewHits
.
text
=
bean
.
testNum
.
toString
()
+
"已测"
this
.
setOnClickListener
{
homeEvent
?.
testItemClick
(
bean
.
recommendLinkUrl
)
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/view/HomeTestView.kt
View file @
fbf458b1
...
...
@@ -30,7 +30,8 @@ class HomeTestView(private val mContext: Context, private var homeEvent: HomeImp
val
params
=
LinearLayout
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
)
layoutParams
=
params
View
.
inflate
(
mContext
,
R
.
layout
.
home_test_view
,
this
)
homeModuleIntelligentViewHomeCommonTitleView
.
setTitle
(
"测试·分析"
)
homeModuleIntelligentViewHomeCommonTitleView
.
setTitle
(
"测试分析"
)
homeModuleIntelligentViewHomeCommonTitleView
.
setMoreText
(
"更多测试"
)
homeModuleIntelligentViewHomeCommonTitleView
.
setOnClickListener
{
homeEvent
?.
testMoreClick
()
}
...
...
m-home/src/xlzx/java/com/yidianling/home/ui/widget/HomeModuleCategoryView.kt
View file @
fbf458b1
...
...
@@ -42,20 +42,10 @@ class HomeModuleCategoryView : FrameLayout {
/**
* 文本宽度
*/
var
textViewWidth
:
Int
=
0
/**
* 文本高度
*/
var
textViewHeight
:
Int
=
0
/**
* 间隔
*/
var
margin
:
Int
=
0
var
imageViewHeight
:
Int
=
0
var
dp8
:
Int
=
0
private
var
realTestView
:
HomePagerBannerRealView
?
=
null
var
dp3
:
Int
=
0
var
dp12
:
Int
=
0
/**
* 倍数
*/
...
...
@@ -82,11 +72,10 @@ class HomeModuleCategoryView : FrameLayout {
*/
private
fun
initView
()
{
View
.
inflate
(
context
,
R
.
layout
.
home_pager_banner_category_view
,
this
)
val
params
=
FrameLayout
.
LayoutParams
(
FrameLayout
.
LayoutParams
.
MATCH_PARENT
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
val
params
=
LayoutParams
(
LayoutParams
.
MATCH_PARENT
,
LayoutParams
.
WRAP_CONTENT
)
// params.topMargin = ScreenUtil.screenHeight * (356f / 750f).toInt()
layoutParams
=
params
initArgs
()
}
...
...
@@ -95,13 +84,11 @@ class HomeModuleCategoryView : FrameLayout {
* 初始化变量
*/
private
fun
initArgs
()
{
categoryWidth
=
ScreenUtil
.
screenWidth
-
RxImageTool
.
dp2px
(
30f
)
textViewWidth
=
categoryWidth
/
4
imageViewWidth
=
RxImageTool
.
dip2px
(
38f
)
margin
=
(
categoryWidth
-
4
*
imageViewWidth
)
/
8
dp8
=
RxImageTool
.
dip2px
(
8f
)
//高度=文字12dp+16dp间距
textViewHeight
=
RxImageTool
.
dip2px
(
28f
)
categoryWidth
=
ScreenUtil
.
screenWidth
-
RxImageTool
.
dp2px
(
12f
+
3f
+
3f
+
12f
)
imageViewWidth
=
categoryWidth
/
3
imageViewHeight
=
imageViewWidth
*
52
/
107
dp3
=
RxImageTool
.
dip2px
(
3f
)
dp12
=
RxImageTool
.
dip2px
(
12f
)
}
fun
initData
(
askCategoryDataBean
:
List
<
HomeHeaderBean
.
AskCategoryDataBean
>?)
{
...
...
@@ -149,23 +136,18 @@ class HomeModuleCategoryView : FrameLayout {
homeModulePagerBannerFlRoot
.
removeAllViews
()
var
i
=
0
for
(
item
in
mDataList
!!
)
{
if
(
i
>
7
)
{
if
(
i
>
5
)
{
break
}
val
imageView
=
createIcon
(
i
)
val
textView
=
createText
(
i
)
homeModulePagerBannerFlRoot
.
addView
(
imageView
)
homeModulePagerBannerFlRoot
.
addView
(
textView
)
imageView
.
setOnClickListener
{
homeEvent
!!
.
categoryClick
(
item
)
}
textView
.
setOnClickListener
{
homeEvent
!!
.
categoryClick
(
item
)
}
bindIconData
(
imageView
,
item
)
bindTextData
(
textView
,
item
)
i
++
}
}
...
...
@@ -174,21 +156,20 @@ class HomeModuleCategoryView : FrameLayout {
* 创建图标
*/
private
fun
createIcon
(
i
:
Int
):
ImageView
{
val
imageParams
=
FrameLayout
.
LayoutParams
(
imageViewWidth
,
imageViewWidth
)
val
imageParams
=
LayoutParams
(
imageViewWidth
,
imageViewHeight
)
val
imageView
=
ImageView
(
context
)
imageView
.
scaleType
=
ImageView
.
ScaleType
.
CENTER_CROP
if
(
i
>
3
)
{
multiple
=
2
imageParams
.
topMargin
=
imageViewWidth
+
dp8
+
textViewHeight
+
dp8
+
RxImageTool
.
dip2px
(
1f
)
imageParams
.
leftMargin
=
margin
*
(
i
-
3
)
+
(
i
-
4
)
*
(
imageViewWidth
+
margin
)
if
(
i
>
2
)
{
//第二行
imageParams
.
topMargin
=
imageViewHeight
imageParams
.
leftMargin
=
dp12
+
dp3
*
(
i
-
3
)
+
imageViewWidth
*
(
i
-
3
)
}
else
{
multiple
=
1
imageParams
.
leftMargin
=
margin
*
(
i
+
1
)
+
i
*
(
imageViewWidth
+
margin
)
//第一行
imageParams
.
topMargin
=
0
imageParams
.
leftMargin
=
dp12
+
dp3
*
i
+
imageViewWidth
*
i
}
imageView
.
layoutParams
=
imageParams
return
imageView
}
...
...
@@ -199,46 +180,7 @@ class HomeModuleCategoryView : FrameLayout {
imageView
:
ImageView
,
categoryBean
:
HomeHeaderBean
.
AskCategoryDataBean
)
{
GlideApp
.
with
(
context
).
load
(
categoryBean
.
coverUrl
)
.
centerCrop
().
into
(
imageView
)
}
/**
* 创建文本
*/
private
fun
createText
(
index
:
Int
):
TextView
{
val
textParams
=
FrameLayout
.
LayoutParams
(
textViewWidth
,
textViewHeight
)
val
textView
=
TextView
(
context
)
textView
.
setTextColor
(
Color
.
parseColor
(
"#444444"
))
textView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
12f
)
textView
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
if
(
index
>
3
)
{
textParams
.
topMargin
=
2
*
(
imageViewWidth
+
dp8
)
+
textViewHeight
+
dp8
textParams
.
leftMargin
=
textViewWidth
*
(
index
-
4
)
}
else
{
textParams
.
topMargin
=
imageViewWidth
+
dp8
textParams
.
leftMargin
=
textViewWidth
*
(
index
)
}
textView
.
layoutParams
=
textParams
return
textView
}
/**
* 设置文本
*/
private
fun
bindTextData
(
textView
:
TextView
,
categoryBean
:
HomeHeaderBean
.
AskCategoryDataBean
)
{
textView
.
text
=
categoryBean
.
cateTitle
}
fun
onDestory
()
{
if
(
null
==
realTestView
)
{
return
}
realTestView
!!
.
onDestory
()
}
}
\ No newline at end of file
m-home/src/xlzx/res/drawable-xhdpi/home_banner_first_icon.png
0 → 100644
View file @
fbf458b1
19.1 KB
m-home/src/xlzx/res/drawable-xhdpi/home_banner_fourth_icon.png
0 → 100644
View file @
fbf458b1
19.1 KB
m-home/src/xlzx/res/drawable-xhdpi/home_banner_second_icon.png
0 → 100644
View file @
fbf458b1
18.9 KB
m-home/src/xlzx/res/drawable-xhdpi/home_banner_third_icon.png
0 → 100644
View file @
fbf458b1
17.2 KB
m-home/src/xlzx/res/drawable/home_show_more_line.xml
View file @
fbf458b1
...
...
@@ -7,6 +7,6 @@
android:width=
"0.5dp"
/>
<corners
android:radius=
"@dimen/platform_dp_1
2
"
/>
android:radius=
"@dimen/platform_dp_1
4
"
/>
</shape>
\ No newline at end of file
m-home/src/xlzx/res/drawable/home_test_top_btn_bg.xml
0 → 100644
View file @
fbf458b1
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/platform_color_FFFFFF"
/>
<corners
android:radius=
"14dp"
/>
</shape>
\ No newline at end of file
m-home/src/xlzx/res/drawable/home_test_top_view_layout_back.xml
View file @
fbf458b1
...
...
@@ -2,12 +2,13 @@
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"@color/platform_color_70FFFFFF"
/>
<gradient
android:startColor=
"#82A1D4"
android:endColor=
"#7DACCA"
/>
<corners
android:bottomLeftRadius=
"@dimen/platform_dp_20"
android:bottomRightRadius=
"@dimen/platform_dp_20"
android:topRightRadius=
"@dimen/platform_dp_20"
android:topRightRadius=
"@dimen/platform_dp_10"
android:topLeftRadius=
"@dimen/platform_dp_10"
/>
</shape>
\ No newline at end of file
m-home/src/xlzx/res/layout/home_button_banner_view.xml
View file @
fbf458b1
...
...
@@ -5,11 +5,6 @@
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<com.yidianling.home.ui.widget.HomeModuleCategoryView
android:id=
"@+id/home_category_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -19,127 +14,103 @@
android:orientation=
"horizontal"
android:paddingBottom=
"12dp"
>
<RelativeLayout
<LinearLayout
android:id=
"@+id/homeModuleButtonBannerFirst"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_weight=
"1"
android:
background=
"@drawable/home_dcotor_bt_bg
"
android:gravity=
"center
_horizontal
"
>
android:
orientation=
"vertical
"
android:gravity=
"center"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerFirstTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"7dp"
android:text=
"预约咨询"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
/>
<ImageView
android:layout_width=
"54dp"
android:layout_height=
"38dp"
android:src=
"@drawable/home_banner_first_icon"
android:scaleType=
"fitXY"
/>
<TextView
android:id=
"@+id/tv_first_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:
layout_below=
"@+id/homeModuleButtonBannerFirstTitle
"
android:
text=
"1W+师资
"
android:textColor=
"@color/platform_color_
44444
4"
android:textSize=
"
@dimen/platform_dp_11"
/>
</
Relative
Layout>
android:
text=
"咨询沟通
"
android:
layout_marginTop=
"7dp
"
android:textColor=
"@color/platform_color_
24242
4"
android:textSize=
"
13dp"
/>
</
Linear
Layout>
<
Relative
Layout
<
Linear
Layout
android:id=
"@+id/homeModuleButtonBannerFourth"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginStart=
"8dp"
android:layout_weight=
"1"
android:
background=
"@drawable/home_listen_bt_bg
"
android:gravity=
"center
_horizontal
"
>
android:
orientation=
"vertical
"
android:gravity=
"center"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerFourthTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"7dp"
android:text=
"心理测试"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
/>
<ImageView
android:layout_width=
"54dp"
android:layout_height=
"38dp"
android:src=
"@drawable/home_banner_fourth_icon"
android:scaleType=
"fitXY"
/>
<TextView
android:id=
"@+id/tv_second_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:
layout_below=
"@+id/homeModuleButtonBannerFourthTitle
"
android:
text=
"专业权威
"
android:textColor=
"@color/platform_color_
44444
4"
android:textSize=
"
@dimen/platform_dp_11"
/>
</
Relative
Layout>
android:
text=
"心理测试
"
android:
layout_marginTop=
"7dp
"
android:textColor=
"@color/platform_color_
24242
4"
android:textSize=
"
13dp"
/>
</
Linear
Layout>
<
Relative
Layout
<
Linear
Layout
android:id=
"@+id/homeModuleButtonBannerThird"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginStart=
"8dp"
android:layout_weight=
"1"
android:background=
"@drawable/home_course_bt_bg"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
android:gravity=
"center"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerThirdTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"7dp"
android:text=
"心理课堂"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
/>
<ImageView
android:layout_width=
"54dp"
android:layout_height=
"38dp"
android:src=
"@drawable/home_banner_third_icon"
android:scaleType=
"fitXY"
/>
<TextView
android:id=
"@+id/tv_third_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:
layout_below=
"@+id/homeModuleButtonBannerThirdTitle
"
android:
text=
"学习与成长
"
android:textColor=
"@color/platform_color_
44444
4"
android:textSize=
"
@dimen/platform_dp_11"
/>
</
Relative
Layout>
android:
text=
"主题阅读
"
android:
layout_marginTop=
"7dp
"
android:textColor=
"@color/platform_color_
24242
4"
android:textSize=
"
13dp"
/>
</
Linear
Layout>
<
Relative
Layout
<
Linear
Layout
android:id=
"@+id/homeModuleButtonBannerSecond"
android:layout_width=
"0dp"
android:layout_height=
"78dp"
android:layout_marginStart=
"8dp"
android:layout_weight=
"1"
android:
background=
"@drawable/home_test_bt_bg
"
android:gravity=
"center
_horizontal
"
>
android:
orientation=
"vertical
"
android:gravity=
"center"
>
<TextView
android:id=
"@+id/homeModuleButtonBannerSecondTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"7dp"
android:text=
"即时倾诉"
android:textColor=
"@color/platform_black"
android:textSize=
"@dimen/platform_dp_16"
android:textStyle=
"bold"
/>
<ImageView
android:layout_width=
"54dp"
android:layout_height=
"38dp"
android:src=
"@drawable/home_banner_second_icon"
android:scaleType=
"fitXY"
/>
<TextView
android:id=
"@+id/tv_fourth_text"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/homeModuleButtonBannerSecondTitle"
android:layout_centerVertical=
"true"
android:text=
"专业解忧"
android:textColor=
"@color/platform_color_444444"
android:textSize=
"@dimen/platform_dp_11"
/>
</RelativeLayout>
android:text=
"人生答疑"
android:layout_marginTop=
"7dp"
android:textColor=
"@color/platform_color_242424"
android:textSize=
"13dp"
/>
</LinearLayout>
</LinearLayout>
<com.yidianling.home.ui.widget.HomeModuleCategoryView
android:id=
"@+id/home_category_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</LinearLayout>
m-home/src/xlzx/res/layout/home_common_title_view.xml
View file @
fbf458b1
...
...
@@ -4,56 +4,44 @@
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:paddingTop=
"@dimen/platform_dp_24"
android:paddingBottom=
"@dimen/platform_dp_14"
>
<View
android:id=
"@+id/view_line"
android:layout_width=
"0dp"
android:layout_height=
"5dp"
android:background=
"@drawable/home_common_title_gradient_back"
app:layout_constraintLeft_toLeftOf=
"@+id/homeModuleCommonTitleViewTitle"
app:layout_constraintRight_toRightOf=
"@+id/homeModuleCommonTitleViewTitle"
app:layout_constraintBottom_toBottomOf=
"@+id/homeModuleCommonTitleViewTitle"
android:layout_marginBottom=
"2dp"
/>
android:paddingTop=
"@dimen/platform_dp_20"
android:paddingBottom=
"@dimen/platform_dp_6"
>
<TextView
android:id=
"@+id/homeModuleCommonTitleViewTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:paddingRight=
"@dimen/platform_dp_1"
tools:text=
"通用
.
标题"
android:textSize=
"2
4
dp"
tools:text=
"通用标题"
android:textSize=
"2
0
dp"
android:textStyle=
"bold"
android:textColor=
"@color/platform_color_
333333
"
android:textColor=
"@color/platform_color_
242424
"
android:layout_marginLeft=
"@dimen/platform_dp_15"
app:layout_constraintLeft_toLeftOf=
"parent"
/>
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
/>
<LinearLayout
android:layout_width=
"66dp"
android:layout_height=
"@dimen/platform_dp_24"
android:id=
"@+id/homeModuleCommonTitleViewMorell"
android:layout_width=
"74dp"
android:layout_height=
"@dimen/platform_dp_28"
android:orientation=
"horizontal"
android:gravity=
"center"
android:layout_marginBottom=
"@dimen/platform_dp_3"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
android:layout_marginRight=
"@dimen/platform_dp_15"
android:background=
"@drawable/home_show_more_line"
>
android:background=
"@drawable/home_show_more_line"
android:visibility=
"gone"
>
<TextView
android:id=
"@+id/homeModuleCommonTitleViewMoreText"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:text=
"更多"
android:text=
"更多
选择
"
android:layout_marginLeft=
"@dimen/platform_dp_2"
android:textColor=
"@color/platform_color_444444"
android:textSize=
"13sp"
/>
<ImageView
android:layout_height=
"8dp"
android:layout_width=
"4dp"
android:src=
"@drawable/home_sale_arrow"
android:layout_marginLeft=
"3dp"
/>
android:textColor=
"@color/platform_color_666666"
android:textSize=
"12dp"
/>
</LinearLayout>
...
...
m-home/src/xlzx/res/layout/home_test_top_item_view.xml
View file @
fbf458b1
...
...
@@ -3,109 +3,44 @@
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<android.support.v7.widget.CardView
android:id=
"@+id/homeModuleIntelligentTopViewImageCardView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:cardCornerRadius=
"@dimen/platform_dp_7"
app:cardElevation=
"0dp"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/homeModuleIntelligentTopViewImage"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/home_image_default_back"
android:scaleType=
"centerCrop"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<View
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"45"
/>
<View
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"55"
android:background=
"@drawable/home_intelligent_gradient_back"
/>
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
android:layout_height=
"92dp"
android:background=
"@drawable/home_test_top_view_layout_back"
>
<TextView
android:id=
"@+id/homeModule
Intelligen
tTopViewTitle"
android:id=
"@+id/homeModule
Tes
tTopViewTitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_
alignParentBottom=
"true
"
android:layout_
marginTop=
"24dp
"
android:layout_marginLeft=
"@dimen/platform_dp_14"
android:layout_marginRight=
"@dimen/platform_dp_115"
android:layout_marginBottom=
"@dimen/platform_dp_35"
android:layout_marginRight=
"100dp"
android:ellipsize=
"end"
android:maxLines=
"1"
android:textColor=
"@color/platform_color_FFFFFF"
android:textSize=
"@dimen/platform_dp_
24
"
android:textSize=
"@dimen/platform_dp_
18
"
android:textStyle=
"bold"
tools:text=
"先结婚还是先买先结婚还是先买房"
/>
<
LinearLayout
android:id=
"@+id/homeModule
IntelligentTopViewDescLayout
"
<
TextView
android:id=
"@+id/homeModule
TestTopViewHits
"
android:layout_width=
"wrap_content"
android:layout_height=
"@dimen/platform_dp_18"
android:layout_alignLeft=
"@+id/homeModuleIntelligentTopViewTitle"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"@dimen/platform_dp_14"
android:background=
"@drawable/home_test_top_view_layout_back"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
android:paddingLeft=
"@dimen/platform_dp_10"
android:paddingRight=
"@dimen/platform_dp_10"
>
<TextView
android:id=
"@+id/homeModuleIntelligentTopViewHits"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/platform_color_444444"
android:textSize=
"@dimen/platform_dp_12"
android:textStyle=
"bold"
tools:text=
"2486"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"已测"
android:textColor=
"@color/platform_color_666666"
android:textSize=
"@dimen/platform_dp_12"
/>
</LinearLayout>
android:layout_height=
"wrap_content"
android:layout_marginTop=
"53dp"
android:layout_marginLeft=
"16dp"
android:textColor=
"@color/platform_color_FFFFFF"
android:textSize=
"@dimen/platform_dp_12"
tools:text=
"2486已测"
/>
<RelativeLayout
android:id=
"@+id/ll_day_test"
android:layout_width=
"@dimen/platform_dp_64"
android:layout_height=
"@dimen/platform_dp_20"
<TextView
android:layout_width=
"64dp"
android:layout_height=
"28dp"
android:text=
"测试"
android:textColor=
"#FBAA0E"
android:textSize=
"13dp"
android:gravity=
"center"
android:layout_alignParentRight=
"true"
android:background=
"@drawable/home_intelligent_top_view_recommend_back"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:text=
"每日一测"
android:textColor=
"@color/platform_color_242424"
android:textSize=
"@dimen/platform_dp_12"
android:textStyle=
"bold"
/>
</RelativeLayout>
android:layout_marginTop=
"25dp"
android:layout_marginRight=
"14dp"
android:background=
"@drawable/home_test_top_btn_bg"
/>
</RelativeLayout>
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