mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-28 16:27:38 +00:00
Fixed error that prevented flashing
This commit is contained in:
parent
0119ebddbe
commit
dabe6267b9
@ -155,8 +155,6 @@ fun setScrollToLast(view: RecyclerView, shouldScrollToLast: Boolean) {
|
||||
Observable.timer(1, TimeUnit.SECONDS).subscribeK { callback() }
|
||||
}
|
||||
|
||||
val tag = RecyclerView::class.java.name.sumBy { it.toInt() }
|
||||
|
||||
fun RecyclerView.Adapter<*>.setListener() {
|
||||
val observer = object : RecyclerView.AdapterDataObserver() {
|
||||
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
|
||||
@ -164,11 +162,12 @@ fun setScrollToLast(view: RecyclerView, shouldScrollToLast: Boolean) {
|
||||
}
|
||||
}
|
||||
registerAdapterDataObserver(observer)
|
||||
view.setTag(tag, observer)
|
||||
view.setTag(R.id.recyclerScrollListener, observer)
|
||||
}
|
||||
|
||||
fun RecyclerView.Adapter<*>.removeListener() {
|
||||
val observer = view.getTag(tag) as? RecyclerView.AdapterDataObserver ?: return
|
||||
val observer =
|
||||
view.getTag(R.id.recyclerScrollListener) as? RecyclerView.AdapterDataObserver ?: return
|
||||
unregisterAdapterDataObserver(observer)
|
||||
}
|
||||
|
||||
|
6
app/src/main/res/values/ids.xml
Normal file
6
app/src/main/res/values/ids.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<item name="recyclerScrollListener" type="id" />
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user