1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 13:57:10 +09:00

Render emoji apple icon in page's top toolbar, fallback to system emoji in case of exception (#926)

This commit is contained in:
Evgenii Kozlov 2020-09-25 17:19:25 +03:00 committed by GitHub
parent b76165dc17
commit f90ea92892
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 11 deletions

View file

@ -4,6 +4,7 @@
### Fixes & tech 🚒
* Render emoji apple icon in page top toolbar, fallback to system emoji in case of exception (#926)
* Disable DND for profile header on home dashboard (#923)
* Exclude text color and background marks where param value is equal to default value (#786)
* Try/catch instead of crashing for issues from 0.0.48 (#925)

View file

@ -59,6 +59,7 @@ import com.anytypeio.anytype.domain.block.model.Block
import com.anytypeio.anytype.domain.block.model.Block.Content.Text
import com.anytypeio.anytype.domain.ext.getFirstLinkMarkupParam
import com.anytypeio.anytype.domain.ext.getSubstring
import com.anytypeio.anytype.emojifier.Emojifier
import com.anytypeio.anytype.ext.extractMarks
import com.anytypeio.anytype.presentation.page.PageViewModel
import com.anytypeio.anytype.presentation.page.PageViewModelFactory
@ -750,17 +751,29 @@ open class PageFragment :
private fun resetTopToolbarTitle(text: String?, emoji: String?, image: String?) {
topToolbar.title.text = text
if (emoji != null) topToolbar.emoji.text = emoji
if (image != null) {
topToolbar.image.visible()
Glide
.with(topToolbar.image)
.load(image)
.centerInside()
.circleCrop()
.into(topToolbar.image)
} else {
topToolbar.image.setImageDrawable(null)
when {
emoji != null && emoji.isNotEmpty() -> {
try {
topToolbar.emoji.invisible()
Glide.with(topToolbar.image).load(Emojifier.uri(emoji)).into(topToolbar.image)
} catch (e: Exception) {
topToolbar.emoji.visible()
topToolbar.emoji.text = emoji
}
}
image != null -> {
topToolbar.emoji.invisible()
topToolbar.image.visible()
Glide
.with(topToolbar.image)
.load(image)
.centerInside()
.circleCrop()
.into(topToolbar.image)
}
else -> {
topToolbar.image.setImageDrawable(null)
}
}
}