lab2
This commit is contained in:
parent
4be18d6f77
commit
4c565c2294
1
.idea/.name
Normal file
1
.idea/.name
Normal file
@ -0,0 +1 @@
|
||||
pmu-demo
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
41
.idea/inspectionProfiles/Project_Default.xml
Normal file
41
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewApiLevelMustBeValid" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewFontScaleMustBeGreaterThanZero" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewMultipleParameterProviders" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewMustBeTopLevelFunction" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewNeedsComposableAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewNotSupportedInUnitTestFiles" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewPickerAnnotation" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -1,4 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
|
@ -4,11 +4,11 @@ plugins {
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.example.pmulabs"
|
||||
compileSdk = 33
|
||||
namespace = "ru.ulstu.is.pmu"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.example.pmulabs"
|
||||
applicationId = "ru.ulstu.is.pmu"
|
||||
minSdk = 24
|
||||
targetSdk = 33
|
||||
versionCode = 1
|
||||
@ -51,10 +51,11 @@ android {
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation("androidx.core:core-ktx:1.9.0")
|
||||
implementation("androidx.core:core-ktx:1.12.0")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
|
||||
implementation("androidx.activity:activity-compose:1.7.2")
|
||||
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
|
||||
implementation("androidx.navigation:navigation-compose:2.7.3")
|
||||
implementation("androidx.compose.ui:ui")
|
||||
implementation("androidx.compose.ui:ui-graphics")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
@ -66,4 +67,5 @@ dependencies {
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest")
|
||||
debugImplementation("androidx.compose.material:material-icons-extended:1.5.3")
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
package com.example.pmulabs
|
||||
package ru.ulstu.`is`.pmu
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
@ -19,6 +17,6 @@ class ExampleInstrumentedTest {
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.example.pmulabs", appContext.packageName)
|
||||
assertEquals("ru.ulstu.is.pmu", appContext.packageName)
|
||||
}
|
||||
}
|
@ -10,13 +10,13 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.PMULabs"
|
||||
android:theme="@style/Theme.Pmudemo"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".MainComposeActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.PMULabs">
|
||||
android:theme="@style/Theme.Pmudemo">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
@ -1,46 +1,43 @@
|
||||
package com.example.pmulabs
|
||||
package ru.ulstu.`is`.pmu
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.example.pmulabs.ui.theme.PMULabsTheme
|
||||
import ru.ulstu.`is`.pmu.composeui.navigation.MainNavbar
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
class MainComposeActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
PMULabsTheme {
|
||||
// A surface container using the 'background' color from the theme
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
Greeting("Android")
|
||||
MainNavbar()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
fun Greeting(name: String, modifier: Modifier = Modifier) {
|
||||
Text(
|
||||
text = "Hello $name!",
|
||||
modifier = modifier
|
||||
)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun GreetingPreview() {
|
||||
PMULabsTheme {
|
||||
Greeting("Android")
|
||||
fun MainNavbarPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
MainNavbar()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
package ru.ulstu.`is`.pmu.composeui.navigation
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.NavigationBar
|
||||
import androidx.compose.material3.NavigationBarDefaults
|
||||
import androidx.compose.material3.NavigationBarItem
|
||||
import androidx.compose.material3.NavigationBarItemDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.NavDestination.Companion.hierarchy
|
||||
import androidx.navigation.NavGraph.Companion.findStartDestination
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.NavType
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||
import androidx.navigation.compose.rememberNavController
|
||||
import androidx.navigation.navArgument
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.login.LoginView
|
||||
import ru.ulstu.`is`.pmu.login.RegistrationView
|
||||
import ru.ulstu.`is`.pmu.main.MainView
|
||||
import ru.ulstu.`is`.pmu.profile.Profile
|
||||
import ru.ulstu.`is`.pmu.rent.composeui.CreateRent
|
||||
import ru.ulstu.`is`.pmu.rent.composeui.RentList
|
||||
import ru.ulstu.`is`.pmu.rent.composeui.RentView
|
||||
import ru.ulstu.`is`.pmu.ticket.composeui.TicketList
|
||||
import ru.ulstu.`is`.pmu.ticket.composeui.TicketView
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@Composable
|
||||
fun Navbar(
|
||||
navController: NavHostController,
|
||||
currentDestination: NavDestination?,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
NavigationBar(modifier) {
|
||||
Screen.bottomBarItems.forEach { screen ->
|
||||
NavigationBarItem(
|
||||
colors = NavigationBarItemDefaults.colors(colorResource(R.color.lightBlue)),
|
||||
icon = { Icon(screen.icon, contentDescription = null) },
|
||||
label = { Text(stringResource(screen.resourceId)) },
|
||||
selected = currentDestination?.hierarchy?.any { it.route == screen.route } == true,
|
||||
onClick = {
|
||||
navController.navigate(screen.route) {
|
||||
popUpTo(navController.graph.findStartDestination().id) {
|
||||
saveState = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Composable
|
||||
fun Navhost(
|
||||
navController: NavHostController,
|
||||
innerPadding: PaddingValues, modifier:
|
||||
Modifier = Modifier
|
||||
) {
|
||||
NavHost(
|
||||
navController,
|
||||
startDestination = Screen.MainView.route,
|
||||
modifier.padding(innerPadding)
|
||||
) {
|
||||
composable(Screen.Profile.route) { Profile(navController) }
|
||||
composable(Screen.TicketList.route) { TicketList(navController) }
|
||||
composable(Screen.RentList.route) { RentList(navController) }
|
||||
composable(Screen.LoginView.route) { LoginView(navController) }
|
||||
composable(Screen.RegistrationView.route) { RegistrationView(navController) }
|
||||
composable(Screen.MainView.route) { MainView(navController) }
|
||||
composable(Screen.CreateRent.route) { CreateRent(navController) }
|
||||
composable(
|
||||
Screen.TicketView.route,
|
||||
arguments = listOf(navArgument("id") { type = NavType.IntType })
|
||||
) { backStackEntry ->
|
||||
backStackEntry.arguments?.let { TicketView(it.getInt("id")) }
|
||||
}
|
||||
composable(
|
||||
Screen.RentView.route,
|
||||
arguments = listOf(navArgument("id") { type = NavType.IntType })
|
||||
) { backStackEntry ->
|
||||
backStackEntry.arguments?.let { RentView(it.getInt("id")) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun MainNavbar() {
|
||||
val navController = rememberNavController()
|
||||
val navBackStackEntry by navController.currentBackStackEntryAsState()
|
||||
val currentDestination = navBackStackEntry?.destination
|
||||
val currentScreen = currentDestination?.route?.let { Screen.getItem(it) }
|
||||
|
||||
Scaffold(
|
||||
bottomBar = {
|
||||
if (currentScreen == null || currentScreen.showInBottomBar) {
|
||||
Navbar(navController, currentDestination)
|
||||
}
|
||||
}
|
||||
) { innerPadding ->
|
||||
Navhost(navController, innerPadding)
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun MainNavbarPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
MainNavbar()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package ru.ulstu.`is`.pmu.composeui.navigation
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.AccountCircle
|
||||
import androidx.compose.material.icons.filled.AirplaneTicket
|
||||
import androidx.compose.material.icons.filled.Favorite
|
||||
import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material.icons.filled.LocalSee
|
||||
import androidx.compose.material.icons.filled.Login
|
||||
import androidx.compose.material.icons.filled.Payments
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
|
||||
enum class Screen(
|
||||
val route: String,
|
||||
@StringRes val resourceId: Int,
|
||||
val icon: ImageVector = Icons.Filled.Favorite,
|
||||
val showInBottomBar: Boolean = true
|
||||
) {
|
||||
Profile(
|
||||
"profile", R.string.student_main_title, Icons.Filled.AccountCircle
|
||||
),
|
||||
TicketView(
|
||||
"ticket-view/{id}", R.string.ticket_view_title, showInBottomBar = false
|
||||
),
|
||||
TicketList(
|
||||
"ticket-list", R.string.ticket_main_title, showInBottomBar = false
|
||||
),
|
||||
RentView(
|
||||
"rent-view/{id}", R.string.rent_view_title, showInBottomBar = false
|
||||
),
|
||||
RentList(
|
||||
"rent-list", R.string.rent_main_title, showInBottomBar = false
|
||||
),
|
||||
LoginView(
|
||||
"login", R.string.rent_view_title, Icons.Filled.Login
|
||||
),
|
||||
RegistrationView(
|
||||
"registration", R.string.rent_view_title, showInBottomBar = false
|
||||
),
|
||||
MainView(
|
||||
"main", R.string.rent_view_title, Icons.Filled.Search
|
||||
),
|
||||
CreateRent(
|
||||
"create-rent", R.string.rent_view_title, showInBottomBar = false
|
||||
);
|
||||
|
||||
companion object {
|
||||
val bottomBarItems = listOf(
|
||||
MainView,
|
||||
Profile,
|
||||
LoginView
|
||||
)
|
||||
|
||||
fun getItem(route: String): Screen? {
|
||||
val findRoute = route.split("/").first()
|
||||
return values().find { value -> value.route.startsWith(findRoute) }
|
||||
}
|
||||
}
|
||||
}
|
157
app/src/main/java/ru/ulstu/is/pmu/login/LoginView.kt
Normal file
157
app/src/main/java/ru/ulstu/is/pmu/login/LoginView.kt
Normal file
@ -0,0 +1,157 @@
|
||||
package ru.ulstu.`is`.pmu.login
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.os.Build
|
||||
import android.view.textclassifier.TextLinks.TextLink
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Email
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonColors
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ElevatedCard
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TextFieldColors
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.modifier.modifierLocalConsumer
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextLayoutInput
|
||||
import androidx.compose.ui.text.font.FontStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.TextUnitType
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.composeui.navigation.Screen
|
||||
import ru.ulstu.`is`.pmu.rent.composeui.RentView
|
||||
import ru.ulstu.`is`.pmu.rent.model.getRents
|
||||
import ru.ulstu.`is`.pmu.ticket.composeui.TicketList
|
||||
import ru.ulstu.`is`.pmu.ticket.model.getTickets
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
import kotlin.math.round
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun LoginView(navController: NavController?) {
|
||||
Column(
|
||||
Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.login_heading_text),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 40.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(color = Color.Black, thickness = 2.dp,modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth())
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.login_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.login_label))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.password_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.password_label))
|
||||
}
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.login_button))
|
||||
}
|
||||
)
|
||||
Text(
|
||||
text = "Ещё не зарегистрированы?",
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
)
|
||||
TextButton(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
onClick = {
|
||||
navController?.navigate("registration")
|
||||
},
|
||||
content = {
|
||||
Text(stringResource(id = R.string.registration),
|
||||
color = colorResource(R.color.lightBlue), textDecoration = TextDecoration.Underline)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun LoginViewPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
LoginView(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
193
app/src/main/java/ru/ulstu/is/pmu/login/RegistrationView.kt
Normal file
193
app/src/main/java/ru/ulstu/is/pmu/login/RegistrationView.kt
Normal file
@ -0,0 +1,193 @@
|
||||
package ru.ulstu.`is`.pmu.login
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.gestures.Orientation
|
||||
import androidx.compose.foundation.gestures.rememberScrollableState
|
||||
import androidx.compose.foundation.gestures.scrollable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun RegistrationView(navController: NavController?) {
|
||||
val state = rememberScrollState()
|
||||
LaunchedEffect(Unit) { state.animateScrollTo(100) }
|
||||
Column(
|
||||
Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp)
|
||||
.verticalScroll(state),
|
||||
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.registration),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(color = Color.Black, thickness = 2.dp,modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth())
|
||||
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.surname_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.surname))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.name_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.name))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.dateOfBirth_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.dateOfBirth))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.login_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.login_label))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.password_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.password_label))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = stringResource(id = R.string.password_example), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.password_confirm))
|
||||
}
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.registration_button))
|
||||
}
|
||||
)
|
||||
Text(
|
||||
text = "Уже зарегистрированы?",
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
)
|
||||
TextButton(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
onClick = {
|
||||
navController?.navigate("login")
|
||||
},
|
||||
content = {
|
||||
Text(
|
||||
stringResource(id = R.string.login_heading_text),
|
||||
color = colorResource(R.color.lightBlue), textDecoration = TextDecoration.Underline)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun RegistrationViewPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
RegistrationView(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
173
app/src/main/java/ru/ulstu/is/pmu/main/MainView.kt
Normal file
173
app/src/main/java/ru/ulstu/is/pmu/main/MainView.kt
Normal file
@ -0,0 +1,173 @@
|
||||
package ru.ulstu.`is`.pmu.main
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.CalendarMonth
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun MainView(navController: NavController?) {
|
||||
val state = rememberScrollState()
|
||||
LaunchedEffect(Unit) { state.animateScrollTo(100) }
|
||||
Column(
|
||||
Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp)
|
||||
.verticalScroll(state),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.main_heading),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(
|
||||
color = Color.Black, thickness = 2.dp, modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth()
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = "", onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_from))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = "", onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_to))
|
||||
}
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.padding(all = 10.dp)
|
||||
.weight(1f),
|
||||
value = "", onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_arrivalDate))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.padding(all = 10.dp)
|
||||
.weight(1f),
|
||||
value = "", onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_departureDate))
|
||||
}
|
||||
)
|
||||
}
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {
|
||||
navController?.navigate("ticket-list")
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.button_search))
|
||||
}
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
verticalAlignment = Alignment.Bottom
|
||||
) {
|
||||
Button(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
onClick = {},
|
||||
colors = ButtonDefaults.buttonColors(colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.button_help))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun MainViewPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
MainView(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
142
app/src/main/java/ru/ulstu/is/pmu/profile/Profile.kt
Normal file
142
app/src/main/java/ru/ulstu/is/pmu/profile/Profile.kt
Normal file
@ -0,0 +1,142 @@
|
||||
package ru.ulstu.`is`.pmu.profile
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
import ru.ulstu.`is`.pmu.user.model.getUsers
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun Profile(navController: NavController?) {
|
||||
val state = rememberScrollState()
|
||||
LaunchedEffect(Unit) { state.animateScrollTo(100) }
|
||||
Column(
|
||||
Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp)
|
||||
.verticalScroll(state),
|
||||
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.profile_heading),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(color = Color.Black, thickness = 2.dp,modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth())
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = getUsers()[0].fio, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.name))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = getUsers()[0].username, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.login_label))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = getUsers()[0].dateOfBirth, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.dateOfBirth))
|
||||
}
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent),
|
||||
border = BorderStroke(3.dp, colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Column(){
|
||||
Text("Паспорт РФ", fontSize = 20.sp, color = Color.Black, softWrap = true)
|
||||
Text("серия номер", fontSize = 10.sp, color = Color.Red, softWrap = true)
|
||||
Text("7323 273284", fontSize = 10.sp, color = Color.Black, softWrap = true)}
|
||||
Column() {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.passport),
|
||||
contentDescription = "",
|
||||
modifier = Modifier.size(80.dp, 80.dp),
|
||||
alignment = Alignment.CenterEnd
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {
|
||||
navController?.navigate("rent-list")
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent),
|
||||
border = BorderStroke(3.dp, colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.my_rents), color = Color.Black)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun ProfilePreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
Profile(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
182
app/src/main/java/ru/ulstu/is/pmu/rent/composeui/CreateRent.kt
Normal file
182
app/src/main/java/ru/ulstu/is/pmu/rent/composeui/CreateRent.kt
Normal file
@ -0,0 +1,182 @@
|
||||
package ru.ulstu.`is`.pmu.rent.composeui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Paint
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExposedDropdownMenuBox
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.composeui.navigation.Screen
|
||||
import ru.ulstu.`is`.pmu.ticket.model.getTickets
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
import ru.ulstu.`is`.pmu.user.model.getUsers
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun CreateRent(navController: NavController?) {
|
||||
Column(
|
||||
Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.create_rent),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(color = Color.Black, thickness = 2.dp,modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth())
|
||||
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
var selectedIndex by remember { mutableIntStateOf(0) }
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text(
|
||||
text = "Выбрать билет",
|
||||
modifier = Modifier
|
||||
.clickable { expanded = true }
|
||||
.background(color = Color.Transparent)
|
||||
.padding(8.dp)
|
||||
.fillMaxWidth(),
|
||||
color = colorResource(R.color.lightBlue),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
DropdownMenu(
|
||||
expanded = expanded,
|
||||
onDismissRequest = { expanded = false }
|
||||
) {
|
||||
getTickets().forEachIndexed { index, ticket ->
|
||||
DropdownMenuItem(
|
||||
text = { Text(text = "${ticket.from} --> ${ticket.to}") },
|
||||
onClick = {
|
||||
selectedIndex = index
|
||||
expanded = false
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = getUsers()[0].fio, onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_user))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = LocalDate.now().toString(), onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_dateOfRent))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
value = "Ожидает подтверждения", onValueChange = {},
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
focusedBorderColor = colorResource(R.color.lightBlue),
|
||||
unfocusedBorderColor = Color.DarkGray
|
||||
),
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_status))
|
||||
}
|
||||
)
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {navController?.navigate("rent-list")},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.button_confirm_rent))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun CreateRentPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
CreateRent(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
100
app/src/main/java/ru/ulstu/is/pmu/rent/composeui/RentList.kt
Normal file
100
app/src/main/java/ru/ulstu/is/pmu/rent/composeui/RentList.kt
Normal file
@ -0,0 +1,100 @@
|
||||
package ru.ulstu.`is`.pmu.rent.composeui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.BorderStroke
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.composeui.navigation.Screen
|
||||
import ru.ulstu.`is`.pmu.rent.model.getRents
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@Composable
|
||||
fun RentList(navController: NavController?) {
|
||||
Column(
|
||||
Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.list_rents),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 25.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(color = Color.Black, thickness = 2.dp,modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth())
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = {navController?.navigate("create-rent")},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorResource(R.color.lightBlue)),
|
||||
content = {
|
||||
Text(stringResource(id = R.string.create_rent))
|
||||
}
|
||||
)
|
||||
getRents().forEachIndexed() { index, rent ->
|
||||
val rentId = Screen.RentView.route.replace("{id}", index.toString())
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = { navController?.navigate(rentId) },
|
||||
colors = ButtonDefaults.buttonColors(containerColor = Color.Transparent),
|
||||
border = BorderStroke(3.dp, colorResource(R.color.lightBlue)),
|
||||
) {
|
||||
Text("${rent.ticket} ${rent.status}", color = Color.Black)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun RentListPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
RentList(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
78
app/src/main/java/ru/ulstu/is/pmu/rent/composeui/RentView.kt
Normal file
78
app/src/main/java/ru/ulstu/is/pmu/rent/composeui/RentView.kt
Normal file
@ -0,0 +1,78 @@
|
||||
package ru.ulstu.`is`.pmu.rent.composeui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.rent.model.getRents
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun RentView(id: Int) {
|
||||
val rent = getRents()[id]
|
||||
Column(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp)
|
||||
) {
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = rent.user, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_user))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = rent.dateOfRent, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_dateOfRent))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = rent.status, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_status))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = rent.ticket, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.rent_ticket))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
fun RentViewPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
RentView(id = 0)
|
||||
}
|
||||
}
|
||||
}
|
19
app/src/main/java/ru/ulstu/is/pmu/rent/model/Rent.kt
Normal file
19
app/src/main/java/ru/ulstu/is/pmu/rent/model/Rent.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package ru.ulstu.`is`.pmu.rent.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Rent(
|
||||
val user: String,
|
||||
val dateOfRent: String,
|
||||
var status: String,
|
||||
val ticket: String
|
||||
) : Serializable
|
||||
|
||||
|
||||
fun getRents(): List<Rent> {
|
||||
return listOf(
|
||||
Rent("user1", "2023-10-01", "Confirmed", "Ulyanovsk --> Moscow"),
|
||||
Rent("user2", "2023-10-04", "Waiting confirmation", "Ulyanovsk --> Saint Petersburg"),
|
||||
Rent("user3", "2023-10-03", "Confirmed", "Ulyanovsk --> Sochi")
|
||||
)
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package ru.ulstu.`is`.pmu.ticket.composeui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.Divider
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ImageBitmap
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.imageResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavController
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.composeui.navigation.Screen
|
||||
import ru.ulstu.`is`.pmu.ticket.model.getTickets
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@Composable
|
||||
fun TicketList(navController: NavController?) {
|
||||
Column( Modifier
|
||||
.padding(all = 10.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(horizontal = 24.dp)
|
||||
.padding(vertical = 32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Image(
|
||||
bitmap = ImageBitmap.imageResource(R.drawable.logo),
|
||||
contentDescription = "Логотип",
|
||||
modifier = Modifier.size(100.dp, 100.dp)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(id = R.string.list_tickets),
|
||||
textAlign = TextAlign.Center,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 30.sp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 10.dp),
|
||||
)
|
||||
Divider(color = Color.Black, thickness = 2.dp,modifier = Modifier
|
||||
.padding(bottom = 24.dp)
|
||||
.fillMaxWidth())
|
||||
getTickets().forEachIndexed() { index, ticket ->
|
||||
val ticketId = Screen.TicketView.route.replace("{id}", index.toString())
|
||||
Button(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp),
|
||||
onClick = { navController?.navigate(ticketId) },
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorResource(R.color.lightBlue)),
|
||||
) {
|
||||
Text("${ticket.from} --> ${ticket.to}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Composable
|
||||
fun TicketListPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
TicketList(navController = null)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package ru.ulstu.`is`.pmu.ticket.composeui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import ru.ulstu.`is`.pmu.R
|
||||
import ru.ulstu.`is`.pmu.ticket.model.getTickets
|
||||
import ru.ulstu.`is`.pmu.ui.theme.PmudemoTheme
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun TicketView(id: Int) {
|
||||
val ticket = getTickets()[id]
|
||||
Column(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(all = 10.dp)
|
||||
) {
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = ticket.from, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_from))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = ticket.to, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_to))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = ticket.departureDate, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_departureDate))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = ticket.arrivalDate, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_arrivalDate))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = ticket.cost.toString(), onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_cost))
|
||||
}
|
||||
)
|
||||
OutlinedTextField(modifier = Modifier.fillMaxWidth(),
|
||||
value = ticket.seat, onValueChange = {}, readOnly = true,
|
||||
label = {
|
||||
Text(stringResource(id = R.string.ticket_seat))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(name = "Light Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_NO)
|
||||
@Preview(name = "Dark Mode", showBackground = true, uiMode = Configuration.UI_MODE_NIGHT_YES)
|
||||
@Composable
|
||||
fun TicketViewPreview() {
|
||||
PmudemoTheme {
|
||||
Surface(
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
TicketView(id = 0)
|
||||
}
|
||||
}
|
||||
}
|
21
app/src/main/java/ru/ulstu/is/pmu/ticket/model/Ticket.kt
Normal file
21
app/src/main/java/ru/ulstu/is/pmu/ticket/model/Ticket.kt
Normal file
@ -0,0 +1,21 @@
|
||||
package ru.ulstu.`is`.pmu.ticket.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class Ticket(
|
||||
var from: String,
|
||||
val to: String,
|
||||
val departureDate: String,
|
||||
val arrivalDate: String,
|
||||
var cost: Double,
|
||||
var seat: String
|
||||
) : Serializable
|
||||
|
||||
|
||||
fun getTickets(): List<Ticket> {
|
||||
return listOf(
|
||||
Ticket("Ulyanovsk", "Moscow", "2023-10-12", "2023-10-16", 2679.5, "25С"),
|
||||
Ticket("Ulyanovsk", "Saint-Petersburg", "2023-10-01", "2023-10-16", 5399.0, "102A"),
|
||||
Ticket("Ulyanovsk", "Sochi", "2023-10-11", "2023-10-13", 2499.9, "42B")
|
||||
)
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.example.pmulabs.ui.theme
|
||||
package ru.ulstu.`is`.pmu.ui.theme
|
||||
|
||||
import androidx.compose.ui.graphics.Color
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.pmulabs.ui.theme
|
||||
package ru.ulstu.`is`.pmu.ui.theme
|
||||
|
||||
import android.app.Activity
|
||||
import android.os.Build
|
||||
@ -38,7 +38,7 @@ private val LightColorScheme = lightColorScheme(
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun PMULabsTheme(
|
||||
fun PmudemoTheme(
|
||||
darkTheme: Boolean = isSystemInDarkTheme(),
|
||||
// Dynamic color is available on Android 12+
|
||||
dynamicColor: Boolean = true,
|
@ -1,4 +1,4 @@
|
||||
package com.example.pmulabs.ui.theme
|
||||
package ru.ulstu.`is`.pmu.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
20
app/src/main/java/ru/ulstu/is/pmu/user/model/User.kt
Normal file
20
app/src/main/java/ru/ulstu/is/pmu/user/model/User.kt
Normal file
@ -0,0 +1,20 @@
|
||||
package ru.ulstu.`is`.pmu.user.model
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
class User(
|
||||
val id: Int,
|
||||
var fio: String,
|
||||
val dateOfBirth: String,
|
||||
val username: String,
|
||||
val password: String,
|
||||
) : Serializable
|
||||
|
||||
|
||||
fun getUsers(): List<User> {
|
||||
return listOf(
|
||||
User(0, "Jane Smith", "2001-04-12", "user1", "password1"),
|
||||
User(1, "John Smith", "2000-08-18", "user2", "password2"),
|
||||
User(2, "Tanya Artamonova", "2003-11-07", "user3", "password3")
|
||||
)
|
||||
}
|
5
app/src/main/res/drawable/baseline_account_circle_24.xml
Normal file
5
app/src/main/res/drawable/baseline_account_circle_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM12,6c1.93,0 3.5,1.57 3.5,3.5S13.93,13 12,13s-3.5,-1.57 -3.5,-3.5S10.07,6 12,6zM12,20c-2.03,0 -4.43,-0.82 -6.14,-2.88C7.55,15.8 9.68,15 12,15s4.45,0.8 6.14,2.12C16.43,19.18 14.03,20 12,20z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/baseline_flight_24.xml
Normal file
5
app/src/main/res/drawable/baseline_flight_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M21,16v-2l-8,-5V3.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,2.67 10,3.5V9l-8,5v2l8,-2.5V19l-2,1.5V22l3.5,-1 3.5,1v-1.5L13,19v-5.5l8,2.5z"/>
|
||||
</vector>
|
5
app/src/main/res/drawable/baseline_payments_24.xml
Normal file
5
app/src/main/res/drawable/baseline_payments_24.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:tint="#000000"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M19,14L19,6c0,-1.1 -0.9,-2 -2,-2L3,4c-1.1,0 -2,0.9 -2,2v8c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM10,13c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM23,7v11c0,1.1 -0.9,2 -2,2L4,20v-2h17L21,7h2z"/>
|
||||
</vector>
|
BIN
app/src/main/res/drawable/logo.png
Normal file
BIN
app/src/main/res/drawable/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
BIN
app/src/main/res/drawable/passport.png
Normal file
BIN
app/src/main/res/drawable/passport.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
@ -7,4 +7,5 @@
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
<color name="lightBlue">#6AABC8</color>
|
||||
</resources>
|
@ -1,3 +1,53 @@
|
||||
<resources>
|
||||
<string name="app_name">PMULabs</string>
|
||||
<string name="app_name">Avia Pass</string>
|
||||
<string name="arrow">--></string>
|
||||
<string name="student_firstname">Откуда</string>
|
||||
<string name="student_lastname">Куда</string>
|
||||
<string name="student_group">Дата вылета</string>
|
||||
<string name="student_phone">Дата прилёта</string>
|
||||
<string name="student_email">Стоимость</string>
|
||||
<string name="rent_user">Пользователь</string>
|
||||
<string name="rent_dateOfRent">Дата бронирования</string>
|
||||
<string name="rent_status">Статус бронирования</string>
|
||||
<string name="rent_ticket">Билет</string>
|
||||
<string name="ticket_from">Откуда</string>
|
||||
<string name="ticket_to">Куда</string>
|
||||
<string name="ticket_arrivalDate">Дата вылета</string>
|
||||
<string name="ticket_departureDate">Дата прилёта</string>
|
||||
<string name="ticket_cost">Стоимость</string>
|
||||
<string name="ticket_seat">Место</string>
|
||||
<string name="button_edit">Редактировать</string>
|
||||
<string name="button_confirm_rent">Подтвердить</string>
|
||||
<string name="login_heading_text">Вход</string>
|
||||
<string name="login_example">user@mail.ru</string>
|
||||
<string name="password_example">Password</string>
|
||||
<string name="surname">Фамилия</string>
|
||||
<string name="name">Имя</string>
|
||||
<string name="surname_example">Петров</string>
|
||||
<string name="name_example">Павел</string>
|
||||
<string name="password_confirm">Подтверждение пароля</string>
|
||||
<string name="login_button">Войти</string>
|
||||
<string name="dateOfBirth">Дата рождения</string>
|
||||
<string name="dateOfBirth_example">2000-01-01</string>
|
||||
<string name="registration_button">Зарегистрироваться</string>
|
||||
<string name="login_label">Логин</string>
|
||||
<string name="password_label">Пароль</string>
|
||||
<string name="list_tickets">Билеты</string>
|
||||
<string name="list_rents">Бронирования</string>
|
||||
<string name="main_heading">Поиск авиабилетов</string>
|
||||
<string name="registration">Регистрация</string>
|
||||
<string name="button_choose_dates">Выбрать даты</string>
|
||||
<string name="button_filter">Фильтр</string>
|
||||
<string name="button_search">Поиск</string>
|
||||
<string name="profile_heading">Личный кабинет</string>
|
||||
<string name="my_documents">Мои документы</string>
|
||||
<string name="my_rents">Мои бронирования</string>
|
||||
<string name="create_rent">Создать бронь</string>
|
||||
<string name="button_help">Написать в поддержку</string>
|
||||
<string name="ticket_main_title">""</string>
|
||||
<string name="ticket_view_title">""</string>
|
||||
<string name="rent_main_title">""</string>
|
||||
<string name="rent_view_title">""</string>
|
||||
<string name="student_main_title">""</string>
|
||||
<string name="student_view_title">""</string>
|
||||
</resources>
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.PMULabs" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
<style name="Theme.Pmudemo" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
</resources>
|
@ -1,9 +1,8 @@
|
||||
package com.example.pmulabs
|
||||
package ru.ulstu.`is`.pmu
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
@ -7,6 +7,7 @@
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
android.overridePathCheck=true
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,4 +1,4 @@
|
||||
#Wed Oct 18 17:54:32 GMT+04:00 2023
|
||||
#Mon Sep 25 15:50:37 SAMT 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
|
||||
|
328
gradlew
vendored
328
gradlew
vendored
@ -1,14 +1,19 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/usr/bin/
|
||||
env sh
|
||||
|
||||
#
|
||||
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -18,168 +23,249 @@
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
Gradle start
|
||||
up script
|
||||
for
|
||||
UN *X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
PRG = "$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
while [ -h "$PRG" ]; do
|
||||
ls =
|
||||
`ls -ld "$PRG"`
|
||||
link =
|
||||
`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/
|
||||
null;
|
||||
then
|
||||
PRG = "$link"
|
||||
else
|
||||
PRG =
|
||||
`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED = "`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/
|
||||
null
|
||||
APP_HOME = "`pwd -P`"
|
||||
cd "$SAVED" >/dev/
|
||||
null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
APP_NAME = "Gradle"
|
||||
APP_BASE_NAME =
|
||||
`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
DEFAULT_JVM_OPTS = '"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
MAX_FD = "maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
warn() {
|
||||
echo
|
||||
"$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
die() {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
"$*"
|
||||
echo
|
||||
exit 1
|
||||
exit
|
||||
1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
cygwin = false
|
||||
msys = false
|
||||
darwin = false
|
||||
nonstop = false
|
||||
case "`uname`"
|
||||
in
|
||||
CYGWIN
|
||||
* )
|
||||
cygwin = true;;
|
||||
Darwin* )
|
||||
darwin = true;;
|
||||
MINGW* )
|
||||
msys = true;;
|
||||
NONSTOP* )
|
||||
nonstop = true;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH = $APP_HOME / gradle / wrapper / gradle - wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
if [ -n "$JAVA_HOME" ]; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ];
|
||||
then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD = "$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
JAVACMD = "$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ];
|
||||
then
|
||||
die
|
||||
"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
Please set
|
||||
the JAVA_HOME
|
||||
variable in
|
||||
your environment
|
||||
to match
|
||||
the
|
||||
location
|
||||
of your
|
||||
Java installation
|
||||
."
|
||||
fi
|
||||
else
|
||||
JAVACMD = "java"
|
||||
which java
|
||||
>/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set
|
||||
the JAVA_HOME
|
||||
variable in
|
||||
your environment
|
||||
to match
|
||||
the
|
||||
location
|
||||
of your
|
||||
Java installation
|
||||
."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ];
|
||||
then
|
||||
MAX_FD_LIMIT =
|
||||
`ulimit -H -n`
|
||||
if [ $? -eq 0 ]; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ];
|
||||
then
|
||||
MAX_FD = "$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit
|
||||
-
|
||||
n $MAX_FD
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
warn
|
||||
"Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
if
|
||||
$darwin;
|
||||
then
|
||||
GRADLE_OPTS = "$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ];
|
||||
then
|
||||
APP_HOME =
|
||||
`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH =
|
||||
`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
JAVACMD =
|
||||
`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW =
|
||||
`find -L / -maxdepth 1 -mindepth 1 -
|
||||
type d
|
||||
2>/dev/null`
|
||||
SEP = ""
|
||||
for
|
||||
dir in
|
||||
$ROOTDIRSRAW;
|
||||
do
|
||||
ROOTDIRS = "$ROOTDIRS$SEP$dir"
|
||||
SEP = "|"
|
||||
done
|
||||
OURCYGPATTERN = "(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ];
|
||||
then
|
||||
OURCYGPATTERN = "$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i = 0
|
||||
for
|
||||
arg in
|
||||
"$@"; do
|
||||
CHECK =
|
||||
`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2 =
|
||||
`echo "$arg"|egrep -c "^-"` ### Determine if
|
||||
an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ###
|
||||
Added a
|
||||
condition
|
||||
eval
|
||||
`
|
||||
echo args$i
|
||||
`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `
|
||||
echo args$i
|
||||
`="\"$arg\""
|
||||
fi
|
||||
i =
|
||||
`
|
||||
expr $i
|
||||
+ 1`
|
||||
done
|
||||
case
|
||||
$i in
|
||||
0) set --;;
|
||||
1) set -- "$args0";;
|
||||
2) set -- "$args0" "$args1";;
|
||||
3) set -- "$args0" "$args1" "$args2";;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3";;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4";;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5";;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6";;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7";;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8";;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
|
||||
save() {
|
||||
for
|
||||
i
|
||||
do printf % s\\n
|
||||
"$i" | sed
|
||||
"s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/";
|
||||
done
|
||||
echo
|
||||
" "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
APP_ARGS =
|
||||
`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
eval set
|
||||
--
|
||||
$DEFAULT_JVM_OPTS $JAVA_OPTS
|
||||
$GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
@ -13,6 +13,5 @@ dependencyResolutionManagement {
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "PMULabs"
|
||||
rootProject.name = "pmu-demo"
|
||||
include(":app")
|
||||
|
Loading…
Reference in New Issue
Block a user