feat: вёрстка приведена к соответствию m3
This commit is contained in:
1 parent
cd993fc1e5
commit
5ea21719e2
11 files changed
+217
-148
No files matched your search
@@ -70,6 +70,7 @@ dependencies {
|
|||||||
implementation(libs.androidx.compose.ui.graphics)
|
implementation(libs.androidx.compose.ui.graphics)
|
||||||
implementation(libs.androidx.compose.ui.tooling.preview)
|
implementation(libs.androidx.compose.ui.tooling.preview)
|
||||||
implementation(libs.androidx.compose.material3)
|
implementation(libs.androidx.compose.material3)
|
||||||
|
implementation(libs.androidx.compose.material3.adaptive.nav.suite)
|
||||||
|
|
||||||
debugImplementation(libs.androidx.compose.ui.tooling)
|
debugImplementation(libs.androidx.compose.ui.tooling)
|
||||||
}
|
}
|
||||||
@@ -1,19 +1,14 @@
|
|||||||
package com.freeturn.app.ui.navigation
|
package com.freeturn.app.ui.navigation
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
|
||||||
import androidx.compose.animation.Crossfade
|
import androidx.compose.animation.Crossfade
|
||||||
import androidx.compose.animation.slideInVertically
|
|
||||||
import androidx.compose.animation.slideOutVertically
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.WindowInsets
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.statusBarsPadding
|
import androidx.compose.foundation.layout.statusBarsPadding
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material3.NavigationBar
|
|
||||||
import androidx.compose.material3.NavigationBarItem
|
|
||||||
import androidx.compose.material3.Scaffold
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.adaptive.currentWindowAdaptiveInfo
|
||||||
|
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffold
|
||||||
|
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteScaffoldDefaults
|
||||||
|
import androidx.compose.material3.adaptive.navigationsuite.NavigationSuiteType
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
@@ -21,9 +16,9 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import com.freeturn.app.R
|
import com.freeturn.app.R
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import androidx.navigation.NavHostController
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
@@ -51,7 +46,7 @@ object Routes {
|
|||||||
const val LOGS = "logs"
|
const val LOGS = "logs"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Нижнее меню видно только в основном потоке, не во время онбординга
|
// Нижнее меню / рельс видно только в основном потоке, не во время онбординга
|
||||||
private val BOTTOM_NAV_ROUTES = setOf(Routes.HOME, Routes.LOGS, Routes.SERVER_MANAGEMENT, Routes.CLIENT_SETUP)
|
private val BOTTOM_NAV_ROUTES = setOf(Routes.HOME, Routes.LOGS, Routes.SERVER_MANAGEMENT, Routes.CLIENT_SETUP)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -68,43 +63,81 @@ fun AppNavigation(viewModel: MainViewModel) {
|
|||||||
val navController = rememberNavController()
|
val navController = rememberNavController()
|
||||||
val backStackEntry by navController.currentBackStackEntryAsState()
|
val backStackEntry by navController.currentBackStackEntryAsState()
|
||||||
val currentRoute = backStackEntry?.destination?.route
|
val currentRoute = backStackEntry?.destination?.route
|
||||||
val showBottomBar = currentRoute in BOTTOM_NAV_ROUTES
|
val showNavSuite = currentRoute in BOTTOM_NAV_ROUTES
|
||||||
|
|
||||||
Scaffold(
|
// Адаптивно: bar на телефоне, rail на ширинах ≥600dp, drawer — при расширенном классе.
|
||||||
modifier = Modifier.fillMaxSize(),
|
// На экранах онбординга и SSH-setup навигация скрыта через NavigationSuiteType.None.
|
||||||
bottomBar = {
|
val adaptiveType = NavigationSuiteScaffoldDefaults
|
||||||
AnimatedVisibility(
|
.calculateFromAdaptiveInfo(currentWindowAdaptiveInfo())
|
||||||
visible = showBottomBar,
|
val layoutType = if (showNavSuite) adaptiveType else NavigationSuiteType.None
|
||||||
enter = slideInVertically(initialOffsetY = { it }),
|
|
||||||
exit = slideOutVertically(targetOffsetY = { it })
|
val context = LocalContext.current
|
||||||
) {
|
|
||||||
AppNavigationBar(
|
NavigationSuiteScaffold(
|
||||||
currentRoute = currentRoute,
|
layoutType = layoutType,
|
||||||
onNavigate = { route ->
|
navigationSuiteItems = {
|
||||||
navController.navigate(route) {
|
navItems.forEach { item ->
|
||||||
|
val selected = currentRoute == item.route
|
||||||
|
item(
|
||||||
|
selected = selected,
|
||||||
|
onClick = {
|
||||||
|
if (!selected) HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
||||||
|
navController.navigate(item.route) {
|
||||||
popUpTo(Routes.HOME) { saveState = true; inclusive = false }
|
popUpTo(Routes.HOME) { saveState = true; inclusive = false }
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
restoreState = true
|
restoreState = true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
icon = {
|
||||||
|
Crossfade(targetState = selected, label = "nav_icon_${item.route}") { isSelected ->
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(
|
||||||
|
if (isSelected) item.selectedIconRes else item.unselectedIconRes
|
||||||
|
),
|
||||||
|
contentDescription = stringResource(item.labelResId)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
contentWindowInsets = WindowInsets(0, 0, 0, 0)
|
label = { Text(stringResource(item.labelResId)) }
|
||||||
) { innerPadding ->
|
)
|
||||||
Box(
|
}
|
||||||
modifier = Modifier
|
}
|
||||||
.fillMaxSize()
|
) {
|
||||||
.padding(bottom = if (showBottomBar) innerPadding.calculateBottomPadding() else 0.dp)
|
AppNavHost(
|
||||||
|
navController = navController,
|
||||||
|
viewModel = viewModel,
|
||||||
|
startDestination = startDestination
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Диалог капчи поверх любого экрана. Оборачиваем в key(sessionId), чтобы для
|
||||||
|
// каждой новой капча-сессии Compose пересоздавал диалог и WebView грузил URL заново
|
||||||
|
// (бинарник цикличит креды и для каждой выдаёт новую капчу с тем же localhost-URL).
|
||||||
|
val captchaState = proxyState as? ProxyState.CaptchaRequired
|
||||||
|
if (captchaState != null) {
|
||||||
|
androidx.compose.runtime.key(captchaState.sessionId) {
|
||||||
|
CaptchaWebViewDialog(
|
||||||
|
captchaUrl = captchaState.url,
|
||||||
|
onDismiss = { viewModel.dismissCaptcha() }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun AppNavHost(
|
||||||
|
navController: NavHostController,
|
||||||
|
viewModel: MainViewModel,
|
||||||
|
startDestination: String
|
||||||
) {
|
) {
|
||||||
NavHost(
|
NavHost(
|
||||||
navController = navController,
|
navController = navController,
|
||||||
startDestination = startDestination,
|
startDestination = startDestination,
|
||||||
modifier = Modifier.statusBarsPadding() // Добавляем отступ для статус-бара сверху
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.statusBarsPadding()
|
||||||
) {
|
) {
|
||||||
|
// Онбординг-мастер (без навигации)
|
||||||
// Онбординг-мастер (без нижнего меню)
|
|
||||||
|
|
||||||
composable(Routes.ONBOARDING) {
|
composable(Routes.ONBOARDING) {
|
||||||
OnboardingScreen(
|
OnboardingScreen(
|
||||||
onSetupServer = { navController.navigate(Routes.SSH_SETUP_OB) },
|
onSetupServer = { navController.navigate(Routes.SSH_SETUP_OB) },
|
||||||
@@ -156,8 +189,7 @@ fun AppNavigation(viewModel: MainViewModel) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Основной поток (с нижним меню)
|
// Основной поток (с навигацией)
|
||||||
|
|
||||||
composable(Routes.SSH_SETUP) {
|
composable(Routes.SSH_SETUP) {
|
||||||
SshSetupScreen(
|
SshSetupScreen(
|
||||||
viewModel = viewModel,
|
viewModel = viewModel,
|
||||||
@@ -177,7 +209,7 @@ fun AppNavigation(viewModel: MainViewModel) {
|
|||||||
onContinue = {
|
onContinue = {
|
||||||
navController.navigate(Routes.CLIENT_SETUP) {
|
navController.navigate(Routes.CLIENT_SETUP) {
|
||||||
// Убираем SERVER_MANAGEMENT из back stack,
|
// Убираем SERVER_MANAGEMENT из back stack,
|
||||||
// иначе он остаётся под CLIENT_SETUP и bottom nav ломается
|
// иначе он остаётся под CLIENT_SETUP и навигация ломается
|
||||||
popUpTo(Routes.HOME) { inclusive = false; saveState = false }
|
popUpTo(Routes.HOME) { inclusive = false; saveState = false }
|
||||||
launchSingleTop = true
|
launchSingleTop = true
|
||||||
}
|
}
|
||||||
@@ -204,21 +236,6 @@ fun AppNavigation(viewModel: MainViewModel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Диалог капчи поверх любого экрана. Оборачиваем в key(sessionId), чтобы для
|
|
||||||
// каждой новой капча-сессии Compose пересоздавал диалог и WebView грузил URL заново
|
|
||||||
// (бинарник цикличит креды и для каждой выдаёт новую капчу с тем же localhost-URL).
|
|
||||||
val captchaState = proxyState as? ProxyState.CaptchaRequired
|
|
||||||
if (captchaState != null) {
|
|
||||||
androidx.compose.runtime.key(captchaState.sessionId) {
|
|
||||||
CaptchaWebViewDialog(
|
|
||||||
captchaUrl = captchaState.url,
|
|
||||||
onDismiss = { viewModel.dismissCaptcha() }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private data class NavItem(
|
private data class NavItem(
|
||||||
val route: String,
|
val route: String,
|
||||||
@@ -233,34 +250,3 @@ private val navItems = listOf(
|
|||||||
NavItem(Routes.CLIENT_SETUP, R.string.client_title, R.drawable.mobile_24px, R.drawable.mobile_outlined_24px),
|
NavItem(Routes.CLIENT_SETUP, R.string.client_title, R.drawable.mobile_24px, R.drawable.mobile_outlined_24px),
|
||||||
NavItem(Routes.LOGS, R.string.logs_title, R.drawable.terminal_24px, R.drawable.terminal_24px)
|
NavItem(Routes.LOGS, R.string.logs_title, R.drawable.terminal_24px, R.drawable.terminal_24px)
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun AppNavigationBar(
|
|
||||||
currentRoute: String?,
|
|
||||||
onNavigate: (String) -> Unit
|
|
||||||
) {
|
|
||||||
val context = LocalContext.current
|
|
||||||
NavigationBar {
|
|
||||||
navItems.forEach { item ->
|
|
||||||
val selected = currentRoute == item.route
|
|
||||||
NavigationBarItem(
|
|
||||||
selected = selected,
|
|
||||||
onClick = {
|
|
||||||
if (!selected) HapticUtil.perform(context, HapticUtil.Pattern.SELECTION)
|
|
||||||
onNavigate(item.route)
|
|
||||||
},
|
|
||||||
icon = {
|
|
||||||
Crossfade(targetState = selected, label = "nav_icon_${item.route}") { isSelected ->
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(
|
|
||||||
if (isSelected) item.selectedIconRes else item.unselectedIconRes
|
|
||||||
),
|
|
||||||
contentDescription = stringResource(item.labelResId)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
label = { Text(stringResource(item.labelResId)) }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,6 +15,7 @@ import androidx.compose.foundation.layout.height
|
|||||||
import androidx.compose.foundation.layout.imePadding
|
import androidx.compose.foundation.layout.imePadding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
@@ -132,8 +133,14 @@ fun ClientSetupScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding)
|
.padding(padding)
|
||||||
.imePadding()
|
.imePadding()
|
||||||
.padding(horizontal = 24.dp)
|
|
||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.widthIn(max = 840.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
@@ -189,7 +196,7 @@ fun ClientSetupScreen(
|
|||||||
Text(
|
Text(
|
||||||
stringResource(R.string.threads_recommendation),
|
stringResource(R.string.threads_recommendation),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,7 +233,7 @@ fun ClientSetupScreen(
|
|||||||
Text(
|
Text(
|
||||||
stringResource(R.string.transport_protocol_desc),
|
stringResource(R.string.transport_protocol_desc),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
|
SingleChoiceSegmentedButtonRow(modifier = Modifier.fillMaxWidth()) {
|
||||||
@@ -279,7 +286,7 @@ fun ClientSetupScreen(
|
|||||||
Text(
|
Text(
|
||||||
stringResource(R.string.dns_mode_desc),
|
stringResource(R.string.dns_mode_desc),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val dnsOptions = listOf(
|
val dnsOptions = listOf(
|
||||||
@@ -358,7 +365,7 @@ fun ClientSetupScreen(
|
|||||||
if (customKernelExists) stringResource(R.string.loaded_from_memory)
|
if (customKernelExists) stringResource(R.string.loaded_from_memory)
|
||||||
else stringResource(R.string.from_apk),
|
else stringResource(R.string.from_apk),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.55f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,9 +416,7 @@ fun ClientSetupScreen(
|
|||||||
Spacer(Modifier.height(8.dp))
|
Spacer(Modifier.height(8.dp))
|
||||||
Button(
|
Button(
|
||||||
onClick = onFinish,
|
onClick = onFinish,
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.height(56.dp),
|
|
||||||
enabled = serverAddress.isNotBlank() && vkLink.isNotBlank(),
|
enabled = serverAddress.isNotBlank() && vkLink.isNotBlank(),
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
@@ -423,6 +428,7 @@ fun ClientSetupScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SwitchRow(
|
private fun SwitchRow(
|
||||||
@@ -441,7 +447,7 @@ private fun SwitchRow(
|
|||||||
Text(
|
Text(
|
||||||
description,
|
description,
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Switch(checked = checked, onCheckedChange = onCheckedChange)
|
Switch(checked = checked, onCheckedChange = onCheckedChange)
|
||||||
|
|||||||
@@ -83,9 +83,7 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
import com.freeturn.app.ui.theme.StatusBlue
|
import com.freeturn.app.ui.theme.extendedColorScheme
|
||||||
import com.freeturn.app.ui.theme.StatusGreen
|
|
||||||
import com.freeturn.app.ui.theme.StatusGreenDark
|
|
||||||
import com.freeturn.app.viewmodel.MainViewModel
|
import com.freeturn.app.viewmodel.MainViewModel
|
||||||
import com.freeturn.app.viewmodel.ProxyState
|
import com.freeturn.app.viewmodel.ProxyState
|
||||||
import com.freeturn.app.viewmodel.SshConnectionState
|
import com.freeturn.app.viewmodel.SshConnectionState
|
||||||
@@ -205,10 +203,10 @@ fun HomeScreen(
|
|||||||
},
|
},
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = when (proxyState) {
|
color = when (proxyState) {
|
||||||
is ProxyState.Running -> StatusGreen
|
is ProxyState.Running -> MaterialTheme.extendedColorScheme.success
|
||||||
is ProxyState.Error -> MaterialTheme.colorScheme.error
|
is ProxyState.Error -> MaterialTheme.colorScheme.error
|
||||||
is ProxyState.CaptchaRequired -> MaterialTheme.colorScheme.error
|
is ProxyState.CaptchaRequired -> MaterialTheme.colorScheme.error
|
||||||
else -> MaterialTheme.colorScheme.onBackground.copy(alpha = 0.65f)
|
else -> MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
},
|
},
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
@@ -249,7 +247,8 @@ fun HomeScreen(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(8.dp)
|
.size(8.dp)
|
||||||
.background(
|
.background(
|
||||||
if (sshState is SshConnectionState.Connected) StatusBlue
|
if (sshState is SshConnectionState.Connected)
|
||||||
|
MaterialTheme.extendedColorScheme.info
|
||||||
else MaterialTheme.colorScheme.outline,
|
else MaterialTheme.colorScheme.outline,
|
||||||
CircleShape
|
CircleShape
|
||||||
)
|
)
|
||||||
@@ -263,7 +262,7 @@ fun HomeScreen(
|
|||||||
else -> stringResource(R.string.ssh_disconnected)
|
else -> stringResource(R.string.ssh_disconnected)
|
||||||
},
|
},
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.6f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
if (sshState !is SshConnectionState.Connected) {
|
if (sshState !is SshConnectionState.Connected) {
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
@@ -272,8 +271,7 @@ fun HomeScreen(
|
|||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
viewModel.reconnectSsh()
|
viewModel.reconnectSsh()
|
||||||
},
|
},
|
||||||
enabled = sshState !is SshConnectionState.Connecting,
|
enabled = sshState !is SshConnectionState.Connecting
|
||||||
modifier = Modifier.height(28.dp)
|
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.reconnect), style = MaterialTheme.typography.labelSmall)
|
Text(stringResource(R.string.reconnect), style = MaterialTheme.typography.labelSmall)
|
||||||
}
|
}
|
||||||
@@ -401,9 +399,10 @@ private fun UpdateDialogs(viewModel: MainViewModel) {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ProxyToggleButton(state: ProxyState, onClick: () -> Unit) {
|
private fun ProxyToggleButton(state: ProxyState, onClick: () -> Unit) {
|
||||||
|
val extended = MaterialTheme.extendedColorScheme
|
||||||
val containerColor by animateColorAsState(
|
val containerColor by animateColorAsState(
|
||||||
targetValue = when (state) {
|
targetValue = when (state) {
|
||||||
is ProxyState.Running -> StatusGreenDark
|
is ProxyState.Running -> extended.successContainer
|
||||||
is ProxyState.Error -> MaterialTheme.colorScheme.errorContainer
|
is ProxyState.Error -> MaterialTheme.colorScheme.errorContainer
|
||||||
is ProxyState.Starting -> MaterialTheme.colorScheme.secondaryContainer
|
is ProxyState.Starting -> MaterialTheme.colorScheme.secondaryContainer
|
||||||
else -> MaterialTheme.colorScheme.primaryContainer
|
else -> MaterialTheme.colorScheme.primaryContainer
|
||||||
@@ -413,7 +412,7 @@ private fun ProxyToggleButton(state: ProxyState, onClick: () -> Unit) {
|
|||||||
)
|
)
|
||||||
val contentColor by animateColorAsState(
|
val contentColor by animateColorAsState(
|
||||||
targetValue = when (state) {
|
targetValue = when (state) {
|
||||||
is ProxyState.Running -> StatusGreen
|
is ProxyState.Running -> extended.onSuccessContainer
|
||||||
is ProxyState.Error -> MaterialTheme.colorScheme.onErrorContainer
|
is ProxyState.Error -> MaterialTheme.colorScheme.onErrorContainer
|
||||||
is ProxyState.Starting -> MaterialTheme.colorScheme.onSecondaryContainer
|
is ProxyState.Starting -> MaterialTheme.colorScheme.onSecondaryContainer
|
||||||
else -> MaterialTheme.colorScheme.onPrimaryContainer
|
else -> MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
@@ -435,7 +434,7 @@ private fun ProxyToggleButton(state: ProxyState, onClick: () -> Unit) {
|
|||||||
.clip(CircleShape),
|
.clip(CircleShape),
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
color = containerColor,
|
color = containerColor,
|
||||||
shadowElevation = if (state is ProxyState.Running) 12.dp else 4.dp
|
tonalElevation = if (state is ProxyState.Running) 6.dp else 1.dp
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
@@ -561,7 +560,13 @@ private fun InfoBottomSheet(
|
|||||||
trailingContent = {
|
trailingContent = {
|
||||||
androidx.compose.material3.Switch(
|
androidx.compose.material3.Switch(
|
||||||
checked = privacyMode,
|
checked = privacyMode,
|
||||||
onCheckedChange = onPrivacyModeChange
|
onCheckedChange = {
|
||||||
|
HapticUtil.perform(
|
||||||
|
context,
|
||||||
|
if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF
|
||||||
|
)
|
||||||
|
onPrivacyModeChange(it)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -575,7 +580,13 @@ private fun InfoBottomSheet(
|
|||||||
trailingContent = {
|
trailingContent = {
|
||||||
androidx.compose.material3.Switch(
|
androidx.compose.material3.Switch(
|
||||||
checked = dynamicTheme,
|
checked = dynamicTheme,
|
||||||
onCheckedChange = { viewModel.setDynamicTheme(it) }
|
onCheckedChange = {
|
||||||
|
HapticUtil.perform(
|
||||||
|
context,
|
||||||
|
if (it) HapticUtil.Pattern.TOGGLE_ON else HapticUtil.Pattern.TOGGLE_OFF
|
||||||
|
)
|
||||||
|
viewModel.setDynamicTheme(it)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -776,7 +787,7 @@ private fun ConfigRow(label: String, value: String) {
|
|||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
Text(value, style = MaterialTheme.typography.bodySmall)
|
Text(value, style = MaterialTheme.typography.bodySmall)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.freeturn.app.R
|
import com.freeturn.app.R
|
||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
import com.freeturn.app.ui.theme.StatusGreen
|
import com.freeturn.app.ui.theme.extendedColorScheme
|
||||||
import com.freeturn.app.ui.theme.StatusOrange
|
|
||||||
import com.freeturn.app.viewmodel.MainViewModel
|
import com.freeturn.app.viewmodel.MainViewModel
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -95,7 +94,7 @@ fun LogsScreen(viewModel: MainViewModel) {
|
|||||||
Text(
|
Text(
|
||||||
stringResource(R.string.no_logs),
|
stringResource(R.string.no_logs),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.4f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -129,8 +128,8 @@ private fun LogLine(line: String) {
|
|||||||
|
|
||||||
val textColor = when {
|
val textColor = when {
|
||||||
isError -> MaterialTheme.colorScheme.error
|
isError -> MaterialTheme.colorScheme.error
|
||||||
isWarning -> StatusOrange
|
isWarning -> MaterialTheme.extendedColorScheme.warning
|
||||||
isSuccess -> StatusGreen
|
isSuccess -> MaterialTheme.extendedColorScheme.success
|
||||||
isHeader -> MaterialTheme.colorScheme.primary
|
isHeader -> MaterialTheme.colorScheme.primary
|
||||||
else -> MaterialTheme.colorScheme.onSurfaceVariant
|
else -> MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import androidx.compose.foundation.shape.CircleShape
|
|||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import com.freeturn.app.R
|
import com.freeturn.app.R
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.ButtonDefaults
|
|
||||||
import androidx.compose.material3.Card
|
import androidx.compose.material3.Card
|
||||||
import androidx.compose.material3.CardDefaults
|
import androidx.compose.material3.CardDefaults
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -110,7 +109,7 @@ fun OnboardingScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.onboarding_subtitle),
|
text = stringResource(R.string.onboarding_subtitle),
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.65f),
|
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||||
textAlign = TextAlign.Center
|
textAlign = TextAlign.Center
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -153,11 +152,8 @@ fun OnboardingScreen(
|
|||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
onSetupServer()
|
onSetupServer()
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
shape = MaterialTheme.shapes.large
|
||||||
.height(56.dp),
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
elevation = ButtonDefaults.buttonElevation(defaultElevation = 4.dp)
|
|
||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.wifi_24px), contentDescription = null)
|
Icon(painterResource(R.drawable.wifi_24px), contentDescription = null)
|
||||||
Spacer(Modifier.width(10.dp))
|
Spacer(Modifier.width(10.dp))
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.imePadding
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
@@ -59,8 +60,7 @@ import androidx.compose.ui.text.input.KeyboardType
|
|||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import com.freeturn.app.ui.HapticUtil
|
import com.freeturn.app.ui.HapticUtil
|
||||||
import com.freeturn.app.ui.theme.StatusBlue
|
import com.freeturn.app.ui.theme.extendedColorScheme
|
||||||
import com.freeturn.app.ui.theme.StatusGreen
|
|
||||||
import com.freeturn.app.viewmodel.MainViewModel
|
import com.freeturn.app.viewmodel.MainViewModel
|
||||||
import com.freeturn.app.viewmodel.ServerState
|
import com.freeturn.app.viewmodel.ServerState
|
||||||
import com.freeturn.app.viewmodel.SshConnectionState
|
import com.freeturn.app.viewmodel.SshConnectionState
|
||||||
@@ -105,8 +105,14 @@ fun ServerManagementScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(padding)
|
.padding(padding)
|
||||||
.imePadding()
|
.imePadding()
|
||||||
.padding(horizontal = 24.dp)
|
|
||||||
.verticalScroll(rememberScrollState()),
|
.verticalScroll(rememberScrollState()),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.widthIn(max = 840.dp)
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 24.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp)
|
verticalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
@@ -120,7 +126,7 @@ fun ServerManagementScreen(
|
|||||||
label = stringResource(R.string.ssh_connection),
|
label = stringResource(R.string.ssh_connection),
|
||||||
isActive = isConnected,
|
isActive = isConnected,
|
||||||
activeLabel = stringResource(R.string.paired),
|
activeLabel = stringResource(R.string.paired),
|
||||||
activeColor = StatusBlue
|
activeColor = MaterialTheme.extendedColorScheme.info
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(10.dp))
|
Spacer(Modifier.height(10.dp))
|
||||||
StatusRow(stringResource(R.string.vk_turn_proxy), serverKnown?.running == true)
|
StatusRow(stringResource(R.string.vk_turn_proxy), serverKnown?.running == true)
|
||||||
@@ -182,7 +188,7 @@ fun ServerManagementScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.server_running_vless),
|
text = stringResource(R.string.server_running_vless),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = StatusBlue
|
color = MaterialTheme.extendedColorScheme.info
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,9 +200,7 @@ fun ServerManagementScreen(
|
|||||||
viewModel.installServer()
|
viewModel.installServer()
|
||||||
},
|
},
|
||||||
enabled = isConnected && !isWorking,
|
enabled = isConnected && !isWorking,
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.height(52.dp),
|
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.cloud_download_24px), null)
|
Icon(painterResource(R.drawable.cloud_download_24px), null)
|
||||||
@@ -212,9 +216,7 @@ fun ServerManagementScreen(
|
|||||||
},
|
},
|
||||||
enabled = (isConnected && !isWorking
|
enabled = (isConnected && !isWorking
|
||||||
&& serverKnown?.installed == true) && !serverKnown.running,
|
&& serverKnown?.installed == true) && !serverKnown.running,
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.height(52.dp),
|
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Icon(painterResource(R.drawable.play_arrow_24px), null)
|
Icon(painterResource(R.drawable.play_arrow_24px), null)
|
||||||
@@ -228,9 +230,7 @@ fun ServerManagementScreen(
|
|||||||
viewModel.stopServer()
|
viewModel.stopServer()
|
||||||
},
|
},
|
||||||
enabled = isConnected && !isWorking && serverKnown?.running == true,
|
enabled = isConnected && !isWorking && serverKnown?.running == true,
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.height(52.dp),
|
|
||||||
shape = MaterialTheme.shapes.large,
|
shape = MaterialTheme.shapes.large,
|
||||||
colors = ButtonDefaults.outlinedButtonColors(
|
colors = ButtonDefaults.outlinedButtonColors(
|
||||||
contentColor = MaterialTheme.colorScheme.error
|
contentColor = MaterialTheme.colorScheme.error
|
||||||
@@ -248,9 +248,7 @@ fun ServerManagementScreen(
|
|||||||
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
HapticUtil.perform(context, HapticUtil.Pattern.CLICK)
|
||||||
onContinue()
|
onContinue()
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier.fillMaxWidth(),
|
||||||
.fillMaxWidth()
|
|
||||||
.height(56.dp),
|
|
||||||
shape = MaterialTheme.shapes.large
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.continue_client_setup))
|
Text(stringResource(R.string.continue_client_setup))
|
||||||
@@ -308,10 +306,13 @@ fun ServerManagementScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SshStatusBadge(sshState: SshConnectionState, ip: String) {
|
private fun SshStatusBadge(sshState: SshConnectionState, ip: String) {
|
||||||
val connected = sshState is SshConnectionState.Connected
|
val connected = sshState is SshConnectionState.Connected
|
||||||
|
val dotColor = if (connected) MaterialTheme.extendedColorScheme.info
|
||||||
|
else MaterialTheme.colorScheme.error
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.padding(end = 16.dp)
|
modifier = Modifier.padding(end = 16.dp)
|
||||||
@@ -319,13 +320,13 @@ private fun SshStatusBadge(sshState: SshConnectionState, ip: String) {
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(8.dp)
|
.size(8.dp)
|
||||||
.background(if (connected) StatusBlue else MaterialTheme.colorScheme.error, CircleShape)
|
.background(dotColor, CircleShape)
|
||||||
)
|
)
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.width(6.dp))
|
||||||
Text(
|
Text(
|
||||||
if (connected) ip else stringResource(R.string.not_connected),
|
if (connected) ip else stringResource(R.string.not_connected),
|
||||||
style = MaterialTheme.typography.labelSmall,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.7f)
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,7 +336,7 @@ private fun StatusRow(
|
|||||||
label: String,
|
label: String,
|
||||||
isActive: Boolean,
|
isActive: Boolean,
|
||||||
activeLabel: String = stringResource(R.string.active),
|
activeLabel: String = stringResource(R.string.active),
|
||||||
activeColor: Color = StatusGreen
|
activeColor: Color = MaterialTheme.extendedColorScheme.success
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|||||||
@@ -75,10 +75,3 @@ val surfaceContainerLowDark = Color(0xFF191C20)
|
|||||||
val surfaceContainerDark = Color(0xFF1D2024)
|
val surfaceContainerDark = Color(0xFF1D2024)
|
||||||
val surfaceContainerHighDark = Color(0xFF282A2F)
|
val surfaceContainerHighDark = Color(0xFF282A2F)
|
||||||
val surfaceContainerHighestDark = Color(0xFF33353A)
|
val surfaceContainerHighestDark = Color(0xFF33353A)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val StatusGreen = Color(0xFF4CAF50)
|
|
||||||
val StatusGreenDark = Color(0xFF1B5E20)
|
|
||||||
val StatusBlue = Color(0xFF2196F3)
|
|
||||||
val StatusOrange = Color(0xFFE67E22)
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.freeturn.app.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
|
import androidx.compose.runtime.staticCompositionLocalOf
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Дополнительная цветовая схема для ролей, которых нет в MaterialTheme.colorScheme:
|
||||||
|
* success / warning / info. Значения сгенерированы через Material Theme Builder
|
||||||
|
* (seed: success #4CAF50, warning #E67E22, info #2196F3) и держат полный набор
|
||||||
|
* тональных пар, чтобы корректно пройти контраст 4.5:1 в light/dark.
|
||||||
|
*/
|
||||||
|
@Immutable
|
||||||
|
data class ExtendedColorScheme(
|
||||||
|
val success: Color,
|
||||||
|
val onSuccess: Color,
|
||||||
|
val successContainer: Color,
|
||||||
|
val onSuccessContainer: Color,
|
||||||
|
val warning: Color,
|
||||||
|
val onWarning: Color,
|
||||||
|
val warningContainer: Color,
|
||||||
|
val onWarningContainer: Color,
|
||||||
|
val info: Color,
|
||||||
|
val onInfo: Color,
|
||||||
|
val infoContainer: Color,
|
||||||
|
val onInfoContainer: Color,
|
||||||
|
)
|
||||||
|
|
||||||
|
private val extendedLight = ExtendedColorScheme(
|
||||||
|
success = Color(0xFF006E1C),
|
||||||
|
onSuccess = Color(0xFFFFFFFF),
|
||||||
|
successContainer = Color(0xFF7BFB88),
|
||||||
|
onSuccessContainer = Color(0xFF002204),
|
||||||
|
warning = Color(0xFF8B5000),
|
||||||
|
onWarning = Color(0xFFFFFFFF),
|
||||||
|
warningContainer = Color(0xFFFFDCBE),
|
||||||
|
onWarningContainer = Color(0xFF2D1600),
|
||||||
|
info = Color(0xFF00639C),
|
||||||
|
onInfo = Color(0xFFFFFFFF),
|
||||||
|
infoContainer = Color(0xFFCEE5FF),
|
||||||
|
onInfoContainer = Color(0xFF001D33),
|
||||||
|
)
|
||||||
|
|
||||||
|
private val extendedDark = ExtendedColorScheme(
|
||||||
|
success = Color(0xFF5FDB72),
|
||||||
|
onSuccess = Color(0xFF00390B),
|
||||||
|
successContainer = Color(0xFF005313),
|
||||||
|
onSuccessContainer = Color(0xFF7BFB88),
|
||||||
|
warning = Color(0xFFFFB787),
|
||||||
|
onWarning = Color(0xFF4B2800),
|
||||||
|
warningContainer = Color(0xFF6B3C00),
|
||||||
|
onWarningContainer = Color(0xFFFFDCBE),
|
||||||
|
info = Color(0xFF97CCFF),
|
||||||
|
onInfo = Color(0xFF003354),
|
||||||
|
infoContainer = Color(0xFF004B77),
|
||||||
|
onInfoContainer = Color(0xFFCEE5FF),
|
||||||
|
)
|
||||||
|
|
||||||
|
internal fun extendedColorSchemeFor(darkTheme: Boolean): ExtendedColorScheme =
|
||||||
|
if (darkTheme) extendedDark else extendedLight
|
||||||
|
|
||||||
|
internal val LocalExtendedColorScheme = staticCompositionLocalOf { extendedLight }
|
||||||
|
|
||||||
|
val MaterialTheme.extendedColorScheme: ExtendedColorScheme
|
||||||
|
@Composable
|
||||||
|
@ReadOnlyComposable
|
||||||
|
get() = LocalExtendedColorScheme.current
|
||||||
@@ -9,6 +9,7 @@ import androidx.compose.material3.dynamicDarkColorScheme
|
|||||||
import androidx.compose.material3.dynamicLightColorScheme
|
import androidx.compose.material3.dynamicLightColorScheme
|
||||||
import androidx.compose.material3.lightColorScheme
|
import androidx.compose.material3.lightColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.SideEffect
|
import androidx.compose.runtime.SideEffect
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
@@ -116,9 +117,13 @@ fun FreeTurnTheme(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompositionLocalProvider(
|
||||||
|
LocalExtendedColorScheme provides extendedColorSchemeFor(darkTheme)
|
||||||
|
) {
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colorScheme = colorScheme,
|
colorScheme = colorScheme,
|
||||||
typography = Typography,
|
typography = Typography,
|
||||||
content = content
|
content = content
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "9.1.0"
|
agp = "9.1.1"
|
||||||
kotlin = "2.3.20"
|
kotlin = "2.3.20"
|
||||||
coreKtx = "1.18.0"
|
coreKtx = "1.18.0"
|
||||||
appcompat = "1.7.1"
|
appcompat = "1.7.1"
|
||||||
@@ -19,6 +19,7 @@ androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graph
|
|||||||
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version = "1.5.0-alpha16" }
|
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version = "1.5.0-alpha16" }
|
||||||
|
androidx-compose-material3-adaptive-nav-suite = { group = "androidx.compose.material3", name = "material3-adaptive-navigation-suite", version = "1.5.0-alpha16" }
|
||||||
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
|
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
|
||||||
androidx-datastore-preferences = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "datastorePreferences" }
|
androidx-datastore-preferences = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "datastorePreferences" }
|
||||||
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
|
androidx-lifecycle-viewmodel-compose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycleViewmodelCompose" }
|
||||||
|
|||||||
Reference in new issue
Block a user