Commit d78fbf45 by 霍志良

feat:首页UI修改

parent 5885e04e
...@@ -5,6 +5,7 @@ import android.view.View ...@@ -5,6 +5,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.load.engine.DiskCacheStrategy
...@@ -22,7 +23,7 @@ import kotlinx.android.synthetic.ydl.home_button_banner_view.view.* ...@@ -22,7 +23,7 @@ import kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
*/ */
class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?,var listenFree:Boolean) : LinearLayout(mContext) { class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?,var listenFree:Boolean) : LinearLayout(mContext) {
private var buttonParams: LinearLayout.LayoutParams? = null private var buttonParams: ConstraintLayout.LayoutParams? = null
private var buttonParamsFrame: FrameLayout.LayoutParams? = null private var buttonParamsFrame: FrameLayout.LayoutParams? = null
private var buttonParamsFrame2: FrameLayout.LayoutParams? = null private var buttonParamsFrame2: FrameLayout.LayoutParams? = null
...@@ -47,7 +48,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -47,7 +48,7 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
.load(R.drawable.qingsu_new_free_dynamic) .load(R.drawable.qingsu_new_free_dynamic)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE) .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(qingsuGif) .into(qingsuGif)
initButtonView() // initButtonView()
homeModuleButtonBannerFirst.setOnClickListener { homeModuleButtonBannerFirst.setOnClickListener {
homeEvent?.reservationExpertsClick() homeEvent?.reservationExpertsClick()
...@@ -71,17 +72,16 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -71,17 +72,16 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
val screenWidth = RxDeviceTool.getScreenWidth(mContext) val screenWidth = RxDeviceTool.getScreenWidth(mContext)
val viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt() val viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt()
val viewHeight = viewWidth * 78 / 80 val viewHeight = viewWidth * 78 / 80
buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight) buttonParams = ConstraintLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight) buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame2= FrameLayout.LayoutParams((viewWidth/2.0).toInt(), (viewHeight/2.3).toInt()) buttonParamsFrame2= FrameLayout.LayoutParams((viewWidth/2.0).toInt(), (viewHeight/2.3).toInt())
buttonParamsFrame2!!.setMargins((((viewWidth/12f).toInt())),0,0,0) buttonParamsFrame2!!.setMargins((((viewWidth/12f).toInt())),0,0,0)
qingsuGif.layoutParams=buttonParamsFrame2 // qingsuGif.layoutParams=buttonParamsFrame2
homeModuleButtonBannerFirst.layoutParams = buttonParams homeModuleButtonBannerFirst.layoutParams = buttonParams
homeModuleButtonBannerSecond.layoutParams = buttonParams homeModuleButtonBannerSecond.layoutParams = buttonParams
homeModuleButtonBannerThird.layoutParams = buttonParams homeModuleButtonBannerThird.layoutParams = buttonParams
homeModuleButtonBannerFourth.layoutParams = buttonParams homeModuleButtonBannerFourth.layoutParams = buttonParams
homeModuleButtonBannerSecondFrame.layoutParams=buttonParamsFrame // homeModuleButtonBannerSecondFrame.layoutParams=buttonParamsFrame
} }
} }
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent ...@@ -29,7 +29,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
private var lastPosition = 0 private var lastPosition = 0
private var count = 0 private var count = 0
private var mIndicatorWidth: Int = RxImageTool.dip2px(9f) private var mIndicatorWidth: Int = RxImageTool.dip2px(15f)
private var mIndicatorHeight: Int = RxImageTool.dip2px(5f) private var mIndicatorHeight: Int = RxImageTool.dip2px(5f)
private var dp2 : Int = 0 private var dp2 : Int = 0
...@@ -39,7 +39,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent ...@@ -39,7 +39,7 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
init { init {
initView() initView()
dp2 = RxImageTool.dip2px(4f) dp2 = RxImageTool.dip2px(2f)
} }
private fun initView() { private fun initView() {
...@@ -52,13 +52,24 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent ...@@ -52,13 +52,24 @@ class HomeCategoryContainer(private val mContext: Context, private var homeEvent
*/ */
fun initData(bean: HomeHeaderBean?) { fun initData(bean: HomeHeaderBean?) {
mHomeCategoryAdapter?.updateItems(bean?.askCategoryData) mHomeCategoryAdapter?.updateItems(bean?.askCategoryData)
if (bean?.askCategoryData?.size!! > PAGE_ITEM_SIZE){ if (bean?.askCategoryData?.size!! >= PAGE_ITEM_SIZE) {
count = Math.ceil(Math.ceil(bean.askCategoryData?.size?.toFloat()?.div(PAGE_ITEM_SIZE.toFloat())?.toDouble()!!)).toInt() count = Math.ceil(
Math.ceil(
bean.askCategoryData?.size?.toFloat()?.div(PAGE_ITEM_SIZE.toFloat())
?.toDouble()!!
)
).toInt()
createIndicator() createIndicator()
val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(153f)) val params = RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
RxImageTool.dip2px(153f)
)
vp_category.layoutParams = params vp_category.layoutParams = params
}else{ } else {
val params = RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,RxImageTool.dip2px(143f)) val params = RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
RxImageTool.dip2px(143f)
)
vp_category.layoutParams = params vp_category.layoutParams = params
ll_Indicator.visibility = View.GONE ll_Indicator.visibility = View.GONE
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
android:color="#E0E0E0"/> android:color="#E0E0E0"/>
<size <size
android:width="22dp" android:width="5dp"
android:height="5dp"/> android:height="5dp"/>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:paddingLeft="@dimen/platform_dp_8" android:layout_marginTop="@dimen/platform_dp_12">
android:paddingRight="@dimen/platform_dp_8"
android:layout_marginTop="@dimen/platform_dp_12"
>
<RelativeLayout <RelativeLayout
android:id="@+id/homeModuleButtonBannerFirst" android:id="@+id/homeModuleButtonBannerFirst"
android:layout_width="80dp" android:layout_width="82dp"
android:layout_height="78dp" android:layout_height="82dp"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/homeModuleButtonBannerFourth"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/home_button_banner_first_img_new" android:background="@drawable/home_button_banner_first_img_new"
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/homeModuleButtonBannerFirstTitle" android:id="@+id/homeModuleButtonBannerFirstTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:text="心理咨询"/> android:text="心理咨询" />
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerFirstTitle" android:layout_below="@+id/homeModuleButtonBannerFirstTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:text="3W+师资"/> android:text="3W+师资"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/homeModuleButtonBannerFourth" android:id="@+id/homeModuleButtonBannerFourth"
android:layout_width="80dp" android:layout_width="82dp"
android:layout_height="78dp" android:layout_height="82dp"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintLeft_toRightOf="@id/homeModuleButtonBannerFirst"
app:layout_constraintRight_toLeftOf="@id/homeModuleButtonBannerThird"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/home_confide_free_icon" android:background="@drawable/home_confide_free_icon"
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/homeModuleButtonBannerFourthTitle" android:id="@+id/homeModuleButtonBannerFourthTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:text="心理测试"/> android:text="心理测试" />
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerFourthTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:layout_below="@+id/homeModuleButtonBannerFourthTitle"
android:textSize="@dimen/platform_dp_12" android:text="抑郁测量"
android:text="抑郁测量"/> android:textColor="@color/black"
android:textSize="@dimen/platform_dp_12" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/homeModuleButtonBannerThird" android:id="@+id/homeModuleButtonBannerThird"
android:layout_width="80dp" android:layout_width="82dp"
android:layout_height="78dp" android:layout_height="82dp"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintLeft_toRightOf="@id/homeModuleButtonBannerFourth"
app:layout_constraintRight_toLeftOf="@id/homeModuleButtonBannerSecond"
app:layout_constraintTop_toTopOf="parent"
android:orientation="vertical" android:orientation="vertical"
android:background="@drawable/home_button_banner_third_img_new" android:background="@drawable/home_button_banner_third_img_new"
android:gravity="center"> android:gravity="center">
<TextView <TextView
android:id="@+id/homeModuleButtonBannerThirdTitle" android:id="@+id/homeModuleButtonBannerThirdTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16" android:textSize="@dimen/platform_dp_16"
android:text="心理课堂"/> android:text="心理课堂"/>
<TextView <TextView
android:layout_below="@+id/homeModuleButtonBannerThirdTitle" android:layout_below="@+id/homeModuleButtonBannerThirdTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:textColor="@color/black"
android:textSize="@dimen/platform_dp_12" android:textSize="@dimen/platform_dp_12"
android:text="学习与成长"/> android:text="学习与成长"/>
</RelativeLayout> </RelativeLayout>
<FrameLayout
android:id="@+id/homeModuleButtonBannerSecond"
android:layout_width="80dp"
android:layout_height="78dp"
android:background="@drawable/home_button_banner_fourth_img_new"
>
<RelativeLayout
android:id="@+id/homeModuleButtonBannerSecondFrame"
android:layout_width="80dp"
android:layout_height="78dp"
android:gravity="center">
<TextView
android:id="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_16"
android:text="倾诉热线"/>
<TextView <FrameLayout
android:id="@+id/homeModuleButtonBannerSecond"
android:layout_width="82dp"
android:layout_height="82dp"
app:layout_constraintHorizontal_chainStyle="spread"
app:layout_constraintLeft_toRightOf="@id/homeModuleButtonBannerThird"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="@drawable/home_button_banner_fourth_img_new">
<RelativeLayout
android:id="@+id/homeModuleButtonBannerSecondFrame"
android:layout_width="82dp"
android:layout_height="82dp"
android:gravity="center">
<TextView
android:id="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/black"
android:textSize="@dimen/platform_dp_16"
android:text="倾诉热线" />
<TextView
android:layout_below="@+id/homeModuleButtonBannerSecondTitle" android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12"
android:text="温暖守护您"/>
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/qingsuGif" android:textColor="@color/black"
android:visibility="gone" android:textSize="@dimen/platform_dp_12"
> android:text="温暖守护您" />
</ImageView> </RelativeLayout>
</FrameLayout>
</LinearLayout> <ImageView
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_22"
android:id="@+id/qingsuGif"
android:visibility="visible"></ImageView>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:visibility="gone" android:visibility="visible"
tools:visibility="visible"/> tools:visibility="visible"/>
</RelativeLayout> </RelativeLayout>
\ 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