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

DROID-3251 Chat | Fix | Design fixes (#2492)

This commit is contained in:
Evgenii Kozlov 2025-06-03 10:57:13 +02:00 committed by GitHub
parent cf2681d813
commit 1db1f6edf2
Signed by: github
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 28 deletions

View file

@ -46,7 +46,6 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.colorResource
@ -54,7 +53,6 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
@ -64,15 +62,13 @@ import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import com.anytypeio.anytype.core_models.Url
import com.anytypeio.anytype.core_models.primitives.Space
import com.anytypeio.anytype.core_ui.common.DEFAULT_DISABLED_ALPHA
import com.anytypeio.anytype.core_ui.common.DefaultPreviews
import com.anytypeio.anytype.core_ui.common.FULL_ALPHA
import com.anytypeio.anytype.core_ui.foundation.Divider
import com.anytypeio.anytype.core_ui.foundation.noRippleClickable
import com.anytypeio.anytype.core_ui.views.BodyRegular
import com.anytypeio.anytype.core_ui.views.Caption1Medium
import com.anytypeio.anytype.core_ui.views.Caption1Regular
import com.anytypeio.anytype.core_ui.views.ContentMiscChat
import com.anytypeio.anytype.feature_chats.R
import com.anytypeio.anytype.feature_chats.presentation.ChatView
import com.anytypeio.anytype.feature_chats.presentation.ChatViewModel.ChatBoxMode
@ -567,7 +563,7 @@ private fun ChatBoxUserInput(
onValueChange(newValue, updatedSpans)
},
textStyle = BodyRegular.copy(
textStyle = ContentMiscChat.copy(
color = colorResource(id = R.color.text_primary)
),
modifier = modifier
@ -582,7 +578,7 @@ private fun ChatBoxUserInput(
text = text.text,
hint = stringResource(R.string.write_a_message),
innerTextField = innerTextField,
textStyle = BodyRegular.copy(color = colorResource(R.color.text_tertiary))
textStyle = ContentMiscChat.copy(color = colorResource(R.color.text_tertiary))
)
},
visualTransformation = AnnotatedTextTransformation(spans)

View file

@ -60,16 +60,15 @@ import com.anytypeio.anytype.core_ui.foundation.BUTTON_WARNING
import com.anytypeio.anytype.core_ui.foundation.Divider
import com.anytypeio.anytype.core_ui.foundation.GRADIENT_TYPE_RED
import com.anytypeio.anytype.core_ui.foundation.GenericAlert
import com.anytypeio.anytype.core_ui.views.BodyRegular
import com.anytypeio.anytype.core_ui.views.Caption1Medium
import com.anytypeio.anytype.core_ui.views.Caption1Regular
import com.anytypeio.anytype.core_ui.views.Caption2Regular
import com.anytypeio.anytype.core_ui.views.ContentMiscChat
import com.anytypeio.anytype.core_ui.views.fontIBM
import com.anytypeio.anytype.core_utils.const.DateConst.TIME_H24
import com.anytypeio.anytype.core_utils.ext.formatTimeInMillis
import com.anytypeio.anytype.feature_chats.R
import com.anytypeio.anytype.feature_chats.presentation.ChatView
import com.bumptech.glide.integration.compose.ExperimentalGlideComposeApi
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@ -159,7 +158,7 @@ fun Bubble(
// Rendering text with attachments
Column(
modifier = Modifier
.fillMaxWidth()
.wrapContentWidth()
.background(
color = if (!isUserAuthor)
colorResource(R.color.background_primary)
@ -248,15 +247,6 @@ fun Bubble(
}
}
}
if (isEdited) {
withStyle(
style = SpanStyle(color = colorResource(id = R.color.text_tertiary))
) {
append(
" (${stringResource(R.string.chats_message_edited)})"
)
}
}
withStyle(
style = SpanStyle(
@ -264,22 +254,31 @@ fun Bubble(
)
) {
append(
timestamp.formatTimeInMillis(
TIME_H24
)
timestamp.formatTimeInMillis(TIME_H24).let {
if (isEdited) {
"${stringResource(R.string.chats_message_edited)} $it"
} else {
it
}
}
)
}
},
style = BodyRegular,
style = ContentMiscChat,
color = colorResource(id = R.color.text_primary),
)
// Rendering message timestamp
Text(
modifier = Modifier
.align(Alignment.BottomEnd),
text = timestamp.formatTimeInMillis(
TIME_H24
),
text = timestamp.formatTimeInMillis(TIME_H24).let {
if (isEdited) {
"${stringResource(R.string.chats_message_edited)} $it"
} else {
it
}
},
style = Caption2Regular,
color = colorResource(id = R.color.transparent_active),
maxLines = 1