Compare commits
12 Commits
ac433bc492
...
feature/bt
| Author | SHA1 | Date | |
|---|---|---|---|
| 075dac1fc7 | |||
| bc07ea421b | |||
|
|
59c869d539 | ||
|
|
082c4f7973 | ||
|
|
c2efbd1f75 | ||
|
|
0482f03e09 | ||
|
|
aff43c61a0 | ||
|
|
2987289581 | ||
|
|
aaed01bd12 | ||
|
|
39ff86c8a0 | ||
|
|
993ab0a0b1 | ||
|
|
1f6e7b8ac0 |
@@ -3,7 +3,12 @@ package ru.fincode.tsudesk
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.core.view.WindowCompat
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import ru.fincode.tsudesk.core.ui.components.ConfigureSystemBars
|
||||
import ru.fincode.tsudesk.core.ui.theme.TSUDeskTheme
|
||||
import ru.fincode.tsudesk.core.ui.theme.TSUDeskThemeExt
|
||||
import ru.fincode.tsudesk.presentation.TSUDeskApp
|
||||
|
||||
@AndroidEntryPoint
|
||||
@@ -11,9 +16,16 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
setContent {
|
||||
TSUDeskTheme {
|
||||
ConfigureSystemBars(
|
||||
statusBarColor = Color.Transparent,
|
||||
navigationBarColor = TSUDeskThemeExt.colors.brand,
|
||||
darkIcons = false
|
||||
)
|
||||
TSUDeskApp()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ private const val BASE_TIMEOUT = 30L
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object AppConfigModule {
|
||||
|
||||
private const val BASE_URL_PROD = "https://tulsu.ru/schedule/queries/"
|
||||
private const val BASE_URL_PROD = "https://tulsu.ru/"
|
||||
private const val BASE_URL_DEVELOP = "https://scherbatykh.ru/app/tsudesk/"
|
||||
|
||||
@Provides
|
||||
@@ -1,37 +1,32 @@
|
||||
package ru.fincode.tsudesk.app.presentation.main
|
||||
package ru.fincode.tsudesk.presentation.main
|
||||
|
||||
import androidx.navigation.NavBackStackEntry
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.NavDestination.Companion.hasRoute
|
||||
import ru.fincode.tsudesk.core.navigation.AppRoute
|
||||
import ru.fincode.tsudesk.core.navigation.TopLevelDestination
|
||||
import ru.fincode.tsudesk.core.navigation.route
|
||||
|
||||
fun selectedTopLevel(entry: NavBackStackEntry?): TopLevelDestination {
|
||||
if (entry == null) return TopLevelDestination.SCHEDULE
|
||||
val dest: NavDestination = entry?.destination ?: return TopLevelDestination.SCHEDULE
|
||||
|
||||
return runCatching {
|
||||
when (entry.route<AppRoute>()) {
|
||||
AppRoute.Schedule,
|
||||
is AppRoute.ScheduleDetails -> TopLevelDestination.SCHEDULE
|
||||
return when {
|
||||
dest.hasRoute<AppRoute.Schedule>() || dest.hasRoute<AppRoute.ScheduleDetails>() ->
|
||||
TopLevelDestination.SCHEDULE
|
||||
|
||||
AppRoute.News,
|
||||
is AppRoute.NewsDetails -> TopLevelDestination.NEWS
|
||||
dest.hasRoute<AppRoute.News>() || dest.hasRoute<AppRoute.NewsDetails>() ->
|
||||
TopLevelDestination.NEWS
|
||||
|
||||
AppRoute.Progress -> TopLevelDestination.PROGRESS
|
||||
dest.hasRoute<AppRoute.Progress>() ->
|
||||
TopLevelDestination.PROGRESS
|
||||
|
||||
AppRoute.Settings -> TopLevelDestination.SETTINGS
|
||||
dest.hasRoute<AppRoute.Settings>() ->
|
||||
TopLevelDestination.SETTINGS
|
||||
|
||||
else -> TopLevelDestination.SCHEDULE
|
||||
}
|
||||
}.getOrDefault(TopLevelDestination.SCHEDULE)
|
||||
}
|
||||
|
||||
fun shouldShowBottomBar(entry: NavBackStackEntry?): Boolean {
|
||||
if (entry == null) return false
|
||||
|
||||
return runCatching {
|
||||
when (entry.route<AppRoute>()) {
|
||||
AppRoute.Splash -> false
|
||||
else -> true
|
||||
}
|
||||
}.getOrDefault(true)
|
||||
val dest: NavDestination = entry?.destination ?: return false
|
||||
return !dest.hasRoute<AppRoute.Splash>()
|
||||
}
|
||||
@@ -1,59 +1,50 @@
|
||||
package ru.fincode.tsudesk.presentation.main
|
||||
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import ru.fincode.core.ui.components.BottomBarItem
|
||||
import ru.fincode.core.ui.components.TsudeskBottomBar
|
||||
import ru.fincode.tsudesk.R
|
||||
import ru.fincode.tsudesk.app.presentation.main.selectedTopLevel
|
||||
import ru.fincode.tsudesk.app.presentation.main.shouldShowBottomBar
|
||||
import ru.fincode.tsudesk.core.navigation.TopLevelDestination
|
||||
import ru.fincode.tsudesk.core.navigation.navigateToTopLevel
|
||||
import ru.fincode.tsudesk.core.ui.components.BottomBarItem
|
||||
import ru.fincode.tsudesk.core.ui.components.TsudeskBottomBar
|
||||
|
||||
@Composable
|
||||
fun MainScaffold(
|
||||
navController: NavHostController,
|
||||
content: @Composable (Modifier) -> Unit,
|
||||
) {
|
||||
val scheduleIcon = painterResource(R.drawable.ic_progress)
|
||||
val newsIcon = painterResource(R.drawable.ic_news)
|
||||
val progressIcon = painterResource(R.drawable.ic_progress)
|
||||
val settingsIcon = painterResource(R.drawable.ic_progress)
|
||||
val scheduleIcon =
|
||||
androidx.compose.ui.graphics.vector.ImageVector.vectorResource(R.drawable.ic_progress)
|
||||
val newsIcon =
|
||||
androidx.compose.ui.graphics.vector.ImageVector.vectorResource(R.drawable.ic_progress)
|
||||
val progressIcon =
|
||||
androidx.compose.ui.graphics.vector.ImageVector.vectorResource(R.drawable.ic_progress)
|
||||
val settingsIcon =
|
||||
androidx.compose.ui.graphics.vector.ImageVector.vectorResource(R.drawable.ic_progress)
|
||||
|
||||
val items = listOf(
|
||||
TopLevelItem(
|
||||
destination = TopLevelDestination.SCHEDULE,
|
||||
labelRes = R.string.tab_schedule,
|
||||
icon = scheduleIcon
|
||||
),
|
||||
TopLevelItem(
|
||||
destination = TopLevelDestination.NEWS,
|
||||
labelRes = R.string.tab_news,
|
||||
icon = newsIcon
|
||||
),
|
||||
TopLevelItem(
|
||||
destination = TopLevelDestination.PROGRESS,
|
||||
labelRes = R.string.tab_progress,
|
||||
icon = progressIcon
|
||||
),
|
||||
TopLevelItem(
|
||||
destination = TopLevelDestination.SETTINGS,
|
||||
labelRes = R.string.tab_settings,
|
||||
icon = settingsIcon
|
||||
),
|
||||
TopLevelItem(TopLevelDestination.SCHEDULE, R.string.tab_schedule, scheduleIcon),
|
||||
TopLevelItem(TopLevelDestination.NEWS, R.string.tab_news, newsIcon),
|
||||
TopLevelItem(TopLevelDestination.PROGRESS, R.string.tab_progress, progressIcon),
|
||||
TopLevelItem(TopLevelDestination.SETTINGS, R.string.tab_settings, settingsIcon),
|
||||
)
|
||||
|
||||
val backStackEntry by navController.currentBackStackEntryAsState()
|
||||
val selected = selectedTopLevel(backStackEntry)
|
||||
|
||||
Scaffold(
|
||||
// ВАЖНО: при edge-to-edge отключаем автоматические systemBars insets у Scaffold,
|
||||
// иначе получаем двойные отступы (Scaffold + windowInsetsPadding в Header'е)
|
||||
contentWindowInsets = WindowInsets(0),
|
||||
|
||||
bottomBar = {
|
||||
if (shouldShowBottomBar(backStackEntry)) {
|
||||
val uiItems = items.map { item ->
|
||||
@@ -77,6 +68,8 @@ fun MainScaffold(
|
||||
}
|
||||
}
|
||||
) { innerPadding ->
|
||||
// innerPadding учитывает bottomBar и системные элементы Scaffold (если будут),
|
||||
// но НЕ добавляет statusBars (мы делаем это вручную в нужных местах, например в Header)
|
||||
content(Modifier.padding(innerPadding))
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
package ru.fincode.tsudesk.presentation.main
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import ru.fincode.tsudesk.core.navigation.TopLevelDestination
|
||||
|
||||
data class TopLevelItem(
|
||||
val destination: TopLevelDestination,
|
||||
@StringRes val labelRes: Int,
|
||||
val icon: Painter,
|
||||
val icon: ImageVector
|
||||
)
|
||||
@@ -1,19 +1,20 @@
|
||||
package ru.fincode.tsudesk.presentation.navigation
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.navigation
|
||||
import ru.fincode.tsudesk.presentation.main.MainScaffold
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import ru.fincode.tsudesk.core.navigation.AppRoute
|
||||
import ru.fincode.tsudesk.core.navigation.navigateRoute
|
||||
import ru.fincode.tsudesk.feature.news.presentation.screen.NewsRoute
|
||||
//import ru.fincode.tsudesk.feature.news.presentation.screen.NewsRoute
|
||||
import ru.fincode.tsudesk.presentation.main.MainScaffold
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.screen.ScheduleRoute
|
||||
|
||||
import ru.fincode.tsudesk.feature.splash.presentation.screen.SplashRoute
|
||||
|
||||
|
||||
@Composable
|
||||
fun AppNavHost(
|
||||
navController: NavHostController,
|
||||
@@ -33,51 +34,45 @@ fun AppNavHost(
|
||||
)
|
||||
}
|
||||
|
||||
navigation<AppRoute.Main>(startDestination = AppRoute.Schedule) {
|
||||
composable<AppRoute.Main> {
|
||||
val tabsNavController = rememberNavController()
|
||||
|
||||
composable<AppRoute.Schedule> {
|
||||
MainScaffold(navController) { innerModifier ->
|
||||
ScheduleRoute(
|
||||
modifier = innerModifier,
|
||||
// onOpenDetails = { lessonId ->
|
||||
// navController.navigateRoute(AppRoute.ScheduleDetails(lessonId))
|
||||
// }
|
||||
MainScaffold(
|
||||
navController = tabsNavController
|
||||
) { innerModifier ->
|
||||
MainTabsNavHost(
|
||||
navController = tabsNavController,
|
||||
modifier = innerModifier
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MainTabsNavHost(
|
||||
navController: NavHostController,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = AppRoute.Schedule,
|
||||
modifier = modifier
|
||||
) {
|
||||
composable<AppRoute.Schedule> {
|
||||
ScheduleRoute(modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
|
||||
composable<AppRoute.News> {
|
||||
MainScaffold(navController) { innerModifier: Modifier ->
|
||||
// NewsScreen(
|
||||
// modifier = innerModifier,
|
||||
// onOpenDetails = { id ->
|
||||
// navController.navigateRoute(AppRoute.NewsDetails(id))
|
||||
// }
|
||||
// )
|
||||
}
|
||||
NewsRoute(modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
|
||||
composable<AppRoute.Progress> {
|
||||
MainScaffold(navController) { innerModifier: Modifier ->
|
||||
// ProgressScreen(modifier = innerModifier)
|
||||
}
|
||||
// ProgressRoute(modifier = Modifier)
|
||||
}
|
||||
|
||||
composable<AppRoute.Settings> {
|
||||
MainScaffold(navController) { innerModifier ->
|
||||
// SettingsRoute(modifier = innerModifier)
|
||||
}
|
||||
}
|
||||
//
|
||||
// composable<AppRoute.ScheduleDetails> { entry ->
|
||||
// val args = entry.route<AppRoute.ScheduleDetails>()
|
||||
// ScheduleDetailsScreen(lessonId = args.lessonId)
|
||||
// }
|
||||
//
|
||||
// composable<AppRoute.NewsDetails> { entry ->
|
||||
// val args = entry.route<AppRoute.NewsDetails>()
|
||||
// NewsDetailsScreen(id = args.id)
|
||||
// }
|
||||
// SettingsRoute(modifier = Modifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,12 @@
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:pathData="M12,3L1,9l11,6 9,-4.91V17h2V9L12,3z"
|
||||
android:fillColor="?attr/colorControlNormal"/>
|
||||
android:fillColor="#FF000000"/>
|
||||
|
||||
<path
|
||||
android:pathData="M5,12.18V17c0,2.21 3.58,4 7,4s7,-1.79 7,-4v-4.82l-7,3.82 -7,-3.82z"
|
||||
android:fillColor="?attr/colorControlNormal"/>
|
||||
android:fillColor="#FF000000"/>
|
||||
</vector>
|
||||
@@ -13,7 +13,6 @@ import ru.fincode.tsudesk.core.database.api.schedule.ScheduleDao
|
||||
LessonCacheEntity::class
|
||||
],
|
||||
version = 2,
|
||||
exportSchema = true
|
||||
)
|
||||
@TypeConverters(StringListConverter::class)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package ru.fincode.tsudesk.core.ui.components
|
||||
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
|
||||
data class BottomBarItem(
|
||||
val key: String,
|
||||
val label: String,
|
||||
val icon: ImageVector,
|
||||
)
|
||||
@@ -0,0 +1,38 @@
|
||||
package ru.fincode.tsudesk.core.ui.components
|
||||
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.SystemBarStyle
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.SideEffect
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
|
||||
@Composable
|
||||
fun ConfigureSystemBars(
|
||||
statusBarColor: Color,
|
||||
navigationBarColor: Color = statusBarColor,
|
||||
darkIcons: Boolean = false, // false = светлые иконки
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val status = statusBarColor.toArgb()
|
||||
val nav = navigationBarColor.toArgb()
|
||||
|
||||
SideEffect {
|
||||
val activity = context as? ComponentActivity ?: return@SideEffect
|
||||
|
||||
activity.enableEdgeToEdge(
|
||||
statusBarStyle = if (darkIcons) {
|
||||
SystemBarStyle.light(status, status)
|
||||
} else {
|
||||
SystemBarStyle.dark(status)
|
||||
},
|
||||
navigationBarStyle = SystemBarStyle.auto(
|
||||
lightScrim = nav,
|
||||
darkScrim = nav,
|
||||
detectDarkMode = { darkIcons }
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
package ru.fincode.core.ui.components
|
||||
package ru.fincode.tsudesk.core.ui.components
|
||||
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
|
||||
data class BottomBarItem(
|
||||
val key: String,
|
||||
val label: String,
|
||||
val icon: Painter,
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun TsudeskBottomBar(
|
||||
@@ -21,19 +15,22 @@ fun TsudeskBottomBar(
|
||||
) {
|
||||
NavigationBar {
|
||||
items.forEach { item ->
|
||||
val selected = item.key == selectedKey
|
||||
|
||||
NavigationBarItem(
|
||||
selected = item.key == selectedKey,
|
||||
selected = selected,
|
||||
onClick = { onItemClick(item) },
|
||||
icon = {
|
||||
Icon(
|
||||
painter = item.icon,
|
||||
contentDescription = item.label
|
||||
imageVector = item.icon,
|
||||
contentDescription = item.label,
|
||||
tint = if (selected)
|
||||
MaterialTheme.colorScheme.primary
|
||||
else
|
||||
MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
},
|
||||
label = {
|
||||
Text(text = item.label)
|
||||
},
|
||||
alwaysShowLabel = true
|
||||
label = { Text(item.label) }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ru.fincode.tsudesk.core.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
// Brand (ТулГУ / TSUDesk)
|
||||
val BrandRed = Color(0xFF7C1D1D) // замени на точный бордовый
|
||||
val OnBrand = Color(0xFFFFFFFF)
|
||||
@@ -0,0 +1,22 @@
|
||||
package ru.fincode.tsudesk.core.ui.theme
|
||||
|
||||
import androidx.compose.material3.darkColorScheme
|
||||
import androidx.compose.material3.lightColorScheme
|
||||
|
||||
val LightColorScheme = lightColorScheme(
|
||||
primary = androidx.compose.ui.graphics.Color(0xFF6750A4),
|
||||
onPrimary = androidx.compose.ui.graphics.Color.White,
|
||||
secondary = androidx.compose.ui.graphics.Color(0xFF625B71),
|
||||
onSecondary = androidx.compose.ui.graphics.Color.White,
|
||||
tertiary = androidx.compose.ui.graphics.Color(0xFF7D5260),
|
||||
onTertiary = androidx.compose.ui.graphics.Color.White,
|
||||
)
|
||||
|
||||
val DarkColorScheme = darkColorScheme(
|
||||
primary = androidx.compose.ui.graphics.Color(0xFFD0BCFF),
|
||||
onPrimary = androidx.compose.ui.graphics.Color(0xFF381E72),
|
||||
secondary = androidx.compose.ui.graphics.Color(0xFFCCC2DC),
|
||||
onSecondary = androidx.compose.ui.graphics.Color(0xFF332D41),
|
||||
tertiary = androidx.compose.ui.graphics.Color(0xFFEFB8C8),
|
||||
onTertiary = androidx.compose.ui.graphics.Color(0xFF492532),
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
package ru.fincode.tsudesk.core.ui.theme
|
||||
|
||||
import androidx.compose.runtime.staticCompositionLocalOf
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
||||
data class ExtendedColors(
|
||||
val brand: Color,
|
||||
val onBrand: Color,
|
||||
val brandSoft: Color,
|
||||
)
|
||||
|
||||
val LocalExtendedColors = staticCompositionLocalOf {
|
||||
ExtendedColors(
|
||||
brand = Color.Unspecified,
|
||||
onBrand = Color.Unspecified,
|
||||
brandSoft = Color.Unspecified,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package ru.fincode.tsudesk.core.ui.theme
|
||||
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
|
||||
@Composable
|
||||
fun TSUDeskTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val scheme = if (darkTheme) DarkColorScheme else LightColorScheme
|
||||
|
||||
val extended = ExtendedColors(
|
||||
brand = BrandRed,
|
||||
onBrand = OnBrand,
|
||||
brandSoft = BrandRed.copy(alpha = 0.12f),
|
||||
)
|
||||
|
||||
CompositionLocalProvider(LocalExtendedColors provides extended) {
|
||||
MaterialTheme(
|
||||
colorScheme = scheme,
|
||||
typography = TSUDeskTypography,
|
||||
content = content
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package ru.fincode.tsudesk.core.ui.theme
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
|
||||
|
||||
object TSUDeskThemeExt {
|
||||
val colors: ExtendedColors
|
||||
@Composable get() = LocalExtendedColors.current
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.fincode.tsudesk.core.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
|
||||
val TSUDeskTypography = Typography()
|
||||
@@ -9,7 +9,7 @@ import java.util.Locale
|
||||
class NewsHtmlParser {
|
||||
|
||||
private val dateFormatter =
|
||||
DateTimeFormatter.ofPattern("dd.MM.yyyy", Locale("ru"))
|
||||
DateTimeFormatter.ofPattern("dd.MM.yyyy", Locale.forLanguageTag("ru"))
|
||||
|
||||
fun parseArchivePage(html: String): List<NewsItem> {
|
||||
val itemRegex = Regex(
|
||||
|
||||
@@ -3,7 +3,7 @@ package ru.fincode.tsudesk.feature.schedule.data.remote
|
||||
object ScheduleApiContract {
|
||||
|
||||
object Path {
|
||||
const val GET_SCHEDULE_METHOD = "GetSchedule.php"
|
||||
const val GET_SCHEDULE_METHOD = "schedule/queries/GetSchedule.php"
|
||||
}
|
||||
|
||||
object Query {
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
package ru.fincode.tsudesk.feature.schedule.presentation.navigation
|
||||
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.navigation.NavGraphBuilder
|
||||
import androidx.navigation.compose.composable
|
||||
import ru.fincode.tsudesk.core.navigation.AppRoute
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.screen.ScheduleRoute
|
||||
|
||||
fun NavGraphBuilder.scheduleGraph(
|
||||
modifier: Modifier = Modifier,
|
||||
// на будущее:
|
||||
// onOpenDetails: (lessonId: Long) -> Unit,
|
||||
) {
|
||||
composable<AppRoute.Schedule> {
|
||||
ScheduleRoute()
|
||||
ScheduleRoute(
|
||||
modifier = modifier,
|
||||
// onOpenDetails = onOpenDetails
|
||||
)
|
||||
}
|
||||
|
||||
// composable<AppRoute.ScheduleDetails> { backStackEntry ->
|
||||
// val args = backStackEntry.toRoute<AppRoute.ScheduleDetails>()
|
||||
// composable<AppRoute.ScheduleDetails> { entry ->
|
||||
// val args = entry.toRoute<AppRoute.ScheduleDetails>()
|
||||
// ScheduleDetailsRoute(lessonId = args.lessonId)
|
||||
// }
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package ru.fincode.tsudesk.feature.schedule.presentation
|
||||
package ru.fincode.tsudesk.feature.schedule.presentation.screen
|
||||
|
||||
sealed interface ScheduleAction {
|
||||
|
||||
@@ -3,7 +3,21 @@ package ru.fincode.tsudesk.feature.schedule.presentation.screen
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.statusBars
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
@@ -14,9 +28,23 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.material3.AssistChip
|
||||
import androidx.compose.material3.AssistChipDefaults
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.OutlinedTextFieldDefaults
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
@@ -28,7 +56,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ru.fincode.tsudesk.core.common.model.DataResult
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.*
|
||||
import ru.fincode.tsudesk.core.ui.theme.TSUDeskThemeExt
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.util.dowRuShort
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.util.todayString
|
||||
|
||||
@@ -60,31 +88,38 @@ private fun ScheduleHeader(
|
||||
onIntent: (ScheduleIntent) -> Unit
|
||||
) {
|
||||
val shape = RoundedCornerShape(bottomStart = 20.dp, bottomEnd = 20.dp)
|
||||
val brand = TSUDeskThemeExt.colors
|
||||
|
||||
val headerBrush = Brush.linearGradient(
|
||||
listOf(
|
||||
MaterialTheme.colorScheme.error,
|
||||
MaterialTheme.colorScheme.error.copy(alpha = 0.75f)
|
||||
brand.brand,
|
||||
brand.brand.copy(alpha = 0.75f)
|
||||
)
|
||||
)
|
||||
|
||||
Column(
|
||||
Box(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(shape)
|
||||
.background(headerBrush)
|
||||
.padding(top = 20.dp, start = 16.dp, end = 16.dp, bottom = 14.dp)
|
||||
) {
|
||||
Column(
|
||||
Modifier
|
||||
// inset только для содержимого, фон остаётся до верха
|
||||
.windowInsetsPadding(WindowInsets.statusBars)
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 14.dp)
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = "Расписание",
|
||||
color = MaterialTheme.colorScheme.onError,
|
||||
color = brand.onBrand,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "ТулГУ • Осенний семестр",
|
||||
color = MaterialTheme.colorScheme.onError.copy(alpha = 0.8f),
|
||||
color = brand.onBrand.copy(alpha = 0.8f),
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
@@ -105,19 +140,17 @@ private fun ScheduleHeader(
|
||||
isLoading = state.isLoading,
|
||||
onExpanded = { onIntent(ScheduleIntent.SetGroupMenuExpanded(it)) },
|
||||
onValueChange = { onIntent(ScheduleIntent.ChangeGroupInput(it)) },
|
||||
|
||||
// выбор из списка -> сразу загрузка
|
||||
onSelectRecent = { group ->
|
||||
onIntent(ScheduleIntent.SelectRecentGroup(group))
|
||||
onIntent(ScheduleIntent.ApplyGroup)
|
||||
},
|
||||
|
||||
onRemoveRecent = { onIntent(ScheduleIntent.RemoveRecentGroup(it)) },
|
||||
onApply = { onIntent(ScheduleIntent.ApplyGroup) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ModeToggle(
|
||||
@@ -566,9 +599,10 @@ private fun LessonCard(lesson: UiLesson) {
|
||||
|
||||
@Composable
|
||||
private fun LessonBadge(text: String, kind: BadgeKind) {
|
||||
val brand = TSUDeskThemeExt.colors
|
||||
val (bg, fg) = when (kind) {
|
||||
BadgeKind.INFO -> MaterialTheme.colorScheme.primary.copy(alpha = 0.12f) to MaterialTheme.colorScheme.primary
|
||||
BadgeKind.PRIMARY -> MaterialTheme.colorScheme.error.copy(alpha = 0.12f) to MaterialTheme.colorScheme.error
|
||||
BadgeKind.PRIMARY -> brand.brandSoft to brand.brand
|
||||
BadgeKind.LAB -> MaterialTheme.colorScheme.tertiary.copy(alpha = 0.12f) to MaterialTheme.colorScheme.tertiary
|
||||
BadgeKind.MUTED -> MaterialTheme.colorScheme.surfaceVariant to MaterialTheme.colorScheme.onSurfaceVariant
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user