Commit d7bd79d8 by 万齐军

feature: 首页UI布局

parent 94eeae82
......@@ -260,6 +260,9 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
NewH5Activity.start(this, h5Paramsqing)
}
findViewById<View>(R.id.img_customer)?.setOnClickListener {
if (!PhoneCallIn.loginByOneKeyLogin(this, true)) {
return@setOnClickListener
}
val imService = ARouter.getInstance().navigation(IImService::class.java)
imService?.startKefuChat(this, "", 0, 0)
}
......
......@@ -4,6 +4,7 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt
import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R
import com.ydl.confide.databinding.ItemConfideHomeRecentBinding
......@@ -28,7 +29,7 @@ class VideoShowAdapter(private val data: List<ConfideHomeBodyBean>?, private val
override fun onBindViewHolder(holder: BindingViewHolder<ItemVideoShowBinding>, position: Int) {
val itemVideoShowViewModel = dataList[position]
holder.binding.item = itemVideoShowViewModel
holder.itemView.setOnClickListener { event.videoShowClick(position, data) }
holder.itemView.setOnClickListener { /*event.videoShowClick(position, data)*/ }
}
override fun getItemCount() = dataList.size
......@@ -66,14 +67,14 @@ class ItemVideoShowViewModel {
val name = ObservableField<String>("")
val coverUrl = ObservableField<String>("")
val videoCoverUrl = ObservableField<String>("")
val state = ObservableField<String>("")
val state = ObservableInt()
}
internal fun ItemVideoShowViewModel.mapOf(bean: ConfideHomeBodyBean): ItemVideoShowViewModel {
name.set(bean.confidedName)
coverUrl.set(bean.confidedIcon/*coverPicture*/)
videoCoverUrl.set(bean.confidedIcon/*coverVideoPicture*/)
state.set(bean.confideLine.toString())
coverUrl.set(bean.coverPicture)
videoCoverUrl.set(bean.coverVideoPicture)
state.set(bean.confideLine?:0)
linkUrl = bean.linkUrl
return this
}
......
......@@ -2,6 +2,7 @@ package com.ydl.confide.home.util
import android.widget.TextView
import androidx.databinding.BindingAdapter
import com.ydl.confide.R
@BindingAdapter("confideLineText")
fun TextView.confideLineText(line: Int) {
......@@ -16,4 +17,27 @@ fun TextView.confideLineText(line: Int) {
text = "通话中"
}
}
}
@BindingAdapter("confideLineRecentText")
fun TextView.confideLineRecentText(line: Int) {
when (line) {
1 -> {
text = "空闲"
setBackgroundResource(R.drawable.confide_bg_main_color)
}
2 -> {
text = "离线"
setBackgroundResource(R.drawable.confide_bg_color_666666)
}
3 -> {
text = "通话中"
setBackgroundResource(R.drawable.confide_bg_color_ff8f38)
}
else ->{
text = ""
background = null
}
}
}
\ No newline at end of file
......@@ -28,7 +28,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="10dp"
android:layout_marginBottom="2dp"
android:maxLines="1"
android:text="@{item.name}"
android:textColor="@color/white"
android:textSize="10sp" />
......@@ -38,9 +39,14 @@
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:layout_marginBottom="2dp"
android:text="@{item.state}"
android:maxLines="1"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp"
android:textColor="@color/white"
android:textSize="7sp" />
android:textSize="7sp"
app:confideLineRecentText="@{item.state}" />
</androidx.cardview.widget.CardView>
</layout>
......@@ -12,13 +12,19 @@
<androidx.cardview.widget.CardView
android:layout_width="180dp"
android:layout_height="140dp"
android:layout_marginLeft="5dp"
android:layout_marginLeft="6dp"
android:layout_marginTop="20dp"
android:layout_marginRight="5dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="0dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:imageUrl="@{item.videoCoverUrl}" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......@@ -33,7 +39,6 @@
android:layout_width="33dp"
android:layout_height="33dp"
android:layout_gravity="center"
android:src="@drawable/ic_video_play"
app:imageUrl="@{item.videoCoverUrl}" />
android:src="@drawable/ic_video_play" />
</androidx.cardview.widget.CardView>
</layout>
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