mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
call adapter methods in UI thread
otherwise sometimes this exception was thrown: IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
a488b9738e
commit
2f35ae19fc
@ -195,7 +195,6 @@ abstract class BrowserController(args: Bundle) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun listingResult(davResponse: DavResponse) {
|
override fun listingResult(davResponse: DavResponse) {
|
||||||
adapter!!.clear()
|
|
||||||
recyclerViewItems = ArrayList()
|
recyclerViewItems = ArrayList()
|
||||||
if (davResponse.getData() != null) {
|
if (davResponse.getData() != null) {
|
||||||
val objectList = davResponse.getData() as List<BrowserFile>
|
val objectList = davResponse.getData() as List<BrowserFile>
|
||||||
@ -210,9 +209,10 @@ abstract class BrowserController(args: Bundle) :
|
|||||||
|
|
||||||
FileSortOrder.getFileSortOrder(appPreferences?.sorting).sortCloudFiles(recyclerViewItems)
|
FileSortOrder.getFileSortOrder(appPreferences?.sorting).sortCloudFiles(recyclerViewItems)
|
||||||
|
|
||||||
adapter!!.addItems(0, recyclerViewItems)
|
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity!!.runOnUiThread {
|
activity!!.runOnUiThread {
|
||||||
|
adapter!!.clear()
|
||||||
|
adapter!!.addItems(0, recyclerViewItems)
|
||||||
adapter!!.notifyDataSetChanged()
|
adapter!!.notifyDataSetChanged()
|
||||||
changeEnabledStatusForBarItems(true)
|
changeEnabledStatusForBarItems(true)
|
||||||
}
|
}
|
||||||
@ -247,7 +247,11 @@ abstract class BrowserController(args: Bundle) :
|
|||||||
selectedPaths.remove(file.parent!! + "/")
|
selectedPaths.remove(file.parent!! + "/")
|
||||||
file = File(file.parent!!)
|
file = File(file.parent!!)
|
||||||
}
|
}
|
||||||
adapter!!.notifyDataSetChanged()
|
if (activity != null) {
|
||||||
|
activity!!.runOnUiThread {
|
||||||
|
adapter!!.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onItemClick(view: View, position: Int): Boolean {
|
override fun onItemClick(view: View, position: Int): Boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user