Commit b513ec08 by 霍志良

feat:倾诉优化

parent 512b9218
...@@ -3,11 +3,15 @@ package com.yidianling.home.ui.view ...@@ -3,11 +3,15 @@ package com.yidianling.home.ui.view
import android.content.Context import android.content.Context
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.event.IHomeBaseEvent import com.yidianling.home.event.IHomeBaseEvent
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import kotlinx.android.synthetic.ydl.home_button_banner_view.view.* import kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
/** /**
...@@ -20,6 +24,8 @@ import kotlinx.android.synthetic.ydl.home_button_banner_view.view.* ...@@ -20,6 +24,8 @@ import kotlinx.android.synthetic.ydl.home_button_banner_view.view.*
class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) : LinearLayout(mContext) { class HomeButtonBannerView(private val mContext: Context, private var homeEvent: IHomeBaseEvent?) : LinearLayout(mContext) {
private var buttonParams: LinearLayout.LayoutParams? = null private var buttonParams: LinearLayout.LayoutParams? = null
private var buttonParamsFrame: FrameLayout.LayoutParams? = null
private var buttonParamsFrame2: FrameLayout.LayoutParams? = null
init { init {
initView() initView()
...@@ -29,7 +35,10 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -29,7 +35,10 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
val params = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) val params = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
layoutParams = params layoutParams = params
View.inflate(mContext, R.layout.home_button_banner_view, this) View.inflate(mContext, R.layout.home_button_banner_view, this)
Glide.with(context)
.load(R.drawable.qingsu_new_free_temp)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(qingsuGif)
initButtonView() initButtonView()
homeModuleButtonBannerFirst.setOnClickListener { homeModuleButtonBannerFirst.setOnClickListener {
...@@ -55,6 +64,11 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent: ...@@ -55,6 +64,11 @@ class HomeButtonBannerView(private val mContext: Context, private var homeEvent:
var viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt() var viewWidth = ((screenWidth - 2 * 9 * RxDeviceTool.getScreenDensity(mContext)) / 4).toInt()
var viewHeight = viewWidth * 78 / 80 var viewHeight = viewWidth * 78 / 80
buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight) buttonParams = LinearLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame = FrameLayout.LayoutParams(viewWidth, viewHeight)
buttonParamsFrame2= FrameLayout.LayoutParams((viewWidth/2)+10, viewHeight/2-30)
buttonParamsFrame2!!.setMargins(RxImageTool.dp2px((viewWidth/19f)),0,0,0)
qingsuGif.layoutParams=buttonParamsFrame2
homeModuleButtonBannerSecondFrame.layoutParams=buttonParamsFrame
homeModuleButtonBannerFirst.layoutParams = buttonParams homeModuleButtonBannerFirst.layoutParams = buttonParams
homeModuleButtonBannerSecond.layoutParams = buttonParams homeModuleButtonBannerSecond.layoutParams = buttonParams
homeModuleButtonBannerThird.layoutParams = buttonParams homeModuleButtonBannerThird.layoutParams = buttonParams
......
...@@ -79,28 +79,39 @@ ...@@ -79,28 +79,39 @@
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="即时倾诉"/>
<RelativeLayout <TextView
android:id="@+id/homeModuleButtonBannerSecond" android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="80dp" android:layout_width="wrap_content"
android:layout_height="78dp" android:layout_height="wrap_content"
android:background="@drawable/home_button_banner_fourth_img_new" android:textColor="@color/platform_color_FFFFFF"
android:gravity="center"> android:textSize="@dimen/platform_dp_12"
<TextView android:text="24小时在线"/>
android:id="@+id/homeModuleButtonBannerSecondTitle" </RelativeLayout>
android:layout_width="wrap_content" <ImageView
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:textStyle="bold" android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF" android:id="@+id/qingsuGif"
android:textSize="@dimen/platform_dp_16" >
android:text="即时倾诉"/> </ImageView>
<TextView </FrameLayout>
android:layout_below="@+id/homeModuleButtonBannerSecondTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_FFFFFF"
android:textSize="@dimen/platform_dp_12"
android:text="24小时在线"/>
</RelativeLayout>
</LinearLayout> </LinearLayout>
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