Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
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
bp
ShenghuoquanBusiness
Commits
6af676fb
Commit
6af676fb
authored
Jul 11, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 商品上下架后处理商品列表恰好为空情况
parent
95c0a5d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
CommodityListAdapter.kt
...oquan/commodity/ui/coupon/adapter/CommodityListAdapter.kt
+8
-0
CommodityListFragment.kt
...uan/commodity/ui/coupon/fragment/CommodityListFragment.kt
+8
-0
No files found.
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/ui/coupon/adapter/CommodityListAdapter.kt
View file @
6af676fb
...
...
@@ -11,6 +11,7 @@ import androidx.databinding.BindingAdapter
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.ViewDataBinding
import
androidx.lifecycle.LifecycleOwner
import
androidx.lifecycle.MutableLiveData
import
androidx.recyclerview.widget.RecyclerView
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.resource.bitmap.CenterCrop
...
...
@@ -79,6 +80,11 @@ class CommodityListAdapter(private val context: Context, private val status: Com
*/
private
val
commodityData
by
lazy
{
ArrayList
<
Goods
>()
}
/**
* 商品数据变化
*/
val
commodityDataChange
by
lazy
{
MutableLiveData
<
ArrayList
<
Goods
>>()
}
/**
* 更新数据
*/
...
...
@@ -167,6 +173,7 @@ class CommodityListAdapter(private val context: Context, private val status: Com
ToastUtil
.
showToast
(
context
,
"下架成功"
)
commodityData
.
remove
(
data
)
notifyItemRemoved
(
position
)
commodityDataChange
.
value
=
commodityData
})
}
is
CommodityAuditItemViewHolder
->
{
...
...
@@ -183,6 +190,7 @@ class CommodityListAdapter(private val context: Context, private val status: Com
ToastUtil
.
showToast
(
context
,
"上架成功"
)
commodityData
.
remove
(
data
)
notifyItemRemoved
(
position
)
commodityDataChange
.
value
=
commodityData
})
}
}
...
...
Components/commodity/src/main/java/com/yidian/shenghuoquan/commodity/ui/coupon/fragment/CommodityListFragment.kt
View file @
6af676fb
...
...
@@ -49,6 +49,7 @@ class CommodityListFragment(private val status: CommodityStatus) :
* 订阅数据
*/
private
fun
subscribeLiveData
()
{
// 下拉刷新完成
vm
.
refreshFinish
.
observe
(
this
,
{
binding
.
rlCommodityList
.
finishRefresh
()
if
(
it
.
isNullOrEmpty
())
{
...
...
@@ -58,10 +59,17 @@ class CommodityListFragment(private val status: CommodityStatus) :
adapter
?.
updateData
(
it
)
}
})
// 上拉加载更多完成
vm
.
loadMoreFinish
.
observe
(
this
,
{
binding
.
rlCommodityList
.
finishLoadMore
()
adapter
?.
insertData
(
it
)
})
// 商品数据变化
adapter
?.
commodityDataChange
?.
observe
(
this
,
{
if
(
it
.
isNullOrEmpty
())
{
binding
.
pvEmptyPage
.
isVisible
=
true
}
})
}
/**
...
...
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