move strings in core/ui module

disable generating android resources everywhere except core/ui module
replace UiR with R
This commit is contained in:
2025-08-27 04:53:46 +03:00
parent 799ed820e3
commit 4677e484d9
37 changed files with 359 additions and 348 deletions
@@ -67,7 +67,7 @@ import java.io.File
import java.io.FileOutputStream
import kotlin.math.abs
import kotlin.random.Random
import dev.meloda.fast.ui.R as UiR
import dev.meloda.fast.ui.R
interface MessagesHistoryViewModel {
@@ -1188,7 +1188,7 @@ class MessagesHistoryViewModelImpl(
clipboardManager.setPrimaryClip(ClipData.newPlainText("Message", messageToCopy))
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S) {
Toast.makeText(applicationContext, UiR.string.copied_to_clipboard, Toast.LENGTH_SHORT)
Toast.makeText(applicationContext, R.string.copied_to_clipboard, Toast.LENGTH_SHORT)
.show()
}
}
@@ -56,7 +56,7 @@ import dev.meloda.fast.datastore.AppSettings
import dev.meloda.fast.messageshistory.model.ActionMode
import dev.meloda.fast.ui.components.IconButton
import dev.meloda.fast.ui.theme.LocalThemeConfig
import dev.meloda.fast.ui.R as UiR
import dev.meloda.fast.ui.R
@OptIn(ExperimentalLayoutApi::class, ExperimentalHazeMaterialsApi::class)
@Composable
@@ -154,7 +154,7 @@ fun MessagesHistoryInputBar(
},
) {
Icon(
painter = painterResource(id = UiR.drawable.ic_outline_emoji_emotions_24),
painter = painterResource(id = R.drawable.ic_outline_emoji_emotions_24),
contentDescription = "Emoji button",
tint = MaterialTheme.colorScheme.primary
)
@@ -172,35 +172,35 @@ fun MessagesHistoryInputBar(
item(
key = "Bold",
label = context.getString(UiR.string.bold)
label = context.getString(R.string.bold)
) {
onBoldRequested()
close()
}
item(
key = "Italic",
label = context.getString(UiR.string.italic)
label = context.getString(R.string.italic)
) {
onItalicRequested()
close()
}
item(
key = "Underline",
label = context.getString(UiR.string.underline)
label = context.getString(R.string.underline)
) {
onUnderlineRequested()
close()
}
item(
key = "Link",
label = context.getString(UiR.string.link)
label = context.getString(R.string.link)
) {
onLinkRequested()
close()
}
item(
key = "Regular",
label = context.getString(UiR.string.regular)
label = context.getString(R.string.regular)
) {
onRegularRequested()
close()
@@ -218,7 +218,7 @@ fun MessagesHistoryInputBar(
),
placeholder = {
Text(
text = stringResource(id = UiR.string.message_input_hint),
text = stringResource(id = R.string.message_input_hint),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
@@ -238,7 +238,7 @@ fun MessagesHistoryInputBar(
}
) {
Icon(
painter = painterResource(id = UiR.drawable.round_attach_file_24),
painter = painterResource(id = R.drawable.round_attach_file_24),
contentDescription = "Add attachment button",
tint = MaterialTheme.colorScheme.primary,
)
@@ -267,11 +267,11 @@ fun MessagesHistoryInputBar(
Icon(
painter = painterResource(
id = when (actionMode) {
ActionMode.DELETE -> UiR.drawable.round_delete_outline_24
ActionMode.EDIT -> UiR.drawable.ic_round_done_24
ActionMode.RECORD_AUDIO -> UiR.drawable.ic_round_mic_none_24
ActionMode.RECORD_VIDEO -> UiR.drawable.rounded_photo_camera_24
ActionMode.SEND -> UiR.drawable.round_send_24
ActionMode.DELETE -> R.drawable.round_delete_outline_24
ActionMode.EDIT -> R.drawable.ic_round_done_24
ActionMode.RECORD_AUDIO -> R.drawable.ic_round_mic_none_24
ActionMode.RECORD_VIDEO -> R.drawable.rounded_photo_camera_24
ActionMode.SEND -> R.drawable.round_send_24
}
),
contentDescription = null,
@@ -50,7 +50,7 @@ import dev.meloda.fast.ui.theme.LocalThemeConfig
import dev.meloda.fast.ui.util.ImmutableList
import dev.meloda.fast.ui.util.emptyImmutableList
import kotlinx.coroutines.launch
import dev.meloda.fast.ui.R as UiR
import dev.meloda.fast.ui.R
@OptIn(
ExperimentalMaterial3Api::class,
@@ -167,7 +167,7 @@ fun MessagesHistoryScreen(
val topBarTitle by remember(screenState, selectedMessages) {
derivedStateOf {
when {
screenState.isLoading -> context.getString(UiR.string.title_loading)
screenState.isLoading -> context.getString(R.string.title_loading)
selectedMessages.isNotEmpty() -> "(${selectedMessages.size})"
else -> screenState.title
}
@@ -54,7 +54,7 @@ import dev.meloda.fast.datastore.AppSettings
import dev.meloda.fast.ui.theme.LocalThemeConfig
import dev.meloda.fast.ui.util.getImage
import dev.meloda.fast.ui.R as UiR
import dev.meloda.fast.ui.R
@OptIn(ExperimentalMaterial3Api::class, ExperimentalHazeMaterialsApi::class)
@Composable
@@ -114,7 +114,7 @@ fun MessagesHistoryTopBar(
modifier = Modifier
.align(Alignment.Center)
.size(24.dp),
painter = painterResource(id = UiR.drawable.ic_round_bookmark_border_24),
painter = painterResource(id = R.drawable.ic_round_bookmark_border_24),
contentDescription = "Favorites icon",
tint = MaterialTheme.colorScheme.onPrimary
)
@@ -137,7 +137,7 @@ fun MessagesHistoryTopBar(
modifier = Modifier
.size(36.dp)
.clip(CircleShape),
placeholder = painterResource(id = UiR.drawable.ic_account_circle_cut),
placeholder = painterResource(id = R.drawable.ic_account_circle_cut),
)
}
}
@@ -185,7 +185,7 @@ fun MessagesHistoryTopBar(
}
) {
Icon(
painter = painterResource(UiR.drawable.round_reply_24),
painter = painterResource(R.drawable.round_reply_24),
contentDescription = null
)
}
@@ -198,7 +198,7 @@ fun MessagesHistoryTopBar(
}
) {
Icon(
painter = painterResource(UiR.drawable.round_reply_all_24),
painter = painterResource(R.drawable.round_reply_all_24),
contentDescription = null
)
}
@@ -210,13 +210,13 @@ fun MessagesHistoryTopBar(
}
) {
Icon(
painter = painterResource(UiR.drawable.round_forward_24),
painter = painterResource(R.drawable.round_forward_24),
contentDescription = null
)
}
IconButton(onClick = onDeleteSelectedButtonClicked) {
Icon(
painter = painterResource(UiR.drawable.round_delete_outline_24),
painter = painterResource(R.drawable.round_delete_outline_24),
contentDescription = null
)
}
@@ -244,7 +244,7 @@ fun MessagesHistoryTopBar(
dropDownMenuExpanded = false
},
text = {
Text(text = stringResource(UiR.string.action_refresh))
Text(text = stringResource(R.string.action_refresh))
},
leadingIcon = {
Icon(
@@ -26,7 +26,6 @@ import dev.meloda.fast.model.api.domain.VkMessage
import dev.meloda.fast.ui.R
import java.text.SimpleDateFormat
import java.util.Locale
import dev.meloda.fast.ui.R as UiR
private fun isAccount(fromId: Long) = fromId == UserConfig.userId
@@ -41,7 +40,7 @@ fun VkMessage.extractAvatar() = when {
}
else -> null
}?.let(UiImage::Url) ?: UiImage.Resource(UiR.drawable.ic_account_circle_cut)
}?.let(UiImage::Url) ?: UiImage.Resource(R.drawable.ic_account_circle_cut)
fun VkMessage.extractDate(): String =
SimpleDateFormat("HH:mm", Locale.getDefault()).format(date * 1000L)
@@ -91,7 +90,7 @@ fun VkConversation.extractTitle(
) = when (peerType) {
PeerType.USER -> {
if (isAccount(id)) {
UiText.Resource(UiR.string.favorites)
UiText.Resource(R.string.favorites)
} else {
val userName = user?.let { user ->
if (useContactName) {
@@ -214,7 +213,7 @@ fun VkMessage.extractActionText(
when (action) {
VkMessage.Action.CHAT_CREATE -> {
val string = UiText.ResourceParams(
UiR.string.message_action_chat_created,
R.string.message_action_chat_created,
listOf(prefix, text)
).parseString(resources)
.orEmpty()
@@ -242,7 +241,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_TITLE_UPDATE -> {
val string = UiText.ResourceParams(
UiR.string.message_action_chat_renamed,
R.string.message_action_chat_renamed,
listOf(prefix, text)
).parseString(resources)
.orEmpty()
@@ -270,7 +269,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_PHOTO_UPDATE -> {
UiText.ResourceParams(
UiR.string.message_action_chat_photo_update,
R.string.message_action_chat_photo_update,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -290,7 +289,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_PHOTO_REMOVE -> {
UiText.ResourceParams(
UiR.string.message_action_chat_photo_remove,
R.string.message_action_chat_photo_remove,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -311,7 +310,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_KICK_USER -> {
if (memberId == fromId) {
UiText.ResourceParams(
UiR.string.message_action_chat_user_left,
R.string.message_action_chat_user_left,
listOf(memberPrefix)
).parseString(resources)
.orEmpty()
@@ -333,7 +332,7 @@ fun VkMessage.extractActionText(
else lastMessage.actionUser.toString()
val string = UiText.ResourceParams(
UiR.string.message_action_chat_user_kicked,
R.string.message_action_chat_user_kicked,
listOf(prefix, postfix)
).parseString(resources)
.orEmpty()
@@ -363,7 +362,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_INVITE_USER -> {
if (memberId == lastMessage.fromId) {
UiText.ResourceParams(
UiR.string.message_action_chat_user_returned,
R.string.message_action_chat_user_returned,
listOf(memberPrefix)
).parseString(resources)
.orEmpty()
@@ -385,7 +384,7 @@ fun VkMessage.extractActionText(
else lastMessage.actionUser.toString()
val string = UiText.ResourceParams(
UiR.string.message_action_chat_user_invited,
R.string.message_action_chat_user_invited,
listOf(memberPrefix, postfix)
).parseString(resources)
.orEmpty()
@@ -408,7 +407,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_INVITE_USER_BY_LINK -> {
UiText.ResourceParams(
UiR.string.message_action_chat_user_joined_by_link,
R.string.message_action_chat_user_joined_by_link,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -428,7 +427,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_INVITE_USER_BY_CALL -> {
UiText.ResourceParams(
UiR.string.message_action_chat_user_joined_by_call,
R.string.message_action_chat_user_joined_by_call,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -448,7 +447,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_INVITE_USER_BY_CALL_LINK -> {
UiText.ResourceParams(
UiR.string.message_action_chat_user_joined_by_call_link,
R.string.message_action_chat_user_joined_by_call_link,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -473,7 +472,7 @@ fun VkMessage.extractActionText(
// val hasMessageText = messageText.isNotEmpty()
UiText.ResourceParams(
UiR.string.message_action_chat_pin_message,
R.string.message_action_chat_pin_message,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -509,7 +508,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_UNPIN_MESSAGE -> {
UiText.ResourceParams(
UiR.string.message_action_chat_unpin_message,
R.string.message_action_chat_unpin_message,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -529,7 +528,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_SCREENSHOT -> {
UiText.ResourceParams(
UiR.string.message_action_chat_screenshot,
R.string.message_action_chat_screenshot,
listOf(prefix)
).parseString(resources)
.orEmpty()
@@ -549,7 +548,7 @@ fun VkMessage.extractActionText(
VkMessage.Action.CHAT_STYLE_UPDATE -> {
UiText.ResourceParams(
UiR.string.message_action_chat_style_update,
R.string.message_action_chat_style_update,
listOf(prefix)
).parseString(resources)
.orEmpty()