Commit 44eeea65 by ydl

Merge branch 'feature/心理咨询首页改版_from咨询加声网分支' into dev

# Conflicts:
#	config.gradle
parents 8295a7e3 1d5eb58b
...@@ -20,8 +20,8 @@ import java.util.List; ...@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule { public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/"; String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST; // public static String appEnv = YDLConstants.ENV_AUTO_TEST;
public static String appEnv = YDLConstants.ENV_TEST; // public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD; public static String appEnv = YDLConstants.ENV_PROD;
@Override @Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) { public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
...@@ -5,18 +5,18 @@ ext { ...@@ -5,18 +5,18 @@ ext {
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
"m-confide" : "0.0.48.52", "m-confide" : "0.0.48.71",
"m-consultant" : "0.0.59.10", "m-consultant" : "0.0.59.20",
"m-fm" : "0.0.29.9", "m-fm" : "0.0.30.00",
"m-user" : "0.0.60.12", "m-user" : "0.0.60.20",
"m-home" : "0.0.22.5", "m-home" : "0.0.22.18",
"m-im" : "0.0.18.10", "m-im" : "0.0.18.10",
"m-dynamic" : "0.0.7.7", "m-dynamic" : "0.0.7.70",
"m-article" : "0.0.0.5", "m-article" : "0.0.0.6",
"m-muse" : "0.0.28.12", "m-muse" : "0.0.28.20",
"m-tests" : "0.0.24.7", "m-tests" : "0.0.24.10",
"m-course" : "0.0.42.5", "m-course" : "0.0.42.6",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.6", "m-audioim-api" : "0.0.6",
...@@ -33,7 +33,7 @@ ext { ...@@ -33,7 +33,7 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.39.33", "ydl-platform" : "0.0.39.34",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.32", "ydl-webview" : "0.0.38.32",
...@@ -84,8 +84,6 @@ ext { ...@@ -84,8 +84,6 @@ ext {
] ]
ydlCompileVersion = [ ydlCompileVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
//第三步 若干 //第三步 若干
...@@ -116,7 +114,7 @@ ext { ...@@ -116,7 +114,7 @@ ext {
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//第一步 //第一步
"ydl-platform" : "0.0.39.26", "ydl-platform" : "0.0.39.34",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.38.31", "ydl-webview" : "0.0.38.31",
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,6 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse ...@@ -4,6 +4,7 @@ import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.data.http.RxUtils import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.home.model.bean.* import com.yidianling.home.model.bean.*
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
...@@ -76,7 +77,8 @@ class HomeBaseHttp { ...@@ -76,7 +77,8 @@ class HomeBaseHttp {
} }
//首页文章请求 //首页文章请求
fun getArticleData(perPageRows: String = "4"): Observable<BaseAPIResponse<HomeArticleBean>> { fun getArticleData(): Observable<BaseAPIResponse<HomeArticleBean>> {
articleListSize = if (YdlCommonOut.getApp().packageName == "com.cxzapp.xinlizixun") "6" else "4"
return getHomePagerApi().getArticleData(perPageRows = articleListSize) return getHomePagerApi().getArticleData(perPageRows = articleListSize)
} }
...@@ -84,6 +86,7 @@ class HomeBaseHttp { ...@@ -84,6 +86,7 @@ class HomeBaseHttp {
fun getConsultData(goodType: String): Observable<BaseAPIResponse<HomeConsultBean>> { fun getConsultData(goodType: String): Observable<BaseAPIResponse<HomeConsultBean>> {
val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo() val loginBean = ModularServiceManager.provide(IUserService::class.java).getUserInfo()
var userId = loginBean?.uid ?: "" var userId = loginBean?.uid ?: ""
consultListSize = if (YdlCommonOut.getApp().packageName == "com.cxzapp.xinlizixun") "4" else "3"
return getHomePagerApi().getConsultData(category = goodType, uid = userId,limit = consultListSize) return getHomePagerApi().getConsultData(category = goodType, uid = userId,limit = consultListSize)
} }
......
...@@ -6,6 +6,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA ...@@ -6,6 +6,7 @@ import com.ydl.ydlcommon.base.config.YDL_DOMAIN_JAVA
import com.ydl.ydlcommon.data.PlatformDataManager import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.data.http.BaseAPIResponse import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.router.YdlCommonOut
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.home.model.bean.* import com.yidianling.home.model.bean.*
import io.reactivex.Observable import io.reactivex.Observable
......
...@@ -105,13 +105,17 @@ class YdlHomeAdapter( ...@@ -105,13 +105,17 @@ class YdlHomeAdapter(
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): RecyclerView.ViewHolder {
when (viewType) { when (viewType) {
//顶部图片banner
YdlHomeViewHolderConstract.HOME_IMAGE_BANNER -> {
return HomeImageBannerViewHolder(HomeImageBannerView(mContext, homeEvent))
}
//顶部预约专家,即时倾诉,心理测试按钮模块 //顶部预约专家,即时倾诉,心理测试按钮模块
YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW -> { YdlHomeViewHolderConstract.BUTTON_BANNER_VIEW -> {
return HomeButtonBannerViewHolder(HomeButtonBannerView(mContext, homeEvent)) return HomeButtonBannerViewHolder(HomeButtonBannerView(mContext, homeEvent))
} }
//倾诉*排解模块 //倾诉*排解模块
YdlHomeViewHolderConstract.CONFIDE_VIEW -> { YdlHomeViewHolderConstract.CONFIDE_VIEW -> {
return HomeConfideViewHolder(HomeConfideView(mContext, homeEvent)) return HomeEmptyViewHolder(HomeEmptyView(mContext))
} }
//课程*成长模块 //课程*成长模块
YdlHomeViewHolderConstract.COURSE_VIEW -> { YdlHomeViewHolderConstract.COURSE_VIEW -> {
...@@ -143,28 +147,30 @@ class YdlHomeAdapter( ...@@ -143,28 +147,30 @@ class YdlHomeAdapter(
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) { when (holder) {
is HomeImageBannerViewHolder -> {
holder.imageBannerView.initData(list[position])
}
//顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块 //顶部预约专家,即时倾诉,心理课堂,心理测试按钮模块
is HomeButtonBannerViewHolder -> { is HomeButtonBannerViewHolder -> {
holder.buttonBannerView.initData( holder.buttonBannerView.initData(
list[position].headerBean?.homeSaleData,
list[position].headerBean?.askCategoryData list[position].headerBean?.askCategoryData
) )
} }
//倾诉*排解模块 //倾诉*排解模块
is HomeConfideViewHolder -> { // is HomeConfideViewHolder -> {
if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) { // if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
val parm = holder.itemView.layoutParams // val parm = holder.itemView.layoutParams
parm.height = 0 // parm.height = 0
holder.itemView.layoutParams = parm // holder.itemView.layoutParams = parm
} else { // } else {
holder.confideViewView.setTitle( // holder.confideViewView.setTitle(
list[position].headerBean?.listenCategoryDate, // list[position].headerBean?.listenCategoryDate,
confideSelectPosition // confideSelectPosition
) // )
holder.confideViewView.setConfideExpertInfoView(list[position].confideBean?.body) // holder.confideViewView.setConfideExpertInfoView(list[position].confideBean?.body)
confidePosition = position // confidePosition = position
} // }
} // }
//课程*成长模块 //课程*成长模块
is HomeCourseViewHolder -> { is HomeCourseViewHolder -> {
if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) { if (!TextUtils.isEmpty(ffrom) && ffrom.endsWith("huawei")) {
...@@ -219,6 +225,9 @@ class YdlHomeAdapter( ...@@ -219,6 +225,9 @@ class YdlHomeAdapter(
return list.size return list.size
} }
inner class HomeImageBannerViewHolder(val imageBannerView: HomeImageBannerView) :
RecyclerView.ViewHolder(imageBannerView)
/** /**
* 顶部预约专家,即时倾诉,心理测试按钮模块 ViewHolder * 顶部预约专家,即时倾诉,心理测试按钮模块 ViewHolder
*/ */
...@@ -237,6 +246,9 @@ class YdlHomeAdapter( ...@@ -237,6 +246,9 @@ class YdlHomeAdapter(
inner class HomeConfideViewHolder(val confideViewView: HomeConfideView) : inner class HomeConfideViewHolder(val confideViewView: HomeConfideView) :
RecyclerView.ViewHolder(confideViewView) RecyclerView.ViewHolder(confideViewView)
inner class HomeEmptyViewHolder(val emptyView: HomeEmptyView) :
RecyclerView.ViewHolder(emptyView)
/** /**
* 课程*成长模块 ViewHolder * 课程*成长模块 ViewHolder
*/ */
......
...@@ -10,6 +10,10 @@ package com.yidianling.home.constract ...@@ -10,6 +10,10 @@ package com.yidianling.home.constract
class YdlHomeViewHolderConstract { class YdlHomeViewHolderConstract {
companion object { companion object {
/** /**
* 顶部banner
*/
val HOME_IMAGE_BANNER = 10000
/**
* 顶部ViewPager与分类模块 * 顶部ViewPager与分类模块
*/ */
val PAGER_BANNER_VIEW = 10001 val PAGER_BANNER_VIEW = 10001
...@@ -22,28 +26,29 @@ class YdlHomeViewHolderConstract { ...@@ -22,28 +26,29 @@ class YdlHomeViewHolderConstract {
*/ */
val CONSULT_VIEW = 10003 val CONSULT_VIEW = 10003
/** /**
* 课程*成长模块 * 测试模块
*/
val COURSE_VIEW = 10004
/**
* 倾诉*排解模块
*/ */
val CONFIDE_VIEW = 10005 val TEST_VIEW = 10004
/** /**
* 测试模块 * 课程*成长模块
*/ */
val TEST_VIEW = 10006 val COURSE_VIEW = 10005
/** /**
* 解忧*问答模块 * 解忧*问答模块
*/ */
val ASSUAGE_GRIEF_VIEW = 10007 val ASSUAGE_GRIEF_VIEW = 10006
/** /**
* 文章*阅读模块 * 文章*阅读模块
*/ */
val ARTICLE_VIEW = 10008 val ARTICLE_VIEW = 10007
/** /**
* 底部提示语模块 * 底部提示语模块
*/ */
val FOOTER_VIEW = 10009 val FOOTER_VIEW = 10008
/**
* 倾诉*排解模块
*/
val CONFIDE_VIEW = 1000100
} }
} }
\ No newline at end of file
...@@ -16,6 +16,7 @@ import com.ydl.webview.NewH5Activity ...@@ -16,6 +16,7 @@ import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_router.manager.YDLRouterManager import com.ydl.ydl_router.manager.YDLRouterManager
import com.ydl.ydlcommon.base.BaseMvpFragment import com.ydl.ydlcommon.base.BaseMvpFragment
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.http.BaseResponse import com.ydl.ydlcommon.data.http.BaseResponse
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.* import com.ydl.ydlcommon.utils.*
...@@ -33,12 +34,11 @@ import com.yidianling.home.listener.HomeConfideRecyleSuspendListener ...@@ -33,12 +34,11 @@ import com.yidianling.home.listener.HomeConfideRecyleSuspendListener
import com.yidianling.home.model.bean.* import com.yidianling.home.model.bean.*
import com.yidianling.home.presenter.HomePresenterImpl import com.yidianling.home.presenter.HomePresenterImpl
import com.yidianling.home.ui.view.CouponDialog import com.yidianling.home.ui.view.CouponDialog
import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.xlzx.home_fragment_home_module.* import kotlinx.android.synthetic.xlzx.home_fragment_home_module.*
import kotlinx.android.synthetic.xlzx.home_layout_home_module_content.* import kotlinx.android.synthetic.xlzx.home_layout_home_module_content.*
import kotlinx.android.synthetic.xlzx.home_layout_home_module_head_bg.*
import kotlinx.android.synthetic.xlzx.home_layout_home_module_input.* import kotlinx.android.synthetic.xlzx.home_layout_home_module_input.*
import kotlinx.android.synthetic.xlzx.home_layout_home_module_toolbar.*
/** /**
...@@ -85,6 +85,10 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -85,6 +85,10 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
return R.layout.home_fragment_home_module return R.layout.home_fragment_home_module
} }
override fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions(isAddStatusView = true, statusBarDarkMode = true)
}
override fun initDataAndEvent() { override fun initDataAndEvent() {
homeEvent = HomeImpl(activity, this) homeEvent = HomeImpl(activity, this)
initView() initView()
...@@ -113,56 +117,62 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -113,56 +117,62 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
) )
) )
home_swipe_refresh_layout.setProgressViewOffset(false, 0, 200) home_swipe_refresh_layout.setProgressViewOffset(false, 0, 200)
home_swipe_refresh_layout.isEnabled = false home_swipe_refresh_layout.isEnabled = true
etSearch.setOnClickListener { homeEvent?.searchTvClick("") } etSearch.setOnClickListener { homeEvent?.searchTvClick("") }
val inputLayoutParams = ll_search.layoutParams as CoordinatorLayout.LayoutParams home_page_xiaoyi.setOnClickListener {
val inputOriginMargin = inputLayoutParams.leftMargin activity?.let {
var inputOffset = DisplayUtils.dp2px(context, 20).toFloat() ModularServiceManager.provide(IImService::class.java).startP2PXiaoYi(activity)
}
appbar_layout.addOnOffsetChangedListener { appBarLayout, i -> }
home_swipe_refresh_layout.isEnabled = i >= 0
// val inputLayoutParams = ll_search.layoutParams as CoordinatorLayout.LayoutParams
val scale = java.lang.Float.valueOf(Math.abs(i).toFloat())!! / java.lang.Float.valueOf( // val inputOriginMargin = inputLayoutParams.leftMargin
appBarLayout.totalScrollRange.toFloat() // var inputOffset = DisplayUtils.dp2px(context, 20).toFloat()
)!! //
view_search_toolbar_bg.alpha = scale // appbar_layout.addOnOffsetChangedListener { appBarLayout, i ->
val leftMargin = inputOriginMargin - inputOffset * scale // home_swipe_refresh_layout.isEnabled = i >= 0
val rightMargin = inputOriginMargin - inputOffset * scale //
inputLayoutParams.setMargins(leftMargin.toInt(), 0, rightMargin.toInt(), 0) // val scale = java.lang.Float.valueOf(Math.abs(i).toFloat())!! / java.lang.Float.valueOf(
ll_search.layoutParams = inputLayoutParams // appBarLayout.totalScrollRange.toFloat()
val zheZhaoAlpha = ((1 - (0.2 * scale)).toFloat()) // )!!
//以下判断是因为toolbar和遮罩层拦截住了点击事件,导致banner不好点击 // view_search_toolbar_bg.alpha = scale
if (zheZhaoAlpha == 1f) { // val leftMargin = inputOriginMargin - inputOffset * scale
title_layout.visibility = View.GONE // val rightMargin = inputOriginMargin - inputOffset * scale
toolbar.visibility = View.GONE // inputLayoutParams.setMargins(leftMargin.toInt(), 0, rightMargin.toInt(), 0)
} else { // ll_search.layoutParams = inputLayoutParams
title_layout.visibility = View.VISIBLE // val zheZhaoAlpha = ((1 - (0.2 * scale)).toFloat())
toolbar.visibility = View.VISIBLE // //以下判断是因为toolbar和遮罩层拦截住了点击事件,导致banner不好点击
} // if (zheZhaoAlpha == 1f) {
view_search_input_bg.alpha = zheZhaoAlpha // title_layout.visibility = View.GONE
} // toolbar.visibility = View.GONE
initStatus() // } else {
// title_layout.visibility = View.VISIBLE
// toolbar.visibility = View.VISIBLE
// }
// view_search_input_bg.alpha = zheZhaoAlpha
// }
// initStatus()
} }
/** /**
* 初始化状态栏位置 * 初始化状态栏位置
*/ */
private fun initStatus() { // private fun initStatus() {
//
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色 // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {//4.4以下不支持状态栏变色
val statusBarHeight = StatusBarUtils.getStatusBarHeight(activity) // val statusBarHeight = StatusBarUtils.getStatusBarHeight(activity)
var homeTitleBarHeight = resources.getDimension(R.dimen.home_home_title_bar_height) // var homeTitleBarHeight = resources.getDimension(R.dimen.home_home_title_bar_height)
val lp1 = view_search_toolbar_bg.layoutParams as RelativeLayout.LayoutParams // val lp1 = view_search_toolbar_bg.layoutParams as RelativeLayout.LayoutParams
lp1.height = (homeTitleBarHeight + statusBarHeight).toInt() // lp1.height = (homeTitleBarHeight + statusBarHeight).toInt()
view_search_toolbar_bg.layoutParams = lp1 // view_search_toolbar_bg.layoutParams = lp1
//
val lp2 = toolbar.layoutParams as CollapsingToolbarLayout.LayoutParams // val lp2 = toolbar.layoutParams as CollapsingToolbarLayout.LayoutParams
lp2.topMargin = statusBarHeight // lp2.topMargin = statusBarHeight
toolbar.layoutParams = lp2 // toolbar.layoutParams = lp2
} // }
} // }
override fun initDataAndEventLazy() { override fun initDataAndEventLazy() {
} }
...@@ -205,6 +215,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -205,6 +215,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
if (act != null) { if (act != null) {
if (!TextUtils.isEmpty(act.imageUrl)) { if (!TextUtils.isEmpty(act.imageUrl)) {
img_ad.visibility = View.VISIBLE img_ad.visibility = View.VISIBLE
img_ad_card.visibility = View.VISIBLE
GlideApp.with(this).load(act.imageUrl).into(img_ad) GlideApp.with(this).load(act.imageUrl).into(img_ad)
img_ad.setOnClickListener { img_ad.setOnClickListener {
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
...@@ -219,6 +230,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -219,6 +230,7 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
} }
} else { } else {
img_ad.visibility = View.GONE img_ad.visibility = View.GONE
img_ad_card.visibility = View.GONE
} }
if (!TextUtils.isEmpty(act.imageBanner)) { if (!TextUtils.isEmpty(act.imageBanner)) {
val va = SharedPreferencesEditor.getString(act.imageBanner) val va = SharedPreferencesEditor.getString(act.imageBanner)
...@@ -264,9 +276,9 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -264,9 +276,9 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
override fun homeDataResponse(list: MutableList<HomePagerDataBean>) { override fun homeDataResponse(list: MutableList<HomePagerDataBean>) {
home_swipe_refresh_layout.isRefreshing = false home_swipe_refresh_layout.isRefreshing = false
//更新首页数据 //更新首页数据
initHeader(list) if (list.size > 0) {
//移除header条目 list[0].type = YdlHomeViewHolderConstract.HOME_IMAGE_BANNER
list.removeAt(0) }
adapter?.updateItems(list) adapter?.updateItems(list)
//每次全局更新后重置下标位 //每次全局更新后重置下标位
confideLastSelectPosition = 0 confideLastSelectPosition = 0
...@@ -280,38 +292,6 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>() ...@@ -280,38 +292,6 @@ class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterImpl>()
} }
} }
private fun initHeader(list: MutableList<HomePagerDataBean>) {
var headerBean = list[0].headerBean;
// homeEvent?.let { home_category_view.setEvent(it) };
// home_category_view.initData(headerBean?.askCategoryData)
var focusListBean = headerBean?.focusList;
//临时缓存集合
val cacheList = ArrayList<HomeHeaderBean.FocusListBean>()
if (null != focusListBean && focusListBean.isNotEmpty()) {
var imageViews = ArrayList<String>()
//产品说取前8个
if (focusListBean.size > 8) {
cacheList.addAll(focusListBean.subList(0, 8))
} else {
cacheList.addAll(focusListBean)
}
for (item in cacheList) {
imageViews.add(item.imageUrl!!)
}
banner_search.setImageLoader(GlideImageLoader(R.drawable.home_image_default_back))
.setImages(imageViews).start()
banner_search.setOnBannerListener {
homeEvent?.bannerClick(cacheList!![it])
YdlBuryPointUtil.sendClick(
"ydl-xinlizixun-home-banner$it",
"${cacheList[it].imageUrl}"
)
}
banner_search.setIndicatorBottomPadding(20)
}
}
override fun confideDataResponse(data: HomeConfideBean, selectPosition: Int) { override fun confideDataResponse(data: HomeConfideBean, selectPosition: Int) {
//更新倾述列表数据 //更新倾述列表数据
adapter?.updateConfideData(data, selectPosition) adapter?.updateConfideData(data, selectPosition)
......
...@@ -37,7 +37,6 @@ class HomeArticleItemView(private val mContext: Context, private var homeEvent: ...@@ -37,7 +37,6 @@ class HomeArticleItemView(private val mContext: Context, private var homeEvent:
fun updateData(bean: HomeArticleBean.Bean?) { fun updateData(bean: HomeArticleBean.Bean?) {
homeModuleArticleItemViewTitle.text = bean?.title homeModuleArticleItemViewTitle.text = bean?.title
homeModuleArticleItemViewContent.text = bean?.desc homeModuleArticleItemViewContent.text = bean?.desc
homeModuleArticleItemViewAuthor.text = bean?.name
homeModuleArticleItemViewGreatNum.text = bean?.countOfFavorite.toString() homeModuleArticleItemViewGreatNum.text = bean?.countOfFavorite.toString()
homeModuleArticleItemViewLookNum.text = bean?.readNum.toString() homeModuleArticleItemViewLookNum.text = bean?.readNum.toString()
YDLImageCacheManager.showImage(mContext, bean?.imgUrl, homeModuleArticleItemViewImg) YDLImageCacheManager.showImage(mContext, bean?.imgUrl, homeModuleArticleItemViewImg)
......
...@@ -34,7 +34,8 @@ class HomeArticleView(private val mContext: Context, private var homeEvent: IHom ...@@ -34,7 +34,8 @@ class HomeArticleView(private val mContext: Context, private var homeEvent: IHom
) )
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_article_view, this) View.inflate(mContext, R.layout.home_article_view, this)
homeModuleArticleViewHomeCommonTitleView.setTitle("文章·阅读") homeModuleArticleViewHomeCommonTitleView.setTitle("主题阅读")
homeModuleArticleViewHomeCommonTitleView.setMoreText("更多阅读")
homeModuleArticleViewHomeCommonTitleView.setOnClickListener { homeModuleArticleViewHomeCommonTitleView.setOnClickListener {
homeEvent?.articleMoreClick() homeEvent?.articleMoreClick()
} }
......
...@@ -33,14 +33,13 @@ class HomeAssuageGriefImageItemView( ...@@ -33,14 +33,13 @@ class HomeAssuageGriefImageItemView(
radius = 4f radius = 4f
cardElevation = 0f cardElevation = 0f
var screenWidth = RxDeviceTool.getScreenWidth(mContext) var screenWidth = RxDeviceTool.getScreenWidth(mContext)
var viewWidth = (screenWidth - 2 * 30 * RxDeviceTool.getScreenDensity(mContext)).toInt() var viewWidth = (screenWidth - 2 * 16 * RxDeviceTool.getScreenDensity(mContext)).toInt()
var params: LinearLayout.LayoutParams? var params: LinearLayout.LayoutParams?
//根据图片的数量,加载不同的图片布局 //根据图片的数量,加载不同的图片布局
if (urlList.size <= 2) { if (urlList.size <= 2) {
var viewHeight = viewWidth * 178 / 315 var viewHeight = viewWidth * 178 / 315
params = LinearLayout.LayoutParams(viewWidth, viewHeight) params = LinearLayout.LayoutParams(viewWidth, viewHeight)
params.bottomMargin = (20 * RxDeviceTool.getScreenDensity(mContext)).toInt()
layoutParams = params layoutParams = params
View.inflate( View.inflate(
mContext, mContext,
......
...@@ -45,31 +45,20 @@ class HomeAssuageGriefItemView( ...@@ -45,31 +45,20 @@ class HomeAssuageGriefItemView(
} }
private fun initView() { private fun initView() {
val params = LinearLayout.LayoutParams( val params = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
) )
params.setMargins(
(15 * RxDeviceTool.getScreenDensity(mContext)).toInt()
, (0 * RxDeviceTool.getScreenDensity(mContext)).toInt()
, (15 * RxDeviceTool.getScreenDensity(mContext)).toInt()
, (16 * RxDeviceTool.getScreenDensity(mContext)).toInt()
)
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_assuage_grief_item_view, this) View.inflate(mContext, R.layout.home_assuage_grief_item_view, this)
} }
fun updateData(bean: HomeAskBean.DataBean, position: Int, index: Int) { fun updateData(bean: HomeAskBean.DataBean, position: Int, index: Int, isBottomItem: Boolean) {
this.setOnClickListener { this.setOnClickListener {
homeEvent?.askItemClick(bean) homeEvent?.askItemClick(bean)
} }
YDLImageCacheManager.showImage(mContext, bean?.header, homeModuleAssuageGriefViewPersonImg)
homeModuleAssuageGriefViewPersonName.text = bean?.name
// homeModuleAssuageGriefViewTime.text = bean?.timeStr
MoonUtil.identifyFaceExpression( MoonUtil.identifyFaceExpression(
mContext, homeModuleAssuageGriefViewContent, mContext, homeModuleAssuageGriefViewContent,
bean?.content, ImageSpan.ALIGN_BOTTOM bean?.content, ImageSpan.ALIGN_BOTTOM
...@@ -78,6 +67,17 @@ class HomeAssuageGriefItemView( ...@@ -78,6 +67,17 @@ class HomeAssuageGriefItemView(
homeModuleAssuageGriefViewCommentsCount.text = bean?.commentsCount.toString() homeModuleAssuageGriefViewCommentsCount.text = bean?.commentsCount.toString()
homeModuleAssuageGriefViewZanCount.text = bean?.zanCount.toString() homeModuleAssuageGriefViewZanCount.text = bean?.zanCount.toString()
if (isBottomItem) {
homeModuleAssuageGriefViewBottomLine.visibility = View.GONE
homeModuleAssuageGriefViewBottomBtn.visibility = View.VISIBLE
homeModuleAssuageGriefViewBottomBtn.setOnClickListener {
homeEvent?.askMoreClick()
}
} else {
homeModuleAssuageGriefViewBottomLine.visibility = View.VISIBLE
homeModuleAssuageGriefViewBottomBtn.visibility = View.GONE
}
/** /**
* 点赞 * 点赞
...@@ -103,39 +103,6 @@ class HomeAssuageGriefItemView( ...@@ -103,39 +103,6 @@ class HomeAssuageGriefItemView(
} }
} }
homeModuleAssuageGriefItemViewIsFollow.setOnClickListener {
if (bean.isFocused == 1) {
homeEvent?.askItemClick(bean)
} else {
if (!Utils.isFastClick()) {
if (!ModularServiceManager.provide(IUserService::class.java).isLogin()) {
//跳转登录
YDLRouterManager.router(IYDLRouterConstant.ROUTER_MINE_LOGIN)
return@setOnClickListener
}
bean.isFocused = if (bean.isFocused == 1) 0 else 1
setFollowType(bean.isFocused == 1)
//防止连击
homeEvent?.askItemFocusClick(position, bean.uid.toString())
}
}
}
if (bean.uid == 0) {
//匿名,隐藏关注按钮
homeModuleAssuageGriefItemViewIsFollow.visibility = View.GONE
} else {
/**
* 关注
*/
if (bean.isFocused == 1) {
setFollowType(true)
} else {
setFollowType(false)
}
}
/** /**
* 标题 * 标题
*/ */
...@@ -158,17 +125,20 @@ class HomeAssuageGriefItemView( ...@@ -158,17 +125,20 @@ class HomeAssuageGriefItemView(
*/ */
if (null != bean?.smallAttach && bean?.smallAttach!!.isNotEmpty()) { if (null != bean?.smallAttach && bean?.smallAttach!!.isNotEmpty()) {
if (homeAssuageGriefImageItemView != null) { if (homeAssuageGriefImageItemView != null) {
homeModuleAssuageGriefViewChildLayout.removeView(homeAssuageGriefImageItemView) homeModuleAssuageGriefItemImageItemLL.removeAllViews()
homeModuleAssuageGriefItemImageItemLL.visibility = View.GONE
} }
homeAssuageGriefImageItemView = HomeAssuageGriefImageItemView( homeAssuageGriefImageItemView = HomeAssuageGriefImageItemView(
mContext, mContext,
bean?.smallAttach as List<String>, bean?.smallAttach as List<String>,
homeEvent homeEvent
) )
homeModuleAssuageGriefViewChildLayout.addView(homeAssuageGriefImageItemView, 1) homeModuleAssuageGriefItemImageItemLL.addView(homeAssuageGriefImageItemView)
homeModuleAssuageGriefItemImageItemLL.visibility = View.VISIBLE
} else { } else {
if (null != homeAssuageGriefImageItemView) { if (null != homeAssuageGriefImageItemView) {
homeModuleAssuageGriefViewChildLayout.removeView(homeAssuageGriefImageItemView) homeModuleAssuageGriefItemImageItemLL.removeAllViews()
homeModuleAssuageGriefItemImageItemLL.visibility = View.GONE
} }
} }
...@@ -179,16 +149,6 @@ class HomeAssuageGriefItemView( ...@@ -179,16 +149,6 @@ class HomeAssuageGriefItemView(
} }
private fun setFollowType(boolean: Boolean) {
if (boolean) {
homeModuleAssuageGriefItemViewFollow.visibility = View.VISIBLE
homeModuleAssuageGriefItemViewUnFollow.visibility = View.GONE
} else {
homeModuleAssuageGriefItemViewFollow.visibility = View.GONE
homeModuleAssuageGriefItemViewUnFollow.visibility = View.VISIBLE
}
}
private fun initComment(bean: HomeAskBean.DataBean) { private fun initComment(bean: HomeAskBean.DataBean) {
if (bean?.commentsCount > 0) { if (bean?.commentsCount > 0) {
homeModuleAssuageGriefViewComment.visibility = View.VISIBLE homeModuleAssuageGriefViewComment.visibility = View.VISIBLE
...@@ -196,96 +156,22 @@ class HomeAssuageGriefItemView( ...@@ -196,96 +156,22 @@ class HomeAssuageGriefItemView(
var index: Int = 0 var index: Int = 0
var commentBean = bean?.comments!![0] var commentBean = bean?.comments!![0]
YDLImageCacheManager.showImage(mContext, commentBean.userHead, homeModuleAssuageGriefViewHotViewHeader)
if (null != commentBean.name && commentBean.name!!.isNotEmpty()) if (null != commentBean.name && commentBean.name!!.isNotEmpty())
setPartTextColor( homeModuleAssuageGriefViewHotViewComment.text = commentBean.name?:""
homeModuleAssuageGriefViewHotViewComment, commentBean.name,
0, commentBean.name?.length!!, Color.parseColor("#1DA1F2")
)
// userType为2 ,专家 // userType为2 ,专家
if (commentBean.userType == 2) { if (commentBean.userType == 2) {
setImage( homeModuleAssuageGriefViewHotViewVip.visibility = View.VISIBLE
mContext, homeModuleAssuageGriefViewHotViewComment, "vip", } else {
R.drawable.home_assuage_grief_item_user_type_v, homeModuleAssuageGriefViewHotViewVip.visibility = View.GONE
RxImageTool.dp2px(13f),
RxImageTool.dp2px(13f)
)
}
setAppendPartTextColor(
homeModuleAssuageGriefViewHotViewComment, ":",
0,
1
, Color.parseColor("#1DA1F2")
)
MoonUtil.identifyFaceExpression(
mContext, homeModuleAssuageGriefViewHotViewCommentContent,
commentBean.content, ImageSpan.ALIGN_BOTTOM
)
var emptyString = ""
if (null != commentBean.name && commentBean.name!!.isNotEmpty()) {
if (commentBean.userType == 2) {
emptyString += "缩"
}
for (index in 0 until commentBean.name!!.length) {
emptyString += commentBean.name!![index]
}
emptyString += "缩"
}
val span =
SpannableStringBuilder(emptyString + homeModuleAssuageGriefViewHotViewCommentContent.text)
span.setSpan(
ForegroundColorSpan(Color.TRANSPARENT), 0, emptyString.length,
Spanned.SPAN_INCLUSIVE_EXCLUSIVE
)
homeModuleAssuageGriefViewHotViewCommentContent.text = span
}
} }
fun setPartTextColor( homeModuleAssuageGriefViewHotViewCommentContent.text = commentBean.content?:""
textView: TextView, text: String?,
start: Int, end: Int, colorId: Int
) {
var ss: SpannableString = SpannableString(text)
ss.setSpan(
ForegroundColorSpan(colorId), start, end,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.text = ss
}
fun setAppendPartTextColor( } else {
textView: TextView, text: String?, homeModuleAssuageGriefViewComment.visibility = View.GONE
start: Int, end: Int, colorId: Int
) {
var ss: SpannableString = SpannableString(text)
ss.setSpan(
ForegroundColorSpan(colorId), start, end,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.append(ss)
} }
fun setImage(
context: Context,
textView: TextView,
bitmapText: String,
resId: Int,
width: Int,
height: Int
) {
var ss: SpannableString = SpannableString(bitmapText)
var drawable: Drawable = context.resources.getDrawable(resId)
drawable.setBounds(0, 0, width, height)
var imageSpan: ImageSpan = ImageSpan(drawable, ImageSpan.ALIGN_BASELINE)
ss.setSpan(
imageSpan, 0, bitmapText.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)
textView.append(ss)
} }
} }
\ No newline at end of file
...@@ -34,7 +34,8 @@ class HomeAssuageGriefView(private val mContext: Context, private var homeEvent: ...@@ -34,7 +34,8 @@ class HomeAssuageGriefView(private val mContext: Context, private var homeEvent:
) )
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_assuage_grief_view, this) View.inflate(mContext, R.layout.home_assuage_grief_view, this)
homeModuleAssuageGriefViewHomeCommonTitleView.setTitle("解忧·问答") homeModuleAssuageGriefViewHomeCommonTitleView.setTitle("人生答疑")
homeModuleAssuageGriefViewHomeCommonTitleView.setTopMargin(-10)
homeModuleAssuageGriefViewHomeCommonTitleView.setOnClickListener { homeModuleAssuageGriefViewHomeCommonTitleView.setOnClickListener {
homeEvent?.askMoreClick() homeEvent?.askMoreClick()
} }
...@@ -54,8 +55,8 @@ class HomeAssuageGriefView(private val mContext: Context, private var homeEvent: ...@@ -54,8 +55,8 @@ class HomeAssuageGriefView(private val mContext: Context, private var homeEvent:
//刷新数据 //刷新数据
for (index in 0..childCount) { for (index in 0..childCount) {
val itemView = getChildAt(index) val itemView = getChildAt(index)
if (itemView is HomeAssuageGriefItemView) { if (itemView != null && itemView is HomeAssuageGriefItemView) {
itemView.updateData(list[index - 1], position, index - 1) itemView.updateData(list[index - 1], position, index - 1, index == childCount - 1)
} }
} }
} }
......
...@@ -25,26 +25,6 @@ import kotlinx.android.synthetic.xlzx.home_button_banner_view.view.* ...@@ -25,26 +25,6 @@ import kotlinx.android.synthetic.xlzx.home_button_banner_view.view.*
*/ */
class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) : class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) :
LinearLayout(mContext) { 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 { init {
initView() initView()
...@@ -58,46 +38,14 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -58,46 +38,14 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_button_banner_view, this) 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 { homeModuleButtonBannerFirst.setOnClickListener {
homeEvent?.reservationExpertsClick() homeEvent?.reservationExpertsClick()
} }
homeModuleButtonBannerSecond.setOnClickListener { homeModuleButtonBannerSecond.setOnClickListener {
homeEvent?.nowConfideClick() homeEvent?.askMoreClick()
} }
homeModuleButtonBannerThird.setOnClickListener { homeModuleButtonBannerThird.setOnClickListener {
homeEvent?.psychologyClassClick() homeEvent?.articleMoreClick()
} }
homeModuleButtonBannerFourth.setOnClickListener { homeModuleButtonBannerFourth.setOnClickListener {
homeEvent?.psychologyTestClick() homeEvent?.psychologyTestClick()
...@@ -106,71 +54,11 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -106,71 +54,11 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
fun initData( fun initData(
homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>?,
homeCategory: List<HomeHeaderBean.AskCategoryDataBean>? homeCategory: List<HomeHeaderBean.AskCategoryDataBean>?
) { ) {
setRealTextView(homeSaleData)
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) } homeEvent?.let { home_category_view.setEvent(it) }
home_category_view.initData(homeCategory) 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.platform_big_bg_color))
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.platform_color_F5F5F5))
cutOffView.layoutParams = cutOffParams
ll_home_module_button.addView(cutOffView)
hasRealTestView = true
}
realTestView!!.initData(list)
}
} }
\ No newline at end of file
...@@ -5,7 +5,10 @@ import android.support.constraint.ConstraintLayout ...@@ -5,7 +5,10 @@ import android.support.constraint.ConstraintLayout
import android.text.TextUtils import android.text.TextUtils
import android.util.AttributeSet import android.util.AttributeSet
import android.view.View import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import com.ydl.ydlcommon.data.PlatformDataManager import com.ydl.ydlcommon.data.PlatformDataManager
import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R import com.yidianling.home.R
import kotlinx.android.synthetic.xlzx.home_common_title_view.view.* import kotlinx.android.synthetic.xlzx.home_common_title_view.view.*
...@@ -30,13 +33,16 @@ class HomeCommonTitleView(private val mContext: Context, private val attributeSe ...@@ -30,13 +33,16 @@ class HomeCommonTitleView(private val mContext: Context, private val attributeSe
fun setTitle(title: String) { fun setTitle(title: String) {
homeModuleCommonTitleViewTitle.text = title homeModuleCommonTitleViewTitle.text = title
}
val isFromXinliZiXunHuawei = fun setMoreText(text: String) {
!TextUtils.isEmpty(ffrom) && ffrom.startsWith("ATK_7") && ffrom.endsWith("huawei") homeModuleCommonTitleViewMorell.visibility = View.VISIBLE
homeModuleCommonTitleViewMoreText.text = text
if (isFromXinliZiXunHuawei) {
view_line.visibility = View.GONE
} }
fun setTopMargin(topMargin: Int) {
val params = layoutParams as MarginLayoutParams
params.topMargin = RxImageTool.dp2px(topMargin.toFloat())
layoutParams = params
} }
} }
\ No newline at end of file
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.graphics.Color
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
...@@ -50,17 +51,14 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent: ...@@ -50,17 +51,14 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
setHead(bean) setHead(bean)
//设置名称 //设置名称
tv_consult_name.text = bean.name tv_consult_name.text = bean.name
//咨询师标签
tag_view.initData(StringUtils.strToList(bean.tags))
//设置向TA倾诉人数
setConfideNum(bean)
//设置接通率文案 //设置接通率文案
setConnection(bean) setConnection(bean)
//设置向TA倾诉按钮状态 //设置向TA咨询人数
setConfideNum(bean)
//设置向TA咨询按钮状态
setConfideButton(bean) setConfideButton(bean)
//设置红包、原价
setPrice(bean) setOnClickListener {
this.setOnClickListener {
val url = URLUtils.appendParmas(bean.linkUrl, "cateId", cateId) val url = URLUtils.appendParmas(bean.linkUrl, "cateId", cateId)
homeEvent!!.consultItemClick(url, bean.doctorId) homeEvent!!.consultItemClick(url, bean.doctorId)
} }
...@@ -74,16 +72,14 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent: ...@@ -74,16 +72,14 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
} }
/** /**
* 设置向TA倾诉人数 * 设置向TA咨询人数
*/ */
private fun setConfideNum(bodyBean: HomeConsultBean.ListBean) { private fun setConfideNum(bodyBean: HomeConsultBean.ListBean) {
if (TextUtils.isEmpty(bodyBean.zixunOrderNum.toString())) { if (TextUtils.isEmpty(bodyBean.zixunOrderNum.toString())) {
tv_consult_num.visibility = View.GONE tv_consult_num.visibility = View.GONE
tv_tv_consult_num_content.visibility = View.GONE
} else { } else {
tv_consult_num.visibility = View.VISIBLE tv_consult_num.visibility = View.VISIBLE
tv_tv_consult_num_content.visibility = View.VISIBLE tv_consult_num.text = "咨询次数${bodyBean.zixunOrderNum}"
tv_consult_num.text = bodyBean.zixunOrderNum.toString()
} }
} }
...@@ -93,13 +89,11 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent: ...@@ -93,13 +89,11 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
private fun setConnection(bodyBean: HomeConsultBean.ListBean) { private fun setConnection(bodyBean: HomeConsultBean.ListBean) {
if (TextUtils.isEmpty(bodyBean.feedbackRate.toString())) { if (TextUtils.isEmpty(bodyBean.feedbackRate.toString())) {
tv_feedback_rate.visibility = View.INVISIBLE tv_feedback_rate.visibility = View.INVISIBLE
tv_feedback_rate_content.visibility = View.INVISIBLE
} else { } else {
tv_feedback_rate.visibility = View.VISIBLE tv_feedback_rate.visibility = View.VISIBLE
tv_feedback_rate_content.visibility = View.VISIBLE
try { try {
val dd = bodyBean.feedbackRate / 5.00f val dd = bodyBean.feedbackRate / 5.00f
val str = String.format("%.2f", dd * 100f) + "%" val str = String.format("%.1f", dd * 10f)
tv_feedback_rate.text = str tv_feedback_rate.text = str
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
...@@ -114,14 +108,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent: ...@@ -114,14 +108,7 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
//私聊文案 //私聊文案
if (TextUtils.isEmpty(bodyBean.chatBtnText)) { if (TextUtils.isEmpty(bodyBean.chatBtnText)) {
tv_consult_chat.text = "私聊" tv_consult_chat.text = "私聊"
tv_consult_chat.setTextColor( tv_consult_chat.setTextColor(Color.parseColor("#FD9B0A"))
ContextCompat.getColor(
context,
R.color.platform_color_222222
)
)
tv_consult_chat.background =
ContextCompat.getDrawable(context, R.drawable.home_consult_chat_bg)
} else { } else {
tv_consult_chat.text = bodyBean.chatBtnText tv_consult_chat.text = bodyBean.chatBtnText
tv_consult_chat.setTextColor( tv_consult_chat.setTextColor(
...@@ -130,16 +117,11 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent: ...@@ -130,16 +117,11 @@ class HomeConsultItemView(private var mContext: Context, private var homeEvent:
R.color.platform_color_999999 R.color.platform_color_999999
) )
) )
tv_consult_chat.background =
ContextCompat.getDrawable(context, R.drawable.home_consult_chat_rest_bg)
} }
tv_consult_chat.setOnClickListener { tv_consult_chat.setOnClickListener {
homeEvent!!.consultChatClick(bodyBean.uid.toString()) homeEvent!!.consultChatClick(bodyBean.uid.toString())
} }
} }
private fun setPrice(bodyBean: HomeConsultBean.ListBean) {
val confideFee = bodyBean.minBookingPrice
tv_consult_price.text = "¥$confideFee"
}
} }
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.graphics.Color
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Build import android.os.Build
import android.support.design.widget.TabLayout import android.support.design.widget.TabLayout
import android.support.v4.content.ContextCompat import android.support.v4.content.ContextCompat
import android.support.v7.widget.RecyclerView import android.support.v7.widget.RecyclerView
import android.text.Layout
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeConsultBean import com.yidianling.home.model.bean.HomeConsultBean
import com.yidianling.home.model.bean.HomeHeaderBean import com.yidianling.home.model.bean.HomeHeaderBean
import kotlinx.android.synthetic.xlzx.home_confide_view.view.* import kotlinx.android.synthetic.xlzx.home_confide_view.view.*
import java.lang.Exception
import kotlin.math.ceil
/** /**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a> * @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
...@@ -36,11 +42,23 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -36,11 +42,23 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
*/ */
private var listener: ConsultTabSelectedListener? = null private var listener: ConsultTabSelectedListener? = null
private var dp5: Int = 0
private var dp6: Int = 0
private var dp7: Int = 0
private var dp10: Int = 0
private var dp16: Int = 0
init { init {
initView() initView()
} }
private fun initView() { private fun initView() {
dp5 = RxImageTool.dp2px(5f)
dp6 = RxImageTool.dp2px(6f)
dp7 = RxImageTool.dp2px(7f)
dp10 = RxImageTool.dp2px(10f)
dp16 = RxImageTool.dp2px(16f)
val params = RecyclerView.LayoutParams( val params = RecyclerView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
...@@ -48,7 +66,9 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -48,7 +66,9 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
layoutParams = params layoutParams = params
orientation = VERTICAL orientation = VERTICAL
View.inflate(mContext, R.layout.home_confide_view, this) View.inflate(mContext, R.layout.home_confide_view, this)
homeModuleConfideViewHomeCommonTitleView.setTitle("咨询·理解") homeModuleConfideViewHomeCommonTitleView.setTitle("心理咨询")
homeModuleConfideViewHomeCommonTitleView.setMoreText("更多咨询")
homeModuleConfideViewHomeCommonTitleView.setTopMargin(-4)
homeModuleConfideViewHomeCommonTitleView.setOnClickListener { homeModuleConfideViewHomeCommonTitleView.setOnClickListener {
homeEvent?.consultMoreClick() homeEvent?.consultMoreClick()
} }
...@@ -69,19 +89,23 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -69,19 +89,23 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
mLastPosition = lastPosition mLastPosition = lastPosition
tab_layout.removeAllTabs() tab_layout.removeAllTabs()
for ((index, bean) in list.withIndex()) { for ((index, bean) in list.withIndex()) {
tab_layout.addTab(tab_layout.newTab().setText(bean.name), index == lastPosition)
val textView = updateText(TextView(mContext), index == lastPosition)
textView.text = bean.name
val newTab = tab_layout.newTab().setCustomView(textView)
tab_layout.addTab(newTab, index == lastPosition)
} }
listener = ConsultTabSelectedListener(list, tab_layout) listener = ConsultTabSelectedListener(list, tab_layout)
tab_layout.addOnTabSelectedListener(listener!!) tab_layout.addOnTabSelectedListener(listener!!)
var textView = try {
((tab_layout!!.getChildAt(0) as LinearLayout).getChildAt(lastPosition) as LinearLayout).getChildAt( var textView = tab_layout.getTabAt(0) as TextView
1
)
if (textView != null && textView is TextView) { if (textView != null && textView is TextView) {
textView.textSize = 26f
textView.setTextColor(ContextCompat.getColor(mContext, R.color.platform_color_242424)) updateText(textView, true)
textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
} }
} catch (e: Exception) {}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
tab_layout.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY -> tab_layout.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
LogUtil.e("scrollX=$scrollX") LogUtil.e("scrollX=$scrollX")
...@@ -107,7 +131,7 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -107,7 +131,7 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
cacheInfoViewList = ArrayList() cacheInfoViewList = ArrayList()
} }
//创建HomeConsultItemView:每个tab最多显示个专家 //创建HomeConsultItemView:每个tab最多显示个专家
if (cacheInfoViewList!!.size >= list.size) { if (cacheInfoViewList!!.size >= list.size) {
for (index in 0 until list!!.size) { for (index in 0 until list!!.size) {
//设置数据 //设置数据
...@@ -117,19 +141,20 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -117,19 +141,20 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
index == list!!.size - 1, index == list!!.size - 1,
"${category?.id}" "${category?.id}"
) )
cacheInfoViewList!![index].layoutParams = getViewLayoutParams(index)
//添加到布局 //添加到布局
ll_content.addView(cacheInfoViewList!![index]) ll_content.addView(cacheInfoViewList!![index])
} }
} else { } else {
for (index in 0 until list!!.size) { for (index in 0 until list!!.size) {
if (index > 2) { if (index > 3) {
//只取前条数据 //只取前条数据
break break
} }
//数据大于缓存view数量,创建view //数据大于缓存view数量,创建view
if (index > cacheInfoViewList!!.size - 1) { if (index > cacheInfoViewList!!.size - 1) {
var HomeConsultItemView = createConsultInfoView() var mHomeConsultItemView = createConsultInfoView()
cacheInfoViewList!!.add(HomeConsultItemView) cacheInfoViewList!!.add(mHomeConsultItemView)
} }
//设置数据 //设置数据
cacheInfoViewList!![index].setData( cacheInfoViewList!![index].setData(
...@@ -138,12 +163,25 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -138,12 +163,25 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
index == list!!.size - 1, index == list!!.size - 1,
"${category?.id}" "${category?.id}"
) )
cacheInfoViewList!![index].layoutParams = getViewLayoutParams(index)
//添加到布局 //添加到布局
ll_content.addView(cacheInfoViewList!![index]) ll_content.addView(cacheInfoViewList!![index])
} }
} }
} }
fun getViewLayoutParams(index: Int): MarginLayoutParams {
var itemWidth: Int = (RxDeviceTool.getScreenWidth(mContext) - dp10 - dp10) / 2
var itemHeight: Int = (itemWidth * 187) / 166
var topMargin = if (index == 2 || index == 3) itemHeight else 0
val params = LayoutParams(itemWidth, itemHeight) as MarginLayoutParams
params.setMargins(dp10 + (itemWidth) * ((index) % 2),
topMargin,
0,0
)
return params
}
/** /**
* 创建专家信息view * 创建专家信息view
*/ */
...@@ -165,18 +203,10 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -165,18 +203,10 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
} }
override fun onTabUnselected(tab: TabLayout.Tab?) { override fun onTabUnselected(tab: TabLayout.Tab?) {
var textView = var textView = tabLayout?.getTabAt(tab?.position!!)?.customView as TextView
((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) { if (textView != null && textView is TextView) {
textView.textSize = 14f updateText(textView, false)
textView.setTextColor(
ContextCompat.getColor(
mContext,
R.color.platform_color_333333
)
)
} }
} }
...@@ -184,21 +214,28 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom ...@@ -184,21 +214,28 @@ class HomeConsultView(private val mContext: Context, private var homeEvent: IHom
if (mLastPosition == tab!!.position) { if (mLastPosition == tab!!.position) {
return return
} }
var textView = var textView = tabLayout?.getTabAt(tab?.position!!)?.customView as TextView
((tabLayout!!.getChildAt(0) as LinearLayout).getChildAt(tab!!.position) as LinearLayout).getChildAt(
1
)
if (textView != null && textView is TextView) { if (textView != null && textView is TextView) {
textView.textSize = 26f updateText(textView, true)
textView.setTextColor(
ContextCompat.getColor(
mContext,
R.color.platform_color_242424
)
)
textView.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
} }
homeEvent!!.getConsultData(list!![tab!!.position], tab!!.position) homeEvent!!.getConsultData(list!![tab!!.position], tab!!.position)
} }
} }
fun updateText(txtView: TextView, isSelected: Boolean): TextView {
if (!isSelected) {
txtView.textSize = 12f
txtView.setTextColor(Color.parseColor("#999999"))
txtView.setPadding(dp10, dp5, dp10, dp7)
txtView.setBackgroundResource(R.drawable.home_consult_tab_item_unselected_bg)
} else {
txtView.textSize = 12f
txtView.setTextColor(Color.parseColor("#FD9B0A"))
txtView.setPadding(dp10, dp5, dp10, dp7)
txtView.setBackgroundResource(R.drawable.home_consult_tab_item_selected_bg)
}
return txtView
}
} }
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
...@@ -36,6 +37,7 @@ class HomeCourseItemView(private val mContext: Context, private var homeEvent: I ...@@ -36,6 +37,7 @@ class HomeCourseItemView(private val mContext: Context, private var homeEvent: I
/** /**
* 刷新数据 * 刷新数据
*/ */
@SuppressLint("SetTextI18n")
fun updateData(bean: HomeCourseBean.ListBean?) { fun updateData(bean: HomeCourseBean.ListBean?) {
YDLImageCacheManager.showImage(mContext, bean?.pic, homeModuleCourseItemViewImg) YDLImageCacheManager.showImage(mContext, bean?.pic, homeModuleCourseItemViewImg)
...@@ -48,15 +50,27 @@ class HomeCourseItemView(private val mContext: Context, private var homeEvent: I ...@@ -48,15 +50,27 @@ class HomeCourseItemView(private val mContext: Context, private var homeEvent: I
} else { } else {
if (bean?.isPromotion == 1) { if (bean?.isPromotion == 1) {
homeModuleCourseItemViewExpensePrice.text = homeModuleCourseItemViewExpensePrice.text =
"¥" + String.format("%.2f", bean?.promotionApplyFee!!) "¥" + getLastPrice(String.format("%.2f", bean?.promotionApplyFee?:0))
} else { } else {
homeModuleCourseItemViewExpensePrice.text = homeModuleCourseItemViewExpensePrice.text =
"¥" + String.format("%.2f", bean?.applyFee!!) "¥" + getLastPrice(String.format("%.2f", bean?.applyFee?:0))
} }
} }
setOnClickListener { setOnClickListener {
bean?.let {
homeEvent?.courseItemClick(bean) homeEvent?.courseItemClick(bean)
} }
} }
}
fun getLastPrice(price: String): String {
if (price.length > 3) {
if ("0" == price[price.lastIndex].toString() && "0" == price[price.lastIndex - 1].toString() && "." == price[price.lastIndex - 2].toString()
) {
return price.substring(0, price.length - 3)
}
}
return price
}
} }
\ No newline at end of file
...@@ -27,13 +27,14 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome ...@@ -27,13 +27,14 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome
private fun initView() { private fun initView() {
orientation = VERTICAL orientation = VERTICAL
val params = LinearLayout.LayoutParams( val params = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
) )
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_course_view, this) View.inflate(mContext, R.layout.home_course_view, this)
homeModuleCourseViewHomeCommonTitleView.setTitle("学习·成长") homeModuleCourseViewHomeCommonTitleView.setTitle("未知潜能")
homeModuleCourseViewHomeCommonTitleView.setMoreText("更多课程")
homeModuleCourseViewHomeCommonTitleView.setOnClickListener { homeModuleCourseViewHomeCommonTitleView.setOnClickListener {
homeEvent?.courseMreClick() homeEvent?.courseMreClick()
} }
...@@ -50,10 +51,10 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome ...@@ -50,10 +51,10 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome
updateHomeCourseItemViewNumber() updateHomeCourseItemViewNumber()
} }
//刷新数据 //刷新数据
for (index in 0 until childCount) { for (index in 0 until homeModuleCourseViewScrollLL.childCount) {
val itemView = getChildAt(index) val itemView = homeModuleCourseViewScrollLL.getChildAt(index)
if (itemView is HomeCourseItemView) { if (itemView is HomeCourseItemView) {
itemView.updateData(list[index - 1]) itemView.updateData(cacheList[index])
} }
} }
} }
...@@ -62,13 +63,13 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome ...@@ -62,13 +63,13 @@ class HomeCourseView(private val mContext: Context, private var homeEvent: IHome
* 更新itemView的数量以适应新的数据集 * 更新itemView的数量以适应新的数据集
*/ */
private fun updateHomeCourseItemViewNumber() { private fun updateHomeCourseItemViewNumber() {
var childCountRecord = childCount - 1 //减1是因为第一个子View是标题View var childCountRecord = homeModuleCourseViewScrollLL.childCount //减1是因为第一个子View是标题View
while (cacheList.size > childCountRecord) { while (cacheList.size > childCountRecord) {
addView(HomeCourseItemView(mContext, homeEvent)) homeModuleCourseViewScrollLL.addView(HomeCourseItemView(mContext, homeEvent))
childCountRecord++ childCountRecord++
} }
while (cacheList.size < childCountRecord && getChildAt(childCountRecord - 1) is HomeCourseItemView) { while (cacheList.size < childCountRecord && homeModuleCourseViewScrollLL.getChildAt(childCountRecord - 1) is HomeCourseItemView) {
removeViewAt(childCountRecord - 1) homeModuleCourseViewScrollLL.removeViewAt(childCountRecord - 1)
childCountRecord-- childCountRecord--
} }
} }
......
package com.yidianling.home.ui.view
import android.content.Context
import android.widget.LinearLayout
class HomeEmptyView(private val mContext: Context) : LinearLayout(mContext) {
init {
initView()
}
fun initView() {
layoutParams = LayoutParams(0,0)
}
}
\ No newline at end of file
package com.yidianling.home.ui.view
import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import com.ydl.ydlcommon.utils.YdlBuryPointUtil
import com.ydl.ydlcommon.view.banner.GlideImageLoader
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.HomeHeaderBean
import com.yidianling.home.model.bean.HomePagerDataBean
import kotlinx.android.synthetic.xlzx.home_image_banner_view.view.*
class HomeImageBannerView(val mContext: Context, val homeEvent: IHomeBaseEvent) : LinearLayout(mContext) {
init {
initView()
}
fun initView() {
val params = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
) as MarginLayoutParams
params.topMargin = RxImageTool.dp2px(12f)
layoutParams = params
View.inflate(mContext, R.layout.home_image_banner_view, this)
initBannerLayout()
}
private fun initBannerLayout() {
val bannerWidth = RxDeviceTool.getScreenWidth(mContext) - RxImageTool.dp2px(16f) * 2
val bannerLayoutParams = FrameLayout.LayoutParams(
bannerWidth,
(bannerWidth * 131 / 343)
)
banner_search.layoutParams = bannerLayoutParams
banner_search.setIndicatorBottomPadding(10)
}
fun initData(bean: HomePagerDataBean) {
var headerBean = bean.headerBean
var focusListBean = headerBean?.focusList
//临时缓存集合
val cacheList = ArrayList<HomeHeaderBean.FocusListBean>()
if (null != focusListBean && focusListBean.isNotEmpty()) {
var imageViews = ArrayList<String>()
//产品说取前8个
if (focusListBean.size > 8) {
cacheList.addAll(focusListBean.subList(0, 8))
} else {
cacheList.addAll(focusListBean)
}
for (item in cacheList) {
imageViews.add(item.imageUrl!!)
}
banner_search.setImageLoader(GlideImageLoader(R.drawable.home_image_default_back))
.setImages(imageViews).start()
banner_search.setOnBannerListener {
homeEvent?.bannerClick(cacheList!![it])
YdlBuryPointUtil.sendClick(
"ydl-xinlizixun-home-banner$it",
"${cacheList[it].imageUrl}"
)
}
}
}
}
\ No newline at end of file
package com.yidianling.home.ui.view
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import com.ydl.ydlcommon.view.banner.GlideImageLoader
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeHeaderBean
import kotlinx.android.synthetic.xlzx.home_pager_banner_view.view.*
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述:顶部ViewPager与分类模块
* @Copyright Copyright (c) 2019
* @Company 壹点灵
* @date 2019/02/13
*/
class HomePagerBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) :
RelativeLayout(mContext) {
private val mImageViews = ArrayList<String>()
private var homePagerBannerCategoryView: HomePagerBannerCategoryView? = null
init {
initView()
}
private fun initView() {
var screenWidth = RxDeviceTool.getScreenWidth(mContext)
val params = RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
)
layoutParams = params
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)
}
/**
* 填充数据
*/
fun initData(bean: HomeHeaderBean?) {
initCategory(bean?.askCategoryData, bean?.homeSaleData)
initBanner(bean?.focusList)
}
/**
* 更新分类细目
*/
private fun initCategory(
categoryBean: List<HomeHeaderBean.AskCategoryDataBean>?,
homeSaleData: List<HomeHeaderBean.HomeSaleDataBean>?
) {
homePagerBannerCategoryView!!.initData(categoryBean, homeSaleData)
}
/**
* 更新banner
*/
private fun initBanner(focusListBean: List<HomeHeaderBean.FocusListBean>?) {
//临时缓存集合
val cacheList = ArrayList<HomeHeaderBean.FocusListBean>()
if (null != focusListBean && focusListBean.isNotEmpty()) {
mImageViews.clear()
//产品说取前8个
if (focusListBean.size > 8) {
cacheList.addAll(focusListBean.subList(0, 8))
} else {
cacheList.addAll(focusListBean)
}
for (item in cacheList) {
mImageViews.add(item.imageUrl!!)
}
}
homeModulePagerBannerViewBanner.setImageLoader(GlideImageLoader(R.drawable.home_image_default_back))
.setImages(mImageViews).start()
homeModulePagerBannerViewBanner.setOnBannerListener {
homeEvent?.bannerClick(cacheList!![it])
}
}
fun startBanner() {
if (homeModulePagerBannerViewBanner != null) {
homeModulePagerBannerViewBanner.startAutoPlay()
}
}
fun stopBanner() {
if (homeModulePagerBannerViewBanner != null) {
homeModulePagerBannerViewBanner.stopAutoPlay()
}
}
}
\ No newline at end of file
...@@ -15,15 +15,14 @@ import kotlinx.android.synthetic.xlzx.home_test_item_view.view.* ...@@ -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> * @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述: 心灵电台模块item * @描述: 测评模块item
* @Copyright Copyright (c) 2019 * @Copyright Copyright (c) 2019
* @Company 壹点灵 * @Company 壹点灵
* @date 2019/02/14 * @date 2019/02/14
*/ */
class HomeTestItemView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) : class HomeTestItemView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) :
LinearLayout(mContext) { LinearLayout(mContext) {
private val ffrom = PlatformDataManager.getRam().getChannelName() private var params: LayoutParams? = null
private var params: LinearLayout.LayoutParams? = null
init { init {
initView() initView()
...@@ -31,17 +30,12 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo ...@@ -31,17 +30,12 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo
private fun initView() { private fun initView() {
orientation = VERTICAL orientation = VERTICAL
params = LinearLayout.LayoutParams( params = LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT
) )
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_test_item_view, this) 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
}
} }
...@@ -50,14 +44,15 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo ...@@ -50,14 +44,15 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo
*/ */
fun updateData(bean: HomeTestItemBean, isLast: Boolean) { fun updateData(bean: HomeTestItemBean, isLast: Boolean) {
tv_test_item_name.text = bean.name tv_test_item_name.text = bean.name
tv_tested_count.text = bean.testNum.toString() var numStr = ""
YDLImageCacheManager.showImage(mContext, bean?.shareImage, iv_test_item) if (bean.testNum >= 10000) {
numStr = String.format("%.1f", (bean.testNum / 10000.0)) + "万"
if (isLast) {
view_test_line.visibility = View.GONE
} else { } else {
view_test_line.visibility = View.VISIBLE numStr = bean.testNum.toString()
} }
tv_tested_count.text = numStr
YDLImageCacheManager.showImage(mContext, bean?.shareImage, iv_test_item)
this.setOnClickListener { this.setOnClickListener {
homeEvent?.testItemClick(bean.recommendLinkUrl) homeEvent?.testItemClick(bean.recommendLinkUrl)
...@@ -68,7 +63,7 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo ...@@ -68,7 +63,7 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo
* 电台第二个item会有一个marginTop值 * 电台第二个item会有一个marginTop值
*/ */
fun setTopMargin() { fun setTopMargin() {
params?.topMargin = RxImageTool.dp2px(16f) params?.topMargin = RxImageTool.dp2px(15f)
layoutParams = params layoutParams = params
} }
...@@ -76,7 +71,7 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo ...@@ -76,7 +71,7 @@ class HomeTestItemView(private val mContext: Context, private var homeEvent: IHo
* 电台最后一个item会有一个marginBottom值 * 电台最后一个item会有一个marginBottom值
*/ */
fun setBottomMargin() { fun setBottomMargin() {
params?.bottomMargin = RxImageTool.dp2px(16f) params?.bottomMargin = RxImageTool.dp2px(15f)
layoutParams = params layoutParams = params
} }
} }
\ No newline at end of file
package com.yidianling.home.ui.view package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.text.TextUtils
import android.view.View import android.view.View
import android.widget.LinearLayout 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.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.home.model.bean.HomeTestItemBean import com.yidianling.home.model.bean.HomeTestItemBean
...@@ -17,59 +10,35 @@ import kotlinx.android.synthetic.xlzx.home_test_top_item_view.view.* ...@@ -17,59 +10,35 @@ import kotlinx.android.synthetic.xlzx.home_test_top_item_view.view.*
/** /**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a> * @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
* @描述: 心灵电台模块item--顶部item * @描述: 测评模块item--顶部item
* @Copyright Copyright (c) 2019 * @Copyright Copyright (c) 2019
* @Company 壹点灵 * @Company 壹点灵
* @date 2019/02/15 * @date 2019/02/15
*/ */
class HomeTestTopItemView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) : class HomeTestTopItemView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) :
LinearLayout(mContext) { LinearLayout(mContext) {
private val ffrom = PlatformDataManager.getRam().getChannelName()
init { init {
initView() initView()
} }
private fun 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) 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) { 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
)
homeModuleIntelligentTopViewTitle.text = bean.name homeModuleTestTopViewTitle.text = bean.name
homeModuleIntelligentTopViewHits.text = bean.testNum.toString() var numStr = ""
if (bean.testNum >= 10000) {
numStr = String.format("%.1f", (bean.testNum / 10000.0)) + "万"
} else {
numStr = bean.testNum.toString()
}
homeModuleTestTopViewHits.text = numStr + "人已测"
this.setOnClickListener { this.setOnClickListener {
homeEvent?.testItemClick(bean.recommendLinkUrl) homeEvent?.testItemClick(bean.recommendLinkUrl)
......
...@@ -30,7 +30,9 @@ class HomeTestView(private val mContext: Context, private var homeEvent: HomeImp ...@@ -30,7 +30,9 @@ class HomeTestView(private val mContext: Context, private var homeEvent: HomeImp
val params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) val params = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_test_view, this) View.inflate(mContext, R.layout.home_test_view, this)
homeModuleIntelligentViewHomeCommonTitleView.setTitle("测试·分析") homeModuleIntelligentViewHomeCommonTitleView.setTitle("测试分析")
homeModuleIntelligentViewHomeCommonTitleView.setMoreText("更多测试")
homeModuleIntelligentViewHomeCommonTitleView.setTopMargin(-6)
homeModuleIntelligentViewHomeCommonTitleView.setOnClickListener { homeModuleIntelligentViewHomeCommonTitleView.setOnClickListener {
homeEvent?.testMoreClick() homeEvent?.testMoreClick()
} }
...@@ -54,9 +56,9 @@ class HomeTestView(private val mContext: Context, private var homeEvent: HomeImp ...@@ -54,9 +56,9 @@ class HomeTestView(private val mContext: Context, private var homeEvent: HomeImp
if (index == 1) { if (index == 1) {
itemView.setTopMargin() itemView.setTopMargin()
} }
// else if (index == homeModuleIntelligentViewAddLayout.childCount -1) { if (index == homeModuleIntelligentViewAddLayout.childCount -1) {
// itemView.setBottomMargin() itemView.setBottomMargin()
// } }
itemView.updateData(list[index],index == list.size - 1) itemView.updateData(list[index],index == list.size - 1)
}else if (itemView is HomeTestTopItemView) { }else if (itemView is HomeTestTopItemView) {
itemView.updateData(list[index]) itemView.updateData(list[index])
......
...@@ -42,20 +42,34 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -42,20 +42,34 @@ class HomeModuleCategoryView : FrameLayout {
/** /**
* 文本宽度 * 文本宽度
*/ */
var imageViewHeight: Int = 0
/**
* 间隔
*/
var margin: Int = 0
/**
* 八个的时候文本宽度
*/
var textViewWidth: Int = 0 var textViewWidth: Int = 0
/** /**
* 文本高度 * 八个的时候文本高度
*/ */
var textViewHeight: Int = 0 var textViewHeight: Int = 0
/** /**
* 间隔 * 八个时候分类宽度
*/ */
var margin: Int = 0 var categoryEightWidth: Int = 0
/**
* 八个时候分类宽度
*/
var imageEightViewWidth: Int = 0
var dp1: Int = 0
var dp3: Int = 0
var dp6: Int = 0
var dp8: Int = 0 var dp8: Int = 0
var dp12: Int = 0
var dp15: Int = 0
private var realTestView: HomePagerBannerRealView? = null
/** /**
* 倍数 * 倍数
*/ */
...@@ -82,11 +96,10 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -82,11 +96,10 @@ class HomeModuleCategoryView : FrameLayout {
*/ */
private fun initView() { private fun initView() {
View.inflate(context, R.layout.home_pager_banner_category_view, this) View.inflate(context, R.layout.home_pager_banner_category_view, this)
val params = FrameLayout.LayoutParams( val params = LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT LayoutParams.WRAP_CONTENT
) )
// params.topMargin = ScreenUtil.screenHeight * (356f / 750f).toInt()
layoutParams = params layoutParams = params
initArgs() initArgs()
} }
...@@ -95,13 +108,21 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -95,13 +108,21 @@ class HomeModuleCategoryView : FrameLayout {
* 初始化变量 * 初始化变量
*/ */
private fun initArgs() { private fun initArgs() {
categoryWidth = ScreenUtil.screenWidth - RxImageTool.dp2px(30f) categoryWidth = ScreenUtil.screenWidth - RxImageTool.dp2px(12f + 3f + 3f + 12f)
textViewWidth = categoryWidth / 4 imageViewWidth = categoryWidth / 3
imageViewWidth = RxImageTool.dip2px(38f) imageViewHeight = imageViewWidth * 52 / 107
margin = (categoryWidth - 4 * imageViewWidth) / 8 dp1 = RxImageTool.dip2px(1f)
dp8 = RxImageTool.dip2px(8f) dp3 = RxImageTool.dip2px(3f)
//高度=文字12dp+16dp间距 dp6 = RxImageTool.dip2px(4f)
dp12 = RxImageTool.dip2px(12f)
categoryEightWidth = ScreenUtil.screenWidth - RxImageTool.dp2px(30f)
textViewWidth = categoryEightWidth / 4
imageEightViewWidth = RxImageTool.dip2px(38f)
textViewHeight = RxImageTool.dip2px(28f) textViewHeight = RxImageTool.dip2px(28f)
margin = (categoryEightWidth - 4 * imageEightViewWidth) / 8
dp8 = RxImageTool.dip2px(8f)
dp15 = RxImageTool.dip2px(15f)
} }
fun initData(askCategoryDataBean: List<HomeHeaderBean.AskCategoryDataBean>?) { fun initData(askCategoryDataBean: List<HomeHeaderBean.AskCategoryDataBean>?) {
...@@ -148,11 +169,14 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -148,11 +169,14 @@ class HomeModuleCategoryView : FrameLayout {
private fun refreshView() { private fun refreshView() {
homeModulePagerBannerFlRoot.removeAllViews() homeModulePagerBannerFlRoot.removeAllViews()
var i = 0 var i = 0
// 后端没资源,Android自己做兼容,复原原来的代码
mDataList?.let {
if (mDataList?.size!! >= 8) {
for (item in mDataList!!) { for (item in mDataList!!) {
if (i > 7) { if (i > 7) {
break break
} }
val imageView = createIcon(i) val imageView = createEightIcon(i)
val textView = createText(i) val textView = createText(i)
homeModulePagerBannerFlRoot.addView(imageView) homeModulePagerBannerFlRoot.addView(imageView)
...@@ -168,59 +192,86 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -168,59 +192,86 @@ class HomeModuleCategoryView : FrameLayout {
bindTextData(textView, item) bindTextData(textView, item)
i++ i++
} }
} else if (mDataList?.size!! == 6) {
for (item in mDataList!!) {
if (i > 5) {
break
}
val imageView = createSixIcon(i)
homeModulePagerBannerFlRoot.addView(imageView)
imageView.setOnClickListener {
homeEvent!!.categoryClick(item)
}
bindIconData(imageView, item)
i++
}
}
}
} }
/** /**
* 创建图标 * 创建图标
*/ */
private fun createIcon(i: Int): ImageView { private fun createSixIcon(i: Int): ImageView {
val imageParams = FrameLayout.LayoutParams(imageViewWidth, imageViewWidth) val imageParams = LayoutParams(imageViewWidth, imageViewHeight)
val imageView = ImageView(context) val imageView = ImageView(context)
imageView.scaleType = ImageView.ScaleType.CENTER_CROP imageView.scaleType = ImageView.ScaleType.CENTER_CROP
if (i > 3) { if (i > 2) {
multiple = 2 //第二行
imageParams.topMargin = imageParams.topMargin = imageViewHeight + dp1
imageViewWidth + dp8 + textViewHeight + dp8 + RxImageTool.dip2px(1f) imageParams.leftMargin = dp12 + dp3 * (i - 3) + imageViewWidth * (i - 3)
imageParams.leftMargin = margin * (i - 3) + (i - 4) * (imageViewWidth + margin)
} else { } else {
multiple = 1 //第一行
imageParams.leftMargin = margin * (i + 1) + i * (imageViewWidth + margin) imageParams.topMargin = 0
imageParams.leftMargin = dp12 + dp3 * i + imageViewWidth * i
} }
imageView.layoutParams = imageParams imageView.layoutParams = imageParams
return imageView return imageView
} }
/** /**
* 加载图片 * 创建图标
*/ */
private fun bindIconData( private fun createEightIcon(i: Int): ImageView {
imageView: ImageView, val imageParams = FrameLayout.LayoutParams(imageEightViewWidth, imageEightViewWidth)
categoryBean: HomeHeaderBean.AskCategoryDataBean val imageView = ImageView(context)
) { imageView.scaleType = ImageView.ScaleType.CENTER_CROP
if (i > 3) {
multiple = 2
imageParams.topMargin =
imageEightViewWidth + dp8 + textViewHeight + dp8 + RxImageTool.dip2px(1f) - dp3 - dp1 - dp1
imageParams.leftMargin = dp15 + margin * (i - 3) + (i - 4) * (imageEightViewWidth + margin)
} else {
multiple = 1
imageParams.topMargin = (dp8 + dp3 - dp6)
imageParams.leftMargin = dp15 + margin * (i + 1) + i * (imageEightViewWidth + margin)
}
imageView.layoutParams = imageParams
GlideApp.with(context).load(categoryBean.coverUrl) return imageView
.centerCrop().into(imageView)
} }
/** /**
* 创建文本 * 创建文本
*/ */
private fun createText(index: Int): TextView { private fun createText(index: Int): TextView {
val textParams = FrameLayout.LayoutParams(textViewWidth, textViewHeight) val textParams = FrameLayout.LayoutParams(textViewWidth, LayoutParams.WRAP_CONTENT)
val textView = TextView(context) val textView = TextView(context)
textView.setTextColor(Color.parseColor("#444444")) textView.setTextColor(Color.parseColor("#666666"))
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12f) textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11f)
textView.gravity = Gravity.CENTER_HORIZONTAL textView.gravity = Gravity.CENTER_HORIZONTAL
if (index > 3) { if (index > 3) {
textParams.topMargin = 2 * (imageViewWidth + dp8) + textViewHeight + dp8 textParams.topMargin = 2 * (imageEightViewWidth + dp8) + textViewHeight + dp8 - dp3 - dp3 - dp1 - dp1
textParams.leftMargin = textViewWidth * (index - 4) textParams.leftMargin = dp15 + textViewWidth * (index - 4)
} else { } else {
textParams.topMargin = imageViewWidth + dp8 textParams.topMargin = imageEightViewWidth + (dp8 + dp3 - dp6) + dp8 - dp3
textParams.leftMargin = textViewWidth * (index) textParams.leftMargin = dp15 + textViewWidth * (index)
} }
textView.layoutParams = textParams textView.layoutParams = textParams
...@@ -234,11 +285,14 @@ class HomeModuleCategoryView : FrameLayout { ...@@ -234,11 +285,14 @@ class HomeModuleCategoryView : FrameLayout {
textView.text = categoryBean.cateTitle textView.text = categoryBean.cateTitle
} }
/**
fun onDestory() { * 加载图片
if (null == realTestView) { */
return private fun bindIconData(
} imageView: ImageView,
realTestView!!.onDestory() categoryBean: HomeHeaderBean.AskCategoryDataBean
) {
GlideApp.with(context).load(categoryBean.coverUrl)
.centerCrop().into(imageView)
} }
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F7F7F7" />
<corners android:radius="@dimen/platform_dp_4"/>
</shape>
\ No newline at end of file
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/platform_color_F7F7F7" /> <solid android:color="@color/platform_color_FFFFFF" />
<corners android:radius="@dimen/platform_dp_4"/> <corners android:radius="@dimen/platform_dp_4"/>
<stroke android:width="1dp" <stroke android:width="0.5dp"
android:color="@color/platform_color_FFFFFF" android:color="#CCCCCC" />
/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F8F8F8" />
<corners android:radius="@dimen/platform_dp_8"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="40dp"/> <corners android:radius="18dp"/>
<solid android:color="@android:color/white" /> <solid android:color="#F7F7F7" />
<stroke android:width="1px" android:color="#E6E6E6"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient <solid android:color="@color/platform_color_F6F6F6"/>
android:angle="180"
android:startColor="#F0F0F0"
android:endColor="#F0F0F0"/>
<corners android:radius="@dimen/platform_dp_12" /> <corners android:radius="@dimen/platform_dp_14" />
<padding
android:bottom="@dimen/platform_dp_3"
android:left="@dimen/platform_dp_10"
android:right="@dimen/platform_dp_10"
android:top="@dimen/platform_dp_3" />
<stroke android:color="#F0F0F0"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#19FFBC4A"/>
<corners android:radius="4dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#F8F8F8"/>
<corners android:radius="4dp"/>
</shape>
\ No newline at end of file
...@@ -7,6 +7,6 @@ ...@@ -7,6 +7,6 @@
android:width="0.5dp"/> android:width="0.5dp"/>
<corners <corners
android:radius="@dimen/platform_dp_12"/> android:radius="@dimen/platform_dp_14"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/platform_color_FFFFFF"/>
<corners android:radius="8dp"/>
<stroke android:width="0.5dp"
android:color="#EBEBEB"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#37000000"/>
<corners android:radius="14dp"/>
</shape>
\ No newline at end of file
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<solid android:color="@color/platform_color_70FFFFFF" /> <gradient
android:startColor="#82A1D4"
android:endColor="#7DACCA"/>
<corners <corners
android:bottomLeftRadius="@dimen/platform_dp_20" android:topRightRadius="@dimen/platform_dp_8"
android:bottomRightRadius="@dimen/platform_dp_20" android:topLeftRadius="@dimen/platform_dp_8"
android:topRightRadius="@dimen/platform_dp_20"
/> />
</shape> </shape>
\ No newline at end of file
...@@ -3,6 +3,24 @@ ...@@ -3,6 +3,24 @@
<!-- 阴影部分 --> <!-- 阴影部分 -->
<item <item
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp">
<shape android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#04f4f4f4"
android:startColor="#04f4f4f4"/>
<corners
android:radius="8dp"/>
</shape>
</item>
<!-- 阴影部分 -->
<item
android:bottom="2dp" android:bottom="2dp"
android:left="2dp" android:left="2dp"
android:right="2dp" android:right="2dp"
...@@ -11,21 +29,57 @@ ...@@ -11,21 +29,57 @@
<gradient <gradient
android:angle="270" android:angle="270"
android:endColor="#10f4f4f4"
android:startColor="#10f4f4f4"/>
<corners
android:radius="8dp"/>
</shape>
</item>
<!-- 阴影部分 -->
<item
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp">
<shape android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#16f4f4f4"
android:startColor="#16f4f4f4"/>
<corners
android:radius="8dp"/>
</shape>
</item>
<!-- 阴影部分 -->
<item
android:bottom="6dp"
android:left="6dp"
android:right="6dp"
android:top="6dp">
<shape android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="#32f4f4f4" android:endColor="#32f4f4f4"
android:startColor="#32f4f4f4"/> android:startColor="#32f4f4f4"/>
<corners <corners
android:radius="10dp"/> android:radius="8dp"/>
</shape> </shape>
</item> </item>
<!-- 背景部分 --> <!-- 背景部分 -->
<item <item
android:bottom="3dp" android:bottom="8dp"
android:left="3dp" android:left="8dp"
android:right="3dp" android:right="8dp"
android:top="3dp"> android:top="8dp">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
...@@ -39,7 +93,7 @@ ...@@ -39,7 +93,7 @@
android:startColor="#FFFFFF"/> android:startColor="#FFFFFF"/>
<corners <corners
android:radius="10dp"/> android:radius="8dp"/>
</shape> </shape>
</item> </item>
......
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
android:paddingRight="@dimen/platform_dp_15" android:paddingRight="@dimen/platform_dp_15"
android:paddingTop="@dimen/platform_dp_15"> android:paddingTop="@dimen/platform_dp_15">
<RelativeLayout
android:id="@+id/homeModuleArticleItemViewRl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/homeModuleArticleItemViewCardImg" android:id="@+id/homeModuleArticleItemViewCardImg"
android:layout_width="@dimen/platform_dp_127" android:layout_width="@dimen/platform_dp_127"
...@@ -29,10 +34,11 @@ ...@@ -29,10 +34,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="2" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:textSize="@dimen/platform_dp_18" android:textSize="@dimen/platform_dp_17"
android:textStyle="bold" android:textStyle="bold"
android:lineHeight="18dp"
android:layout_marginTop="-2dp" android:layout_marginTop="-2dp"
android:textColor="@color/platform_color_222222" android:textColor="@color/platform_color_242424"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:lineSpacingExtra="@dimen/platform_dp_1" android:lineSpacingExtra="@dimen/platform_dp_1"
tools:text="喧嚣的世界中,你的重要何以而来?喧嚣的世界中,你的重要何以而来?" tools:text="喧嚣的世界中,你的重要何以而来?喧嚣的世界中,你的重要何以而来?"
...@@ -44,11 +50,11 @@ ...@@ -44,11 +50,11 @@
android:id="@+id/homeModuleArticleItemViewContent" android:id="@+id/homeModuleArticleItemViewContent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="2" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textSize="@dimen/platform_dp_13" android:textSize="@dimen/platform_dp_13"
android:layout_marginTop="@dimen/platform_dp_6" android:layout_marginTop="@dimen/platform_dp_6"
android:textColor="@color/platform_color_666666" android:textColor="@color/platform_color_999999"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_below="@+id/homeModuleArticleItemViewTitle" android:layout_below="@+id/homeModuleArticleItemViewTitle"
android:lineSpacingExtra="@dimen/platform_dp_3" android:lineSpacingExtra="@dimen/platform_dp_3"
...@@ -61,68 +67,57 @@ ...@@ -61,68 +67,57 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_below="@+id/homeModuleArticleItemViewCardImg" android:layout_below="@+id/homeModuleArticleItemViewContent"
android:layout_marginTop="@dimen/platform_dp_16"> android:layout_marginTop="@dimen/platform_dp_10">
<ImageView
android:id="@+id/homeModuleArticleItemViewIcon"
android:layout_width="@dimen/platform_dp_12"
android:layout_height="@dimen/platform_dp_12"
android:src="@drawable/home_article_item_icon"
android:layout_marginTop="1dp"
android:layout_alignParentLeft="true"/>
<TextView
android:id="@+id/homeModuleArticleItemViewAuthor"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:textSize="@dimen/platform_dp_12"
android:textColor="@color/platform_color_242424"
android:layout_marginLeft="@dimen/platform_dp_3"
android:textStyle="bold"
tools:text="赵秀英"/>
<TextView <TextView
android:id="@+id/homeModuleArticleItemViewGreatNum" android:id="@+id/homeModuleArticleItemViewLookNum"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="3327" tools:text="2656"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:textColor="@color/platform_color_242424"/> android:textColor="@color/platform_color_999999"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="点赞" android:text=" 浏览"
android:textSize="@dimen/platform_dp_11" android:textSize="@dimen/platform_dp_11"
android:layout_marginRight="@dimen/platform_dp_12" android:textColor="@color/platform_color_999999"/>
android:textColor="@color/platform_color_666666"/>
<View
android:layout_width="1dp"
android:layout_height="10dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="7dp"
android:background="#EBEBEB"/>
<TextView <TextView
android:id="@+id/homeModuleArticleItemViewLookNum" android:id="@+id/homeModuleArticleItemViewGreatNum"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="2656" tools:text="3327"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:textColor="@color/platform_color_242424"/> android:textColor="@color/platform_color_999999"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="浏览" android:text=" 点赞"
android:textSize="@dimen/platform_dp_11" android:textSize="@dimen/platform_dp_11"
android:textColor="@color/platform_color_666666"/> android:textColor="@color/platform_color_999999"/>
</LinearLayout> </LinearLayout>
</RelativeLayout>
<View <View
android:id="@+id/homeModuleArticleItemViewBottomLine" android:id="@+id/homeModuleArticleItemViewBottomLine"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0.5dp" android:layout_height="0.5dp"
android:background="@color/platform_color_EBEBEB" android:background="@color/platform_color_EBEBEB"
android:layout_centerInParent="true" android:layout_below="@+id/homeModuleArticleItemViewRl"
android:layout_below="@+id/homeModuleArticleItemViewBottomLayout" android:layout_marginTop="@dimen/platform_dp_15"
android:layout_marginTop="@dimen/platform_dp_20"/> android:layout_marginRight="147dp"/>
</RelativeLayout> </RelativeLayout>
...@@ -3,12 +3,8 @@ ...@@ -3,12 +3,8 @@
android:id="@+id/ll_home_module_button" android:id="@+id/ll_home_module_button"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:layout_marginTop="17dp">
<com.yidianling.home.ui.widget.HomeModuleCategoryView
android:id="@+id/home_category_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -19,127 +15,103 @@ ...@@ -19,127 +15,103 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="12dp"> android:paddingBottom="12dp">
<LinearLayout
<RelativeLayout
android:id="@+id/homeModuleButtonBannerFirst" android:id="@+id/homeModuleButtonBannerFirst"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/home_dcotor_bt_bg" android:orientation="vertical"
android:gravity="center"> android:gravity="center">
<TextView <ImageView
android:id="@+id/homeModuleButtonBannerFirstTitle" android:layout_width="54dp"
android:layout_width="wrap_content" android:layout_height="38dp"
android:layout_height="wrap_content" android:src="@drawable/home_banner_first_icon"
android:layout_marginTop="7dp" android:scaleType="fitXY"/>
android:text="预约咨询"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_first_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerFirstTitle" android:text="咨询沟通"
android:text="1W+师资" android:layout_marginTop="3dp"
android:textColor="@color/platform_color_444444" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_11" /> android:textSize="13dp"/>
</RelativeLayout> </LinearLayout>
<RelativeLayout <LinearLayout
android:id="@+id/homeModuleButtonBannerFourth" android:id="@+id/homeModuleButtonBannerFourth"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/home_listen_bt_bg" android:orientation="vertical"
android:gravity="center"> android:gravity="center">
<TextView <ImageView
android:id="@+id/homeModuleButtonBannerFourthTitle" android:layout_width="54dp"
android:layout_width="wrap_content" android:layout_height="38dp"
android:layout_height="wrap_content" android:src="@drawable/home_banner_fourth_icon"
android:layout_marginTop="7dp" android:scaleType="fitXY"/>
android:text="心理测试"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_second_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerFourthTitle" android:text="心理测试"
android:text="专业权威" android:layout_marginTop="3dp"
android:textColor="@color/platform_color_444444" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_11" /> android:textSize="13dp"/>
</RelativeLayout> </LinearLayout>
<RelativeLayout <LinearLayout
android:id="@+id/homeModuleButtonBannerThird" android:id="@+id/homeModuleButtonBannerThird"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/home_course_bt_bg" android:orientation="vertical"
android:gravity="center" android:gravity="center">
>
<TextView <ImageView
android:id="@+id/homeModuleButtonBannerThirdTitle" android:layout_width="54dp"
android:layout_width="wrap_content" android:layout_height="38dp"
android:layout_height="wrap_content" android:src="@drawable/home_banner_third_icon"
android:layout_marginTop="7dp" android:scaleType="fitXY"/>
android:text="心理课堂"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_third_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerThirdTitle" android:text="主题阅读"
android:text="学习与成长" android:layout_marginTop="3dp"
android:textColor="@color/platform_color_444444" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_11" /> android:textSize="13dp"/>
</RelativeLayout> </LinearLayout>
<RelativeLayout <LinearLayout
android:id="@+id/homeModuleButtonBannerSecond" android:id="@+id/homeModuleButtonBannerSecond"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="78dp" android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1" android:layout_weight="1"
android:background="@drawable/home_test_bt_bg" android:orientation="vertical"
android:gravity="center"> android:gravity="center">
<TextView <ImageView
android:id="@+id/homeModuleButtonBannerSecondTitle" android:layout_width="54dp"
android:layout_width="wrap_content" android:layout_height="38dp"
android:layout_height="wrap_content" android:src="@drawable/home_banner_second_icon"
android:layout_gravity="center" android:scaleType="fitXY"/>
android:layout_marginTop="7dp"
android:text="即时倾诉"
android:textColor="@color/platform_black"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold" />
<TextView <TextView
android:id="@+id/tv_fourth_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleButtonBannerSecondTitle" android:text="人生答疑"
android:layout_centerVertical="true" android:layout_marginTop="3dp"
android:text="专业解忧" android:textColor="@color/platform_color_242424"
android:textColor="@color/platform_color_444444" android:textSize="13dp"/>
android:textSize="@dimen/platform_dp_11" /> </LinearLayout>
</RelativeLayout>
</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> </LinearLayout>
...@@ -4,56 +4,44 @@ ...@@ -4,56 +4,44 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:paddingTop="@dimen/platform_dp_24" android:paddingTop="@dimen/platform_dp_30"
android:paddingBottom="@dimen/platform_dp_14"> android:paddingBottom="@dimen/platform_dp_6">
<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"/>
<TextView <TextView
android:id="@+id/homeModuleCommonTitleViewTitle" android:id="@+id/homeModuleCommonTitleViewTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingRight="@dimen/platform_dp_1" android:paddingRight="@dimen/platform_dp_1"
tools:text="通用.标题" tools:text="通用标题"
android:textSize="24dp" android:textSize="20dp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/platform_color_333333" android:textColor="@color/platform_color_242424"
android:layout_marginLeft="@dimen/platform_dp_15" android:layout_marginLeft="@dimen/platform_dp_15"
app:layout_constraintLeft_toLeftOf="parent"/> app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<LinearLayout <LinearLayout
android:layout_width="66dp" android:id="@+id/homeModuleCommonTitleViewMorell"
android:layout_height="@dimen/platform_dp_24" android:layout_width="74dp"
android:layout_height="@dimen/platform_dp_28"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center" android:gravity="center"
android:layout_marginBottom="@dimen/platform_dp_3" android:layout_marginBottom="@dimen/platform_dp_3"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="@dimen/platform_dp_15" 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 <TextView
android:id="@+id/homeModuleCommonTitleViewMoreText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:text="更多" android:text="更多选择"
android:layout_marginLeft="@dimen/platform_dp_2" android:layout_marginLeft="@dimen/platform_dp_2"
android:textColor="@color/platform_color_444444" android:textColor="@color/platform_color_666666"
android:textSize="13sp"/> android:textSize="12dp"/>
<ImageView
android:layout_height="8dp"
android:layout_width="4dp"
android:src="@drawable/home_sale_arrow"
android:layout_marginLeft="3dp"/>
</LinearLayout> </LinearLayout>
......
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:clipChildren="false">
<com.yidianling.home.ui.view.HomeCommonTitleView <com.yidianling.home.ui.view.HomeCommonTitleView
android:id="@+id/homeModuleConfideViewHomeCommonTitleView" android:id="@+id/homeModuleConfideViewHomeCommonTitleView"
...@@ -12,48 +13,34 @@ ...@@ -12,48 +13,34 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:clipChildren="false"
> >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1">
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
app:tabGravity="fill" app:tabGravity="fill"
app:tabIndicatorHeight="0dp" app:tabIndicatorHeight="0dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
app:tabMode="scrollable" app:tabMode="scrollable"
app:tabPaddingStart="4dp"
app:tabPaddingEnd="4dp"
app:tabSelectedTextColor="@color/platform_color_242424" app:tabSelectedTextColor="@color/platform_color_242424"
app:tabTextAppearance="@style/TabLayoutTextSize" app:tabTextAppearance="@style/TabLayoutTextSize"
app:tabTextColor="#333"/> app:tabTextColor="#333"/>
<View
android:layout_alignParentRight="true"
android:background="@drawable/home_consult_head_border"
android:layout_width="20dp"
android:layout_height="match_parent"/>
</RelativeLayout>
<ImageView
android:layout_width="5dp"
android:layout_height="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:src="@drawable/home_sale_arrow"/>
</LinearLayout> </LinearLayout>
<LinearLayout <FrameLayout
android:id="@+id/ll_content" android:id="@+id/ll_content"
android:layout_marginTop="4dp"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"/>
android:orientation="vertical"/>
</merge> </merge>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/platform_dp_15" android:orientation="vertical"
android:layout_marginRight="@dimen/platform_dp_15" android:gravity="center"
android:layout_marginBottom="@dimen/platform_dp_15" android:background="@drawable/home_view_shadow_bg">
android:background="@drawable/home_view_shadow_bg"
android:padding="@dimen/platform_dp_15"
>
<RelativeLayout <RelativeLayout
android:layout_centerVertical="true"
android:id="@+id/rl_consult_head"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="64dp"
> android:layout_marginTop="19dp">
<View
android:layout_width="103dp"
android:layout_height="105dp"
android:background="@drawable/home_consult_head_border"
/>
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:layout_width="102dp" android:layout_width="64dp"
android:layout_height="104dp" android:layout_height="64dp"
android:layout_centerInParent="true" android:layout_centerInParent="true"
app:cardCornerRadius="@dimen/platform_dp_4" app:cardCornerRadius="32dp"
app:cardElevation="1dp"> app:cardElevation="0dp"
android:layout_centerHorizontal="true">
<ImageView <ImageView
android:id="@+id/img_consult_head" android:id="@+id/img_consult_head"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scaleType="fitXY"/> android:scaleType="centerCrop"
android:background="@color/platform_color_E0E0E0"/>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</RelativeLayout> </RelativeLayout>
<LinearLayout <LinearLayout
android:id="@+id/tv_name_layout" android:id="@+id/tv_name_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignTop="@+id/rl_consult_head" android:layout_marginTop="13dp"
android:layout_marginStart="16dp"
android:layout_toEndOf="@+id/rl_consult_head"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
...@@ -72,116 +56,51 @@ ...@@ -72,116 +56,51 @@
</LinearLayout> </LinearLayout>
<com.ydl.ydlcommon.view.TagView <LinearLayout
android:id="@+id/tag_view"
android:layout_width="match_parent"
android:layout_height="@dimen/platform_dp_16"
android:layout_below="@+id/tv_name_layout"
android:layout_marginStart="@dimen/platform_dp_16"
android:layout_marginTop="6dp"
android:layout_marginEnd="@dimen/platform_dp_10"
android:layout_toEndOf="@+id/rl_consult_head"
android:orientation="horizontal"/>
<TextView
android:id="@+id/tv_tv_consult_num_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tag_view"
android:layout_alignLeft="@+id/tv_name_layout"
android:layout_marginTop="8dp"
android:text="咨询次数 "
android:textColor="@color/platform_color_666666"
android:textSize="10sp"
tools:ignore="SpUsage"/>
<TextView
android:id="@+id/tv_consult_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tag_view"
android:layout_marginTop="5dp"
android:layout_toRightOf="@+id/tv_tv_consult_num_content"
android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_12"
android:textStyle="bold"
tools:ignore="SpUsage"
tools:text="8000"/>
<TextView
android:id="@+id/tv_feedback_rate_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tag_view" android:orientation="horizontal">
android:layout_toRightOf="@+id/tv_consult_num"
android:layout_marginTop="8dp"
android:layout_marginLeft="12dp"
android:text="好评率 "
android:textColor="@color/platform_color_666666"
android:textSize="10sp"
tools:ignore="SpUsage"
/>
<TextView <TextView
android:id="@+id/tv_feedback_rate" android:id="@+id/tv_feedback_rate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tag_view" android:textColor="#FF5B46"
android:layout_toRightOf="@+id/tv_feedback_rate_content" android:textSize="15dp"
android:layout_marginTop="5dp"
android:textColor="@color/platform_color_242424"
android:textSize="12sp"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="SpUsage" tools:text="9.8"/>
tools:text="83%"/>
<TextView <TextView
android:id="@+id/tv_consult_price"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/tv_consult_num" android:textColor="#FF5B46"
android:layout_marginStart="@dimen/platform_dp_16" android:textSize="14dp"
android:layout_marginTop="7dp" android:text="分"/>
android:layout_toEndOf="@+id/rl_consult_head"
android:layout_alignBottom="@+id/rl_consult_head"
android:gravity="bottom"
android:textColor="#FF5A4C"
android:textSize="@dimen/platform_dp_16"
android:textStyle="bold"
tools:ignore="SpUsage"
tools:text="¥199"
android:layout_marginBottom="2dp"
/>
<TextView <TextView
android:id="@+id/tv_price_tips" android:id="@+id/tv_consult_num"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBottom="@+id/tv_consult_price"
android:layout_marginLeft="2dp"
android:layout_marginBottom="2dp"
android:layout_toRightOf="@+id/tv_consult_price"
android:gravity="center"
android:text="起"
android:textColor="@color/platform_color_666666" android:textColor="@color/platform_color_666666"
android:textSize="@dimen/platform_dp_12"/> android:textSize="@dimen/platform_dp_13"
tools:text="8000次咨询"
android:layout_marginLeft="4dp"/>
</LinearLayout>
<TextView <TextView
android:id="@+id/tv_consult_chat" android:id="@+id/tv_consult_chat"
android:layout_width="wrap_content" android:layout_width="74dp"
android:layout_height="@dimen/platform_dp_22" android:layout_height="28dp"
android:layout_alignBottom="@+id/tv_consult_price" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_centerHorizontal="true"
android:background="@drawable/home_consult_chat_bg" android:background="@drawable/home_consult_chat_rest_bg"
android:gravity="center" android:gravity="center"
android:paddingLeft="17dp" android:paddingLeft="9dp"
android:paddingTop="3dp" android:paddingRight="9dp"
android:paddingRight="17dp" tools:text="休息中"
android:paddingBottom="3dp" android:layout_marginTop="10dp"
android:text="私聊" android:layout_marginBottom="15dp"
android:textColor="@color/platform_color_222222" android:textColor="@color/platform_color_999999"
android:textSize="12sp" android:textSize="12dp"/>
android:textStyle="bold"/>
</LinearLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="166dp"
android:layout_height="@dimen/platform_dp_99" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_marginLeft="@dimen/platform_dp_15" android:layout_marginLeft="5dp"
android:layout_marginRight="@dimen/platform_dp_15" android:layout_marginRight="5dp"
android:layout_marginBottom="@dimen/platform_dp_13" android:layout_marginTop="10dp">
android:layout_marginTop="@dimen/platform_dp_3"
android:padding="@dimen/platform_dp_15"
android:background="@drawable/home_view_shadow_bg">
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:id="@+id/homeModuleCourseItemViewImgCardView" android:id="@+id/homeModuleCourseItemViewImgCardView"
android:layout_width="127dp" android:layout_width="166dp"
android:layout_height="69dp" android:layout_height="90.3dp"
app:cardCornerRadius="6dp" app:cardCornerRadius="4dp"
app:cardElevation="0dp"> app:cardElevation="0dp">
<ImageView <ImageView
android:id="@+id/homeModuleCourseItemViewImg" android:id="@+id/homeModuleCourseItemViewImg"
android:layout_width="127dp" android:layout_width="166dp"
android:layout_height="69dp" android:layout_height="90.3dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/home_image_default_back"/> android:background="@drawable/home_image_default_back"/>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
...@@ -30,18 +27,26 @@ ...@@ -30,18 +27,26 @@
android:id="@+id/homeModuleCourseItemViewTitle" android:id="@+id/homeModuleCourseItemViewTitle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/homeModuleCourseItemViewImgCardView" android:layout_below="@+id/homeModuleCourseItemViewImgCardView"
android:layout_marginLeft="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_15"
android:textSize="@dimen/platform_dp_16"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textStyle="bold" android:textStyle="bold"
android:lineHeight="17dp"
android:maxLines="2" android:maxLines="2"
android:ellipsize="end" android:ellipsize="end"
android:layout_marginTop="-2dp" android:layout_marginTop="12dp"
tools:text="深度睡眠速效药丸丨帮你 tools:text="深度睡眠速效药丸丨帮你
像婴儿般安稳入睡深度睡眠速效药丸丨帮你 像婴儿般安稳入睡深度睡眠速效药丸丨帮你
像婴儿般安稳入睡"/> 像婴儿般安稳入睡"/>
<RelativeLayout
android:id="@+id/homeModuleCourseItemViewPriceRl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/homeModuleCourseItemViewTitle">
<TextView <TextView
android:layout_marginTop="5dp"
android:id="@+id/homeModuleCourseItemViewFreePrice" android:id="@+id/homeModuleCourseItemViewFreePrice"
android:visibility="gone" android:visibility="gone"
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -50,51 +55,48 @@ ...@@ -50,51 +55,48 @@
android:textSize="@dimen/platform_dp_15" android:textSize="@dimen/platform_dp_15"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/platform_color_34CD65" android:textColor="@color/platform_color_34CD65"
android:layout_alignBottom="@+id/homeModuleCourseItemViewImgCardView" />
android:layout_toRightOf="@+id/homeModuleCourseItemViewImgCardView"
android:layout_marginLeft="@dimen/platform_dp_12"/>
<RelativeLayout <RelativeLayout
android:layout_marginTop="5dp"
android:id="@+id/homeModuleCourseItemViewExpensePriceHideView" android:id="@+id/homeModuleCourseItemViewExpensePriceHideView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:layout_alignBottom="@+id/homeModuleCourseItemViewImgCardView"
android:layout_toRightOf="@+id/homeModuleCourseItemViewImgCardView"
android:layout_marginLeft="@dimen/platform_dp_12"
android:layout_marginBottom="-2dp">
<TextView <TextView
android:id="@+id/homeModuleCourseItemViewExpensePrice" android:id="@+id/homeModuleCourseItemViewExpensePrice"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="¥688" tools:text="¥688"
android:textStyle="bold" android:textStyle="bold"
android:textSize="16dp" android:textSize="15dp"
android:textColor="@color/platform_color_FF5A4C"/> android:textColor="#ED7474"/>
</RelativeLayout> </RelativeLayout>
</RelativeLayout>
<TextView <TextView
android:id="@+id/homeModuleCourseItemViewPersonText" android:id="@+id/homeModuleCourseItemViewPersonNum"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="人气" tools:text="3109"
android:textSize="@dimen/platform_dp_11" android:textSize="@dimen/platform_dp_12"
android:textColor="@color/platform_color_999999"
android:layout_marginLeft="7dp"
android:layout_toRightOf="@+id/homeModuleCourseItemViewPriceRl"
android:layout_alignBottom="@+id/homeModuleCourseItemViewPriceRl"
android:gravity="center" android:gravity="center"
android:textColor="@color/platform_color_666666" android:layout_marginBottom="2dp"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/homeModuleCourseItemViewExpensePriceHideView"
android:layout_alignBottom="@+id/homeModuleCourseItemViewExpensePriceHideView"
android:layout_marginBottom="-1dp"
/> />
<TextView <TextView
android:id="@+id/homeModuleCourseItemViewPersonNum" android:id="@+id/homeModuleCourseItemViewPersonText"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:text="3109" android:text="人气"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:textColor="@color/platform_color_242424"
android:layout_toLeftOf="@+id/homeModuleCourseItemViewPersonText"
android:layout_alignBottom="@+id/homeModuleCourseItemViewExpensePriceHideView"
android:layout_alignTop="@+id/homeModuleCourseItemViewExpensePriceHideView"
android:gravity="center" android:gravity="center"
android:layout_marginBottom="-1dp" android:textColor="@color/platform_color_999999"
android:textStyle="bold" android:layout_toRightOf="@+id/homeModuleCourseItemViewPersonNum"
android:layout_alignBottom="@+id/homeModuleCourseItemViewPriceRl"
android:layout_marginBottom="2dp"
/> />
</RelativeLayout> </RelativeLayout>
...@@ -8,4 +8,24 @@ ...@@ -8,4 +8,24 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:layout_height="wrap_content"/>
<HorizontalScrollView
android:id="@+id/homeModuleCourseViewScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
>
<LinearLayout
android:id="@+id/homeModuleCourseViewScrollLL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="11dp"
android:paddingRight="11dp"
android:orientation="horizontal"/>
</HorizontalScrollView>
<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="#F8F8F8"
android:layout_marginTop="13dp"/>
</merge> </merge>
\ No newline at end of file
...@@ -8,58 +8,68 @@ ...@@ -8,58 +8,68 @@
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false"> android:clipToPadding="false">
<android.support.design.widget.CoordinatorLayout <!-- <android.support.design.widget.CoordinatorLayout-->
android:id="@+id/container" <!-- android:id="@+id/container"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="match_parent" <!-- android:layout_height="match_parent"-->
android:background="@color/platform_f5f5f5" <!-- android:background="@color/home_colorBg"-->
android:clipChildren="false" <!-- android:clipChildren="false"-->
android:clipToPadding="false" <!-- android:clipToPadding="false"-->
app:layout_behavior="@string/appbar_scrolling_view_behavior" <!-- app:layout_behavior="@string/appbar_scrolling_view_behavior"-->
> <!-- >-->
<android.support.design.widget.AppBarLayout <!-- <android.support.design.widget.AppBarLayout-->
android:id="@+id/appbar_layout" <!-- android:id="@+id/appbar_layout"-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:background="@color/platform_f5f5f5" <!-- android:background="@color/home_colorBg"-->
android:clipChildren="false" <!-- android:clipChildren="false"-->
android:clipToPadding="false" <!-- android:clipToPadding="false"-->
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" <!-- android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"-->
app:elevation="0dp"> <!-- app:elevation="0dp">-->
<android.support.design.widget.CollapsingToolbarLayout <!-- <android.support.design.widget.CollapsingToolbarLayout-->
android:layout_width="match_parent" <!-- android:layout_width="match_parent"-->
android:layout_height="match_parent" <!-- android:layout_height="match_parent"-->
android:clipChildren="false" <!-- android:clipChildren="false"-->
android:clipToPadding="false" <!-- android:clipToPadding="false"-->
app:layout_scrollFlags="scroll|exitUntilCollapsed"> <!-- app:layout_scrollFlags="scroll|exitUntilCollapsed">-->
<include layout="@layout/home_layout_home_module_head_bg"/> <!-- <include layout="@layout/home_layout_home_module_head_bg"/>-->
<include <!-- <include-->
layout="@layout/home_layout_home_module_head_middle"/> <!-- layout="@layout/home_layout_home_module_head_middle"/>-->
<!-- <android.support.v7.widget.Toolbar-->
<!-- android:id="@+id/toolbar"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="@dimen/home_home_title_bar_height"-->
<!-- android:alpha="0"-->
<!-- android:background="@android:color/white"-->
<!-- android:tag="toolbar"-->
<!-- android:visibility="gone"-->
<!-- app:layout_collapseMode="pin"-->
<!-- app:popupTheme="@style/Widget.AppCompat.Toolbar"/>-->
<!-- <include layout="@layout/home_layout_home_module_toolbar"/>-->
<!-- </android.support.design.widget.CollapsingToolbarLayout>-->
<!-- </android.support.design.widget.AppBarLayout>-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/home_home_title_bar_height"
android:alpha="0"
android:background="@android:color/white"
android:tag="toolbar"
android:visibility="gone"
app:layout_collapseMode="pin"
app:popupTheme="@style/Widget.AppCompat.Toolbar"/>
<include layout="@layout/home_layout_home_module_toolbar"/>
</android.support.design.widget.CollapsingToolbarLayout> <!-- </android.support.design.widget.CoordinatorLayout>-->
</android.support.design.widget.AppBarLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/home_layout_home_module_input" />
<include layout="@layout/home_layout_home_module_content"/> <include layout="@layout/home_layout_home_module_content"/>
</LinearLayout>
<include layout="@layout/home_layout_home_module_input"/>
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.SwipeRefreshLayout> </android.support.v4.widget.SwipeRefreshLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="8dp"
app:cardElevation="0dp"
>
<com.ydl.ydlcommon.view.banner.Banner
android:id="@+id/banner_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:pa_indicator_different_width="14dp"
app:pa_indicator_drawable_selected="@drawable/home_banner_tip_select"
app:pa_indicator_drawable_unselected="@drawable/home_banner_tip_unselect"
app:pa_indicator_height="5dp"
app:pa_indicator_margin="1.8dp"
app:pa_is_selected_same_unselected="false"
android:scaleType="centerCrop"
/>
</android.support.v7.widget.CardView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_search" android:id="@+id/ll_search"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="35dp" android:layout_height="48dp"
android:layout_marginLeft="35dp" android:paddingTop="2dp"
android:layout_marginRight="35dp" android:paddingLeft="16dp"
android:tag="tag_search_input" android:paddingRight="6dp"
app:layout_anchor="@+id/middle_but_layout"
app:layout_anchorGravity="top"
android:focusable="true" android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:focusableInTouchMode="true" android:background="@color/white"
> android:focusableInTouchMode="true">
<android.support.v7.widget.CardView
android:id="@+id/img_ad_card"
android:layout_width="64dp"
android:layout_height="34dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp"
android:layout_marginEnd="10dp"
android:visibility="gone">
<ImageView <ImageView
android:id="@+id/img_ad" android:id="@+id/img_ad"
android:layout_width="64dp" android:layout_width="64dp"
android:layout_height="34dp" android:layout_height="34dp"
android:layout_marginEnd="10dp" android:visibility="gone"/>
android:visibility="gone" /> </android.support.v7.widget.CardView>
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content"> android:layout_weight="1"
android:layout_height="36dp">
<View <View
android:id="@+id/view_search_input_bg" android:id="@+id/view_search_input_bg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/home_bg_home_module_input" android:background="@drawable/home_bg_home_module_input"
android:tag="tag_search_input_bg" android:tag="tag_search_input_bg"
android:layout_marginRight="@dimen/platform_dp_14"
/> />
<ImageView <ImageView
android:id="@+id/iv_search_icon" android:id="@+id/iv_search_icon"
android:layout_marginLeft="15dp" android:layout_marginLeft="18dp"
android:layout_marginRight="10dp" android:layout_marginRight="11dp"
android:layout_width="14dp" android:layout_width="18dp"
android:layout_height="14dp" android:layout_height="18dp"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:tag="tag_search_input_img" android:tag="tag_search_input_img"
android:src="@drawable/home_search"/> android:src="@drawable/home_module_top_search_icon"/>
<EditText <EditText
android:editable="false" android:editable="false"
android:id="@+id/etSearch" android:id="@+id/etSearch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginRight="@dimen/platform_dp_10"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@id/iv_search_icon" android:layout_toRightOf="@id/iv_search_icon"
android:background="@null" android:background="@null"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" android:focusableInTouchMode="true"
android:hint="搜索专家姓名" android:hint="抑郁症有哪些前兆"
android:imeOptions="actionSearch" android:imeOptions="actionSearch"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/platform_color_444444" android:textColor="@color/platform_color_444444"
...@@ -66,5 +73,16 @@ ...@@ -66,5 +73,16 @@
/> />
</RelativeLayout> </RelativeLayout>
<LinearLayout
android:id="@+id/home_page_xiaoyi"
android:layout_width="44dp"
android:layout_height="44dp"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="@drawable/home_module_top_xiaoyi_icon"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
...@@ -6,7 +6,5 @@ ...@@ -6,7 +6,5 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/platform_white" android:background="@color/platform_white"
android:paddingLeft="15dp"
android:paddingRight="15dp"
/> />
</merge> </merge>
\ No newline at end of file
...@@ -4,11 +4,6 @@ ...@@ -4,11 +4,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="180dp"
>
<com.ydl.ydlcommon.view.banner.Banner <com.ydl.ydlcommon.view.banner.Banner
android:id="@+id/homeModulePagerBannerViewBanner" android:id="@+id/homeModulePagerBannerViewBanner"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -17,18 +12,10 @@ ...@@ -17,18 +12,10 @@
app:pa_indicator_drawable_selected="@drawable/home_banner_tip_select" app:pa_indicator_drawable_selected="@drawable/home_banner_tip_select"
app:pa_indicator_drawable_unselected="@drawable/home_banner_tip_unselect" app:pa_indicator_drawable_unselected="@drawable/home_banner_tip_unselect"
app:pa_indicator_height="5dp" app:pa_indicator_height="5dp"
app:pa_indicator_margin="1.25dp" app:pa_indicator_margin="1.8dp"
app:pa_is_selected_same_unselected="false" app:pa_is_selected_same_unselected="false"
app:pa_is_show_indicator="false"
android:background="@color/platform_color_444444" android:background="@color/platform_color_444444"
/> />
<ImageView
android:layout_alignBottom="@+id/homeModulePagerBannerViewBanner"
android:layout_width="match_parent"
android:layout_height="15dp"
android:background="@drawable/home_arc_bg"/>
</RelativeLayout>
</merge> </merge>
...@@ -10,18 +10,18 @@ ...@@ -10,18 +10,18 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="12dp" android:layout_marginBottom="12dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingTop="@dimen/platform_dp_8"
android:paddingBottom="@dimen/platform_dp_8"
> >
<android.support.v7.widget.CardView <android.support.v7.widget.CardView
android:layout_width="70dp" android:layout_width="44dp"
android:layout_height="50dp" android:layout_height="44dp"
app:cardCornerRadius="@dimen/platform_dp_6" app:cardCornerRadius="@dimen/platform_dp_4"
app:cardElevation="0dp"> app:cardElevation="0dp">
<ImageView <ImageView
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/platform_color_242424" android:textColor="@color/platform_color_242424"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_17"
android:textStyle="bold" android:textStyle="bold"
tools:text="2018倒计时,这一年你过2018倒计时,这一年你过的…"/> tools:text="2018倒计时,这一年你过2018倒计时,这一年你过的…"/>
...@@ -60,13 +60,18 @@ ...@@ -60,13 +60,18 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingRight="@dimen/platform_dp_10"> android:paddingRight="@dimen/platform_dp_10">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_marginRight="3dp"
android:src="@drawable/home_test_item_person_test"/>
<TextView <TextView
android:id="@+id/tv_tested_count" android:id="@+id/tv_tested_count"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_444444" android:textColor="@color/platform_color_999999"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:textStyle="bold"
tools:text="2486" tools:text="2486"
/> />
...@@ -74,30 +79,11 @@ ...@@ -74,30 +79,11 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="人已测" android:text="人已测"
android:textColor="@color/platform_color_666666" android:textColor="@color/platform_color_999999"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
/> />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tv_go"
android:layout_width="@dimen/platform_dp_32"
android:layout_height="@dimen/platform_dp_32"
android:background="@drawable/home_test_item_go_bg"
android:gravity="center"
android:text="GO"
android:textSize="13sp"
android:textColor="@color/platform_color_222222"
android:textStyle="bold"/>
</LinearLayout> </LinearLayout>
<View
android:visibility="gone"
android:layout_marginBottom="@dimen/platform_dp_12"
android:id="@+id/view_test_line"
style="@style/platform_viewline"
android:layout_marginLeft="82dp"
android:background="@color/platform_color_EBEBEB"/>
</LinearLayout> </LinearLayout>
...@@ -3,109 +3,47 @@ ...@@ -3,109 +3,47 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="92dp"
android:layout_marginTop="6dp"
android:layout_marginLeft="8dp"
<android.support.v7.widget.CardView android:layout_marginRight="8dp"
android:id="@+id/homeModuleIntelligentTopViewImageCardView" android:background="@drawable/home_test_top_view_layout_back">
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>
<TextView <TextView
android:id="@+id/homeModuleIntelligentTopViewTitle" android:id="@+id/homeModuleTestTopViewTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true" android:layout_marginTop="24dp"
android:layout_marginLeft="@dimen/platform_dp_14" android:layout_marginLeft="@dimen/platform_dp_14"
android:layout_marginRight="@dimen/platform_dp_115" android:layout_marginRight="100dp"
android:layout_marginBottom="@dimen/platform_dp_35"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_24" android:textSize="@dimen/platform_dp_18"
android:textStyle="bold" android:textStyle="bold"
tools:text="先结婚还是先买先结婚还是先买房" /> tools:text="先结婚还是先买先结婚还是先买房" />
<LinearLayout
android:id="@+id/homeModuleIntelligentTopViewDescLayout"
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 <TextView
android:id="@+id/homeModuleIntelligentTopViewHits" android:id="@+id/homeModuleTestTopViewHits"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_444444" android:layout_marginTop="53dp"
android:layout_marginLeft="16dp"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:textStyle="bold" tools:text="2486已测" />
tools:text="2486" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="64dp"
android:layout_height="wrap_content" android:layout_height="28dp"
android:text="已测" android:text="测试"
android:textColor="@color/platform_color_666666" android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12" /> android:textSize="13dp"
</LinearLayout> android:gravity="center"
<RelativeLayout
android:id="@+id/ll_day_test"
android:layout_width="@dimen/platform_dp_64"
android:layout_height="@dimen/platform_dp_20"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:background="@drawable/home_intelligent_top_view_recommend_back"> android:layout_marginTop="25dp"
android:layout_marginRight="14dp"
<TextView android:background="@drawable/home_test_top_btn_bg"/>
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>
</RelativeLayout> </RelativeLayout>
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
android:id="@+id/homeModuleIntelligentViewAddLayout" android:id="@+id/homeModuleIntelligentViewAddLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/platform_dp_15" android:layout_marginLeft="@dimen/platform_dp_8"
android:layout_marginRight="@dimen/platform_dp_15" android:layout_marginRight="@dimen/platform_dp_8"
android:layout_marginTop="@dimen/platform_dp_2" android:layout_marginTop="@dimen/platform_dp_10"
android:orientation="vertical"/> android:orientation="vertical"
android:background="@drawable/home_view_shadow_bg"/>
</merge> </merge>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment