move strings in core/ui module
disable generating android resources everywhere except core/ui module replace UiR with R
This commit is contained in:
@@ -10,7 +10,7 @@ import dev.meloda.fast.presentation.MainScreen
|
|||||||
import dev.meloda.fast.profile.navigation.Profile
|
import dev.meloda.fast.profile.navigation.Profile
|
||||||
import dev.meloda.fast.ui.util.ImmutableList
|
import dev.meloda.fast.ui.util.ImmutableList
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
object MainGraph
|
object MainGraph
|
||||||
@@ -28,21 +28,21 @@ fun NavGraphBuilder.mainScreen(
|
|||||||
) {
|
) {
|
||||||
val navigationItems = ImmutableList.of(
|
val navigationItems = ImmutableList.of(
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
titleResId = UiR.string.title_friends,
|
titleResId = R.string.title_friends,
|
||||||
selectedIconResId = UiR.drawable.baseline_people_alt_24,
|
selectedIconResId = R.drawable.baseline_people_alt_24,
|
||||||
unselectedIconResId = UiR.drawable.outline_people_alt_24,
|
unselectedIconResId = R.drawable.outline_people_alt_24,
|
||||||
route = Friends,
|
route = Friends,
|
||||||
),
|
),
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
titleResId = UiR.string.title_conversations,
|
titleResId = R.string.title_conversations,
|
||||||
selectedIconResId = UiR.drawable.baseline_chat_24,
|
selectedIconResId = R.drawable.baseline_chat_24,
|
||||||
unselectedIconResId = UiR.drawable.outline_chat_24,
|
unselectedIconResId = R.drawable.outline_chat_24,
|
||||||
route = ConversationsGraph
|
route = ConversationsGraph
|
||||||
),
|
),
|
||||||
BottomNavigationItem(
|
BottomNavigationItem(
|
||||||
titleResId = UiR.string.title_profile,
|
titleResId = R.string.title_profile,
|
||||||
selectedIconResId = UiR.drawable.baseline_account_circle_24,
|
selectedIconResId = R.drawable.baseline_account_circle_24,
|
||||||
unselectedIconResId = UiR.drawable.outline_account_circle_24,
|
unselectedIconResId = R.drawable.outline_account_circle_24,
|
||||||
route = Profile
|
route = Profile
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import dev.meloda.fast.ui.theme.LocalUser
|
|||||||
import dev.meloda.fast.ui.util.isNeedToEnableDarkMode
|
import dev.meloda.fast.ui.util.isNeedToEnableDarkMode
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import org.koin.compose.koinInject
|
import org.koin.compose.koinInject
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@@ -255,9 +255,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private fun createNotificationChannels() {
|
private fun createNotificationChannels() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val noCategoryName = getString(UiR.string.notification_channel_no_category_name)
|
val noCategoryName = getString(R.string.notification_channel_no_category_name)
|
||||||
val noCategoryDescriptionText =
|
val noCategoryDescriptionText =
|
||||||
getString(UiR.string.notification_channel_no_category_description)
|
getString(R.string.notification_channel_no_category_description)
|
||||||
val noCategoryChannel =
|
val noCategoryChannel =
|
||||||
NotificationChannel(
|
NotificationChannel(
|
||||||
AppConstants.NOTIFICATION_CHANNEL_UNCATEGORIZED,
|
AppConstants.NOTIFICATION_CHANNEL_UNCATEGORIZED,
|
||||||
@@ -267,9 +267,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
description = noCategoryDescriptionText
|
description = noCategoryDescriptionText
|
||||||
}
|
}
|
||||||
|
|
||||||
val longPollName = getString(UiR.string.notification_channel_long_polling_service_name)
|
val longPollName = getString(R.string.notification_channel_long_polling_service_name)
|
||||||
val longPollDescriptionText =
|
val longPollDescriptionText =
|
||||||
getString(UiR.string.notification_channel_long_polling_service_description)
|
getString(R.string.notification_channel_long_polling_service_description)
|
||||||
val longPollChannel =
|
val longPollChannel =
|
||||||
NotificationChannel(
|
NotificationChannel(
|
||||||
AppConstants.NOTIFICATION_CHANNEL_LONG_POLLING,
|
AppConstants.NOTIFICATION_CHANNEL_LONG_POLLING,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import android.content.Context
|
|||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
import dev.meloda.fast.common.AppConstants
|
import dev.meloda.fast.common.AppConstants
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
object NotificationsUtils {
|
object NotificationsUtils {
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ object NotificationsUtils {
|
|||||||
actions: List<NotificationCompat.Action> = emptyList(),
|
actions: List<NotificationCompat.Action> = emptyList(),
|
||||||
): NotificationCompat.Builder {
|
): NotificationCompat.Builder {
|
||||||
val builder = NotificationCompat.Builder(context, channelId)
|
val builder = NotificationCompat.Builder(context, channelId)
|
||||||
.setSmallIcon(UiR.drawable.ic_fast_logo)
|
.setSmallIcon(R.drawable.ic_fast_logo)
|
||||||
.setContentTitle(title)
|
.setContentTitle(title)
|
||||||
.setPriority(priority.value)
|
.setPriority(priority.value)
|
||||||
.setContentIntent(contentIntent)
|
.setContentIntent(contentIntent)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class AndroidLibraryComposeConventionPlugin : Plugin<Project> {
|
|||||||
apply(plugin = "org.jetbrains.kotlin.plugin.compose")
|
apply(plugin = "org.jetbrains.kotlin.plugin.compose")
|
||||||
|
|
||||||
val extension = extensions.getByType<LibraryExtension>()
|
val extension = extensions.getByType<LibraryExtension>()
|
||||||
|
extension.androidResources.enable = false
|
||||||
configureAndroidCompose(extension)
|
configureAndroidCompose(extension)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import com.android.build.api.variant.LibraryAndroidComponentsExtension
|
|||||||
import com.android.build.gradle.LibraryExtension
|
import com.android.build.gradle.LibraryExtension
|
||||||
import dev.meloda.fast.configureKotlinAndroid
|
import dev.meloda.fast.configureKotlinAndroid
|
||||||
import dev.meloda.fast.disableUnnecessaryAndroidTests
|
import dev.meloda.fast.disableUnnecessaryAndroidTests
|
||||||
import dev.meloda.fast.libs
|
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.configure
|
import org.gradle.kotlin.dsl.configure
|
||||||
@@ -21,6 +20,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
extensions.configure<LibraryExtension> {
|
extensions.configure<LibraryExtension> {
|
||||||
configureKotlinAndroid(this)
|
configureKotlinAndroid(this)
|
||||||
|
androidResources.enable = false
|
||||||
defaultConfig.targetSdk = 36
|
defaultConfig.targetSdk = 36
|
||||||
defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package dev.meloda.fast.common.util
|
package dev.meloda.fast.common.util
|
||||||
|
|
||||||
import android.content.res.Resources
|
|
||||||
import com.conena.nanokt.jvm.util.dayOfMonth
|
import com.conena.nanokt.jvm.util.dayOfMonth
|
||||||
import com.conena.nanokt.jvm.util.hour
|
import com.conena.nanokt.jvm.util.hour
|
||||||
import com.conena.nanokt.jvm.util.hourOfDay
|
import com.conena.nanokt.jvm.util.hourOfDay
|
||||||
@@ -9,7 +8,6 @@ import com.conena.nanokt.jvm.util.minute
|
|||||||
import com.conena.nanokt.jvm.util.month
|
import com.conena.nanokt.jvm.util.month
|
||||||
import com.conena.nanokt.jvm.util.second
|
import com.conena.nanokt.jvm.util.second
|
||||||
import com.conena.nanokt.jvm.util.year
|
import com.conena.nanokt.jvm.util.year
|
||||||
import dev.meloda.fast.common.R
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
@@ -27,7 +25,11 @@ object TimeUtils {
|
|||||||
}.timeInMillis
|
}.timeInMillis
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLocalizedDate(resources: Resources, date: Long): String {
|
fun getLocalizedDate(
|
||||||
|
date: Long,
|
||||||
|
yesterday: () -> String,
|
||||||
|
today: () -> String
|
||||||
|
): String {
|
||||||
val now = Calendar.getInstance()
|
val now = Calendar.getInstance()
|
||||||
val then = Calendar.getInstance().also { it.timeInMillis = date }
|
val then = Calendar.getInstance().also { it.timeInMillis = date }
|
||||||
|
|
||||||
@@ -36,43 +38,50 @@ object TimeUtils {
|
|||||||
now.month != then.month -> "dd MMMM"
|
now.month != then.month -> "dd MMMM"
|
||||||
now.dayOfMonth != then.dayOfMonth -> {
|
now.dayOfMonth != then.dayOfMonth -> {
|
||||||
if (now.dayOfMonth - then.dayOfMonth == 1) {
|
if (now.dayOfMonth - then.dayOfMonth == 1) {
|
||||||
return resources.getString(R.string.yesterday)
|
return yesterday()
|
||||||
} else {
|
} else {
|
||||||
"dd MMMM"
|
"dd MMMM"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> return resources.getString(R.string.today)
|
else -> return today()
|
||||||
}
|
}
|
||||||
|
|
||||||
return SimpleDateFormat(pattern, Locale.getDefault()).format(date)
|
return SimpleDateFormat(pattern, Locale.getDefault()).format(date)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLocalizedTime(resources: Resources, date: Long): String {
|
fun getLocalizedTime(
|
||||||
|
date: Long,
|
||||||
|
yearShort: () -> String,
|
||||||
|
monthShort: () -> String,
|
||||||
|
weekShort: () -> String,
|
||||||
|
dayShort: () -> String,
|
||||||
|
now: () -> String
|
||||||
|
): String {
|
||||||
val now = Calendar.getInstance()
|
val now = Calendar.getInstance()
|
||||||
val then = Calendar.getInstance().also { it.timeInMillis = date }
|
val then = Calendar.getInstance().also { it.timeInMillis = date }
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
now.year != then.year -> {
|
now.year != then.year -> {
|
||||||
"${now.year - then.year}${resources.getString(R.string.year_short).lowercase()}"
|
"${now.year - then.year}${yearShort().lowercase()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
now.month != then.month -> {
|
now.month != then.month -> {
|
||||||
"${now.month - then.month}${resources.getString(R.string.month_short).lowercase()}"
|
"${now.month - then.month}${monthShort().lowercase()}"
|
||||||
}
|
}
|
||||||
|
|
||||||
now.dayOfMonth != then.dayOfMonth -> {
|
now.dayOfMonth != then.dayOfMonth -> {
|
||||||
val change = now.dayOfMonth - then.dayOfMonth
|
val change = now.dayOfMonth - then.dayOfMonth
|
||||||
|
|
||||||
if (change % 7 == 0) {
|
if (change % 7 == 0) {
|
||||||
"${change / 7}${resources.getString(R.string.week_short).lowercase()}"
|
"${change / 7}${weekShort().lowercase()}"
|
||||||
} else {
|
} else {
|
||||||
"$change${resources.getString(R.string.day_short).lowercase()}"
|
"$change${dayShort().lowercase()}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
now.hour == then.hour && now.minute == then.minute -> {
|
now.hour == then.hour && now.minute == then.minute -> {
|
||||||
resources.getString(R.string.time_now).lowercase()
|
now().lowercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="yesterday">Вчера</string>
|
|
||||||
<string name="today">Сегодня</string>
|
|
||||||
<string name="year_short">Г</string>
|
|
||||||
<string name="month_short">М</string>
|
|
||||||
<string name="week_short">Н</string>
|
|
||||||
<string name="day_short">Д</string>
|
|
||||||
<string name="time_now">Сейчас</string>
|
|
||||||
</resources>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string name="yesterday">Yesterday</string>
|
|
||||||
<string name="today">Today</string>
|
|
||||||
<string name="year_short">Y</string>
|
|
||||||
<string name="month_short">M</string>
|
|
||||||
<string name="week_short">W</string>
|
|
||||||
<string name="day_short">D</string>
|
|
||||||
<string name="time_now">Now</string>
|
|
||||||
</resources>
|
|
||||||
@@ -6,6 +6,7 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "dev.meloda.fast.ui"
|
namespace = "dev.meloda.fast.ui"
|
||||||
|
androidResources.enable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -19,6 +20,8 @@ dependencies {
|
|||||||
implementation(platform(libs.compose.bom))
|
implementation(platform(libs.compose.bom))
|
||||||
implementation(libs.bundles.compose)
|
implementation(libs.bundles.compose)
|
||||||
|
|
||||||
|
implementation(libs.bundles.nanokt)
|
||||||
|
|
||||||
implementation(libs.androidx.navigation.compose)
|
implementation(libs.androidx.navigation.compose)
|
||||||
implementation(libs.kotlin.serialization)
|
implementation(libs.kotlin.serialization)
|
||||||
implementation(libs.koin.androidx.compose.navigation)
|
implementation(libs.koin.androidx.compose.navigation)
|
||||||
|
|||||||
@@ -20,12 +20,12 @@ import androidx.compose.ui.text.style.TextAlign
|
|||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ErrorView(
|
fun ErrorView(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
iconResId: Int? = UiR.drawable.round_error_24,
|
iconResId: Int? = R.drawable.round_error_24,
|
||||||
text: String,
|
text: String,
|
||||||
buttonText: String? = null,
|
buttonText: String? = null,
|
||||||
onButtonClick: (() -> Unit)? = null,
|
onButtonClick: (() -> Unit)? = null,
|
||||||
|
|||||||
@@ -279,4 +279,11 @@
|
|||||||
<string name="action_copy_image">Скопировать изображение</string>
|
<string name="action_copy_image">Скопировать изображение</string>
|
||||||
<string name="action_open_in">Открыть в…</string>
|
<string name="action_open_in">Открыть в…</string>
|
||||||
<string name="action_share">Поделиться</string>
|
<string name="action_share">Поделиться</string>
|
||||||
|
<string name="yesterday">Вчера</string>
|
||||||
|
<string name="today">Сегодня</string>
|
||||||
|
<string name="year_short">Г</string>
|
||||||
|
<string name="month_short">М</string>
|
||||||
|
<string name="week_short">Н</string>
|
||||||
|
<string name="day_short">Д</string>
|
||||||
|
<string name="time_now">Сейчас</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -356,4 +356,11 @@
|
|||||||
<string name="action_copy_image">Copy image</string>
|
<string name="action_copy_image">Copy image</string>
|
||||||
<string name="action_open_in">Open in…</string>
|
<string name="action_open_in">Open in…</string>
|
||||||
<string name="action_share">Share</string>
|
<string name="action_share">Share</string>
|
||||||
|
<string name="yesterday">Yesterday</string>
|
||||||
|
<string name="today">Today</string>
|
||||||
|
<string name="year_short">Y</string>
|
||||||
|
<string name="month_short">M</string>
|
||||||
|
<string name="week_short">W</string>
|
||||||
|
<string name="day_short">D</string>
|
||||||
|
<string name="time_now">Now</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
+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.MaterialDialog
|
||||||
import dev.meloda.fast.ui.components.TextFieldErrorText
|
import dev.meloda.fast.ui.components.TextFieldErrorText
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CaptchaRoute(
|
fun CaptchaRoute(
|
||||||
@@ -116,11 +116,11 @@ fun CaptchaScreen(
|
|||||||
if (showExitAlert) {
|
if (showExitAlert) {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { showExitAlert = false },
|
onDismissRequest = { showExitAlert = false },
|
||||||
title = stringResource(id = UiR.string.warning_confirmation),
|
title = stringResource(id = R.string.warning_confirmation),
|
||||||
text = stringResource(id = UiR.string.captcha_exit_warning),
|
text = stringResource(id = R.string.captcha_exit_warning),
|
||||||
confirmAction = { confirmedExit = true },
|
confirmAction = { confirmedExit = true },
|
||||||
confirmText = stringResource(id = UiR.string.yes),
|
confirmText = stringResource(id = R.string.yes),
|
||||||
cancelText = stringResource(id = UiR.string.no),
|
cancelText = stringResource(id = R.string.no),
|
||||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ fun CaptchaScreen(
|
|||||||
|
|
||||||
if (LocalView.current.isInEditMode) {
|
if (LocalView.current.isInEditMode) {
|
||||||
Image(
|
Image(
|
||||||
painter = painterResource(id = UiR.drawable.test_captcha),
|
painter = painterResource(id = R.drawable.test_captcha),
|
||||||
contentDescription = "Captcha image",
|
contentDescription = "Captcha image",
|
||||||
modifier = imageModifier
|
modifier = imageModifier
|
||||||
)
|
)
|
||||||
@@ -219,7 +219,7 @@ fun CaptchaScreen(
|
|||||||
.clip(RoundedCornerShape(10.dp)),
|
.clip(RoundedCornerShape(10.dp)),
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.round_qr_code_24),
|
painter = painterResource(id = R.drawable.round_qr_code_24),
|
||||||
contentDescription = "QR code icon",
|
contentDescription = "QR code icon",
|
||||||
tint = if (showError) {
|
tint = if (showError) {
|
||||||
MaterialTheme.colorScheme.error
|
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.handleEnterKey
|
||||||
import dev.meloda.fast.ui.util.handleTabKey
|
import dev.meloda.fast.ui.util.handleTabKey
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LoginRoute(
|
fun LoginRoute(
|
||||||
@@ -210,7 +210,7 @@ fun LoginScreen(
|
|||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = UiR.string.sign_in_to_vk),
|
text = stringResource(id = R.string.sign_in_to_vk),
|
||||||
color = MaterialTheme.colorScheme.onBackground,
|
color = MaterialTheme.colorScheme.onBackground,
|
||||||
style = MaterialTheme.typography.displayMedium
|
style = MaterialTheme.typography.displayMedium
|
||||||
)
|
)
|
||||||
@@ -236,11 +236,11 @@ fun LoginScreen(
|
|||||||
},
|
},
|
||||||
value = screenState.login,
|
value = screenState.login,
|
||||||
onValueChange = onLoginInputChanged,
|
onValueChange = onLoginInputChanged,
|
||||||
label = { Text(text = stringResource(id = UiR.string.login_hint)) },
|
label = { Text(text = stringResource(id = R.string.login_hint)) },
|
||||||
placeholder = { Text(text = stringResource(id = UiR.string.login_hint)) },
|
placeholder = { Text(text = stringResource(id = R.string.login_hint)) },
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.ic_round_person_24),
|
painter = painterResource(id = R.drawable.ic_round_person_24),
|
||||||
contentDescription = "Login icon",
|
contentDescription = "Login icon",
|
||||||
tint = if (screenState.loginError) {
|
tint = if (screenState.loginError) {
|
||||||
MaterialTheme.colorScheme.error
|
MaterialTheme.colorScheme.error
|
||||||
@@ -261,7 +261,7 @@ fun LoginScreen(
|
|||||||
visible = screenState.loginError,
|
visible = screenState.loginError,
|
||||||
label = "Login error visibility"
|
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))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -280,11 +280,11 @@ fun LoginScreen(
|
|||||||
.semantics { contentType = ContentType.Password },
|
.semantics { contentType = ContentType.Password },
|
||||||
value = screenState.password,
|
value = screenState.password,
|
||||||
onValueChange = onPasswordInputChanged,
|
onValueChange = onPasswordInputChanged,
|
||||||
label = { Text(text = stringResource(id = UiR.string.password_login_hint)) },
|
label = { Text(text = stringResource(id = R.string.password_login_hint)) },
|
||||||
placeholder = { Text(text = stringResource(id = UiR.string.password_login_hint)) },
|
placeholder = { Text(text = stringResource(id = R.string.password_login_hint)) },
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.round_vpn_key_24),
|
painter = painterResource(id = R.drawable.round_vpn_key_24),
|
||||||
contentDescription = "Password icon",
|
contentDescription = "Password icon",
|
||||||
tint = if (screenState.passwordError) {
|
tint = if (screenState.passwordError) {
|
||||||
MaterialTheme.colorScheme.error
|
MaterialTheme.colorScheme.error
|
||||||
@@ -295,8 +295,8 @@ fun LoginScreen(
|
|||||||
},
|
},
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
val imagePainter = painterResource(
|
val imagePainter = painterResource(
|
||||||
id = if (screenState.passwordVisible) UiR.drawable.round_visibility_off_24
|
id = if (screenState.passwordVisible) R.drawable.round_visibility_off_24
|
||||||
else UiR.drawable.round_visibility_24
|
else R.drawable.round_visibility_24
|
||||||
)
|
)
|
||||||
|
|
||||||
IconButton(onClick = onPasswordVisibilityButtonClicked) {
|
IconButton(onClick = onPasswordVisibilityButtonClicked) {
|
||||||
@@ -329,7 +329,7 @@ fun LoginScreen(
|
|||||||
visible = screenState.passwordError,
|
visible = screenState.passwordError,
|
||||||
label = "Password error visibility"
|
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"
|
label = "Sign in icon visibility"
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.ic_arrow_end),
|
painter = painterResource(id = R.drawable.ic_arrow_end),
|
||||||
contentDescription = "Sign in icon",
|
contentDescription = "Sign in icon",
|
||||||
tint = MaterialTheme.colorScheme.onSecondaryContainer
|
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(
|
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 -> {
|
is LoginDialog.Error -> {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(loginDialog) },
|
onDismissRequest = { onDismissed(loginDialog) },
|
||||||
title = stringResource(UiR.string.title_error),
|
title = stringResource(R.string.title_error),
|
||||||
text = loginDialog.errorTextResId?.let { stringResource(it) }
|
text = loginDialog.errorTextResId?.let { stringResource(it) }
|
||||||
?: loginDialog.errorText
|
?: loginDialog.errorText
|
||||||
?: stringResource(UiR.string.unknown_error_occurred),
|
?: stringResource(R.string.unknown_error_occurred),
|
||||||
confirmText = stringResource(id = UiR.string.ok)
|
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.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import dev.meloda.fast.auth.userbanned.model.UserBannedScreenState
|
import dev.meloda.fast.auth.userbanned.model.UserBannedScreenState
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
@@ -74,7 +74,7 @@ fun UserBannedScreen(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
title = {
|
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)
|
.padding(vertical = 8.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = UiR.string.account_temporarily_blocked),
|
text = stringResource(id = R.string.account_temporarily_blocked),
|
||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
|
|
||||||
)
|
)
|
||||||
@@ -94,7 +94,7 @@ fun UserBannedScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = buildAnnotatedString {
|
text = buildAnnotatedString {
|
||||||
withStyle(SpanStyle(fontWeight = FontWeight.Medium)) {
|
withStyle(SpanStyle(fontWeight = FontWeight.Medium)) {
|
||||||
append(stringResource(id = UiR.string.user_name))
|
append(stringResource(id = R.string.user_name))
|
||||||
append(": ")
|
append(": ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ fun UserBannedScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = buildAnnotatedString {
|
text = buildAnnotatedString {
|
||||||
withStyle(SpanStyle(fontWeight = FontWeight.Medium)) {
|
withStyle(SpanStyle(fontWeight = FontWeight.Medium)) {
|
||||||
append(stringResource(id = UiR.string.blocking_reason_title))
|
append(stringResource(id = R.string.blocking_reason_title))
|
||||||
append(": ")
|
append(": ")
|
||||||
}
|
}
|
||||||
append(screenState.message)
|
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.MaterialDialog
|
||||||
import dev.meloda.fast.ui.components.TextFieldErrorText
|
import dev.meloda.fast.ui.components.TextFieldErrorText
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ValidationRoute(
|
fun ValidationRoute(
|
||||||
@@ -142,11 +142,11 @@ fun ValidationScreen(
|
|||||||
if (showExitAlert) {
|
if (showExitAlert) {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { showExitAlert = false },
|
onDismissRequest = { showExitAlert = false },
|
||||||
title = stringResource(id = UiR.string.warning_confirmation),
|
title = stringResource(id = R.string.warning_confirmation),
|
||||||
text = stringResource(id = UiR.string.validation_exit_warning),
|
text = stringResource(id = R.string.validation_exit_warning),
|
||||||
confirmAction = { confirmedExit = true },
|
confirmAction = { confirmedExit = true },
|
||||||
confirmText = stringResource(id = UiR.string.yes),
|
confirmText = stringResource(id = R.string.yes),
|
||||||
cancelText = stringResource(id = UiR.string.no),
|
cancelText = stringResource(id = R.string.no),
|
||||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -223,7 +223,7 @@ fun ValidationScreen(
|
|||||||
.semantics { contentType = ContentType.SmsOtpCode },
|
.semantics { contentType = ContentType.SmsOtpCode },
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.round_qr_code_24),
|
painter = painterResource(id = R.drawable.round_qr_code_24),
|
||||||
contentDescription = "QR Code icon",
|
contentDescription = "QR Code icon",
|
||||||
tint = if (screenState.codeError) {
|
tint = if (screenState.codeError) {
|
||||||
MaterialTheme.colorScheme.error
|
MaterialTheme.colorScheme.error
|
||||||
@@ -271,7 +271,7 @@ fun ValidationScreen(
|
|||||||
},
|
},
|
||||||
icon = {
|
icon = {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.round_sms_24),
|
painter = painterResource(id = R.drawable.round_sms_24),
|
||||||
tint = MaterialTheme.colorScheme.onPrimary,
|
tint = MaterialTheme.colorScheme.onPrimary,
|
||||||
contentDescription = "SMS icon"
|
contentDescription = "SMS icon"
|
||||||
)
|
)
|
||||||
|
|||||||
+7
-7
@@ -58,7 +58,7 @@ import dev.meloda.fast.ui.theme.LocalThemeConfig
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import org.koin.core.qualifier.named
|
import org.koin.core.qualifier.named
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ChatMaterialsRoute(
|
fun ChatMaterialsRoute(
|
||||||
@@ -88,11 +88,11 @@ fun ChatMaterialsScreen(
|
|||||||
|
|
||||||
val titles = remember {
|
val titles = remember {
|
||||||
listOf(
|
listOf(
|
||||||
UiR.string.chat_attachment_photos,
|
R.string.chat_attachment_photos,
|
||||||
UiR.string.chat_attachment_videos,
|
R.string.chat_attachment_videos,
|
||||||
UiR.string.chat_attachment_music,
|
R.string.chat_attachment_music,
|
||||||
UiR.string.chat_attachment_files,
|
R.string.chat_attachment_files,
|
||||||
UiR.string.chat_attachment_links,
|
R.string.chat_attachment_links,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ fun ChatMaterialsScreen(
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(UiR.string.chat_materials_title),
|
text = stringResource(R.string.chat_materials_title),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
style = MaterialTheme.typography.headlineSmall
|
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 dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import dev.meloda.fast.ui.R as UiR
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -158,7 +157,7 @@ fun AudioMaterialsScreen(
|
|||||||
.background(MaterialTheme.colorScheme.primary)
|
.background(MaterialTheme.colorScheme.primary)
|
||||||
.size(42.dp)
|
.size(42.dp)
|
||||||
.padding(4.dp),
|
.padding(4.dp),
|
||||||
painter = painterResource(UiR.drawable.round_play_arrow_24),
|
painter = painterResource(R.drawable.round_play_arrow_24),
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = contentColorFor(MaterialTheme.colorScheme.primary)
|
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.conversations.model.ConversationsScreenState
|
||||||
import dev.meloda.fast.ui.components.MaterialDialog
|
import dev.meloda.fast.ui.components.MaterialDialog
|
||||||
|
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HandleDialogs(
|
fun HandleDialogs(
|
||||||
@@ -24,50 +24,50 @@ fun HandleDialogs(
|
|||||||
is ConversationDialog.ConversationArchive -> {
|
is ConversationDialog.ConversationArchive -> {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(dialog) },
|
onDismissRequest = { onDismissed(dialog) },
|
||||||
title = stringResource(id = UiR.string.confirm_archive_conversation),
|
title = stringResource(id = R.string.confirm_archive_conversation),
|
||||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(id = UiR.string.action_archive),
|
confirmText = stringResource(id = R.string.action_archive),
|
||||||
cancelText = stringResource(id = UiR.string.cancel)
|
cancelText = stringResource(id = R.string.cancel)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ConversationDialog.ConversationUnarchive -> {
|
is ConversationDialog.ConversationUnarchive -> {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(dialog) },
|
onDismissRequest = { onDismissed(dialog) },
|
||||||
title = stringResource(id = UiR.string.confirm_unarchive_conversation),
|
title = stringResource(id = R.string.confirm_unarchive_conversation),
|
||||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(id = UiR.string.action_unarchive),
|
confirmText = stringResource(id = R.string.action_unarchive),
|
||||||
cancelText = stringResource(id = UiR.string.cancel)
|
cancelText = stringResource(id = R.string.cancel)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ConversationDialog.ConversationDelete -> {
|
is ConversationDialog.ConversationDelete -> {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(dialog) },
|
onDismissRequest = { onDismissed(dialog) },
|
||||||
title = stringResource(id = UiR.string.confirm_delete_conversation),
|
title = stringResource(id = R.string.confirm_delete_conversation),
|
||||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(id = UiR.string.action_delete),
|
confirmText = stringResource(id = R.string.action_delete),
|
||||||
cancelText = stringResource(id = UiR.string.cancel)
|
cancelText = stringResource(id = R.string.cancel)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ConversationDialog.ConversationPin -> {
|
is ConversationDialog.ConversationPin -> {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(dialog) },
|
onDismissRequest = { onDismissed(dialog) },
|
||||||
title = stringResource(id = UiR.string.confirm_pin_conversation),
|
title = stringResource(id = R.string.confirm_pin_conversation),
|
||||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(id = UiR.string.action_pin),
|
confirmText = stringResource(id = R.string.action_pin),
|
||||||
cancelText = stringResource(id = UiR.string.cancel)
|
cancelText = stringResource(id = R.string.cancel)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ConversationDialog.ConversationUnpin -> {
|
is ConversationDialog.ConversationUnpin -> {
|
||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(dialog) },
|
onDismissRequest = { onDismissed(dialog) },
|
||||||
title = stringResource(id = UiR.string.confirm_unpin_conversation),
|
title = stringResource(id = R.string.confirm_unpin_conversation),
|
||||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(id = UiR.string.action_unpin),
|
confirmText = stringResource(id = R.string.action_unpin),
|
||||||
cancelText = stringResource(id = UiR.string.cancel)
|
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.getImage
|
||||||
import dev.meloda.fast.ui.util.getResourcePainter
|
import dev.meloda.fast.ui.util.getResourcePainter
|
||||||
import dev.meloda.fast.ui.util.getString
|
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)
|
val BirthdayColor = Color(0xffb00b69)
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ fun ConversationItem(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.size(32.dp),
|
.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",
|
contentDescription = "Favorites icon",
|
||||||
tint = MaterialTheme.colorScheme.onPrimary
|
tint = MaterialTheme.colorScheme.onPrimary
|
||||||
)
|
)
|
||||||
@@ -150,7 +150,7 @@ fun ConversationItem(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.clip(CircleShape),
|
.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
|
modifier = Modifier
|
||||||
.height(14.dp)
|
.height(14.dp)
|
||||||
.align(Alignment.Center),
|
.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",
|
contentDescription = "Pin icon",
|
||||||
tint = Color.White
|
tint = Color.White
|
||||||
)
|
)
|
||||||
@@ -222,7 +222,7 @@ fun ConversationItem(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.size(10.dp),
|
.size(10.dp),
|
||||||
painter = painterResource(id = UiR.drawable.round_cake_24),
|
painter = painterResource(id = R.drawable.round_cake_24),
|
||||||
contentDescription = "Birthday icon",
|
contentDescription = "Birthday icon",
|
||||||
tint = Color.White
|
tint = Color.White
|
||||||
)
|
)
|
||||||
|
|||||||
+8
-8
@@ -78,7 +78,7 @@ import dev.meloda.fast.ui.util.emptyImmutableList
|
|||||||
import dev.meloda.fast.ui.util.isScrollingUp
|
import dev.meloda.fast.ui.util.isScrollingUp
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.flow.debounce
|
import kotlinx.coroutines.flow.debounce
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@OptIn(
|
@OptIn(
|
||||||
ExperimentalMaterial3Api::class,
|
ExperimentalMaterial3Api::class,
|
||||||
@@ -185,9 +185,9 @@ fun ConversationsScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
id = when {
|
id = when {
|
||||||
screenState.isLoading -> UiR.string.title_loading
|
screenState.isLoading -> R.string.title_loading
|
||||||
screenState.isArchive -> UiR.string.title_archive
|
screenState.isArchive -> R.string.title_archive
|
||||||
else -> UiR.string.title_conversations
|
else -> R.string.title_conversations
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@@ -209,7 +209,7 @@ fun ConversationsScreen(
|
|||||||
if (!screenState.isArchive) {
|
if (!screenState.isArchive) {
|
||||||
IconButton(onClick = onArchiveActionClicked) {
|
IconButton(onClick = onArchiveActionClicked) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(UiR.drawable.outline_archive_24),
|
painter = painterResource(R.drawable.outline_archive_24),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ fun ConversationsScreen(
|
|||||||
dropDownMenuExpanded = false
|
dropDownMenuExpanded = false
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(text = stringResource(id = UiR.string.action_refresh))
|
Text(text = stringResource(id = R.string.action_refresh))
|
||||||
},
|
},
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -287,7 +287,7 @@ fun ConversationsScreen(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.round_create_24),
|
painter = painterResource(id = R.drawable.round_create_24),
|
||||||
contentDescription = "Add chat button"
|
contentDescription = "Add chat button"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -347,7 +347,7 @@ fun ConversationsScreen(
|
|||||||
|
|
||||||
if (conversations.isEmpty()) {
|
if (conversations.isEmpty()) {
|
||||||
NoItemsView(
|
NoItemsView(
|
||||||
buttonText = stringResource(UiR.string.action_refresh),
|
buttonText = stringResource(R.string.action_refresh),
|
||||||
onButtonClick = onRefresh
|
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.VkConversation
|
||||||
import dev.meloda.fast.model.api.domain.VkMessage
|
import dev.meloda.fast.model.api.domain.VkMessage
|
||||||
import dev.meloda.fast.model.api.domain.VkVideoDomain
|
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.ActionState
|
||||||
import dev.meloda.fast.ui.model.api.ConversationOption
|
import dev.meloda.fast.ui.model.api.ConversationOption
|
||||||
import dev.meloda.fast.ui.model.api.UiConversation
|
import dev.meloda.fast.ui.model.api.UiConversation
|
||||||
@@ -32,7 +33,6 @@ import java.util.Calendar
|
|||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import kotlin.math.ln
|
import kotlin.math.ln
|
||||||
import kotlin.math.pow
|
import kotlin.math.pow
|
||||||
import dev.meloda.fast.ui.R as UiR
|
|
||||||
|
|
||||||
fun VkConversation.asPresentation(
|
fun VkConversation.asPresentation(
|
||||||
resources: Resources,
|
resources: Resources,
|
||||||
@@ -45,7 +45,14 @@ fun VkConversation.asPresentation(
|
|||||||
avatar = extractAvatar(),
|
avatar = extractAvatar(),
|
||||||
title = extractTitle(this, useContactName, resources),
|
title = extractTitle(this, useContactName, resources),
|
||||||
unreadCount = extractUnreadCount(lastMessage, this),
|
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),
|
message = extractMessage(resources, lastMessage, id, peerType),
|
||||||
attachmentImage = if (lastMessage?.text == null) null
|
attachmentImage = if (lastMessage?.text == null) null
|
||||||
else getAttachmentConversationIcon(lastMessage),
|
else getAttachmentConversationIcon(lastMessage),
|
||||||
@@ -76,7 +83,7 @@ fun VkConversation.extractAvatar() = when (peerType) {
|
|||||||
PeerType.CHAT -> {
|
PeerType.CHAT -> {
|
||||||
photo200
|
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(
|
private fun extractTitle(
|
||||||
conversation: VkConversation,
|
conversation: VkConversation,
|
||||||
@@ -85,7 +92,7 @@ private fun extractTitle(
|
|||||||
) = when (conversation.peerType) {
|
) = when (conversation.peerType) {
|
||||||
PeerType.USER -> {
|
PeerType.USER -> {
|
||||||
if (isAccount(conversation.id)) {
|
if (isAccount(conversation.id)) {
|
||||||
UiText.Resource(UiR.string.favorites)
|
UiText.Resource(R.string.favorites)
|
||||||
} else {
|
} else {
|
||||||
val userName = conversation.user?.let { user ->
|
val userName = conversation.user?.let { user ->
|
||||||
if (useContactName) {
|
if (useContactName) {
|
||||||
@@ -130,7 +137,7 @@ private fun extractMessage(
|
|||||||
peerId: Long,
|
peerId: Long,
|
||||||
peerType: PeerType
|
peerType: PeerType
|
||||||
): AnnotatedString {
|
): AnnotatedString {
|
||||||
val youPrefix = UiText.Resource(UiR.string.you_message_prefix)
|
val youPrefix = UiText.Resource(R.string.you_message_prefix)
|
||||||
.parseString(resources)
|
.parseString(resources)
|
||||||
.orDots()
|
.orDots()
|
||||||
|
|
||||||
@@ -265,7 +272,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_CREATE -> {
|
VkMessage.Action.CHAT_CREATE -> {
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_created,
|
R.string.message_action_chat_created,
|
||||||
listOf(prefix, text)
|
listOf(prefix, text)
|
||||||
).parseString(resources).orEmpty()
|
).parseString(resources).orEmpty()
|
||||||
|
|
||||||
@@ -288,7 +295,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_TITLE_UPDATE -> {
|
VkMessage.Action.CHAT_TITLE_UPDATE -> {
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_renamed,
|
R.string.message_action_chat_renamed,
|
||||||
listOf(prefix, text)
|
listOf(prefix, text)
|
||||||
).parseString(resources).orEmpty()
|
).parseString(resources).orEmpty()
|
||||||
|
|
||||||
@@ -311,7 +318,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_PHOTO_UPDATE -> {
|
VkMessage.Action.CHAT_PHOTO_UPDATE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_photo_update,
|
R.string.message_action_chat_photo_update,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -324,7 +331,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_PHOTO_REMOVE -> {
|
VkMessage.Action.CHAT_PHOTO_REMOVE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_photo_remove,
|
R.string.message_action_chat_photo_remove,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -338,7 +345,7 @@ private fun extractActionText(
|
|||||||
VkMessage.Action.CHAT_KICK_USER -> {
|
VkMessage.Action.CHAT_KICK_USER -> {
|
||||||
if (memberId == fromId) {
|
if (memberId == fromId) {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_left,
|
R.string.message_action_chat_user_left,
|
||||||
listOf(memberPrefix)
|
listOf(memberPrefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -353,7 +360,7 @@ private fun extractActionText(
|
|||||||
else lastMessage.actionUser.toString()
|
else lastMessage.actionUser.toString()
|
||||||
|
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_kicked,
|
R.string.message_action_chat_user_kicked,
|
||||||
listOf(prefix, postfix)
|
listOf(prefix, postfix)
|
||||||
).parseString(resources).orEmpty()
|
).parseString(resources).orEmpty()
|
||||||
|
|
||||||
@@ -378,7 +385,7 @@ private fun extractActionText(
|
|||||||
VkMessage.Action.CHAT_INVITE_USER -> {
|
VkMessage.Action.CHAT_INVITE_USER -> {
|
||||||
if (memberId == lastMessage.fromId) {
|
if (memberId == lastMessage.fromId) {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_returned,
|
R.string.message_action_chat_user_returned,
|
||||||
listOf(memberPrefix)
|
listOf(memberPrefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -393,7 +400,7 @@ private fun extractActionText(
|
|||||||
else lastMessage.actionUser.toString()
|
else lastMessage.actionUser.toString()
|
||||||
|
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_invited,
|
R.string.message_action_chat_user_invited,
|
||||||
listOf(memberPrefix, postfix)
|
listOf(memberPrefix, postfix)
|
||||||
).parseString(resources).orEmpty()
|
).parseString(resources).orEmpty()
|
||||||
|
|
||||||
@@ -411,7 +418,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_INVITE_USER_BY_LINK -> {
|
VkMessage.Action.CHAT_INVITE_USER_BY_LINK -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_joined_by_link,
|
R.string.message_action_chat_user_joined_by_link,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -424,7 +431,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_INVITE_USER_BY_CALL -> {
|
VkMessage.Action.CHAT_INVITE_USER_BY_CALL -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_joined_by_call,
|
R.string.message_action_chat_user_joined_by_call,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -437,7 +444,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_INVITE_USER_BY_CALL_LINK -> {
|
VkMessage.Action.CHAT_INVITE_USER_BY_CALL_LINK -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_joined_by_call_link,
|
R.string.message_action_chat_user_joined_by_call_link,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -450,7 +457,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_PIN_MESSAGE -> {
|
VkMessage.Action.CHAT_PIN_MESSAGE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_pin_message,
|
R.string.message_action_chat_pin_message,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -463,7 +470,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_UNPIN_MESSAGE -> {
|
VkMessage.Action.CHAT_UNPIN_MESSAGE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_unpin_message,
|
R.string.message_action_chat_unpin_message,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -476,7 +483,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_SCREENSHOT -> {
|
VkMessage.Action.CHAT_SCREENSHOT -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_screenshot,
|
R.string.message_action_chat_screenshot,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -489,7 +496,7 @@ private fun extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_STYLE_UPDATE -> {
|
VkMessage.Action.CHAT_STYLE_UPDATE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_style_update,
|
R.string.message_action_chat_style_update,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources).orEmpty().let(::append)
|
).parseString(resources).orEmpty().let(::append)
|
||||||
|
|
||||||
@@ -510,9 +517,9 @@ private fun extractAttachmentIcon(
|
|||||||
lastMessage.text == null -> null
|
lastMessage.text == null -> null
|
||||||
!lastMessage.forwards.isNullOrEmpty() -> {
|
!lastMessage.forwards.isNullOrEmpty() -> {
|
||||||
if (lastMessage.forwards.orEmpty().size == 1) {
|
if (lastMessage.forwards.orEmpty().size == 1) {
|
||||||
UiImage.Resource(UiR.drawable.ic_attachment_forwarded_message)
|
UiImage.Resource(R.drawable.ic_attachment_forwarded_message)
|
||||||
} else {
|
} 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.isEmpty()) return null
|
||||||
if (attachments.size == 1 || isAttachmentsHaveOneType(attachments)) {
|
if (attachments.size == 1 || isAttachmentsHaveOneType(attachments)) {
|
||||||
lastMessage.geoType?.let {
|
lastMessage.geoType?.let {
|
||||||
return UiImage.Resource(UiR.drawable.ic_map_marker)
|
return UiImage.Resource(R.drawable.ic_map_marker)
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttachmentIconByType(attachments.first().type)
|
getAttachmentIconByType(attachments.first().type)
|
||||||
} else {
|
} 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)) {
|
withStyle(style = SpanStyle(fontWeight = FontWeight.SemiBold)) {
|
||||||
when (lastMessage.geoType) {
|
when (lastMessage.geoType) {
|
||||||
"point" -> {
|
"point" -> {
|
||||||
UiText.Resource(UiR.string.message_geo_point)
|
UiText.Resource(R.string.message_geo_point)
|
||||||
.parseString(resources)
|
.parseString(resources)
|
||||||
.let(::append)
|
.let(::append)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
UiText.Resource(UiR.string.message_geo)
|
UiText.Resource(R.string.message_geo)
|
||||||
.parseString(resources)
|
.parseString(resources)
|
||||||
.let(::append)
|
.let(::append)
|
||||||
}
|
}
|
||||||
@@ -583,7 +590,7 @@ private fun extractAttachmentText(
|
|||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
UiText.Resource(UiR.string.message_attachments_many)
|
UiText.Resource(R.string.message_attachments_many)
|
||||||
.parseString(resources)
|
.parseString(resources)
|
||||||
.let(::append)
|
.let(::append)
|
||||||
}
|
}
|
||||||
@@ -598,22 +605,22 @@ private fun extractAttachmentText(
|
|||||||
|
|
||||||
private fun getAttachmentIconByType(attachmentType: AttachmentType): UiImage? {
|
private fun getAttachmentIconByType(attachmentType: AttachmentType): UiImage? {
|
||||||
return when (attachmentType) {
|
return when (attachmentType) {
|
||||||
AttachmentType.PHOTO -> UiR.drawable.ic_attachment_photo
|
AttachmentType.PHOTO -> R.drawable.ic_attachment_photo
|
||||||
AttachmentType.VIDEO -> UiR.drawable.ic_attachment_video
|
AttachmentType.VIDEO -> R.drawable.ic_attachment_video
|
||||||
AttachmentType.AUDIO -> UiR.drawable.ic_attachment_audio
|
AttachmentType.AUDIO -> R.drawable.ic_attachment_audio
|
||||||
AttachmentType.FILE -> UiR.drawable.ic_attachment_file
|
AttachmentType.FILE -> R.drawable.ic_attachment_file
|
||||||
AttachmentType.LINK -> UiR.drawable.ic_attachment_link
|
AttachmentType.LINK -> R.drawable.ic_attachment_link
|
||||||
AttachmentType.AUDIO_MESSAGE -> UiR.drawable.ic_attachment_voice
|
AttachmentType.AUDIO_MESSAGE -> R.drawable.ic_attachment_voice
|
||||||
AttachmentType.MINI_APP -> UiR.drawable.ic_attachment_mini_app
|
AttachmentType.MINI_APP -> R.drawable.ic_attachment_mini_app
|
||||||
AttachmentType.STICKER -> UiR.drawable.ic_attachment_sticker
|
AttachmentType.STICKER -> R.drawable.ic_attachment_sticker
|
||||||
AttachmentType.GIFT -> UiR.drawable.ic_attachment_gift
|
AttachmentType.GIFT -> R.drawable.ic_attachment_gift
|
||||||
AttachmentType.WALL -> UiR.drawable.ic_attachment_wall
|
AttachmentType.WALL -> R.drawable.ic_attachment_wall
|
||||||
AttachmentType.GRAFFITI -> UiR.drawable.ic_attachment_graffiti
|
AttachmentType.GRAFFITI -> R.drawable.ic_attachment_graffiti
|
||||||
AttachmentType.POLL -> UiR.drawable.ic_attachment_poll
|
AttachmentType.POLL -> R.drawable.ic_attachment_poll
|
||||||
AttachmentType.WALL_REPLY -> UiR.drawable.ic_attachment_wall_reply
|
AttachmentType.WALL_REPLY -> R.drawable.ic_attachment_wall_reply
|
||||||
AttachmentType.CALL -> UiR.drawable.ic_attachment_call
|
AttachmentType.CALL -> R.drawable.ic_attachment_call
|
||||||
AttachmentType.GROUP_CALL_IN_PROGRESS -> UiR.drawable.ic_attachment_group_call
|
AttachmentType.GROUP_CALL_IN_PROGRESS -> R.drawable.ic_attachment_group_call
|
||||||
AttachmentType.STORY -> UiR.drawable.ic_attachment_story
|
AttachmentType.STORY -> R.drawable.ic_attachment_story
|
||||||
AttachmentType.UNKNOWN -> null
|
AttachmentType.UNKNOWN -> null
|
||||||
AttachmentType.CURATOR -> null
|
AttachmentType.CURATOR -> null
|
||||||
AttachmentType.EVENT -> null
|
AttachmentType.EVENT -> null
|
||||||
@@ -624,7 +631,7 @@ private fun getAttachmentIconByType(attachmentType: AttachmentType): UiImage? {
|
|||||||
AttachmentType.NARRATIVE -> null
|
AttachmentType.NARRATIVE -> null
|
||||||
AttachmentType.ARTICLE -> null
|
AttachmentType.ARTICLE -> null
|
||||||
AttachmentType.VIDEO_MESSAGE -> 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
|
AttachmentType.STICKER_PACK_PREVIEW -> null
|
||||||
}?.let(UiImage::Resource)
|
}?.let(UiImage::Resource)
|
||||||
}
|
}
|
||||||
@@ -653,8 +660,8 @@ private fun extractForwardsText(
|
|||||||
withStyle(style = SpanStyle(fontWeight = FontWeight.SemiBold)) {
|
withStyle(style = SpanStyle(fontWeight = FontWeight.SemiBold)) {
|
||||||
append(
|
append(
|
||||||
UiText.Resource(
|
UiText.Resource(
|
||||||
if (forwards.size == 1) UiR.string.forwarded_message
|
if (forwards.size == 1) R.string.forwarded_message
|
||||||
else UiR.string.forwarded_messages
|
else R.string.forwarded_messages
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -732,15 +739,15 @@ private fun getAttachmentUiText(
|
|||||||
if (attachment.type == AttachmentType.VIDEO &&
|
if (attachment.type == AttachmentType.VIDEO &&
|
||||||
(attachment as? VkVideoDomain)?.isShortVideo == true
|
(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()) {
|
if (attachment.type.isMultiple()) {
|
||||||
return when (attachment.type) {
|
return when (attachment.type) {
|
||||||
AttachmentType.PHOTO -> UiR.plurals.attachment_photos
|
AttachmentType.PHOTO -> R.plurals.attachment_photos
|
||||||
AttachmentType.VIDEO -> UiR.plurals.attachment_videos
|
AttachmentType.VIDEO -> R.plurals.attachment_videos
|
||||||
AttachmentType.AUDIO -> UiR.plurals.attachment_audios
|
AttachmentType.AUDIO -> R.plurals.attachment_audios
|
||||||
AttachmentType.FILE -> UiR.plurals.attachment_files
|
AttachmentType.FILE -> R.plurals.attachment_files
|
||||||
else -> throw IllegalArgumentException("Unknown multiple type: ${attachment.type}")
|
else -> throw IllegalArgumentException("Unknown multiple type: ${attachment.type}")
|
||||||
}.let { resId -> UiText.QuantityResource(resId, size) }
|
}.let { resId -> UiText.QuantityResource(resId, size) }
|
||||||
}
|
}
|
||||||
@@ -754,29 +761,29 @@ private fun getAttachmentUiText(
|
|||||||
throw IllegalArgumentException("Unknown multiple type: ${attachment.type}")
|
throw IllegalArgumentException("Unknown multiple type: ${attachment.type}")
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachmentType.LINK -> UiR.string.message_attachments_link
|
AttachmentType.LINK -> R.string.message_attachments_link
|
||||||
AttachmentType.AUDIO_MESSAGE -> UiR.string.message_attachments_audio_message
|
AttachmentType.AUDIO_MESSAGE -> R.string.message_attachments_audio_message
|
||||||
AttachmentType.MINI_APP -> UiR.string.message_attachments_mini_app
|
AttachmentType.MINI_APP -> R.string.message_attachments_mini_app
|
||||||
AttachmentType.STICKER -> UiR.string.message_attachments_sticker
|
AttachmentType.STICKER -> R.string.message_attachments_sticker
|
||||||
AttachmentType.GIFT -> UiR.string.message_attachments_gift
|
AttachmentType.GIFT -> R.string.message_attachments_gift
|
||||||
AttachmentType.WALL -> UiR.string.message_attachments_wall
|
AttachmentType.WALL -> R.string.message_attachments_wall
|
||||||
AttachmentType.GRAFFITI -> UiR.string.message_attachments_graffiti
|
AttachmentType.GRAFFITI -> R.string.message_attachments_graffiti
|
||||||
AttachmentType.POLL -> UiR.string.message_attachments_poll
|
AttachmentType.POLL -> R.string.message_attachments_poll
|
||||||
AttachmentType.WALL_REPLY -> UiR.string.message_attachments_wall_reply
|
AttachmentType.WALL_REPLY -> R.string.message_attachments_wall_reply
|
||||||
AttachmentType.CALL -> UiR.string.message_attachments_call
|
AttachmentType.CALL -> R.string.message_attachments_call
|
||||||
AttachmentType.GROUP_CALL_IN_PROGRESS -> UiR.string.message_attachments_call_in_progress
|
AttachmentType.GROUP_CALL_IN_PROGRESS -> R.string.message_attachments_call_in_progress
|
||||||
AttachmentType.CURATOR -> UiR.string.message_attachments_curator
|
AttachmentType.CURATOR -> R.string.message_attachments_curator
|
||||||
AttachmentType.EVENT -> UiR.string.message_attachments_event
|
AttachmentType.EVENT -> R.string.message_attachments_event
|
||||||
AttachmentType.STORY -> UiR.string.message_attachments_story
|
AttachmentType.STORY -> R.string.message_attachments_story
|
||||||
AttachmentType.WIDGET -> UiR.string.message_attachments_widget
|
AttachmentType.WIDGET -> R.string.message_attachments_widget
|
||||||
AttachmentType.ARTIST -> UiR.string.message_attachments_artist
|
AttachmentType.ARTIST -> R.string.message_attachments_artist
|
||||||
AttachmentType.AUDIO_PLAYLIST -> UiR.string.message_attachments_audio_playlist
|
AttachmentType.AUDIO_PLAYLIST -> R.string.message_attachments_audio_playlist
|
||||||
AttachmentType.PODCAST -> UiR.string.message_attachments_podcast
|
AttachmentType.PODCAST -> R.string.message_attachments_podcast
|
||||||
AttachmentType.NARRATIVE -> UiR.string.message_attachments_narrative
|
AttachmentType.NARRATIVE -> R.string.message_attachments_narrative
|
||||||
AttachmentType.ARTICLE -> UiR.string.message_attachments_article
|
AttachmentType.ARTICLE -> R.string.message_attachments_article
|
||||||
AttachmentType.VIDEO_MESSAGE -> UiR.string.message_attachments_video_message
|
AttachmentType.VIDEO_MESSAGE -> R.string.message_attachments_video_message
|
||||||
AttachmentType.GROUP_CHAT_STICKER -> UiR.string.message_attachments_group_sticker
|
AttachmentType.GROUP_CHAT_STICKER -> R.string.message_attachments_group_sticker
|
||||||
AttachmentType.STICKER_PACK_PREVIEW -> UiR.string.message_attachments_sticker_pack_preview
|
AttachmentType.STICKER_PACK_PREVIEW -> R.string.message_attachments_sticker_pack_preview
|
||||||
}.let(UiText::Resource)
|
}.let(UiText::Resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,11 +792,11 @@ private fun getAttachmentConversationIcon(message: VkMessage?): UiImage? {
|
|||||||
if (attachments.isEmpty()) return null
|
if (attachments.isEmpty()) return null
|
||||||
if (attachments.size == 1 || isAttachmentsHaveOneType(attachments)) {
|
if (attachments.size == 1 || isAttachmentsHaveOneType(attachments)) {
|
||||||
message.geoType?.let {
|
message.geoType?.let {
|
||||||
return UiImage.Resource(UiR.drawable.ic_map_marker)
|
return UiImage.Resource(R.drawable.ic_map_marker)
|
||||||
}
|
}
|
||||||
getAttachmentIconByType(attachments.first().type)
|
getAttachmentIconByType(attachments.first().type)
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
if (!conversation.peerType.isChat() && interactiveUsers.size == 1) {
|
if (!conversation.peerType.isChat() && interactiveUsers.size == 1) {
|
||||||
when (interactionType) {
|
when (interactionType) {
|
||||||
InteractionType.File -> UiR.string.chat_interaction_uploading_file
|
InteractionType.File -> R.string.chat_interaction_uploading_file
|
||||||
InteractionType.Photo -> UiR.string.chat_interaction_uploading_photo
|
InteractionType.Photo -> R.string.chat_interaction_uploading_photo
|
||||||
InteractionType.Typing -> UiR.string.chat_interaction_typing
|
InteractionType.Typing -> R.string.chat_interaction_typing
|
||||||
InteractionType.Video -> UiR.string.chat_interaction_uploading_video
|
InteractionType.Video -> R.string.chat_interaction_uploading_video
|
||||||
InteractionType.VoiceMessage -> UiR.string.chat_interaction_recording_audio_message
|
InteractionType.VoiceMessage -> R.string.chat_interaction_recording_audio_message
|
||||||
}.let(UiText::Resource)
|
}.let(UiText::Resource)
|
||||||
} else {
|
} else {
|
||||||
if (interactiveUsers.size == 1) {
|
if (interactiveUsers.size == 1) {
|
||||||
UiR.string.chat_interaction_chat_single_typing
|
R.string.chat_interaction_chat_single_typing
|
||||||
} else {
|
} else {
|
||||||
UiR.string.chat_interaction_chat_typing
|
R.string.chat_interaction_chat_typing
|
||||||
}.let { resId ->
|
}.let { resId ->
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
resId,
|
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.LocalHazeState
|
||||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||||
import dev.meloda.fast.ui.util.isScrollingUp
|
import dev.meloda.fast.ui.util.isScrollingUp
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CreateChatRoute(
|
fun CreateChatRoute(
|
||||||
@@ -195,8 +195,8 @@ fun CreateChatScreen(
|
|||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
id = if (screenState.isLoading) UiR.string.title_loading
|
id = if (screenState.isLoading) R.string.title_loading
|
||||||
else UiR.string.title_create_chat
|
else R.string.title_create_chat
|
||||||
),
|
),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
@@ -231,8 +231,8 @@ fun CreateChatScreen(
|
|||||||
.onFocusChanged { isTextFieldFocused = it.hasFocus },
|
.onFocusChanged { isTextFieldFocused = it.hasFocus },
|
||||||
value = screenState.chatTitle,
|
value = screenState.chatTitle,
|
||||||
onValueChange = onTitleTextInputChanged,
|
onValueChange = onTitleTextInputChanged,
|
||||||
label = { Text(text = stringResource(UiR.string.create_chat_title)) },
|
label = { Text(text = stringResource(R.string.create_chat_title)) },
|
||||||
placeholder = { Text(text = stringResource(UiR.string.create_chat_title)) },
|
placeholder = { Text(text = stringResource(R.string.create_chat_title)) },
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
colors = TextFieldDefaults.colors(
|
colors = TextFieldDefaults.colors(
|
||||||
unfocusedIndicatorColor = Color.Transparent,
|
unfocusedIndicatorColor = Color.Transparent,
|
||||||
@@ -252,7 +252,7 @@ fun CreateChatScreen(
|
|||||||
ExtendedFloatingActionButton(
|
ExtendedFloatingActionButton(
|
||||||
onClick = onCreateChatButtonClicked,
|
onClick = onCreateChatButtonClicked,
|
||||||
expanded = listState.isScrollingUp(),
|
expanded = listState.isScrollingUp(),
|
||||||
text = { Text(text = stringResource(UiR.string.action_create)) },
|
text = { Text(text = stringResource(R.string.action_create)) },
|
||||||
icon = {
|
icon = {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Rounded.Done,
|
imageVector = Icons.Rounded.Done,
|
||||||
@@ -309,7 +309,7 @@ fun CreateChatScreen(
|
|||||||
|
|
||||||
if (screenState.friends.isEmpty()) {
|
if (screenState.friends.isEmpty()) {
|
||||||
NoItemsView(
|
NoItemsView(
|
||||||
buttonText = stringResource(UiR.string.action_refresh),
|
buttonText = stringResource(R.string.action_refresh),
|
||||||
onButtonClick = onRefresh
|
onButtonClick = onRefresh
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-8
@@ -54,7 +54,6 @@ import dev.meloda.fast.ui.theme.LocalThemeConfig
|
|||||||
import dev.meloda.fast.ui.util.ImmutableList
|
import dev.meloda.fast.ui.util.ImmutableList
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.koin.androidx.viewmodel.ext.android.getViewModel
|
import org.koin.androidx.viewmodel.ext.android.getViewModel
|
||||||
import dev.meloda.fast.ui.R as UiR
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalHazeMaterialsApi::class)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalHazeMaterialsApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -120,11 +119,11 @@ fun FriendsRoute(
|
|||||||
|
|
||||||
var showOrderDialog by remember { mutableStateOf(false) }
|
var showOrderDialog by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val orderPriority = stringResource(UiR.string.friends_order_priority)
|
val orderPriority = stringResource(R.string.friends_order_priority)
|
||||||
val orderName = stringResource(UiR.string.friends_order_name)
|
val orderName = stringResource(R.string.friends_order_name)
|
||||||
val orderRandom = stringResource(UiR.string.friends_order_random)
|
val orderRandom = stringResource(R.string.friends_order_random)
|
||||||
val orderMobile = stringResource(UiR.string.friends_order_mobile)
|
val orderMobile = stringResource(R.string.friends_order_mobile)
|
||||||
val orderSmart = stringResource(UiR.string.friends_order_smart)
|
val orderSmart = stringResource(R.string.friends_order_smart)
|
||||||
|
|
||||||
val orderTitleItems = remember {
|
val orderTitleItems = remember {
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
@@ -158,7 +157,7 @@ fun FriendsRoute(
|
|||||||
onItemClick = {
|
onItemClick = {
|
||||||
selectedIndex = it
|
selectedIndex = it
|
||||||
},
|
},
|
||||||
title = stringResource(UiR.string.friends_order_by_title),
|
title = stringResource(R.string.friends_order_by_title),
|
||||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -202,7 +201,7 @@ fun FriendsRoute(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(UiR.drawable.round_filter_list_24),
|
painter = painterResource(R.drawable.round_filter_list_24),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-9
@@ -12,7 +12,7 @@ import dev.meloda.fast.languagepicker.model.SelectableLanguage
|
|||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
interface LanguagePickerViewModel {
|
interface LanguagePickerViewModel {
|
||||||
val screenState: StateFlow<LanguagePickerScreenState>
|
val screenState: StateFlow<LanguagePickerScreenState>
|
||||||
@@ -32,23 +32,23 @@ class LanguagePickerViewModelImpl(
|
|||||||
val languages = listOf(
|
val languages = listOf(
|
||||||
Triple(
|
Triple(
|
||||||
"",
|
"",
|
||||||
UiText.Resource(UiR.string.language_key_system),
|
UiText.Resource(R.string.language_key_system),
|
||||||
UiText.Resource(UiR.string.language_system)
|
UiText.Resource(R.string.language_system)
|
||||||
),
|
),
|
||||||
Triple(
|
Triple(
|
||||||
"en-US",
|
"en-US",
|
||||||
UiText.Resource(UiR.string.language_key_english),
|
UiText.Resource(R.string.language_key_english),
|
||||||
UiText.Resource(UiR.string.language_english),
|
UiText.Resource(R.string.language_english),
|
||||||
),
|
),
|
||||||
Triple(
|
Triple(
|
||||||
"ru-RU",
|
"ru-RU",
|
||||||
UiText.Resource(UiR.string.language_key_russian),
|
UiText.Resource(R.string.language_key_russian),
|
||||||
UiText.Resource(UiR.string.language_russian)
|
UiText.Resource(R.string.language_russian)
|
||||||
),
|
),
|
||||||
Triple(
|
Triple(
|
||||||
"uk-UA",
|
"uk-UA",
|
||||||
UiText.Resource(UiR.string.language_key_ukrainian),
|
UiText.Resource(R.string.language_key_ukrainian),
|
||||||
UiText.Resource(UiR.string.language_ukrainian)
|
UiText.Resource(R.string.language_ukrainian)
|
||||||
)
|
)
|
||||||
).map { (key, language, local) ->
|
).map { (key, language, local) ->
|
||||||
Triple(
|
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.LanguagePickerScreenState
|
||||||
import dev.meloda.fast.languagepicker.model.SelectableLanguage
|
import dev.meloda.fast.languagepicker.model.SelectableLanguage
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LanguagePickerRoute(
|
fun LanguagePickerRoute(
|
||||||
@@ -110,7 +110,7 @@ fun LanguagePickerScreen(
|
|||||||
LargeTopAppBar(
|
LargeTopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = UiR.string.title_application_language),
|
text = stringResource(id = R.string.title_application_language),
|
||||||
style = MaterialTheme.typography.headlineSmall
|
style = MaterialTheme.typography.headlineSmall
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -162,7 +162,7 @@ fun LanguagePickerScreen(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
text = {
|
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)
|
.align(Alignment.BottomCenter)
|
||||||
.height(64.dp)
|
.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 java.io.FileOutputStream
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
interface MessagesHistoryViewModel {
|
interface MessagesHistoryViewModel {
|
||||||
|
|
||||||
@@ -1188,7 +1188,7 @@ class MessagesHistoryViewModelImpl(
|
|||||||
clipboardManager.setPrimaryClip(ClipData.newPlainText("Message", messageToCopy))
|
clipboardManager.setPrimaryClip(ClipData.newPlainText("Message", messageToCopy))
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S) {
|
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()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-14
@@ -56,7 +56,7 @@ import dev.meloda.fast.datastore.AppSettings
|
|||||||
import dev.meloda.fast.messageshistory.model.ActionMode
|
import dev.meloda.fast.messageshistory.model.ActionMode
|
||||||
import dev.meloda.fast.ui.components.IconButton
|
import dev.meloda.fast.ui.components.IconButton
|
||||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
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)
|
@OptIn(ExperimentalLayoutApi::class, ExperimentalHazeMaterialsApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -154,7 +154,7 @@ fun MessagesHistoryInputBar(
|
|||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.ic_outline_emoji_emotions_24),
|
painter = painterResource(id = R.drawable.ic_outline_emoji_emotions_24),
|
||||||
contentDescription = "Emoji button",
|
contentDescription = "Emoji button",
|
||||||
tint = MaterialTheme.colorScheme.primary
|
tint = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
@@ -172,35 +172,35 @@ fun MessagesHistoryInputBar(
|
|||||||
|
|
||||||
item(
|
item(
|
||||||
key = "Bold",
|
key = "Bold",
|
||||||
label = context.getString(UiR.string.bold)
|
label = context.getString(R.string.bold)
|
||||||
) {
|
) {
|
||||||
onBoldRequested()
|
onBoldRequested()
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
item(
|
item(
|
||||||
key = "Italic",
|
key = "Italic",
|
||||||
label = context.getString(UiR.string.italic)
|
label = context.getString(R.string.italic)
|
||||||
) {
|
) {
|
||||||
onItalicRequested()
|
onItalicRequested()
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
item(
|
item(
|
||||||
key = "Underline",
|
key = "Underline",
|
||||||
label = context.getString(UiR.string.underline)
|
label = context.getString(R.string.underline)
|
||||||
) {
|
) {
|
||||||
onUnderlineRequested()
|
onUnderlineRequested()
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
item(
|
item(
|
||||||
key = "Link",
|
key = "Link",
|
||||||
label = context.getString(UiR.string.link)
|
label = context.getString(R.string.link)
|
||||||
) {
|
) {
|
||||||
onLinkRequested()
|
onLinkRequested()
|
||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
item(
|
item(
|
||||||
key = "Regular",
|
key = "Regular",
|
||||||
label = context.getString(UiR.string.regular)
|
label = context.getString(R.string.regular)
|
||||||
) {
|
) {
|
||||||
onRegularRequested()
|
onRegularRequested()
|
||||||
close()
|
close()
|
||||||
@@ -218,7 +218,7 @@ fun MessagesHistoryInputBar(
|
|||||||
),
|
),
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = UiR.string.message_input_hint),
|
text = stringResource(id = R.string.message_input_hint),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
@@ -238,7 +238,7 @@ fun MessagesHistoryInputBar(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.round_attach_file_24),
|
painter = painterResource(id = R.drawable.round_attach_file_24),
|
||||||
contentDescription = "Add attachment button",
|
contentDescription = "Add attachment button",
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
@@ -267,11 +267,11 @@ fun MessagesHistoryInputBar(
|
|||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(
|
painter = painterResource(
|
||||||
id = when (actionMode) {
|
id = when (actionMode) {
|
||||||
ActionMode.DELETE -> UiR.drawable.round_delete_outline_24
|
ActionMode.DELETE -> R.drawable.round_delete_outline_24
|
||||||
ActionMode.EDIT -> UiR.drawable.ic_round_done_24
|
ActionMode.EDIT -> R.drawable.ic_round_done_24
|
||||||
ActionMode.RECORD_AUDIO -> UiR.drawable.ic_round_mic_none_24
|
ActionMode.RECORD_AUDIO -> R.drawable.ic_round_mic_none_24
|
||||||
ActionMode.RECORD_VIDEO -> UiR.drawable.rounded_photo_camera_24
|
ActionMode.RECORD_VIDEO -> R.drawable.rounded_photo_camera_24
|
||||||
ActionMode.SEND -> UiR.drawable.round_send_24
|
ActionMode.SEND -> R.drawable.round_send_24
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
contentDescription = null,
|
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.ImmutableList
|
||||||
import dev.meloda.fast.ui.util.emptyImmutableList
|
import dev.meloda.fast.ui.util.emptyImmutableList
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@OptIn(
|
@OptIn(
|
||||||
ExperimentalMaterial3Api::class,
|
ExperimentalMaterial3Api::class,
|
||||||
@@ -167,7 +167,7 @@ fun MessagesHistoryScreen(
|
|||||||
val topBarTitle by remember(screenState, selectedMessages) {
|
val topBarTitle by remember(screenState, selectedMessages) {
|
||||||
derivedStateOf {
|
derivedStateOf {
|
||||||
when {
|
when {
|
||||||
screenState.isLoading -> context.getString(UiR.string.title_loading)
|
screenState.isLoading -> context.getString(R.string.title_loading)
|
||||||
selectedMessages.isNotEmpty() -> "(${selectedMessages.size})"
|
selectedMessages.isNotEmpty() -> "(${selectedMessages.size})"
|
||||||
else -> screenState.title
|
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.theme.LocalThemeConfig
|
||||||
import dev.meloda.fast.ui.util.getImage
|
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)
|
@OptIn(ExperimentalMaterial3Api::class, ExperimentalHazeMaterialsApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -114,7 +114,7 @@ fun MessagesHistoryTopBar(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.size(24.dp),
|
.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",
|
contentDescription = "Favorites icon",
|
||||||
tint = MaterialTheme.colorScheme.onPrimary
|
tint = MaterialTheme.colorScheme.onPrimary
|
||||||
)
|
)
|
||||||
@@ -137,7 +137,7 @@ fun MessagesHistoryTopBar(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(36.dp)
|
.size(36.dp)
|
||||||
.clip(CircleShape),
|
.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(
|
Icon(
|
||||||
painter = painterResource(UiR.drawable.round_reply_24),
|
painter = painterResource(R.drawable.round_reply_24),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ fun MessagesHistoryTopBar(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(UiR.drawable.round_reply_all_24),
|
painter = painterResource(R.drawable.round_reply_all_24),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -210,13 +210,13 @@ fun MessagesHistoryTopBar(
|
|||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(UiR.drawable.round_forward_24),
|
painter = painterResource(R.drawable.round_forward_24),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
IconButton(onClick = onDeleteSelectedButtonClicked) {
|
IconButton(onClick = onDeleteSelectedButtonClicked) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(UiR.drawable.round_delete_outline_24),
|
painter = painterResource(R.drawable.round_delete_outline_24),
|
||||||
contentDescription = null
|
contentDescription = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ fun MessagesHistoryTopBar(
|
|||||||
dropDownMenuExpanded = false
|
dropDownMenuExpanded = false
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(text = stringResource(UiR.string.action_refresh))
|
Text(text = stringResource(R.string.action_refresh))
|
||||||
},
|
},
|
||||||
leadingIcon = {
|
leadingIcon = {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
+17
-18
@@ -26,7 +26,6 @@ import dev.meloda.fast.model.api.domain.VkMessage
|
|||||||
import dev.meloda.fast.ui.R
|
import dev.meloda.fast.ui.R
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import dev.meloda.fast.ui.R as UiR
|
|
||||||
|
|
||||||
private fun isAccount(fromId: Long) = fromId == UserConfig.userId
|
private fun isAccount(fromId: Long) = fromId == UserConfig.userId
|
||||||
|
|
||||||
@@ -41,7 +40,7 @@ fun VkMessage.extractAvatar() = when {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else -> null
|
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 =
|
fun VkMessage.extractDate(): String =
|
||||||
SimpleDateFormat("HH:mm", Locale.getDefault()).format(date * 1000L)
|
SimpleDateFormat("HH:mm", Locale.getDefault()).format(date * 1000L)
|
||||||
@@ -91,7 +90,7 @@ fun VkConversation.extractTitle(
|
|||||||
) = when (peerType) {
|
) = when (peerType) {
|
||||||
PeerType.USER -> {
|
PeerType.USER -> {
|
||||||
if (isAccount(id)) {
|
if (isAccount(id)) {
|
||||||
UiText.Resource(UiR.string.favorites)
|
UiText.Resource(R.string.favorites)
|
||||||
} else {
|
} else {
|
||||||
val userName = user?.let { user ->
|
val userName = user?.let { user ->
|
||||||
if (useContactName) {
|
if (useContactName) {
|
||||||
@@ -214,7 +213,7 @@ fun VkMessage.extractActionText(
|
|||||||
when (action) {
|
when (action) {
|
||||||
VkMessage.Action.CHAT_CREATE -> {
|
VkMessage.Action.CHAT_CREATE -> {
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_created,
|
R.string.message_action_chat_created,
|
||||||
listOf(prefix, text)
|
listOf(prefix, text)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -242,7 +241,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_TITLE_UPDATE -> {
|
VkMessage.Action.CHAT_TITLE_UPDATE -> {
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_renamed,
|
R.string.message_action_chat_renamed,
|
||||||
listOf(prefix, text)
|
listOf(prefix, text)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -270,7 +269,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_PHOTO_UPDATE -> {
|
VkMessage.Action.CHAT_PHOTO_UPDATE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_photo_update,
|
R.string.message_action_chat_photo_update,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -290,7 +289,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_PHOTO_REMOVE -> {
|
VkMessage.Action.CHAT_PHOTO_REMOVE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_photo_remove,
|
R.string.message_action_chat_photo_remove,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -311,7 +310,7 @@ fun VkMessage.extractActionText(
|
|||||||
VkMessage.Action.CHAT_KICK_USER -> {
|
VkMessage.Action.CHAT_KICK_USER -> {
|
||||||
if (memberId == fromId) {
|
if (memberId == fromId) {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_left,
|
R.string.message_action_chat_user_left,
|
||||||
listOf(memberPrefix)
|
listOf(memberPrefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -333,7 +332,7 @@ fun VkMessage.extractActionText(
|
|||||||
else lastMessage.actionUser.toString()
|
else lastMessage.actionUser.toString()
|
||||||
|
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_kicked,
|
R.string.message_action_chat_user_kicked,
|
||||||
listOf(prefix, postfix)
|
listOf(prefix, postfix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -363,7 +362,7 @@ fun VkMessage.extractActionText(
|
|||||||
VkMessage.Action.CHAT_INVITE_USER -> {
|
VkMessage.Action.CHAT_INVITE_USER -> {
|
||||||
if (memberId == lastMessage.fromId) {
|
if (memberId == lastMessage.fromId) {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_returned,
|
R.string.message_action_chat_user_returned,
|
||||||
listOf(memberPrefix)
|
listOf(memberPrefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -385,7 +384,7 @@ fun VkMessage.extractActionText(
|
|||||||
else lastMessage.actionUser.toString()
|
else lastMessage.actionUser.toString()
|
||||||
|
|
||||||
val string = UiText.ResourceParams(
|
val string = UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_invited,
|
R.string.message_action_chat_user_invited,
|
||||||
listOf(memberPrefix, postfix)
|
listOf(memberPrefix, postfix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -408,7 +407,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_INVITE_USER_BY_LINK -> {
|
VkMessage.Action.CHAT_INVITE_USER_BY_LINK -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_joined_by_link,
|
R.string.message_action_chat_user_joined_by_link,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -428,7 +427,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_INVITE_USER_BY_CALL -> {
|
VkMessage.Action.CHAT_INVITE_USER_BY_CALL -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_joined_by_call,
|
R.string.message_action_chat_user_joined_by_call,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -448,7 +447,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_INVITE_USER_BY_CALL_LINK -> {
|
VkMessage.Action.CHAT_INVITE_USER_BY_CALL_LINK -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_user_joined_by_call_link,
|
R.string.message_action_chat_user_joined_by_call_link,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -473,7 +472,7 @@ fun VkMessage.extractActionText(
|
|||||||
// val hasMessageText = messageText.isNotEmpty()
|
// val hasMessageText = messageText.isNotEmpty()
|
||||||
|
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_pin_message,
|
R.string.message_action_chat_pin_message,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -509,7 +508,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_UNPIN_MESSAGE -> {
|
VkMessage.Action.CHAT_UNPIN_MESSAGE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_unpin_message,
|
R.string.message_action_chat_unpin_message,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -529,7 +528,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_SCREENSHOT -> {
|
VkMessage.Action.CHAT_SCREENSHOT -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_screenshot,
|
R.string.message_action_chat_screenshot,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
@@ -549,7 +548,7 @@ fun VkMessage.extractActionText(
|
|||||||
|
|
||||||
VkMessage.Action.CHAT_STYLE_UPDATE -> {
|
VkMessage.Action.CHAT_STYLE_UPDATE -> {
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.message_action_chat_style_update,
|
R.string.message_action_chat_style_update,
|
||||||
listOf(prefix)
|
listOf(prefix)
|
||||||
).parseString(resources)
|
).parseString(resources)
|
||||||
.orEmpty()
|
.orEmpty()
|
||||||
|
|||||||
+2
-2
@@ -30,7 +30,7 @@ import java.io.FileOutputStream
|
|||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
interface PhotoViewViewModel {
|
interface PhotoViewViewModel {
|
||||||
val screenState: StateFlow<PhotoViewScreenState>
|
val screenState: StateFlow<PhotoViewScreenState>
|
||||||
@@ -114,7 +114,7 @@ class PhotoViewViewModelImpl(
|
|||||||
viewModelScope.launch(Dispatchers.Main) {
|
viewModelScope.launch(Dispatchers.Main) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
applicationContext,
|
applicationContext,
|
||||||
UiR.string.error_occurred,
|
R.string.error_occurred,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -61,6 +61,7 @@ import dev.meloda.fast.photoviewer.PhotoViewViewModel
|
|||||||
import dev.meloda.fast.photoviewer.PhotoViewViewModelImpl
|
import dev.meloda.fast.photoviewer.PhotoViewViewModelImpl
|
||||||
import dev.meloda.fast.photoviewer.model.PhotoViewArguments
|
import dev.meloda.fast.photoviewer.model.PhotoViewArguments
|
||||||
import dev.meloda.fast.photoviewer.model.PhotoViewScreenState
|
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.FullScreenDialog
|
||||||
import dev.meloda.fast.ui.components.Loader
|
import dev.meloda.fast.ui.components.Loader
|
||||||
import dev.meloda.fast.ui.util.getImage
|
import dev.meloda.fast.ui.util.getImage
|
||||||
@@ -69,7 +70,6 @@ import kotlinx.coroutines.launch
|
|||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
import dev.meloda.fast.ui.R as UiR
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun PhotoViewDialog(
|
fun PhotoViewDialog(
|
||||||
@@ -136,7 +136,7 @@ private fun PhotoViewRoute(
|
|||||||
scope.launch(Dispatchers.Main) {
|
scope.launch(Dispatchers.Main) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
UiR.string.error_occurred,
|
R.string.error_occurred,
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
@@ -285,7 +285,7 @@ private fun TopBar(
|
|||||||
onShareClicked()
|
onShareClicked()
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(text = stringResource(UiR.string.action_share))
|
Text(text = stringResource(R.string.action_share))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
@@ -294,7 +294,7 @@ private fun TopBar(
|
|||||||
onOpenInClicked()
|
onOpenInClicked()
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(text = stringResource(UiR.string.action_open_in))
|
Text(text = stringResource(R.string.action_open_in))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
@@ -303,7 +303,7 @@ private fun TopBar(
|
|||||||
onCopyLinkClicked()
|
onCopyLinkClicked()
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
Text(text = stringResource(UiR.string.action_copy_link))
|
Text(text = stringResource(R.string.action_copy_link))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
@@ -312,7 +312,7 @@ private fun TopBar(
|
|||||||
onCopyClicked()
|
onCopyClicked()
|
||||||
},
|
},
|
||||||
text = {
|
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 dev.meloda.fast.profile.model.ProfileScreenState
|
||||||
import org.koin.androidx.compose.koinViewModel
|
import org.koin.androidx.compose.koinViewModel
|
||||||
|
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ProfileRoute(
|
fun ProfileRoute(
|
||||||
@@ -115,7 +115,7 @@ fun ProfileScreen(
|
|||||||
model = screenState.avatarUrl,
|
model = screenState.avatarUrl,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
contentScale = ContentScale.Crop,
|
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))
|
Spacer(modifier = Modifier.height(18.dp))
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.asStateFlow
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
import kotlinx.coroutines.flow.update
|
import kotlinx.coroutines.flow.update
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
class SettingsViewModel(
|
class SettingsViewModel(
|
||||||
private val loadUserByIdUseCase: LoadUserByIdUseCase,
|
private val loadUserByIdUseCase: LoadUserByIdUseCase,
|
||||||
@@ -319,65 +319,65 @@ class SettingsViewModel(
|
|||||||
val accountVisible = UserConfig.isLoggedIn()
|
val accountVisible = UserConfig.isLoggedIn()
|
||||||
val accountTitle = SettingsItem.Title(
|
val accountTitle = SettingsItem.Title(
|
||||||
key = SettingsKeys.KEY_ACCOUNT,
|
key = SettingsKeys.KEY_ACCOUNT,
|
||||||
title = UiText.Resource(UiR.string.settings_account_title),
|
title = UiText.Resource(R.string.settings_account_title),
|
||||||
isVisible = accountVisible
|
isVisible = accountVisible
|
||||||
)
|
)
|
||||||
val accountLogOut = SettingsItem.TitleText(
|
val accountLogOut = SettingsItem.TitleText(
|
||||||
key = SettingsKeys.KEY_ACCOUNT_LOGOUT,
|
key = SettingsKeys.KEY_ACCOUNT_LOGOUT,
|
||||||
title = UiText.Resource(UiR.string.settings_account_logout_title),
|
title = UiText.Resource(R.string.settings_account_logout_title),
|
||||||
text = UiText.Resource(UiR.string.settings_account_logout_summary),
|
text = UiText.Resource(R.string.settings_account_logout_summary),
|
||||||
isVisible = accountVisible
|
isVisible = accountVisible
|
||||||
)
|
)
|
||||||
|
|
||||||
val generalTitle = SettingsItem.Title(
|
val generalTitle = SettingsItem.Title(
|
||||||
key = SettingsKeys.KEY_GENERAL,
|
key = SettingsKeys.KEY_GENERAL,
|
||||||
title = UiText.Resource(UiR.string.settings_general_title)
|
title = UiText.Resource(R.string.settings_general_title)
|
||||||
)
|
)
|
||||||
val generalUseContactNames = SettingsItem.Switch(
|
val generalUseContactNames = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_USE_CONTACT_NAMES,
|
key = SettingsKeys.KEY_USE_CONTACT_NAMES,
|
||||||
title = UiText.Resource(UiR.string.settings_general_contact_names_title),
|
title = UiText.Resource(R.string.settings_general_contact_names_title),
|
||||||
text = UiText.Resource(UiR.string.settings_general_contact_names_summary),
|
text = UiText.Resource(R.string.settings_general_contact_names_summary),
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_CONTACT_NAMES
|
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_CONTACT_NAMES
|
||||||
)
|
)
|
||||||
val generalShowEmojiButton = SettingsItem.Switch(
|
val generalShowEmojiButton = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_SHOW_EMOJI_BUTTON,
|
key = SettingsKeys.KEY_SHOW_EMOJI_BUTTON,
|
||||||
title = UiText.Resource(UiR.string.settings_general_show_emoji_button_title),
|
title = UiText.Resource(R.string.settings_general_show_emoji_button_title),
|
||||||
text = UiText.Resource(UiR.string.settings_general_show_emoji_button_summary),
|
text = UiText.Resource(R.string.settings_general_show_emoji_button_summary),
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
|
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_SHOW_EMOJI_BUTTON
|
||||||
)
|
)
|
||||||
val generalShowAttachmentButton = SettingsItem.Switch(
|
val generalShowAttachmentButton = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_SHOW_ATTACHMENT_BUTTON,
|
key = SettingsKeys.KEY_SHOW_ATTACHMENT_BUTTON,
|
||||||
title = UiText.Resource(UiR.string.settings_general_show_attachment_button_title),
|
title = UiText.Resource(R.string.settings_general_show_attachment_button_title),
|
||||||
text = UiText.Resource(UiR.string.settings_general_show_attachment_button_summary),
|
text = UiText.Resource(R.string.settings_general_show_attachment_button_summary),
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_SHOW_ATTACHMENT_BUTTON
|
defaultValue = SettingsKeys.DEFAULT_VALUE_SHOW_ATTACHMENT_BUTTON
|
||||||
)
|
)
|
||||||
val generalEnableHaptic = SettingsItem.Switch(
|
val generalEnableHaptic = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_ENABLE_HAPTIC,
|
key = SettingsKeys.KEY_ENABLE_HAPTIC,
|
||||||
defaultValue = SettingsKeys.DEFAULT_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(
|
val appearanceTitle = SettingsItem.Title(
|
||||||
key = SettingsKeys.KEY_APPEARANCE,
|
key = SettingsKeys.KEY_APPEARANCE,
|
||||||
title = UiText.Resource(UiR.string.settings_appearance_title)
|
title = UiText.Resource(R.string.settings_appearance_title)
|
||||||
)
|
)
|
||||||
val appearanceMultiline = SettingsItem.Switch(
|
val appearanceMultiline = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_APPEARANCE_MULTILINE,
|
key = SettingsKeys.KEY_APPEARANCE_MULTILINE,
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_MULTILINE,
|
defaultValue = SettingsKeys.DEFAULT_VALUE_MULTILINE,
|
||||||
title = UiText.Resource(UiR.string.settings_appearance_multiline_title),
|
title = UiText.Resource(R.string.settings_appearance_multiline_title),
|
||||||
text = UiText.Resource(UiR.string.settings_appearance_multiline_summary)
|
text = UiText.Resource(R.string.settings_appearance_multiline_summary)
|
||||||
)
|
)
|
||||||
|
|
||||||
val darkThemeValues = listOf(
|
val darkThemeValues = listOf(
|
||||||
DarkMode.ENABLED to UiText.Resource(UiR.string.settings_dark_theme_value_enabled),
|
DarkMode.ENABLED to UiText.Resource(R.string.settings_dark_theme_value_enabled),
|
||||||
DarkMode.FOLLOW_SYSTEM to UiText.Resource(UiR.string.settings_dark_theme_value_follow_system),
|
DarkMode.FOLLOW_SYSTEM to UiText.Resource(R.string.settings_dark_theme_value_follow_system),
|
||||||
DarkMode.AUTO_BATTERY to UiText.Resource(UiR.string.settings_dark_theme_value_battery_saver),
|
DarkMode.AUTO_BATTERY to UiText.Resource(R.string.settings_dark_theme_value_battery_saver),
|
||||||
DarkMode.DISABLED to UiText.Resource(UiR.string.settings_dark_theme_value_disabled)
|
DarkMode.DISABLED to UiText.Resource(R.string.settings_dark_theme_value_disabled)
|
||||||
).toMap()
|
).toMap()
|
||||||
|
|
||||||
val appearanceDarkTheme = SettingsItem.ListItem(
|
val appearanceDarkTheme = SettingsItem.ListItem(
|
||||||
key = SettingsKeys.KEY_APPEARANCE_DARK_MODE,
|
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,
|
valueClass = Int::class,
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_DARK_MODE,
|
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_DARK_MODE,
|
||||||
titles = darkThemeValues.values.toList(),
|
titles = darkThemeValues.values.toList(),
|
||||||
@@ -387,10 +387,10 @@ class SettingsViewModel(
|
|||||||
val darkThemeValue = darkThemeValues[DarkMode.parse(item.value)]
|
val darkThemeValue = darkThemeValues[DarkMode.parse(item.value)]
|
||||||
|
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
value = UiR.string.settings_dark_theme_current_value,
|
value = R.string.settings_dark_theme_current_value,
|
||||||
args = listOf(
|
args = listOf(
|
||||||
darkThemeValue
|
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(
|
val appearanceUseAmoledDarkTheme = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_APPEARANCE_AMOLED_THEME,
|
key = SettingsKeys.KEY_APPEARANCE_AMOLED_THEME,
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_AMOLED_THEME,
|
defaultValue = SettingsKeys.DEFAULT_VALUE_APPEARANCE_AMOLED_THEME,
|
||||||
title = UiText.Resource(UiR.string.settings_amoled_dark_theme),
|
title = UiText.Resource(R.string.settings_amoled_dark_theme),
|
||||||
text = UiText.Resource(UiR.string.settings_amoled_dark_theme_description)
|
text = UiText.Resource(R.string.settings_amoled_dark_theme_description)
|
||||||
)
|
)
|
||||||
val appearanceUseDynamicColors = SettingsItem.Switch(
|
val appearanceUseDynamicColors = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_USE_DYNAMIC_COLORS,
|
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,
|
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
|
defaultValue = SettingsKeys.DEFAULT_VALUE_USE_DYNAMIC_COLORS
|
||||||
)
|
)
|
||||||
val appearanceUseSystemFont = SettingsItem.Switch(
|
val appearanceUseSystemFont = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_USE_SYSTEM_FONT,
|
key = SettingsKeys.KEY_USE_SYSTEM_FONT,
|
||||||
defaultValue = SettingsKeys.DEFAULT_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(
|
val appearanceLanguage = SettingsItem.TitleText(
|
||||||
key = SettingsKeys.KEY_APPEARANCE_LANGUAGE,
|
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(
|
val featuresTitle = SettingsItem.Title(
|
||||||
key = "features",
|
key = "features",
|
||||||
title = UiText.Resource(UiR.string.settings_features_title)
|
title = UiText.Resource(R.string.settings_features_title)
|
||||||
)
|
)
|
||||||
val featuresFastText = SettingsItem.TextField(
|
val featuresFastText = SettingsItem.TextField(
|
||||||
key = SettingsKeys.KEY_FEATURES_FAST_TEXT,
|
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
|
defaultValue = SettingsKeys.DEFAULT_VALUE_FEATURES_FAST_TEXT
|
||||||
).apply {
|
).apply {
|
||||||
textProvider = TextProvider { settingsItem ->
|
textProvider = TextProvider { settingsItem ->
|
||||||
UiText.ResourceParams(
|
UiText.ResourceParams(
|
||||||
UiR.string.pref_message_fast_text_summary,
|
R.string.pref_message_fast_text_summary,
|
||||||
listOf(settingsItem.value)
|
listOf(settingsItem.value)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -437,46 +437,46 @@ class SettingsViewModel(
|
|||||||
|
|
||||||
val activityTitle = SettingsItem.Title(
|
val activityTitle = SettingsItem.Title(
|
||||||
key = "activity",
|
key = "activity",
|
||||||
title = UiText.Resource(UiR.string.settings_activity_title)
|
title = UiText.Resource(R.string.settings_activity_title)
|
||||||
)
|
)
|
||||||
val visibilitySendOnlineStatus = SettingsItem.Switch(
|
val visibilitySendOnlineStatus = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS,
|
key = SettingsKeys.KEY_ACTIVITY_SEND_ONLINE_STATUS,
|
||||||
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS,
|
defaultValue = SettingsKeys.DEFAULT_VALUE_KEY_ACTIVITY_SEND_ONLINE_STATUS,
|
||||||
title = UiText.Resource(UiR.string.settings_activity_send_online_title),
|
title = UiText.Resource(R.string.settings_activity_send_online_title),
|
||||||
text = UiText.Resource(UiR.string.settings_activity_send_online_summary)
|
text = UiText.Resource(R.string.settings_activity_send_online_summary)
|
||||||
)
|
)
|
||||||
|
|
||||||
val experimentalTitle = SettingsItem.Title(
|
val experimentalTitle = SettingsItem.Title(
|
||||||
key = "experimental",
|
key = "experimental",
|
||||||
title = UiText.Resource(UiR.string.settings_experimental_title)
|
title = UiText.Resource(R.string.settings_experimental_title)
|
||||||
)
|
)
|
||||||
val experimentalLongPollBackground = SettingsItem.Switch(
|
val experimentalLongPollBackground = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_LONG_POLL_IN_BACKGROUND,
|
key = SettingsKeys.KEY_LONG_POLL_IN_BACKGROUND,
|
||||||
defaultValue = SettingsKeys.DEFAULT_LONG_POLL_IN_BACKGROUND,
|
defaultValue = SettingsKeys.DEFAULT_LONG_POLL_IN_BACKGROUND,
|
||||||
title = UiText.Resource(UiR.string.settings_features_long_poll_in_background_title),
|
title = UiText.Resource(R.string.settings_features_long_poll_in_background_title),
|
||||||
text = UiText.Resource(UiR.string.settings_features_long_poll_in_background_summary)
|
text = UiText.Resource(R.string.settings_features_long_poll_in_background_summary)
|
||||||
)
|
)
|
||||||
val experimentalShowTimeInActionMessages = SettingsItem.Switch(
|
val experimentalShowTimeInActionMessages = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_SHOW_TIME_IN_ACTION_MESSAGES,
|
key = SettingsKeys.KEY_SHOW_TIME_IN_ACTION_MESSAGES,
|
||||||
defaultValue = SettingsKeys.DEFAULT_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(
|
val experimentalUseBlur = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_USE_BLUR,
|
key = SettingsKeys.KEY_USE_BLUR,
|
||||||
defaultValue = SettingsKeys.DEFAULT_USE_BLUR,
|
defaultValue = SettingsKeys.DEFAULT_USE_BLUR,
|
||||||
title = UiText.Resource(UiR.string.settings_experimental_use_blur_title),
|
title = UiText.Resource(R.string.settings_experimental_use_blur_title),
|
||||||
text = UiText.Resource(UiR.string.settings_experimental_use_blur_summary)
|
text = UiText.Resource(R.string.settings_experimental_use_blur_summary)
|
||||||
)
|
)
|
||||||
val enableAnimations = SettingsItem.Switch(
|
val enableAnimations = SettingsItem.Switch(
|
||||||
key = SettingsKeys.KEY_MORE_ANIMATIONS,
|
key = SettingsKeys.KEY_MORE_ANIMATIONS,
|
||||||
defaultValue = SettingsKeys.DEFAULT_MORE_ANIMATIONS,
|
defaultValue = SettingsKeys.DEFAULT_MORE_ANIMATIONS,
|
||||||
title = UiText.Resource(UiR.string.settings_experimental_more_animations_title),
|
title = UiText.Resource(R.string.settings_experimental_more_animations_title),
|
||||||
text = UiText.Resource(UiR.string.settings_experimental_more_animations_summary)
|
text = UiText.Resource(R.string.settings_experimental_more_animations_summary)
|
||||||
)
|
)
|
||||||
|
|
||||||
val debugTitle = SettingsItem.Title(
|
val debugTitle = SettingsItem.Title(
|
||||||
key = "debug",
|
key = "debug",
|
||||||
title = UiText.Resource(UiR.string.settings_debug_title)
|
title = UiText.Resource(R.string.settings_debug_title)
|
||||||
)
|
)
|
||||||
val debugPerformCrash = SettingsItem.TitleText(
|
val debugPerformCrash = SettingsItem.TitleText(
|
||||||
key = SettingsKeys.KEY_DEBUG_PERFORM_CRASH,
|
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.settings.model.SettingsScreenState
|
||||||
import dev.meloda.fast.ui.components.ActionInvokeDismiss
|
import dev.meloda.fast.ui.components.ActionInvokeDismiss
|
||||||
import dev.meloda.fast.ui.components.MaterialDialog
|
import dev.meloda.fast.ui.components.MaterialDialog
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HandleDialogs(
|
fun HandleDialogs(
|
||||||
@@ -50,16 +50,16 @@ fun HandleDialogs(
|
|||||||
MaterialDialog(
|
MaterialDialog(
|
||||||
onDismissRequest = { onDismissed(dialog) },
|
onDismissRequest = { onDismissed(dialog) },
|
||||||
title = stringResource(
|
title = stringResource(
|
||||||
id = if (isEasterEgg) UiR.string.easter_egg_log_out_dmitry
|
id = if (isEasterEgg) R.string.easter_egg_log_out_dmitry
|
||||||
else UiR.string.sign_out_confirm_title
|
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()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(
|
confirmText = stringResource(
|
||||||
id = if (isEasterEgg) UiR.string.easter_egg_log_out_dmitry
|
id = if (isEasterEgg) R.string.easter_egg_log_out_dmitry
|
||||||
else UiR.string.action_sign_out
|
else R.string.action_sign_out
|
||||||
),
|
),
|
||||||
cancelText = stringResource(id = UiR.string.no),
|
cancelText = stringResource(id = R.string.no),
|
||||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -70,8 +70,8 @@ fun HandleDialogs(
|
|||||||
title = "Perform crash",
|
title = "Perform crash",
|
||||||
text = "App will be crashed. Are you sure?",
|
text = "App will be crashed. Are you sure?",
|
||||||
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
confirmAction = { onConfirmed(dialog, bundleOf()) },
|
||||||
confirmText = stringResource(id = UiR.string.yes),
|
confirmText = stringResource(id = R.string.yes),
|
||||||
cancelText = stringResource(id = UiR.string.cancel),
|
cancelText = stringResource(id = R.string.cancel),
|
||||||
actionInvokeDismiss = ActionInvokeDismiss.Always
|
actionInvokeDismiss = ActionInvokeDismiss.Always
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ fun HandleDialogs(
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
confirmText = "Import",
|
confirmText = "Import",
|
||||||
cancelText = stringResource(UiR.string.cancel)
|
cancelText = stringResource(R.string.cancel)
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -210,7 +210,7 @@ fun HandleDialogs(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
confirmText = stringResource(UiR.string.ok),
|
confirmText = stringResource(R.string.ok),
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
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.TitleItem
|
||||||
import dev.meloda.fast.settings.presentation.item.TitleTextItem
|
import dev.meloda.fast.settings.presentation.item.TitleTextItem
|
||||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||||
import dev.meloda.fast.ui.R as UiR
|
import dev.meloda.fast.ui.R
|
||||||
|
|
||||||
|
|
||||||
@OptIn(
|
@OptIn(
|
||||||
@@ -83,7 +83,7 @@ fun SettingsScreen(
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = UiR.string.title_settings),
|
text = stringResource(id = R.string.title_settings),
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
style = MaterialTheme.typography.headlineSmall
|
style = MaterialTheme.typography.headlineSmall
|
||||||
@@ -92,7 +92,7 @@ fun SettingsScreen(
|
|||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = onBack) {
|
IconButton(onClick = onBack) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(id = UiR.drawable.ic_round_arrow_back_24),
|
painter = painterResource(id = R.drawable.ic_round_arrow_back_24),
|
||||||
contentDescription = "Back button"
|
contentDescription = "Back button"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user