move strings in core/ui module
disable generating android resources everywhere except core/ui module replace UiR with R
This commit is contained in:
+7
-7
@@ -58,7 +58,7 @@ import dev.meloda.fast.ui.components.ActionInvokeDismiss
|
||||
import dev.meloda.fast.ui.components.MaterialDialog
|
||||
import dev.meloda.fast.ui.components.TextFieldErrorText
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun CaptchaRoute(
|
||||
@@ -116,11 +116,11 @@ fun CaptchaScreen(
|
||||
if (showExitAlert) {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { showExitAlert = false },
|
||||
title = stringResource(id = UiR.string.warning_confirmation),
|
||||
text = stringResource(id = UiR.string.captcha_exit_warning),
|
||||
title = stringResource(id = R.string.warning_confirmation),
|
||||
text = stringResource(id = R.string.captcha_exit_warning),
|
||||
confirmAction = { confirmedExit = true },
|
||||
confirmText = stringResource(id = UiR.string.yes),
|
||||
cancelText = stringResource(id = UiR.string.no),
|
||||
confirmText = stringResource(id = R.string.yes),
|
||||
cancelText = stringResource(id = R.string.no),
|
||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||
)
|
||||
}
|
||||
@@ -187,7 +187,7 @@ fun CaptchaScreen(
|
||||
|
||||
if (LocalView.current.isInEditMode) {
|
||||
Image(
|
||||
painter = painterResource(id = UiR.drawable.test_captcha),
|
||||
painter = painterResource(id = R.drawable.test_captcha),
|
||||
contentDescription = "Captcha image",
|
||||
modifier = imageModifier
|
||||
)
|
||||
@@ -219,7 +219,7 @@ fun CaptchaScreen(
|
||||
.clip(RoundedCornerShape(10.dp)),
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.round_qr_code_24),
|
||||
painter = painterResource(id = R.drawable.round_qr_code_24),
|
||||
contentDescription = "QR code icon",
|
||||
tint = if (showError) {
|
||||
MaterialTheme.colorScheme.error
|
||||
|
||||
+18
-18
@@ -69,7 +69,7 @@ import dev.meloda.fast.ui.theme.LocalSizeConfig
|
||||
import dev.meloda.fast.ui.util.handleEnterKey
|
||||
import dev.meloda.fast.ui.util.handleTabKey
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun LoginRoute(
|
||||
@@ -210,7 +210,7 @@ fun LoginScreen(
|
||||
.align(Alignment.Center)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = UiR.string.sign_in_to_vk),
|
||||
text = stringResource(id = R.string.sign_in_to_vk),
|
||||
color = MaterialTheme.colorScheme.onBackground,
|
||||
style = MaterialTheme.typography.displayMedium
|
||||
)
|
||||
@@ -236,11 +236,11 @@ fun LoginScreen(
|
||||
},
|
||||
value = screenState.login,
|
||||
onValueChange = onLoginInputChanged,
|
||||
label = { Text(text = stringResource(id = UiR.string.login_hint)) },
|
||||
placeholder = { Text(text = stringResource(id = UiR.string.login_hint)) },
|
||||
label = { Text(text = stringResource(id = R.string.login_hint)) },
|
||||
placeholder = { Text(text = stringResource(id = R.string.login_hint)) },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.ic_round_person_24),
|
||||
painter = painterResource(id = R.drawable.ic_round_person_24),
|
||||
contentDescription = "Login icon",
|
||||
tint = if (screenState.loginError) {
|
||||
MaterialTheme.colorScheme.error
|
||||
@@ -261,7 +261,7 @@ fun LoginScreen(
|
||||
visible = screenState.loginError,
|
||||
label = "Login error visibility"
|
||||
) {
|
||||
TextFieldErrorText(text = stringResource(id = UiR.string.error_empty_field))
|
||||
TextFieldErrorText(text = stringResource(id = R.string.error_empty_field))
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
@@ -280,11 +280,11 @@ fun LoginScreen(
|
||||
.semantics { contentType = ContentType.Password },
|
||||
value = screenState.password,
|
||||
onValueChange = onPasswordInputChanged,
|
||||
label = { Text(text = stringResource(id = UiR.string.password_login_hint)) },
|
||||
placeholder = { Text(text = stringResource(id = UiR.string.password_login_hint)) },
|
||||
label = { Text(text = stringResource(id = R.string.password_login_hint)) },
|
||||
placeholder = { Text(text = stringResource(id = R.string.password_login_hint)) },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.round_vpn_key_24),
|
||||
painter = painterResource(id = R.drawable.round_vpn_key_24),
|
||||
contentDescription = "Password icon",
|
||||
tint = if (screenState.passwordError) {
|
||||
MaterialTheme.colorScheme.error
|
||||
@@ -295,8 +295,8 @@ fun LoginScreen(
|
||||
},
|
||||
trailingIcon = {
|
||||
val imagePainter = painterResource(
|
||||
id = if (screenState.passwordVisible) UiR.drawable.round_visibility_off_24
|
||||
else UiR.drawable.round_visibility_24
|
||||
id = if (screenState.passwordVisible) R.drawable.round_visibility_off_24
|
||||
else R.drawable.round_visibility_24
|
||||
)
|
||||
|
||||
IconButton(onClick = onPasswordVisibilityButtonClicked) {
|
||||
@@ -329,7 +329,7 @@ fun LoginScreen(
|
||||
visible = screenState.passwordError,
|
||||
label = "Password error visibility"
|
||||
) {
|
||||
TextFieldErrorText(text = stringResource(id = UiR.string.error_empty_field))
|
||||
TextFieldErrorText(text = stringResource(id = R.string.error_empty_field))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ fun LoginScreen(
|
||||
label = "Sign in icon visibility"
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.ic_arrow_end),
|
||||
painter = painterResource(id = R.drawable.ic_arrow_end),
|
||||
contentDescription = "Sign in icon",
|
||||
tint = MaterialTheme.colorScheme.onSecondaryContainer
|
||||
)
|
||||
@@ -397,7 +397,7 @@ fun LoginScreen(
|
||||
)
|
||||
}
|
||||
) {
|
||||
Text(stringResource(UiR.string.login_sign_up))
|
||||
Text(stringResource(R.string.login_sign_up))
|
||||
}
|
||||
|
||||
Text(
|
||||
@@ -412,7 +412,7 @@ fun LoginScreen(
|
||||
)
|
||||
}
|
||||
) {
|
||||
Text(stringResource(UiR.string.login_forgot_password))
|
||||
Text(stringResource(R.string.login_forgot_password))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -433,11 +433,11 @@ fun HandleDialogs(
|
||||
is LoginDialog.Error -> {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(loginDialog) },
|
||||
title = stringResource(UiR.string.title_error),
|
||||
title = stringResource(R.string.title_error),
|
||||
text = loginDialog.errorTextResId?.let { stringResource(it) }
|
||||
?: loginDialog.errorText
|
||||
?: stringResource(UiR.string.unknown_error_occurred),
|
||||
confirmText = stringResource(id = UiR.string.ok)
|
||||
?: stringResource(R.string.unknown_error_occurred),
|
||||
confirmText = stringResource(id = R.string.ok)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -24,7 +24,7 @@ import androidx.compose.ui.text.withStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import dev.meloda.fast.auth.userbanned.model.UserBannedScreenState
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
@@ -74,7 +74,7 @@ fun UserBannedScreen(
|
||||
}
|
||||
},
|
||||
title = {
|
||||
Text(text = stringResource(id = UiR.string.warning))
|
||||
Text(text = stringResource(id = R.string.warning))
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -86,7 +86,7 @@ fun UserBannedScreen(
|
||||
.padding(vertical = 8.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = UiR.string.account_temporarily_blocked),
|
||||
text = stringResource(id = R.string.account_temporarily_blocked),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
|
||||
)
|
||||
@@ -94,7 +94,7 @@ fun UserBannedScreen(
|
||||
Text(
|
||||
text = buildAnnotatedString {
|
||||
withStyle(SpanStyle(fontWeight = FontWeight.Medium)) {
|
||||
append(stringResource(id = UiR.string.user_name))
|
||||
append(stringResource(id = R.string.user_name))
|
||||
append(": ")
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ fun UserBannedScreen(
|
||||
Text(
|
||||
text = buildAnnotatedString {
|
||||
withStyle(SpanStyle(fontWeight = FontWeight.Medium)) {
|
||||
append(stringResource(id = UiR.string.blocking_reason_title))
|
||||
append(stringResource(id = R.string.blocking_reason_title))
|
||||
append(": ")
|
||||
}
|
||||
append(screenState.message)
|
||||
|
||||
+7
-7
@@ -60,7 +60,7 @@ import dev.meloda.fast.ui.components.ActionInvokeDismiss
|
||||
import dev.meloda.fast.ui.components.MaterialDialog
|
||||
import dev.meloda.fast.ui.components.TextFieldErrorText
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun ValidationRoute(
|
||||
@@ -142,11 +142,11 @@ fun ValidationScreen(
|
||||
if (showExitAlert) {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { showExitAlert = false },
|
||||
title = stringResource(id = UiR.string.warning_confirmation),
|
||||
text = stringResource(id = UiR.string.validation_exit_warning),
|
||||
title = stringResource(id = R.string.warning_confirmation),
|
||||
text = stringResource(id = R.string.validation_exit_warning),
|
||||
confirmAction = { confirmedExit = true },
|
||||
confirmText = stringResource(id = UiR.string.yes),
|
||||
cancelText = stringResource(id = UiR.string.no),
|
||||
confirmText = stringResource(id = R.string.yes),
|
||||
cancelText = stringResource(id = R.string.no),
|
||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||
)
|
||||
}
|
||||
@@ -223,7 +223,7 @@ fun ValidationScreen(
|
||||
.semantics { contentType = ContentType.SmsOtpCode },
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.round_qr_code_24),
|
||||
painter = painterResource(id = R.drawable.round_qr_code_24),
|
||||
contentDescription = "QR Code icon",
|
||||
tint = if (screenState.codeError) {
|
||||
MaterialTheme.colorScheme.error
|
||||
@@ -271,7 +271,7 @@ fun ValidationScreen(
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.round_sms_24),
|
||||
painter = painterResource(id = R.drawable.round_sms_24),
|
||||
tint = MaterialTheme.colorScheme.onPrimary,
|
||||
contentDescription = "SMS icon"
|
||||
)
|
||||
|
||||
+7
-7
@@ -58,7 +58,7 @@ import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import org.koin.core.qualifier.named
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun ChatMaterialsRoute(
|
||||
@@ -88,11 +88,11 @@ fun ChatMaterialsScreen(
|
||||
|
||||
val titles = remember {
|
||||
listOf(
|
||||
UiR.string.chat_attachment_photos,
|
||||
UiR.string.chat_attachment_videos,
|
||||
UiR.string.chat_attachment_music,
|
||||
UiR.string.chat_attachment_files,
|
||||
UiR.string.chat_attachment_links,
|
||||
R.string.chat_attachment_photos,
|
||||
R.string.chat_attachment_videos,
|
||||
R.string.chat_attachment_music,
|
||||
R.string.chat_attachment_files,
|
||||
R.string.chat_attachment_links,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ fun ChatMaterialsScreen(
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(UiR.string.chat_materials_title),
|
||||
text = stringResource(R.string.chat_materials_title),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
|
||||
+1
-2
@@ -60,7 +60,6 @@ import dev.meloda.fast.ui.theme.LocalHazeState
|
||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@@ -158,7 +157,7 @@ fun AudioMaterialsScreen(
|
||||
.background(MaterialTheme.colorScheme.primary)
|
||||
.size(42.dp)
|
||||
.padding(4.dp),
|
||||
painter = painterResource(UiR.drawable.round_play_arrow_24),
|
||||
painter = painterResource(R.drawable.round_play_arrow_24),
|
||||
contentDescription = null,
|
||||
tint = contentColorFor(MaterialTheme.colorScheme.primary)
|
||||
)
|
||||
|
||||
+16
-16
@@ -8,7 +8,7 @@ import dev.meloda.fast.conversations.model.ConversationDialog
|
||||
import dev.meloda.fast.conversations.model.ConversationsScreenState
|
||||
import dev.meloda.fast.ui.components.MaterialDialog
|
||||
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun HandleDialogs(
|
||||
@@ -24,50 +24,50 @@ fun HandleDialogs(
|
||||
is ConversationDialog.ConversationArchive -> {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
title = stringResource(id = UiR.string.confirm_archive_conversation),
|
||||
title = stringResource(id = R.string.confirm_archive_conversation),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = UiR.string.action_archive),
|
||||
cancelText = stringResource(id = UiR.string.cancel)
|
||||
confirmText = stringResource(id = R.string.action_archive),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
)
|
||||
}
|
||||
|
||||
is ConversationDialog.ConversationUnarchive -> {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
title = stringResource(id = UiR.string.confirm_unarchive_conversation),
|
||||
title = stringResource(id = R.string.confirm_unarchive_conversation),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = UiR.string.action_unarchive),
|
||||
cancelText = stringResource(id = UiR.string.cancel)
|
||||
confirmText = stringResource(id = R.string.action_unarchive),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
)
|
||||
}
|
||||
|
||||
is ConversationDialog.ConversationDelete -> {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
title = stringResource(id = UiR.string.confirm_delete_conversation),
|
||||
title = stringResource(id = R.string.confirm_delete_conversation),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = UiR.string.action_delete),
|
||||
cancelText = stringResource(id = UiR.string.cancel)
|
||||
confirmText = stringResource(id = R.string.action_delete),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
)
|
||||
}
|
||||
|
||||
is ConversationDialog.ConversationPin -> {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
title = stringResource(id = UiR.string.confirm_pin_conversation),
|
||||
title = stringResource(id = R.string.confirm_pin_conversation),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = UiR.string.action_pin),
|
||||
cancelText = stringResource(id = UiR.string.cancel)
|
||||
confirmText = stringResource(id = R.string.action_pin),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
)
|
||||
}
|
||||
|
||||
is ConversationDialog.ConversationUnpin -> {
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
title = stringResource(id = UiR.string.confirm_unpin_conversation),
|
||||
title = stringResource(id = R.string.confirm_unpin_conversation),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = UiR.string.action_unpin),
|
||||
cancelText = stringResource(id = UiR.string.cancel)
|
||||
confirmText = stringResource(id = R.string.action_unpin),
|
||||
cancelText = stringResource(id = R.string.cancel)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -53,7 +53,7 @@ import dev.meloda.fast.ui.model.api.UiConversation
|
||||
import dev.meloda.fast.ui.util.getImage
|
||||
import dev.meloda.fast.ui.util.getResourcePainter
|
||||
import dev.meloda.fast.ui.util.getString
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
val BirthdayColor = Color(0xffb00b69)
|
||||
|
||||
@@ -127,7 +127,7 @@ fun ConversationItem(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.size(32.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
|
||||
)
|
||||
@@ -150,7 +150,7 @@ fun ConversationItem(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.clip(CircleShape),
|
||||
placeholder = painterResource(id = UiR.drawable.ic_account_circle_cut)
|
||||
placeholder = painterResource(id = R.drawable.ic_account_circle_cut)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ fun ConversationItem(
|
||||
modifier = Modifier
|
||||
.height(14.dp)
|
||||
.align(Alignment.Center),
|
||||
painter = painterResource(id = UiR.drawable.ic_round_push_pin_24),
|
||||
painter = painterResource(id = R.drawable.ic_round_push_pin_24),
|
||||
contentDescription = "Pin icon",
|
||||
tint = Color.White
|
||||
)
|
||||
@@ -222,7 +222,7 @@ fun ConversationItem(
|
||||
modifier = Modifier
|
||||
.align(Alignment.Center)
|
||||
.size(10.dp),
|
||||
painter = painterResource(id = UiR.drawable.round_cake_24),
|
||||
painter = painterResource(id = R.drawable.round_cake_24),
|
||||
contentDescription = "Birthday icon",
|
||||
tint = Color.White
|
||||
)
|
||||
|
||||
+8
-8
@@ -78,7 +78,7 @@ import dev.meloda.fast.ui.util.emptyImmutableList
|
||||
import dev.meloda.fast.ui.util.isScrollingUp
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@OptIn(
|
||||
ExperimentalMaterial3Api::class,
|
||||
@@ -185,9 +185,9 @@ fun ConversationsScreen(
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = when {
|
||||
screenState.isLoading -> UiR.string.title_loading
|
||||
screenState.isArchive -> UiR.string.title_archive
|
||||
else -> UiR.string.title_conversations
|
||||
screenState.isLoading -> R.string.title_loading
|
||||
screenState.isArchive -> R.string.title_archive
|
||||
else -> R.string.title_conversations
|
||||
}
|
||||
),
|
||||
maxLines = 1,
|
||||
@@ -209,7 +209,7 @@ fun ConversationsScreen(
|
||||
if (!screenState.isArchive) {
|
||||
IconButton(onClick = onArchiveActionClicked) {
|
||||
Icon(
|
||||
painter = painterResource(UiR.drawable.outline_archive_24),
|
||||
painter = painterResource(R.drawable.outline_archive_24),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
@@ -234,7 +234,7 @@ fun ConversationsScreen(
|
||||
dropDownMenuExpanded = false
|
||||
},
|
||||
text = {
|
||||
Text(text = stringResource(id = UiR.string.action_refresh))
|
||||
Text(text = stringResource(id = R.string.action_refresh))
|
||||
},
|
||||
leadingIcon = {
|
||||
Icon(
|
||||
@@ -287,7 +287,7 @@ fun ConversationsScreen(
|
||||
}
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.round_create_24),
|
||||
painter = painterResource(id = R.drawable.round_create_24),
|
||||
contentDescription = "Add chat button"
|
||||
)
|
||||
}
|
||||
@@ -347,7 +347,7 @@ fun ConversationsScreen(
|
||||
|
||||
if (conversations.isEmpty()) {
|
||||
NoItemsView(
|
||||
buttonText = stringResource(UiR.string.action_refresh),
|
||||
buttonText = stringResource(R.string.action_refresh),
|
||||
onButtonClick = onRefresh
|
||||
)
|
||||
}
|
||||
|
||||
+90
-83
@@ -23,6 +23,7 @@ import dev.meloda.fast.model.api.domain.VkAttachment
|
||||
import dev.meloda.fast.model.api.domain.VkConversation
|
||||
import dev.meloda.fast.model.api.domain.VkMessage
|
||||
import dev.meloda.fast.model.api.domain.VkVideoDomain
|
||||
import dev.meloda.fast.ui.R
|
||||
import dev.meloda.fast.ui.model.api.ActionState
|
||||
import dev.meloda.fast.ui.model.api.ConversationOption
|
||||
import dev.meloda.fast.ui.model.api.UiConversation
|
||||
@@ -32,7 +33,6 @@ import java.util.Calendar
|
||||
import java.util.Locale
|
||||
import kotlin.math.ln
|
||||
import kotlin.math.pow
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
|
||||
fun VkConversation.asPresentation(
|
||||
resources: Resources,
|
||||
@@ -45,7 +45,14 @@ fun VkConversation.asPresentation(
|
||||
avatar = extractAvatar(),
|
||||
title = extractTitle(this, useContactName, resources),
|
||||
unreadCount = extractUnreadCount(lastMessage, this),
|
||||
date = TimeUtils.getLocalizedTime(resources, (lastMessage?.date ?: -1) * 1000L),
|
||||
date = TimeUtils.getLocalizedTime(
|
||||
date = (lastMessage?.date ?: -1) * 1000L,
|
||||
yearShort = { resources.getString(R.string.year_short) },
|
||||
monthShort = { resources.getString(R.string.month_short) },
|
||||
weekShort = { resources.getString(R.string.week_short) },
|
||||
dayShort = { resources.getString(R.string.day_short) },
|
||||
now = { resources.getString(R.string.time_now) },
|
||||
),
|
||||
message = extractMessage(resources, lastMessage, id, peerType),
|
||||
attachmentImage = if (lastMessage?.text == null) null
|
||||
else getAttachmentConversationIcon(lastMessage),
|
||||
@@ -76,7 +83,7 @@ fun VkConversation.extractAvatar() = when (peerType) {
|
||||
PeerType.CHAT -> {
|
||||
photo200
|
||||
}
|
||||
}?.let(UiImage::Url) ?: UiImage.Resource(UiR.drawable.ic_account_circle_cut)
|
||||
}?.let(UiImage::Url) ?: UiImage.Resource(R.drawable.ic_account_circle_cut)
|
||||
|
||||
private fun extractTitle(
|
||||
conversation: VkConversation,
|
||||
@@ -85,7 +92,7 @@ private fun extractTitle(
|
||||
) = when (conversation.peerType) {
|
||||
PeerType.USER -> {
|
||||
if (isAccount(conversation.id)) {
|
||||
UiText.Resource(UiR.string.favorites)
|
||||
UiText.Resource(R.string.favorites)
|
||||
} else {
|
||||
val userName = conversation.user?.let { user ->
|
||||
if (useContactName) {
|
||||
@@ -130,7 +137,7 @@ private fun extractMessage(
|
||||
peerId: Long,
|
||||
peerType: PeerType
|
||||
): AnnotatedString {
|
||||
val youPrefix = UiText.Resource(UiR.string.you_message_prefix)
|
||||
val youPrefix = UiText.Resource(R.string.you_message_prefix)
|
||||
.parseString(resources)
|
||||
.orDots()
|
||||
|
||||
@@ -265,7 +272,7 @@ private fun extractActionText(
|
||||
|
||||
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()
|
||||
|
||||
@@ -288,7 +295,7 @@ private fun 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()
|
||||
|
||||
@@ -311,7 +318,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -324,7 +331,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -338,7 +345,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -353,7 +360,7 @@ private fun 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()
|
||||
|
||||
@@ -378,7 +385,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -393,7 +400,7 @@ private fun 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()
|
||||
|
||||
@@ -411,7 +418,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -424,7 +431,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -437,7 +444,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -450,7 +457,7 @@ private fun extractActionText(
|
||||
|
||||
VkMessage.Action.CHAT_PIN_MESSAGE -> {
|
||||
UiText.ResourceParams(
|
||||
UiR.string.message_action_chat_pin_message,
|
||||
R.string.message_action_chat_pin_message,
|
||||
listOf(prefix)
|
||||
).parseString(resources).orEmpty().let(::append)
|
||||
|
||||
@@ -463,7 +470,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -476,7 +483,7 @@ private fun extractActionText(
|
||||
|
||||
VkMessage.Action.CHAT_SCREENSHOT -> {
|
||||
UiText.ResourceParams(
|
||||
UiR.string.message_action_chat_screenshot,
|
||||
R.string.message_action_chat_screenshot,
|
||||
listOf(prefix)
|
||||
).parseString(resources).orEmpty().let(::append)
|
||||
|
||||
@@ -489,7 +496,7 @@ private fun 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().let(::append)
|
||||
|
||||
@@ -510,9 +517,9 @@ private fun extractAttachmentIcon(
|
||||
lastMessage.text == null -> null
|
||||
!lastMessage.forwards.isNullOrEmpty() -> {
|
||||
if (lastMessage.forwards.orEmpty().size == 1) {
|
||||
UiImage.Resource(UiR.drawable.ic_attachment_forwarded_message)
|
||||
UiImage.Resource(R.drawable.ic_attachment_forwarded_message)
|
||||
} else {
|
||||
UiImage.Resource(UiR.drawable.ic_attachment_forwarded_messages)
|
||||
UiImage.Resource(R.drawable.ic_attachment_forwarded_messages)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,12 +528,12 @@ private fun extractAttachmentIcon(
|
||||
if (attachments.isEmpty()) return null
|
||||
if (attachments.size == 1 || isAttachmentsHaveOneType(attachments)) {
|
||||
lastMessage.geoType?.let {
|
||||
return UiImage.Resource(UiR.drawable.ic_map_marker)
|
||||
return UiImage.Resource(R.drawable.ic_map_marker)
|
||||
}
|
||||
|
||||
getAttachmentIconByType(attachments.first().type)
|
||||
} else {
|
||||
UiImage.Resource(UiR.drawable.ic_baseline_attach_file_24)
|
||||
UiImage.Resource(R.drawable.ic_baseline_attach_file_24)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -542,13 +549,13 @@ private fun extractAttachmentText(
|
||||
withStyle(style = SpanStyle(fontWeight = FontWeight.SemiBold)) {
|
||||
when (lastMessage.geoType) {
|
||||
"point" -> {
|
||||
UiText.Resource(UiR.string.message_geo_point)
|
||||
UiText.Resource(R.string.message_geo_point)
|
||||
.parseString(resources)
|
||||
.let(::append)
|
||||
}
|
||||
|
||||
else -> {
|
||||
UiText.Resource(UiR.string.message_geo)
|
||||
UiText.Resource(R.string.message_geo)
|
||||
.parseString(resources)
|
||||
.let(::append)
|
||||
}
|
||||
@@ -583,7 +590,7 @@ private fun extractAttachmentText(
|
||||
}
|
||||
|
||||
else -> {
|
||||
UiText.Resource(UiR.string.message_attachments_many)
|
||||
UiText.Resource(R.string.message_attachments_many)
|
||||
.parseString(resources)
|
||||
.let(::append)
|
||||
}
|
||||
@@ -598,22 +605,22 @@ private fun extractAttachmentText(
|
||||
|
||||
private fun getAttachmentIconByType(attachmentType: AttachmentType): UiImage? {
|
||||
return when (attachmentType) {
|
||||
AttachmentType.PHOTO -> UiR.drawable.ic_attachment_photo
|
||||
AttachmentType.VIDEO -> UiR.drawable.ic_attachment_video
|
||||
AttachmentType.AUDIO -> UiR.drawable.ic_attachment_audio
|
||||
AttachmentType.FILE -> UiR.drawable.ic_attachment_file
|
||||
AttachmentType.LINK -> UiR.drawable.ic_attachment_link
|
||||
AttachmentType.AUDIO_MESSAGE -> UiR.drawable.ic_attachment_voice
|
||||
AttachmentType.MINI_APP -> UiR.drawable.ic_attachment_mini_app
|
||||
AttachmentType.STICKER -> UiR.drawable.ic_attachment_sticker
|
||||
AttachmentType.GIFT -> UiR.drawable.ic_attachment_gift
|
||||
AttachmentType.WALL -> UiR.drawable.ic_attachment_wall
|
||||
AttachmentType.GRAFFITI -> UiR.drawable.ic_attachment_graffiti
|
||||
AttachmentType.POLL -> UiR.drawable.ic_attachment_poll
|
||||
AttachmentType.WALL_REPLY -> UiR.drawable.ic_attachment_wall_reply
|
||||
AttachmentType.CALL -> UiR.drawable.ic_attachment_call
|
||||
AttachmentType.GROUP_CALL_IN_PROGRESS -> UiR.drawable.ic_attachment_group_call
|
||||
AttachmentType.STORY -> UiR.drawable.ic_attachment_story
|
||||
AttachmentType.PHOTO -> R.drawable.ic_attachment_photo
|
||||
AttachmentType.VIDEO -> R.drawable.ic_attachment_video
|
||||
AttachmentType.AUDIO -> R.drawable.ic_attachment_audio
|
||||
AttachmentType.FILE -> R.drawable.ic_attachment_file
|
||||
AttachmentType.LINK -> R.drawable.ic_attachment_link
|
||||
AttachmentType.AUDIO_MESSAGE -> R.drawable.ic_attachment_voice
|
||||
AttachmentType.MINI_APP -> R.drawable.ic_attachment_mini_app
|
||||
AttachmentType.STICKER -> R.drawable.ic_attachment_sticker
|
||||
AttachmentType.GIFT -> R.drawable.ic_attachment_gift
|
||||
AttachmentType.WALL -> R.drawable.ic_attachment_wall
|
||||
AttachmentType.GRAFFITI -> R.drawable.ic_attachment_graffiti
|
||||
AttachmentType.POLL -> R.drawable.ic_attachment_poll
|
||||
AttachmentType.WALL_REPLY -> R.drawable.ic_attachment_wall_reply
|
||||
AttachmentType.CALL -> R.drawable.ic_attachment_call
|
||||
AttachmentType.GROUP_CALL_IN_PROGRESS -> R.drawable.ic_attachment_group_call
|
||||
AttachmentType.STORY -> R.drawable.ic_attachment_story
|
||||
AttachmentType.UNKNOWN -> null
|
||||
AttachmentType.CURATOR -> null
|
||||
AttachmentType.EVENT -> null
|
||||
@@ -624,7 +631,7 @@ private fun getAttachmentIconByType(attachmentType: AttachmentType): UiImage? {
|
||||
AttachmentType.NARRATIVE -> null
|
||||
AttachmentType.ARTICLE -> null
|
||||
AttachmentType.VIDEO_MESSAGE -> null
|
||||
AttachmentType.GROUP_CHAT_STICKER -> UiR.drawable.ic_attachment_sticker
|
||||
AttachmentType.GROUP_CHAT_STICKER -> R.drawable.ic_attachment_sticker
|
||||
AttachmentType.STICKER_PACK_PREVIEW -> null
|
||||
}?.let(UiImage::Resource)
|
||||
}
|
||||
@@ -653,8 +660,8 @@ private fun extractForwardsText(
|
||||
withStyle(style = SpanStyle(fontWeight = FontWeight.SemiBold)) {
|
||||
append(
|
||||
UiText.Resource(
|
||||
if (forwards.size == 1) UiR.string.forwarded_message
|
||||
else UiR.string.forwarded_messages
|
||||
if (forwards.size == 1) R.string.forwarded_message
|
||||
else R.string.forwarded_messages
|
||||
).parseString(resources)
|
||||
)
|
||||
}
|
||||
@@ -732,15 +739,15 @@ private fun getAttachmentUiText(
|
||||
if (attachment.type == AttachmentType.VIDEO &&
|
||||
(attachment as? VkVideoDomain)?.isShortVideo == true
|
||||
) {
|
||||
return UiText.Resource(UiR.string.message_attachments_clip)
|
||||
return UiText.Resource(R.string.message_attachments_clip)
|
||||
}
|
||||
|
||||
if (attachment.type.isMultiple()) {
|
||||
return when (attachment.type) {
|
||||
AttachmentType.PHOTO -> UiR.plurals.attachment_photos
|
||||
AttachmentType.VIDEO -> UiR.plurals.attachment_videos
|
||||
AttachmentType.AUDIO -> UiR.plurals.attachment_audios
|
||||
AttachmentType.FILE -> UiR.plurals.attachment_files
|
||||
AttachmentType.PHOTO -> R.plurals.attachment_photos
|
||||
AttachmentType.VIDEO -> R.plurals.attachment_videos
|
||||
AttachmentType.AUDIO -> R.plurals.attachment_audios
|
||||
AttachmentType.FILE -> R.plurals.attachment_files
|
||||
else -> throw IllegalArgumentException("Unknown multiple type: ${attachment.type}")
|
||||
}.let { resId -> UiText.QuantityResource(resId, size) }
|
||||
}
|
||||
@@ -754,29 +761,29 @@ private fun getAttachmentUiText(
|
||||
throw IllegalArgumentException("Unknown multiple type: ${attachment.type}")
|
||||
}
|
||||
|
||||
AttachmentType.LINK -> UiR.string.message_attachments_link
|
||||
AttachmentType.AUDIO_MESSAGE -> UiR.string.message_attachments_audio_message
|
||||
AttachmentType.MINI_APP -> UiR.string.message_attachments_mini_app
|
||||
AttachmentType.STICKER -> UiR.string.message_attachments_sticker
|
||||
AttachmentType.GIFT -> UiR.string.message_attachments_gift
|
||||
AttachmentType.WALL -> UiR.string.message_attachments_wall
|
||||
AttachmentType.GRAFFITI -> UiR.string.message_attachments_graffiti
|
||||
AttachmentType.POLL -> UiR.string.message_attachments_poll
|
||||
AttachmentType.WALL_REPLY -> UiR.string.message_attachments_wall_reply
|
||||
AttachmentType.CALL -> UiR.string.message_attachments_call
|
||||
AttachmentType.GROUP_CALL_IN_PROGRESS -> UiR.string.message_attachments_call_in_progress
|
||||
AttachmentType.CURATOR -> UiR.string.message_attachments_curator
|
||||
AttachmentType.EVENT -> UiR.string.message_attachments_event
|
||||
AttachmentType.STORY -> UiR.string.message_attachments_story
|
||||
AttachmentType.WIDGET -> UiR.string.message_attachments_widget
|
||||
AttachmentType.ARTIST -> UiR.string.message_attachments_artist
|
||||
AttachmentType.AUDIO_PLAYLIST -> UiR.string.message_attachments_audio_playlist
|
||||
AttachmentType.PODCAST -> UiR.string.message_attachments_podcast
|
||||
AttachmentType.NARRATIVE -> UiR.string.message_attachments_narrative
|
||||
AttachmentType.ARTICLE -> UiR.string.message_attachments_article
|
||||
AttachmentType.VIDEO_MESSAGE -> UiR.string.message_attachments_video_message
|
||||
AttachmentType.GROUP_CHAT_STICKER -> UiR.string.message_attachments_group_sticker
|
||||
AttachmentType.STICKER_PACK_PREVIEW -> UiR.string.message_attachments_sticker_pack_preview
|
||||
AttachmentType.LINK -> R.string.message_attachments_link
|
||||
AttachmentType.AUDIO_MESSAGE -> R.string.message_attachments_audio_message
|
||||
AttachmentType.MINI_APP -> R.string.message_attachments_mini_app
|
||||
AttachmentType.STICKER -> R.string.message_attachments_sticker
|
||||
AttachmentType.GIFT -> R.string.message_attachments_gift
|
||||
AttachmentType.WALL -> R.string.message_attachments_wall
|
||||
AttachmentType.GRAFFITI -> R.string.message_attachments_graffiti
|
||||
AttachmentType.POLL -> R.string.message_attachments_poll
|
||||
AttachmentType.WALL_REPLY -> R.string.message_attachments_wall_reply
|
||||
AttachmentType.CALL -> R.string.message_attachments_call
|
||||
AttachmentType.GROUP_CALL_IN_PROGRESS -> R.string.message_attachments_call_in_progress
|
||||
AttachmentType.CURATOR -> R.string.message_attachments_curator
|
||||
AttachmentType.EVENT -> R.string.message_attachments_event
|
||||
AttachmentType.STORY -> R.string.message_attachments_story
|
||||
AttachmentType.WIDGET -> R.string.message_attachments_widget
|
||||
AttachmentType.ARTIST -> R.string.message_attachments_artist
|
||||
AttachmentType.AUDIO_PLAYLIST -> R.string.message_attachments_audio_playlist
|
||||
AttachmentType.PODCAST -> R.string.message_attachments_podcast
|
||||
AttachmentType.NARRATIVE -> R.string.message_attachments_narrative
|
||||
AttachmentType.ARTICLE -> R.string.message_attachments_article
|
||||
AttachmentType.VIDEO_MESSAGE -> R.string.message_attachments_video_message
|
||||
AttachmentType.GROUP_CHAT_STICKER -> R.string.message_attachments_group_sticker
|
||||
AttachmentType.STICKER_PACK_PREVIEW -> R.string.message_attachments_sticker_pack_preview
|
||||
}.let(UiText::Resource)
|
||||
}
|
||||
|
||||
@@ -785,11 +792,11 @@ private fun getAttachmentConversationIcon(message: VkMessage?): UiImage? {
|
||||
if (attachments.isEmpty()) return null
|
||||
if (attachments.size == 1 || isAttachmentsHaveOneType(attachments)) {
|
||||
message.geoType?.let {
|
||||
return UiImage.Resource(UiR.drawable.ic_map_marker)
|
||||
return UiImage.Resource(R.drawable.ic_map_marker)
|
||||
}
|
||||
getAttachmentIconByType(attachments.first().type)
|
||||
} else {
|
||||
UiImage.Resource(UiR.drawable.ic_baseline_attach_file_24)
|
||||
UiImage.Resource(R.drawable.ic_baseline_attach_file_24)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -835,17 +842,17 @@ private fun extractInteractionText(
|
||||
} else {
|
||||
if (!conversation.peerType.isChat() && interactiveUsers.size == 1) {
|
||||
when (interactionType) {
|
||||
InteractionType.File -> UiR.string.chat_interaction_uploading_file
|
||||
InteractionType.Photo -> UiR.string.chat_interaction_uploading_photo
|
||||
InteractionType.Typing -> UiR.string.chat_interaction_typing
|
||||
InteractionType.Video -> UiR.string.chat_interaction_uploading_video
|
||||
InteractionType.VoiceMessage -> UiR.string.chat_interaction_recording_audio_message
|
||||
InteractionType.File -> R.string.chat_interaction_uploading_file
|
||||
InteractionType.Photo -> R.string.chat_interaction_uploading_photo
|
||||
InteractionType.Typing -> R.string.chat_interaction_typing
|
||||
InteractionType.Video -> R.string.chat_interaction_uploading_video
|
||||
InteractionType.VoiceMessage -> R.string.chat_interaction_recording_audio_message
|
||||
}.let(UiText::Resource)
|
||||
} else {
|
||||
if (interactiveUsers.size == 1) {
|
||||
UiR.string.chat_interaction_chat_single_typing
|
||||
R.string.chat_interaction_chat_single_typing
|
||||
} else {
|
||||
UiR.string.chat_interaction_chat_typing
|
||||
R.string.chat_interaction_chat_typing
|
||||
}.let { resId ->
|
||||
UiText.ResourceParams(
|
||||
resId,
|
||||
|
||||
+7
-7
@@ -70,7 +70,7 @@ import dev.meloda.fast.ui.components.VkErrorView
|
||||
import dev.meloda.fast.ui.theme.LocalHazeState
|
||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import dev.meloda.fast.ui.util.isScrollingUp
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun CreateChatRoute(
|
||||
@@ -195,8 +195,8 @@ fun CreateChatScreen(
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(
|
||||
id = if (screenState.isLoading) UiR.string.title_loading
|
||||
else UiR.string.title_create_chat
|
||||
id = if (screenState.isLoading) R.string.title_loading
|
||||
else R.string.title_create_chat
|
||||
),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
@@ -231,8 +231,8 @@ fun CreateChatScreen(
|
||||
.onFocusChanged { isTextFieldFocused = it.hasFocus },
|
||||
value = screenState.chatTitle,
|
||||
onValueChange = onTitleTextInputChanged,
|
||||
label = { Text(text = stringResource(UiR.string.create_chat_title)) },
|
||||
placeholder = { Text(text = stringResource(UiR.string.create_chat_title)) },
|
||||
label = { Text(text = stringResource(R.string.create_chat_title)) },
|
||||
placeholder = { Text(text = stringResource(R.string.create_chat_title)) },
|
||||
singleLine = true,
|
||||
colors = TextFieldDefaults.colors(
|
||||
unfocusedIndicatorColor = Color.Transparent,
|
||||
@@ -252,7 +252,7 @@ fun CreateChatScreen(
|
||||
ExtendedFloatingActionButton(
|
||||
onClick = onCreateChatButtonClicked,
|
||||
expanded = listState.isScrollingUp(),
|
||||
text = { Text(text = stringResource(UiR.string.action_create)) },
|
||||
text = { Text(text = stringResource(R.string.action_create)) },
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = Icons.Rounded.Done,
|
||||
@@ -309,7 +309,7 @@ fun CreateChatScreen(
|
||||
|
||||
if (screenState.friends.isEmpty()) {
|
||||
NoItemsView(
|
||||
buttonText = stringResource(UiR.string.action_refresh),
|
||||
buttonText = stringResource(R.string.action_refresh),
|
||||
onButtonClick = onRefresh
|
||||
)
|
||||
}
|
||||
|
||||
+7
-8
@@ -54,7 +54,6 @@ import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import dev.meloda.fast.ui.util.ImmutableList
|
||||
import kotlinx.coroutines.launch
|
||||
import org.koin.androidx.viewmodel.ext.android.getViewModel
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalHazeMaterialsApi::class)
|
||||
@Composable
|
||||
@@ -120,11 +119,11 @@ fun FriendsRoute(
|
||||
|
||||
var showOrderDialog by remember { mutableStateOf(false) }
|
||||
|
||||
val orderPriority = stringResource(UiR.string.friends_order_priority)
|
||||
val orderName = stringResource(UiR.string.friends_order_name)
|
||||
val orderRandom = stringResource(UiR.string.friends_order_random)
|
||||
val orderMobile = stringResource(UiR.string.friends_order_mobile)
|
||||
val orderSmart = stringResource(UiR.string.friends_order_smart)
|
||||
val orderPriority = stringResource(R.string.friends_order_priority)
|
||||
val orderName = stringResource(R.string.friends_order_name)
|
||||
val orderRandom = stringResource(R.string.friends_order_random)
|
||||
val orderMobile = stringResource(R.string.friends_order_mobile)
|
||||
val orderSmart = stringResource(R.string.friends_order_smart)
|
||||
|
||||
val orderTitleItems = remember {
|
||||
ImmutableList.of(
|
||||
@@ -158,7 +157,7 @@ fun FriendsRoute(
|
||||
onItemClick = {
|
||||
selectedIndex = it
|
||||
},
|
||||
title = stringResource(UiR.string.friends_order_by_title),
|
||||
title = stringResource(R.string.friends_order_by_title),
|
||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||
)
|
||||
}
|
||||
@@ -202,7 +201,7 @@ fun FriendsRoute(
|
||||
}
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(UiR.drawable.round_filter_list_24),
|
||||
painter = painterResource(R.drawable.round_filter_list_24),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
|
||||
+9
-9
@@ -12,7 +12,7 @@ import dev.meloda.fast.languagepicker.model.SelectableLanguage
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
interface LanguagePickerViewModel {
|
||||
val screenState: StateFlow<LanguagePickerScreenState>
|
||||
@@ -32,23 +32,23 @@ class LanguagePickerViewModelImpl(
|
||||
val languages = listOf(
|
||||
Triple(
|
||||
"",
|
||||
UiText.Resource(UiR.string.language_key_system),
|
||||
UiText.Resource(UiR.string.language_system)
|
||||
UiText.Resource(R.string.language_key_system),
|
||||
UiText.Resource(R.string.language_system)
|
||||
),
|
||||
Triple(
|
||||
"en-US",
|
||||
UiText.Resource(UiR.string.language_key_english),
|
||||
UiText.Resource(UiR.string.language_english),
|
||||
UiText.Resource(R.string.language_key_english),
|
||||
UiText.Resource(R.string.language_english),
|
||||
),
|
||||
Triple(
|
||||
"ru-RU",
|
||||
UiText.Resource(UiR.string.language_key_russian),
|
||||
UiText.Resource(UiR.string.language_russian)
|
||||
UiText.Resource(R.string.language_key_russian),
|
||||
UiText.Resource(R.string.language_russian)
|
||||
),
|
||||
Triple(
|
||||
"uk-UA",
|
||||
UiText.Resource(UiR.string.language_key_ukrainian),
|
||||
UiText.Resource(UiR.string.language_ukrainian)
|
||||
UiText.Resource(R.string.language_key_ukrainian),
|
||||
UiText.Resource(R.string.language_ukrainian)
|
||||
)
|
||||
).map { (key, language, local) ->
|
||||
Triple(
|
||||
|
||||
+4
-4
@@ -59,7 +59,7 @@ import dev.meloda.fast.languagepicker.LanguagePickerViewModelImpl
|
||||
import dev.meloda.fast.languagepicker.model.LanguagePickerScreenState
|
||||
import dev.meloda.fast.languagepicker.model.SelectableLanguage
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun LanguagePickerRoute(
|
||||
@@ -110,7 +110,7 @@ fun LanguagePickerScreen(
|
||||
LargeTopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(id = UiR.string.title_application_language),
|
||||
text = stringResource(id = R.string.title_application_language),
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
)
|
||||
},
|
||||
@@ -162,7 +162,7 @@ fun LanguagePickerScreen(
|
||||
)
|
||||
},
|
||||
text = {
|
||||
Text(text = stringResource(id = UiR.string.open_system_language_picker))
|
||||
Text(text = stringResource(id = R.string.open_system_language_picker))
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -216,7 +216,7 @@ fun LanguagePickerScreen(
|
||||
.align(Alignment.BottomCenter)
|
||||
.height(64.dp)
|
||||
) {
|
||||
Text(text = stringResource(id = UiR.string.action_apply))
|
||||
Text(text = stringResource(id = R.string.action_apply))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
+14
-14
@@ -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,
|
||||
|
||||
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
+8
-8
@@ -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(
|
||||
|
||||
+17
-18
@@ -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()
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ import java.io.FileOutputStream
|
||||
import java.net.URLDecoder
|
||||
import java.util.UUID
|
||||
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
interface PhotoViewViewModel {
|
||||
val screenState: StateFlow<PhotoViewScreenState>
|
||||
@@ -114,7 +114,7 @@ class PhotoViewViewModelImpl(
|
||||
viewModelScope.launch(Dispatchers.Main) {
|
||||
Toast.makeText(
|
||||
applicationContext,
|
||||
UiR.string.error_occurred,
|
||||
R.string.error_occurred,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
||||
+6
-6
@@ -61,6 +61,7 @@ import dev.meloda.fast.photoviewer.PhotoViewViewModel
|
||||
import dev.meloda.fast.photoviewer.PhotoViewViewModelImpl
|
||||
import dev.meloda.fast.photoviewer.model.PhotoViewArguments
|
||||
import dev.meloda.fast.photoviewer.model.PhotoViewScreenState
|
||||
import dev.meloda.fast.ui.R
|
||||
import dev.meloda.fast.ui.components.FullScreenDialog
|
||||
import dev.meloda.fast.ui.components.Loader
|
||||
import dev.meloda.fast.ui.util.getImage
|
||||
@@ -69,7 +70,6 @@ import kotlinx.coroutines.launch
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
import java.net.URLEncoder
|
||||
import kotlin.math.abs
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
|
||||
@Composable
|
||||
fun PhotoViewDialog(
|
||||
@@ -136,7 +136,7 @@ private fun PhotoViewRoute(
|
||||
scope.launch(Dispatchers.Main) {
|
||||
Toast.makeText(
|
||||
context,
|
||||
UiR.string.error_occurred,
|
||||
R.string.error_occurred,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
@@ -285,7 +285,7 @@ private fun TopBar(
|
||||
onShareClicked()
|
||||
},
|
||||
text = {
|
||||
Text(text = stringResource(UiR.string.action_share))
|
||||
Text(text = stringResource(R.string.action_share))
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
@@ -294,7 +294,7 @@ private fun TopBar(
|
||||
onOpenInClicked()
|
||||
},
|
||||
text = {
|
||||
Text(text = stringResource(UiR.string.action_open_in))
|
||||
Text(text = stringResource(R.string.action_open_in))
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
@@ -303,7 +303,7 @@ private fun TopBar(
|
||||
onCopyLinkClicked()
|
||||
},
|
||||
text = {
|
||||
Text(text = stringResource(UiR.string.action_copy_link))
|
||||
Text(text = stringResource(R.string.action_copy_link))
|
||||
}
|
||||
)
|
||||
DropdownMenuItem(
|
||||
@@ -312,7 +312,7 @@ private fun TopBar(
|
||||
onCopyClicked()
|
||||
},
|
||||
text = {
|
||||
Text(text = stringResource(UiR.string.action_copy_image))
|
||||
Text(text = stringResource(R.string.action_copy_image))
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import dev.meloda.fast.profile.ProfileViewModelImpl
|
||||
import dev.meloda.fast.profile.model.ProfileScreenState
|
||||
import org.koin.androidx.compose.koinViewModel
|
||||
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun ProfileRoute(
|
||||
@@ -115,7 +115,7 @@ fun ProfileScreen(
|
||||
model = screenState.avatarUrl,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.Crop,
|
||||
placeholder = painterResource(id = UiR.drawable.ic_account_circle_cut)
|
||||
placeholder = painterResource(id = R.drawable.ic_account_circle_cut)
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(18.dp))
|
||||
|
||||
@@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
class SettingsViewModel(
|
||||
private val loadUserByIdUseCase: LoadUserByIdUseCase,
|
||||
@@ -319,65 +319,65 @@ class SettingsViewModel(
|
||||
val accountVisible = UserConfig.isLoggedIn()
|
||||
val accountTitle = SettingsItem.Title(
|
||||
key = SettingsKeys.KEY_ACCOUNT,
|
||||
title = UiText.Resource(UiR.string.settings_account_title),
|
||||
title = UiText.Resource(R.string.settings_account_title),
|
||||
isVisible = accountVisible
|
||||
)
|
||||
val accountLogOut = SettingsItem.TitleText(
|
||||
key = SettingsKeys.KEY_ACCOUNT_LOGOUT,
|
||||
title = UiText.Resource(UiR.string.settings_account_logout_title),
|
||||
text = UiText.Resource(UiR.string.settings_account_logout_summary),
|
||||
title = UiText.Resource(R.string.settings_account_logout_title),
|
||||
text = UiText.Resource(R.string.settings_account_logout_summary),
|
||||
isVisible = accountVisible
|
||||
)
|
||||
|
||||
val generalTitle = SettingsItem.Title(
|
||||
key = SettingsKeys.KEY_GENERAL,
|
||||
title = UiText.Resource(UiR.string.settings_general_title)
|
||||
title = UiText.Resource(R.string.settings_general_title)
|
||||
)
|
||||
val generalUseContactNames = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_USE_CONTACT_NAMES,
|
||||
title = UiText.Resource(UiR.string.settings_general_contact_names_title),
|
||||
text = UiText.Resource(UiR.string.settings_general_contact_names_summary),
|
||||
title = UiText.Resource(R.string.settings_general_contact_names_title),
|
||||
text = UiText.Resource(R.string.settings_general_contact_names_summary),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_CONTACT_NAMES
|
||||
)
|
||||
val generalShowEmojiButton = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_SHOW_EMOJI_BUTTON,
|
||||
title = UiText.Resource(UiR.string.settings_general_show_emoji_button_title),
|
||||
text = UiText.Resource(UiR.string.settings_general_show_emoji_button_summary),
|
||||
title = UiText.Resource(R.string.settings_general_show_emoji_button_title),
|
||||
text = UiText.Resource(R.string.settings_general_show_emoji_button_summary),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
|
||||
)
|
||||
val generalShowAttachmentButton = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_SHOW_ATTACHMENT_BUTTON,
|
||||
title = UiText.Resource(UiR.string.settings_general_show_attachment_button_title),
|
||||
text = UiText.Resource(UiR.string.settings_general_show_attachment_button_summary),
|
||||
title = UiText.Resource(R.string.settings_general_show_attachment_button_title),
|
||||
text = UiText.Resource(R.string.settings_general_show_attachment_button_summary),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_SHOW_ATTACHMENT_BUTTON
|
||||
)
|
||||
val generalEnableHaptic = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_ENABLE_HAPTIC,
|
||||
defaultValue = SettingsKeys.DEFAULT_ENABLE_HAPTIC,
|
||||
title = UiText.Resource(UiR.string.settings_general_enable_haptic_title)
|
||||
title = UiText.Resource(R.string.settings_general_enable_haptic_title)
|
||||
)
|
||||
|
||||
val appearanceTitle = SettingsItem.Title(
|
||||
key = SettingsKeys.KEY_APPEARANCE,
|
||||
title = UiText.Resource(UiR.string.settings_appearance_title)
|
||||
title = UiText.Resource(R.string.settings_appearance_title)
|
||||
)
|
||||
val appearanceMultiline = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_APPEARANCE_MULTILINE,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_MULTILINE,
|
||||
title = UiText.Resource(UiR.string.settings_appearance_multiline_title),
|
||||
text = UiText.Resource(UiR.string.settings_appearance_multiline_summary)
|
||||
title = UiText.Resource(R.string.settings_appearance_multiline_title),
|
||||
text = UiText.Resource(R.string.settings_appearance_multiline_summary)
|
||||
)
|
||||
|
||||
val darkThemeValues = listOf(
|
||||
DarkMode.ENABLED to UiText.Resource(UiR.string.settings_dark_theme_value_enabled),
|
||||
DarkMode.FOLLOW_SYSTEM to UiText.Resource(UiR.string.settings_dark_theme_value_follow_system),
|
||||
DarkMode.AUTO_BATTERY to UiText.Resource(UiR.string.settings_dark_theme_value_battery_saver),
|
||||
DarkMode.DISABLED to UiText.Resource(UiR.string.settings_dark_theme_value_disabled)
|
||||
DarkMode.ENABLED to UiText.Resource(R.string.settings_dark_theme_value_enabled),
|
||||
DarkMode.FOLLOW_SYSTEM to UiText.Resource(R.string.settings_dark_theme_value_follow_system),
|
||||
DarkMode.AUTO_BATTERY to UiText.Resource(R.string.settings_dark_theme_value_battery_saver),
|
||||
DarkMode.DISABLED to UiText.Resource(R.string.settings_dark_theme_value_disabled)
|
||||
).toMap()
|
||||
|
||||
val appearanceDarkTheme = SettingsItem.ListItem(
|
||||
key = SettingsKeys.KEY_APPEARANCE_DARK_MODE,
|
||||
title = UiText.Resource(UiR.string.settings_dark_theme),
|
||||
title = UiText.Resource(R.string.settings_dark_theme),
|
||||
valueClass = Int::class,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_DARK_MODE,
|
||||
titles = darkThemeValues.values.toList(),
|
||||
@@ -387,10 +387,10 @@ class SettingsViewModel(
|
||||
val darkThemeValue = darkThemeValues[DarkMode.parse(item.value)]
|
||||
|
||||
UiText.ResourceParams(
|
||||
value = UiR.string.settings_dark_theme_current_value,
|
||||
value = R.string.settings_dark_theme_current_value,
|
||||
args = listOf(
|
||||
darkThemeValue
|
||||
?: UiText.Resource(UiR.string.settings_dark_theme_current_value_unknown)
|
||||
?: UiText.Resource(R.string.settings_dark_theme_current_value_unknown)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -398,38 +398,38 @@ class SettingsViewModel(
|
||||
val appearanceUseAmoledDarkTheme = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_APPEARANCE_AMOLED_THEME,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_AMOLED_THEME,
|
||||
title = UiText.Resource(UiR.string.settings_amoled_dark_theme),
|
||||
text = UiText.Resource(UiR.string.settings_amoled_dark_theme_description)
|
||||
title = UiText.Resource(R.string.settings_amoled_dark_theme),
|
||||
text = UiText.Resource(R.string.settings_amoled_dark_theme_description)
|
||||
)
|
||||
val appearanceUseDynamicColors = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_USE_DYNAMIC_COLORS,
|
||||
title = UiText.Resource(UiR.string.settings_dynamic_colors),
|
||||
title = UiText.Resource(R.string.settings_dynamic_colors),
|
||||
isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S,
|
||||
text = UiText.Resource(UiR.string.settings_dynamic_colors_description),
|
||||
text = UiText.Resource(R.string.settings_dynamic_colors_description),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_DYNAMIC_COLORS
|
||||
)
|
||||
val appearanceUseSystemFont = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_USE_SYSTEM_FONT,
|
||||
defaultValue = SettingsKeys.DEFAULT_USE_SYSTEM_FONT,
|
||||
title = UiText.Resource(UiR.string.settings_appearance_use_system_font_title)
|
||||
title = UiText.Resource(R.string.settings_appearance_use_system_font_title)
|
||||
)
|
||||
val appearanceLanguage = SettingsItem.TitleText(
|
||||
key = SettingsKeys.KEY_APPEARANCE_LANGUAGE,
|
||||
title = UiText.Resource(UiR.string.settings_application_language),
|
||||
title = UiText.Resource(R.string.settings_application_language),
|
||||
)
|
||||
|
||||
val featuresTitle = SettingsItem.Title(
|
||||
key = "features",
|
||||
title = UiText.Resource(UiR.string.settings_features_title)
|
||||
title = UiText.Resource(R.string.settings_features_title)
|
||||
)
|
||||
val featuresFastText = SettingsItem.TextField(
|
||||
key = SettingsKeys.KEY_FEATURES_FAST_TEXT,
|
||||
title = UiText.Resource(UiR.string.settings_features_fast_text_title),
|
||||
title = UiText.Resource(R.string.settings_features_fast_text_title),
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_FEATURES_FAST_TEXT
|
||||
).apply {
|
||||
textProvider = TextProvider { settingsItem ->
|
||||
UiText.ResourceParams(
|
||||
UiR.string.pref_message_fast_text_summary,
|
||||
R.string.pref_message_fast_text_summary,
|
||||
listOf(settingsItem.value)
|
||||
)
|
||||
}
|
||||
@@ -437,46 +437,46 @@ class SettingsViewModel(
|
||||
|
||||
val activityTitle = SettingsItem.Title(
|
||||
key = "activity",
|
||||
title = UiText.Resource(UiR.string.settings_activity_title)
|
||||
title = UiText.Resource(R.string.settings_activity_title)
|
||||
)
|
||||
val visibilitySendOnlineStatus = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS,
|
||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS,
|
||||
title = UiText.Resource(UiR.string.settings_activity_send_online_title),
|
||||
text = UiText.Resource(UiR.string.settings_activity_send_online_summary)
|
||||
title = UiText.Resource(R.string.settings_activity_send_online_title),
|
||||
text = UiText.Resource(R.string.settings_activity_send_online_summary)
|
||||
)
|
||||
|
||||
val experimentalTitle = SettingsItem.Title(
|
||||
key = "experimental",
|
||||
title = UiText.Resource(UiR.string.settings_experimental_title)
|
||||
title = UiText.Resource(R.string.settings_experimental_title)
|
||||
)
|
||||
val experimentalLongPollBackground = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_LONG_POLL_IN_BACKGROUND,
|
||||
defaultValue = SettingsKeys.DEFAULT_LONG_POLL_IN_BACKGROUND,
|
||||
title = UiText.Resource(UiR.string.settings_features_long_poll_in_background_title),
|
||||
text = UiText.Resource(UiR.string.settings_features_long_poll_in_background_summary)
|
||||
title = UiText.Resource(R.string.settings_features_long_poll_in_background_title),
|
||||
text = UiText.Resource(R.string.settings_features_long_poll_in_background_summary)
|
||||
)
|
||||
val experimentalShowTimeInActionMessages = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||
defaultValue = SettingsKeys.DEFAULT_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||
title = UiText.Resource(UiR.string.settings_features_show_time_in_action_messages_title)
|
||||
title = UiText.Resource(R.string.settings_features_show_time_in_action_messages_title)
|
||||
)
|
||||
val experimentalUseBlur = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_USE_BLUR,
|
||||
defaultValue = SettingsKeys.DEFAULT_USE_BLUR,
|
||||
title = UiText.Resource(UiR.string.settings_experimental_use_blur_title),
|
||||
text = UiText.Resource(UiR.string.settings_experimental_use_blur_summary)
|
||||
title = UiText.Resource(R.string.settings_experimental_use_blur_title),
|
||||
text = UiText.Resource(R.string.settings_experimental_use_blur_summary)
|
||||
)
|
||||
val enableAnimations = SettingsItem.Switch(
|
||||
key = SettingsKeys.KEY_MORE_ANIMATIONS,
|
||||
defaultValue = SettingsKeys.DEFAULT_MORE_ANIMATIONS,
|
||||
title = UiText.Resource(UiR.string.settings_experimental_more_animations_title),
|
||||
text = UiText.Resource(UiR.string.settings_experimental_more_animations_summary)
|
||||
title = UiText.Resource(R.string.settings_experimental_more_animations_title),
|
||||
text = UiText.Resource(R.string.settings_experimental_more_animations_summary)
|
||||
)
|
||||
|
||||
val debugTitle = SettingsItem.Title(
|
||||
key = "debug",
|
||||
title = UiText.Resource(UiR.string.settings_debug_title)
|
||||
title = UiText.Resource(R.string.settings_debug_title)
|
||||
)
|
||||
val debugPerformCrash = SettingsItem.TitleText(
|
||||
key = SettingsKeys.KEY_DEBUG_PERFORM_CRASH,
|
||||
|
||||
+11
-11
@@ -29,7 +29,7 @@ import dev.meloda.fast.settings.model.SettingsDialog
|
||||
import dev.meloda.fast.settings.model.SettingsScreenState
|
||||
import dev.meloda.fast.ui.components.ActionInvokeDismiss
|
||||
import dev.meloda.fast.ui.components.MaterialDialog
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
@Composable
|
||||
fun HandleDialogs(
|
||||
@@ -50,16 +50,16 @@ fun HandleDialogs(
|
||||
MaterialDialog(
|
||||
onDismissRequest = { onDismissed(dialog) },
|
||||
title = stringResource(
|
||||
id = if (isEasterEgg) UiR.string.easter_egg_log_out_dmitry
|
||||
else UiR.string.sign_out_confirm_title
|
||||
id = if (isEasterEgg) R.string.easter_egg_log_out_dmitry
|
||||
else R.string.sign_out_confirm_title
|
||||
),
|
||||
text = stringResource(id = UiR.string.sign_out_confirm),
|
||||
text = stringResource(id = R.string.sign_out_confirm),
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(
|
||||
id = if (isEasterEgg) UiR.string.easter_egg_log_out_dmitry
|
||||
else UiR.string.action_sign_out
|
||||
id = if (isEasterEgg) R.string.easter_egg_log_out_dmitry
|
||||
else R.string.action_sign_out
|
||||
),
|
||||
cancelText = stringResource(id = UiR.string.no),
|
||||
cancelText = stringResource(id = R.string.no),
|
||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||
)
|
||||
}
|
||||
@@ -70,8 +70,8 @@ fun HandleDialogs(
|
||||
title = "Perform crash",
|
||||
text = "App will be crashed. Are you sure?",
|
||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||
confirmText = stringResource(id = UiR.string.yes),
|
||||
cancelText = stringResource(id = UiR.string.cancel),
|
||||
confirmText = stringResource(id = R.string.yes),
|
||||
cancelText = stringResource(id = R.string.cancel),
|
||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||
)
|
||||
}
|
||||
@@ -101,7 +101,7 @@ fun HandleDialogs(
|
||||
)
|
||||
},
|
||||
confirmText = "Import",
|
||||
cancelText = stringResource(UiR.string.cancel)
|
||||
cancelText = stringResource(R.string.cancel)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
@@ -210,7 +210,7 @@ fun HandleDialogs(
|
||||
)
|
||||
)
|
||||
},
|
||||
confirmText = stringResource(UiR.string.ok),
|
||||
confirmText = stringResource(R.string.ok),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
||||
+3
-3
@@ -44,7 +44,7 @@ import dev.meloda.fast.settings.presentation.item.TextFieldItem
|
||||
import dev.meloda.fast.settings.presentation.item.TitleItem
|
||||
import dev.meloda.fast.settings.presentation.item.TitleTextItem
|
||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import dev.meloda.fast.ui.R as UiR
|
||||
import dev.meloda.fast.ui.R
|
||||
|
||||
|
||||
@OptIn(
|
||||
@@ -83,7 +83,7 @@ fun SettingsScreen(
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(id = UiR.string.title_settings),
|
||||
text = stringResource(id = R.string.title_settings),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
style = MaterialTheme.typography.headlineSmall
|
||||
@@ -92,7 +92,7 @@ fun SettingsScreen(
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(
|
||||
painter = painterResource(id = UiR.drawable.ic_round_arrow_back_24),
|
||||
painter = painterResource(id = R.drawable.ic_round_arrow_back_24),
|
||||
contentDescription = "Back button"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user