Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
PublicAndroidApps
Nebulo
Commits
b2badb41
Commit
b2badb41
authored
Aug 11, 2019
by
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
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/smokescreen/fragment/DnsRuleFragment.kt
View file @
b2badb41
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
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