Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
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
Administrator
Magisk
Commits
8a23d1da
Commit
8a23d1da
authored
Jan 23, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not run setMarkdown on I/O thread
parent
d3eb61e0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
MarkDownDialog.kt
...java/com/topjohnwu/magisk/events/dialog/MarkDownDialog.kt
+5
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/events/dialog/MarkDownDialog.kt
View file @
8a23d1da
...
@@ -10,6 +10,7 @@ import com.topjohnwu.magisk.di.ServiceLocator
...
@@ -10,6 +10,7 @@ import com.topjohnwu.magisk.di.ServiceLocator
import
com.topjohnwu.magisk.view.MagiskDialog
import
com.topjohnwu.magisk.view.MagiskDialog
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
import
timber.log.Timber
import
timber.log.Timber
import
java.io.IOException
import
java.io.IOException
...
@@ -23,12 +24,13 @@ abstract class MarkDownDialog : DialogEvent() {
...
@@ -23,12 +24,13 @@ abstract class MarkDownDialog : DialogEvent() {
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
markdown_window_md2
,
null
)
val
view
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
markdown_window_md2
,
null
)
setView
(
view
)
setView
(
view
)
val
tv
=
view
.
findViewById
<
TextView
>(
R
.
id
.
md_txt
)
val
tv
=
view
.
findViewById
<
TextView
>(
R
.
id
.
md_txt
)
(
ownerActivity
as
BaseActivity
).
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
(
ownerActivity
as
BaseActivity
).
lifecycleScope
.
launch
{
try
{
try
{
ServiceLocator
.
markwon
.
setMarkdown
(
tv
,
getMarkdownText
())
val
text
=
withContext
(
Dispatchers
.
IO
)
{
getMarkdownText
()
}
ServiceLocator
.
markwon
.
setMarkdown
(
tv
,
text
)
}
catch
(
e
:
IOException
)
{
}
catch
(
e
:
IOException
)
{
Timber
.
e
(
e
)
Timber
.
e
(
e
)
tv
.
post
{
tv
.
setText
(
R
.
string
.
download_file_error
)
}
tv
.
setText
(
R
.
string
.
download_file_error
)
}
}
}
}
}
}
...
...
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