Remembering Background color and Text elements for posts.
This commit is contained in:
@@ -246,15 +246,19 @@ fun NoteCompose(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val backgroundColor = if (isNew) {
|
val primaryColor = MaterialTheme.colors.primary.copy(0.12f)
|
||||||
val newColor = MaterialTheme.colors.primary.copy(0.12f)
|
val defaultBackgroundColor = MaterialTheme.colors.background
|
||||||
if (parentBackgroundColor != null) {
|
|
||||||
newColor.compositeOver(parentBackgroundColor)
|
val backgroundColor = remember(isNew, parentBackgroundColor) {
|
||||||
|
if (isNew) {
|
||||||
|
if (parentBackgroundColor != null) {
|
||||||
|
primaryColor.compositeOver(parentBackgroundColor)
|
||||||
|
} else {
|
||||||
|
primaryColor.compositeOver(defaultBackgroundColor)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
newColor.compositeOver(MaterialTheme.colors.background)
|
parentBackgroundColor ?: defaultBackgroundColor
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
parentBackgroundColor ?: MaterialTheme.colors.background
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val columnModifier = remember(backgroundColor) {
|
val columnModifier = remember(backgroundColor) {
|
||||||
@@ -436,11 +440,11 @@ private fun RenderTextEvent(
|
|||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
navController: NavController
|
navController: NavController
|
||||||
) {
|
) {
|
||||||
val tags = remember { note.event?.tags() }
|
val tags = remember(note.event?.id()) { note.event?.tags() }
|
||||||
val hashtags = remember { note.event?.hashtags() ?: emptyList() }
|
val hashtags = remember(note.event?.id()) { note.event?.hashtags() ?: emptyList() }
|
||||||
val eventContent = remember { accountViewModel.decrypt(note) }
|
val eventContent = remember(note.event?.id()) { accountViewModel.decrypt(note) }
|
||||||
val modifier = remember { Modifier.fillMaxWidth() }
|
val modifier = remember(note.event?.id()) { Modifier.fillMaxWidth() }
|
||||||
val isAuthorTheLoggedUser = remember { accountViewModel.isLoggedUser(note.author) }
|
val isAuthorTheLoggedUser = remember(note.event?.id()) { accountViewModel.isLoggedUser(note.author) }
|
||||||
|
|
||||||
if (eventContent != null) {
|
if (eventContent != null) {
|
||||||
if (makeItShort && isAuthorTheLoggedUser) {
|
if (makeItShort && isAuthorTheLoggedUser) {
|
||||||
|
|||||||
Reference in New Issue
Block a user