Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
android_vedio
Commits
321ba848
Commit
321ba848
authored
Sep 13, 2024
by
mengcuiguang2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
90a5925b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
107 deletions
+12
-107
VipAdapter.kt
...in/java/com/duben/duoduoplayletu/ui/adapter/VipAdapter.kt
+9
-104
shape_vip_adapter.xml
video/app/src/main/res/drawable/shape_vip_adapter.xml
+1
-1
shape_vip_adapter_none.xml
video/app/src/main/res/drawable/shape_vip_adapter_none.xml
+1
-1
item_rv_vip.xml
video/app/src/main/res/layout/item_rv_vip.xml
+1
-1
No files found.
video/app/src/main/java/com/duben/duoduoplayletu/ui/adapter/VipAdapter.kt
View file @
321ba848
...
...
@@ -57,115 +57,20 @@ class VipAdapter(val vipList: MutableList<VipBean.ListBean>) :
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
val
vipBean
=
vipList
[
position
]
if
(
vipBean
.
trial
!=
0
)
{
holder
.
tvVipItemLable
.
setPadding
(
0
,
0
,
0
,
0
)
holder
.
tvVipItemLable
.
text
=
"限时特惠"
holder
.
tvVipItemLable
.
gravity
=
Gravity
.
CENTER
holder
.
tvVipItemLable
.
setBackgroundResource
(
R
.
mipmap
.
ic_vip_lable
)
}
else
{
holder
.
tvVipItemLable
.
setPadding
(
0
,
0
,
0
,
0
)
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
// 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
.
payToModel
==
2
)
{
// 跳转小程序领券
holder
.
tvVipItemCurMoney
.
text
=
SpanUtils
()
.
append
(
vipBean
.
oldPrice
.
toFloat
().
toString
())
// .setFontSize(BubbleUtils.sp2px(34))
.
append
(
" 元\n"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
14
))
.
append
(
"原价:"
+
vipBean
.
price
.
toFloat
().
toString
()
+
" 元"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
12
))
.
setStrikethrough
()
.
create
()
}
else
{
if
(
vipBean
.
price
==
0.0
)
{
holder
.
tvVipItemCurMoney
.
text
=
SpanUtils
()
.
append
(
"0.01"
)
// .setFontSize(BubbleUtils.sp2px(34))
.
append
(
"元"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
14
))
.
create
()
}
else
{
holder
.
tvVipItemCurMoney
.
text
=
SpanUtils
()
.
append
(
vipBean
.
price
.
toString
())
// .setFontSize(BubbleUtils.sp2px(34))
.
append
(
"元"
)
.
setFontSize
(
BubbleUtils
.
sp2px
(
14
))
.
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
try
{
if
(!
TextUtils
.
isEmpty
(
vipBean
.
topTitle
))
{
val
topArray
=
vipBean
.
topTitle
.
split
(
","
)
if
(
topArray
!=
null
&&
topArray
.
size
>
0
)
{
holder
.
tvVipItemLable
.
text
=
topArray
[
0
]
?:
""
holder
.
tvVipItemCurMoney
.
text
=
topArray
[
1
]
?:
""
holder
.
tvVipItemMoney
.
text
=
topArray
[
2
]
?:
""
holder
.
tvVipItemTitle
.
text
=
topArray
[
3
]
?:
""
holder
.
tvVipItemLable
.
visibility
=
View
.
VISIBLE
holder
.
tvVipItemLable
.
text
=
topArray
[
0
]
holder
.
tvVipItemMoney
.
text
=
topArray
[
1
]
holder
.
tvVipItemCurMoney
.
text
=
topArray
[
2
]
holder
.
tvVipItemTitle
.
text
=
topArray
[
3
]
}
else
{
holder
.
tvVipItemLable
.
visibility
=
View
.
GONE
}
}
else
{
holder
.
tvVipItemLable
.
visibility
=
View
.
GONE
}
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
...
...
video/app/src/main/res/drawable/shape_vip_adapter.xml
View file @
321ba848
...
...
@@ -3,7 +3,7 @@
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<stroke
android:width=
"2dp"
android:color=
"#EFBC6A"
/>
<solid
android:color=
"
@color/black
"
/>
<solid
android:color=
"
#282d34
"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"10dip"
/>
...
...
video/app/src/main/res/drawable/shape_vip_adapter_none.xml
View file @
321ba848
...
...
@@ -3,7 +3,7 @@
android:shape=
"rectangle"
>
<!-- 填充的颜色 -->
<solid
android:color=
"
@color/black
"
/>
<solid
android:color=
"
#282d34
"
/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners
android:radius=
"10dip"
/>
...
...
video/app/src/main/res/layout/item_rv_vip.xml
View file @
321ba848
...
...
@@ -52,7 +52,7 @@
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"16dp"
android:textColor=
"#939AA3"
android:textSize=
"1
4
sp"
android:textSize=
"1
5
sp"
tools:text=
"原价:123"
/>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment