Commit b2badb41 authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Run updates on the adaptor on the ui thread

parent c8c69523
Pipeline #5088 passed with stage
in 2 minutes and 52 seconds
......@@ -263,7 +263,7 @@ class DnsRuleFragment : Fragment() {
showUserRules = !showUserRules
if (showUserRules) {
userRuleCount = userDnsRules.size
activity!!.runOnUiThread {
activity?.runOnUiThread {
sourceAdapter.notifyItemRangeInserted(sourceAdapterList.size + 1, userRuleCount)
list.smoothScrollToPosition(sourceAdapterList.size + 1)
}
......@@ -304,10 +304,12 @@ class DnsRuleFragment : Fragment() {
showUserRules = true
if (wereRulesShown) {
userRuleCount += 1
sourceAdapter.notifyItemInserted(sourceAdapterList.size + 1 + insertPos)
activity?.runOnUiThread {
sourceAdapter.notifyItemInserted(sourceAdapterList.size + 1 + insertPos)
}
} else {
userRuleCount = userDnsRules.size
activity!!.runOnUiThread {
activity?.runOnUiThread {
sourceAdapter.notifyItemChanged(sourceAdapterList.size)
sourceAdapter.notifyItemRangeInserted(sourceAdapterList.size + 1, userRuleCount)
list.smoothScrollToPosition(insertPos)
......@@ -413,7 +415,7 @@ class DnsRuleFragment : Fragment() {
}
}
runOnUiThread = {
activity!!.runOnUiThread(it)
activity?.runOnUiThread(it)
}
}.build()
......
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