Commit d9dd4c2b authored by mengcuiguang's avatar mengcuiguang

Merge branch 'dev_vedio_aiduanju_yi_241015' of...

Merge branch 'dev_vedio_aiduanju_yi_241015' of http://gitlab.mints-id.com/android/android_vedio into dev_vedio_aiduanju_yi_241015
parents 4cf9a81e 396dc3e1
package com.duben.loveplayletu.ui.adapter package com.duben.loveplayletu.ui.adapter
import android.content.Context import android.content.Context
import android.graphics.Color
import android.text.Html
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
...@@ -12,6 +14,7 @@ import com.duben.loveplayletu.R ...@@ -12,6 +14,7 @@ import com.duben.loveplayletu.R
import com.duben.loveplayletu.mvp.model.VipBean import com.duben.loveplayletu.mvp.model.VipBean
import com.duben.loveplayletu.utils.BubbleUtils import com.duben.loveplayletu.utils.BubbleUtils
import com.duben.loveplayletu.utils.SpanUtils import com.duben.loveplayletu.utils.SpanUtils
import com.duben.loveplayletu.utils.UIUtils
class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) : class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) :
RecyclerView.Adapter<VipAdapter.ViewHolder>() { RecyclerView.Adapter<VipAdapter.ViewHolder>() {
...@@ -35,6 +38,7 @@ class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) : ...@@ -35,6 +38,7 @@ class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) :
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) { inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val rlVipItemRoot: FrameLayout = view.findViewById(R.id.rlVipItemRoot) val rlVipItemRoot: FrameLayout = view.findViewById(R.id.rlVipItemRoot)
val tvVipItemCurMoney: TextView = view.findViewById(R.id.tvVipItemCurMoney) val tvVipItemCurMoney: TextView = view.findViewById(R.id.tvVipItemCurMoney)
val tvVipItemOldMoney: TextView = view.findViewById(R.id.tvVipItemOldMoney)
val tvVipItemMoney: TextView = view.findViewById(R.id.tvVipItemMoney) val tvVipItemMoney: TextView = view.findViewById(R.id.tvVipItemMoney)
val tvVipItemTitle: TextView = view.findViewById(R.id.tvVipItemTitle) val tvVipItemTitle: TextView = view.findViewById(R.id.tvVipItemTitle)
val tvVipItemLable: TextView = view.findViewById(R.id.tvVipItemLable) val tvVipItemLable: TextView = view.findViewById(R.id.tvVipItemLable)
...@@ -51,88 +55,44 @@ class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) : ...@@ -51,88 +55,44 @@ class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) :
val vipBean = vipList[position] val vipBean = vipList[position]
if (vipBean.trial != 0) { if (vipBean.trial != 0) {
holder.tvVipItemLable.setPadding(0, 0, 0, 0)
holder.tvVipItemLable.text = "限时特惠" holder.tvVipItemLable.text = "限时特惠"
holder.tvVipItemLable.gravity = Gravity.CENTER
holder.tvVipItemLable.setBackgroundResource(R.mipmap.ic_vip_lable)
} else { } else {
holder.tvVipItemLable.setPadding(0, 0, 0, 0)
holder.tvVipItemLable.text = "热门" holder.tvVipItemLable.text = "热门"
holder.tvVipItemLable.gravity = Gravity.CENTER
holder.tvVipItemLable.setBackgroundResource(R.mipmap.ic_vip_lable)
} }
// try {
// if(!TextUtils.isEmpty(vipBean.topTitle)){
//
// val topArray= vipBean.topTitle.split(",")
// holder.tvVipItemCurMoney.text = SpanUtils()
// .append(topArray[0])
// .append(topArray[1])
// .setFontSize(BubbleUtils.sp2px(28))
// .append(topArray[2])
// .create()
// holder.tvVipItemMoney.text = topArray[3]
// holder.tvVipItemTitle.text = topArray[4]
// }else{
// holder.tvVipItemTitle.text = vipBean.title
// if (vipBean.price < 1) {
// holder.tvVipItemCurMoney.text = "¥${vipBean.price}"
// } else {
// holder.tvVipItemCurMoney.text = "¥${vipBean.price}"
//// holder.tvVipItemCurMoney.text = "¥${String.format("%.0f", vipBean.price)}"
// }
// if (vipBean.oldPrice > 0) {
// holder.tvVipItemMoney.visibility = View.VISIBLE
// holder.tvVipItemMoney.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG) //中间横线(删除线)
// if (vipBean.oldPrice < 1) {
// holder.tvVipItemMoney.text = "原价:${vipBean.oldPrice}"
// } else {
// holder.tvVipItemMoney.text = "原价:${String.format("%.0f", vipBean.oldPrice)}"
// }
// } else {
// holder.tvVipItemMoney.visibility = View.INVISIBLE
// }
//
// }
// }catch (e:Exception){
// e.printStackTrace()
holder.tvVipItemTitle.text = vipBean.title holder.tvVipItemTitle.text = vipBean.title
// if (vipBean.price < 1) {
// holder.tvVipItemCurMoney.text = "¥${vipBean.price}" holder.tvVipItemOldMoney.text = SpanUtils()
// } else { .append("原价 ")
// holder.tvVipItemCurMoney.text = "¥${vipBean.price}" .setFontSize(BubbleUtils.sp2px(14))
//// holder.tvVipItemCurMoney.text = "¥${String.format("%.0f", vipBean.price)}" .setStrikethrough()
// } .append("" + vipBean.oldPrice)
.setFontSize(BubbleUtils.sp2px(16))
.setBold()
.setStrikethrough()
.create()
if (vipBean.price == 0.0) { if (vipBean.price == 0.0) {
holder.tvVipItemCurMoney.text = SpanUtils() holder.tvVipItemCurMoney.text = SpanUtils()
.append("¥")
.append("0.01") .append("0.01")
.setFontSize(BubbleUtils.sp2px(34)) .setFontSize(BubbleUtils.sp2px(30))
.append("元")
.create() .create()
} else { } else {
holder.tvVipItemCurMoney.text = SpanUtils() holder.tvVipItemCurMoney.text = SpanUtils()
.append("¥")
.append(vipBean.price.toString()) .append(vipBean.price.toString())
.setFontSize(BubbleUtils.sp2px(34)) .setFontSize(BubbleUtils.sp2px(30))
.append("元")
.create() .create()
} }
// if (vipBean.oldPrice > 0) {
// holder.tvVipItemMoney.visibility = View.VISIBLE
// holder.tvVipItemMoney.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG) //中间横线(删除线)
// if (vipBean.oldPrice < 1) {
// holder.tvVipItemMoney.text = "原价:${vipBean.oldPrice}"
// } else {
// holder.tvVipItemMoney.text = "原价:${String.format("%.0f", vipBean.oldPrice)}"
// }
// } else {
// holder.tvVipItemMoney.visibility = View.INVISIBLE
// }
// }
holder.tvVipItemMoney.text = vipBean.topTitle holder.tvVipItemMoney.text = vipBean.topTitle
if (position == 0) {
val layoutParams = holder.rlVipItemRoot.layoutParams as FrameLayout.LayoutParams
layoutParams.width = UIUtils.dp2px(190)
holder.rlVipItemRoot.layoutParams = layoutParams
}
holder.rlVipItemRoot.setOnClickListener { holder.rlVipItemRoot.setOnClickListener {
mOnItemClickListener.onItemClick(position) mOnItemClickListener.onItemClick(position)
...@@ -142,23 +102,24 @@ class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) : ...@@ -142,23 +102,24 @@ class VipAdapter(private val vipList: MutableList<VipBean.ListBean>) :
if (getPosition() == position) { if (getPosition() == position) {
//当前选中 //当前选中
holder.rlVipItemRoot.setBackgroundResource(R.drawable.shape_vip_adapter) holder.rlVipItemRoot.setBackgroundResource(R.drawable.shape_vip_adapter)
// holder.tvVipItemCurMoney.setTextColor( holder.tvVipItemLable.visibility = View.VISIBLE
// ContextCompat.getColor( holder.tvVipItemTitle.setTextColor(Color.parseColor("#9C5200"))
// context, holder.tvVipItemCurMoney.setTextColor(Color.parseColor("#7F4D14"))
// R.color.color_FD7E0E holder.tvVipItemOldMoney.setTextColor(Color.parseColor("#B57924"))
// ) holder.tvVipItemMoney.setTextColor(Color.parseColor("#673810"))
// ) holder.tvVipItemMoney.setBackgroundResource(R.drawable.shape_vip_bottom_s)
} else { } else {
holder.rlVipItemRoot.setBackgroundResource(R.drawable.shape_vip_adapter_none) holder.rlVipItemRoot.setBackgroundResource(R.drawable.shape_vip_adapter_none)
// holder.tvVipItemCurMoney.setTextColor( holder.tvVipItemLable.visibility = View.GONE
// ContextCompat.getColor( holder.tvVipItemTitle.setTextColor(Color.WHITE)
// context, holder.tvVipItemCurMoney.setTextColor(Color.WHITE)
// R.color.white holder.tvVipItemOldMoney.setTextColor(Color.parseColor("#85898A"))
// ) holder.tvVipItemMoney.setTextColor(Color.parseColor("#B0B1B0"))
// ) holder.tvVipItemMoney.setBackgroundResource(R.drawable.shape_vip_bottom)
} }
holder.itemView.setTag(position) holder.itemView.tag = position
} }
override fun getItemCount() = vipList?.size override fun getItemCount() = vipList?.size
......
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"> android:shape="rectangle">
<!-- 填充的颜色 --> <!-- 填充的颜色 -->
<stroke android:width="2dp" android:color="#EFBC6A" /> <!-- <stroke android:width="2dp" android:color="#EFBC6A" />-->
<solid android:color="#282d34" /> <!-- 填充的颜色 -->
<gradient
android:angle="270"
android:endColor="#FFEAB9"
android:startColor="#FBF3DE" />
<!-- 设置按钮的四个角为弧形 --> <!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 --> <!-- android:radius 弧形的半径 -->
<corners android:radius="10dip" /> <corners android:radius="20dip" />
</shape> </shape>
\ No newline at end of file
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
android:shape="rectangle"> android:shape="rectangle">
<!-- 填充的颜色 --> <!-- 填充的颜色 -->
<solid android:color="#282d34" /> <solid android:color="#353738" />
<!-- 设置按钮的四个角为弧形 --> <!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 --> <!-- android:radius 弧形的半径 -->
<corners android:radius="10dip" /> <corners android:radius="20dip" />
<stroke android:width="1dp" android:color="#484848"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<!-- <gradient-->
<!-- android:angle="180"-->
<!-- android:endColor="#f2d6a4"-->
<!-- android:startColor="#efbc6a" />-->
<solid android:color="#494B4C" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</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">
<!-- 填充的颜色 -->
<!-- <gradient-->
<!-- android:angle="180"-->
<!-- android:endColor="#f2d6a4"-->
<!-- android:startColor="#efbc6a" />-->
<solid android:color="#FBD07A" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>
\ No newline at end of file
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<!-- 填充的颜色 --> <!-- 填充的颜色 -->
<gradient <gradient
android:angle="180" android:angle="180"
android:endColor="#f2d6a4" android:endColor="#FC3B02"
android:startColor="#efbc6a" /> android:startColor="#FC8D16" />
<!-- 设置按钮的四个角为弧形 --> <!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 --> <!-- android:radius 弧形的半径 -->
<corners android:bottomLeftRadius="5dp" <corners
android:bottomRightRadius="5dp" android:bottomLeftRadius="0dp"
android:topLeftRadius="0dp" android:bottomRightRadius="8dp"
android:topRightRadius="0dp" android:topLeftRadius="8dp"
/> android:topRightRadius="8dp" />
</shape> </shape>
\ No newline at end of file
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvVip" android:id="@+id/rvVip"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="140dp" android:layout_height="150dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:background="@null" android:background="@null"
android:overScrollMode="never" /> android:overScrollMode="never" />
......
...@@ -43,14 +43,13 @@ ...@@ -43,14 +43,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginBottom="30dp" android:layout_marginBottom="30dp"
android:src="@mipmap/bg_vip_top"></ImageView> android:src="@mipmap/bg_vip_top" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvVip" android:id="@+id/rvVip"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="200dp" android:layout_height="220dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal" />
android:background="@color/color_2F155E" />
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="200dp" android:layout_width="wrap_content"
android:layout_marginLeft="20dp" android:layout_height="138dp"
android:layout_marginRight="20dp" android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:layout_marginRight="10dp"
android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/rlVipItemRoot" android:id="@+id/rlVipItemRoot"
android:layout_width="match_parent" android:layout_width="150dp"
android:layout_height="110dp" android:layout_height="130dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:background="@drawable/shape_vip_adapter_none" android:background="@drawable/shape_vip_adapter_none"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_marginTop="-8dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"> android:layout_gravity="center_vertical"
android:layout_marginTop="-8dp"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/tvVipItemTitle" android:id="@+id/tvVipItemTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginLeft="18dp" android:textColor="#9C5200"
android:textColor="#efbc6a" android:textSize="16sp"
android:textSize="20sp"
android:layout_centerVertical="true"
android:textStyle="bold" android:textStyle="bold"
tools:text="包年会员" /> tools:text="包年会员" />
...@@ -39,42 +37,49 @@ ...@@ -39,42 +37,49 @@
android:id="@+id/tvVipItemCurMoney" android:id="@+id/tvVipItemCurMoney"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_gravity="center_horizontal"
android:layout_alignParentRight="true"
android:layout_marginRight="18dp"
android:gravity="center" android:gravity="center"
android:textColor="#efbc6a" android:textColor="#B4782E"
android:textSize="16sp" android:textSize="18sp"
tools:text="$78" /> tools:text="$78" />
<TextView
android:id="@+id/tvVipItemOldMoney"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:textColor="#efbc6a"
android:textSize="14sp"
tools:text="$78" />
</RelativeLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/tvVipItemMoney" android:id="@+id/tvVipItemMoney"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="28dp" android:layout_height="28dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@drawable/shape_vip_lable" android:background="@drawable/shape_vip_bottom_s"
android:gravity="center" android:gravity="center"
android:textColor="@color/color_A24240" android:textColor="#673810"
android:textSize="12sp" android:textSize="14sp"
tools:text="原价:123" /> tools:text="原价:12q3" />
</FrameLayout> </FrameLayout>
<TextView <TextView
android:id="@+id/tvVipItemLable" android:id="@+id/tvVipItemLable"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="24dp"
android:background="@mipmap/ic_vip_lable" android:layout_marginStart="-1dp"
android:background="@drawable/shape_vip_label"
android:gravity="center" android:gravity="center"
android:paddingLeft="6dp" android:paddingLeft="10dp"
android:paddingTop="2dp" android:paddingTop="2dp"
android:paddingRight="6dp" android:paddingRight="10dp"
android:paddingBottom="2dp" android:paddingBottom="2dp"
android:textColor="@color/color_815136" android:textColor="@color/white"
android:textSize="14sp" android:textSize="14sp"
tools:text="包年会员" /> tools:text="包年会员" />
</FrameLayout> </FrameLayout>
\ 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