mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2219 App | Tech | Release 6 stabilisation (#1570)
This commit is contained in:
parent
083989ae9b
commit
e8958a2dab
1 changed files with 19 additions and 11 deletions
|
@ -61,8 +61,12 @@ class CodeTextInputWidget : AppCompatEditText, SyntaxHighlighter {
|
|||
}
|
||||
|
||||
private fun setupSyntaxHighlighter() {
|
||||
addRules(context.obtainSyntaxRules(Syntaxes.KOTLIN))
|
||||
highlight()
|
||||
runCatching {
|
||||
addRules(context.obtainSyntaxRules(Syntaxes.KOTLIN))
|
||||
highlight()
|
||||
}.onFailure {
|
||||
Timber.e(it, "Error while setting up syntax highlighter")
|
||||
}
|
||||
super.addTextChangedListener(syntaxTextWatcher)
|
||||
}
|
||||
|
||||
|
@ -129,17 +133,21 @@ class CodeTextInputWidget : AppCompatEditText, SyntaxHighlighter {
|
|||
}
|
||||
|
||||
override fun setupSyntax(lang: String?) {
|
||||
if (lang == null) {
|
||||
rules.clear()
|
||||
clearHighlights()
|
||||
} else {
|
||||
val result = context.obtainSyntaxRules(lang)
|
||||
if (result.isEmpty()) {
|
||||
addRules(context.obtainGenericSyntaxRules())
|
||||
runCatching {
|
||||
if (lang == null) {
|
||||
rules.clear()
|
||||
clearHighlights()
|
||||
} else {
|
||||
addRules(result)
|
||||
val result = context.obtainSyntaxRules(lang)
|
||||
if (result.isEmpty()) {
|
||||
addRules(context.obtainGenericSyntaxRules())
|
||||
} else {
|
||||
addRules(result)
|
||||
}
|
||||
highlight()
|
||||
}
|
||||
highlight()
|
||||
}.onFailure {
|
||||
Timber.e(it, "Error while setting syntax rules.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue