Commit 44eeea65 by ydl

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

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