Промежуточное.
This commit is contained in:
parent
552b40b3d9
commit
3e81ac477d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,42 +0,0 @@
|
||||
kotlin version: 1.8.20
|
||||
error message: java.lang.NoSuchMethodError: 'kotlin.sequences.Sequence com.google.devtools.ksp.processing.Resolver.getPackagesWithAnnotation(java.lang.String)'
|
||||
at androidx.room.compiler.processing.ksp.KspRoundEnv.getElementsAnnotatedWith(KspRoundEnv.kt:107)
|
||||
at androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:100)
|
||||
at androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:62)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$6$1.invoke(KotlinSymbolProcessingExtension.kt:291)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$6$1.invoke(KotlinSymbolProcessingExtension.kt:289)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:394)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:289)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:123)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:99)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:257)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:42)
|
||||
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:248)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:88)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:47)
|
||||
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:168)
|
||||
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
|
||||
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
|
||||
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
|
||||
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
|
||||
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
|
||||
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
|
||||
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||
at java.base/java.lang.Thread.run(Thread.java:833)
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
kotlin version: 1.8.20
|
||||
error message: java.lang.NoSuchMethodError: 'kotlin.sequences.Sequence com.google.devtools.ksp.processing.Resolver.getPackagesWithAnnotation(java.lang.String)'
|
||||
at androidx.room.compiler.processing.ksp.KspRoundEnv.getElementsAnnotatedWith(KspRoundEnv.kt:107)
|
||||
at androidx.room.compiler.processing.CommonProcessorDelegate.processRound(XBasicAnnotationProcessor.kt:100)
|
||||
at androidx.room.compiler.processing.ksp.KspBasicAnnotationProcessor.process(KspBasicAnnotationProcessor.kt:62)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$6$1.invoke(KotlinSymbolProcessingExtension.kt:291)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$6$1.invoke(KotlinSymbolProcessingExtension.kt:289)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:394)
|
||||
at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:289)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:123)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:99)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:257)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:42)
|
||||
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:248)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:88)
|
||||
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:47)
|
||||
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:168)
|
||||
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
|
||||
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
|
||||
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
|
||||
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
|
||||
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1486)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|
||||
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
|
||||
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|
||||
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
|
||||
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
|
||||
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
|
||||
at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
|
||||
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
|
||||
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
|
||||
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||
at java.base/java.lang.Thread.run(Thread.java:833)
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ru.ulstu.`is`.pmu.tank.dao
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
@ -8,8 +7,6 @@ import androidx.room.Query
|
||||
import androidx.room.Transaction
|
||||
import androidx.room.Update
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import ru.ulstu.`is`.pmu.tank.model.Nation
|
||||
import ru.ulstu.`is`.pmu.tank.model.NationWithTanks
|
||||
import ru.ulstu.`is`.pmu.tank.model.User
|
||||
import ru.ulstu.`is`.pmu.tank.model.UserTankCrossRef
|
||||
import ru.ulstu.`is`.pmu.tank.model.UserWithTanks
|
||||
@ -21,7 +18,8 @@ interface UserDao {
|
||||
|
||||
//получить нации с танками
|
||||
@Query("SELECT * FROM users")
|
||||
fun getUsersWithTanks(): LiveData<List<UserWithTanks>>
|
||||
@Transaction
|
||||
fun getUsersWithTanks(): List<UserWithTanks>
|
||||
|
||||
//получить конкретного пользователя
|
||||
@Query("select * from users where users.userId = :uid")
|
||||
|
@ -29,7 +29,7 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun userDao() : UserDao
|
||||
|
||||
companion object {
|
||||
private const val DB_NAME: String = "third-db"
|
||||
private const val DB_NAME: String = "seven-db"
|
||||
|
||||
@Volatile
|
||||
private var INSTANCE: AppDatabase? = null
|
||||
@ -116,11 +116,11 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
userDao.insert(user)
|
||||
|
||||
userDao.insert(UserTankCrossRef(user.userId ?: 0, tank1.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId ?: 0, tank3.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId ?: 0, tank5.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId ?: 0, tank7.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId ?: 0, tank9.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId, tank1.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId, tank3.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId, tank5.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId, tank7.tankId ?: 0))
|
||||
userDao.insert(UserTankCrossRef(user.userId, tank9.tankId ?: 0))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,17 +3,15 @@ package ru.ulstu.`is`.pmu.tank.model
|
||||
import androidx.room.Embedded
|
||||
import androidx.room.Junction
|
||||
import androidx.room.Relation
|
||||
import ru.ulstu.`is`.pmu.tank.model.Tank
|
||||
import ru.ulstu.`is`.pmu.tank.model.User
|
||||
import ru.ulstu.`is`.pmu.tank.model.UserTankCrossRef
|
||||
|
||||
//для работы many to many для получения списка танков для пользователя
|
||||
data class TankWithUsers(
|
||||
@Embedded val tank: Tank,
|
||||
@Embedded var tank: Tank,
|
||||
|
||||
@Relation(
|
||||
parentColumn = "tankId",
|
||||
entityColumn = "userId",
|
||||
associateBy = Junction(UserTankCrossRef::class)
|
||||
associateBy = Junction(UserTankCrossRef::class,)
|
||||
)
|
||||
val users: List<User>
|
||||
var users: List<User>
|
||||
)
|
||||
|
@ -9,7 +9,7 @@ import androidx.room.PrimaryKey
|
||||
tableName = "users"
|
||||
)
|
||||
data class User (
|
||||
@PrimaryKey(autoGenerate = false)
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
val userId: Long,
|
||||
@ColumnInfo(name = "nickname")
|
||||
val nickname: String,
|
||||
|
@ -2,31 +2,14 @@ package ru.ulstu.`is`.pmu.tank.model
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
import androidx.room.Ignore
|
||||
import androidx.room.Index
|
||||
import androidx.room.PrimaryKey
|
||||
import org.jetbrains.annotations.NotNull
|
||||
|
||||
//many to many for user and tank
|
||||
@Entity(primaryKeys = ["memberUserId", "memberTankId"],
|
||||
indices = [Index(value = ["memberTankId"], unique = false)],
|
||||
foreignKeys = [
|
||||
ForeignKey(
|
||||
entity = User::class,
|
||||
parentColumns = ["userId"],
|
||||
childColumns = ["memberUserId"],
|
||||
onDelete = ForeignKey.CASCADE,
|
||||
onUpdate = ForeignKey.CASCADE
|
||||
),
|
||||
ForeignKey(
|
||||
entity = Tank::class,
|
||||
parentColumns = ["tankId"],
|
||||
childColumns = ["memberTankId"],
|
||||
onDelete = ForeignKey.CASCADE,
|
||||
onUpdate = ForeignKey.CASCADE
|
||||
)
|
||||
]
|
||||
)
|
||||
@Entity(primaryKeys = ["userId", "tankId"])
|
||||
data class UserTankCrossRef(
|
||||
var memberUserId: Long,
|
||||
var memberTankId: Long
|
||||
val userId: Long,
|
||||
val tankId: Long
|
||||
)
|
||||
|
@ -7,17 +7,13 @@ import androidx.room.Relation
|
||||
|
||||
//для работы many to many для получения списка танков для пользователя
|
||||
data class UserWithTanks(
|
||||
@Embedded var user: User,
|
||||
@Embedded val user: User,
|
||||
|
||||
@Relation(
|
||||
entity = Tank::class,
|
||||
parentColumn = "userId",
|
||||
entityColumn = "tankId",
|
||||
associateBy = Junction(
|
||||
UserTankCrossRef::class,
|
||||
parentColumn = "memberTankId",
|
||||
entityColumn = "memberUserId"
|
||||
)
|
||||
associateBy = Junction(UserTankCrossRef::class,)
|
||||
)
|
||||
var tanks: List<Tank>
|
||||
val tanks: List<Tank>
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ru.ulstu.`is`.pmu.tanks.composeui
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.util.Log
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@ -22,6 +23,7 @@ import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.key
|
||||
import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
@ -58,15 +60,18 @@ fun Hangar(navController: NavController){
|
||||
val currentScreen = currentDestination?.route?.let { Screen.getItem(it) }
|
||||
|
||||
val context = LocalContext.current
|
||||
val users = remember { mutableStateListOf<UserWithTanks>() }
|
||||
val list = remember { mutableStateListOf<UserWithTanks>() }
|
||||
val (user, setUser) = remember { mutableStateOf<UserWithTanks?>(null) }
|
||||
val nations = remember { mutableStateListOf<Nation>() }
|
||||
val levels = remember { mutableStateListOf<Level>() }
|
||||
LaunchedEffect(Unit) {
|
||||
withContext(Dispatchers.IO) {
|
||||
AppDatabase.getInstance(context).userDao().getUsersWithTanks().value?.forEach() { data ->
|
||||
users.clear()
|
||||
users.add(data)
|
||||
AppDatabase.getInstance(context).userDao().getUsersWithTanks().forEach { data ->
|
||||
list.clear()
|
||||
list.add(data)
|
||||
}
|
||||
Log.d("КОЛИЧЕСТВО", list.size.toString())
|
||||
setUser(AppDatabase.getInstance(context).userDao().getUserUid(100L))
|
||||
AppDatabase.getInstance(context).nationDao().getAll().collect { data ->
|
||||
nations.clear()
|
||||
nations.addAll(data)
|
||||
@ -81,93 +86,89 @@ fun Hangar(navController: NavController){
|
||||
Column(
|
||||
verticalArrangement = Arrangement.spacedBy(15.dp)
|
||||
) {
|
||||
users.forEach { user ->
|
||||
key(user.user.userId) {
|
||||
val countRows = user.tanks.size / 2
|
||||
val countRows = user?.tanks?.size?.div(2)
|
||||
|
||||
//проверяем на то, что не всё поместилось в ряды по 2 элемента
|
||||
val oneLastElem = user.tanks.size % 2
|
||||
//проверяем на то, что не всё поместилось в ряды по 2 элемента
|
||||
val oneLastElem = user?.tanks?.size?.rem(2)
|
||||
|
||||
var index = 0
|
||||
var index = 0
|
||||
|
||||
var supportCountRow = countRows
|
||||
var supportCountRow = countRows
|
||||
|
||||
for(n in 1 .. supportCountRow){
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceAround,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp, 0.dp, 10.dp, 0.dp)
|
||||
for(n in 1 .. (supportCountRow ?: 1)){
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceAround,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp, 0.dp, 10.dp, 0.dp)
|
||||
) {
|
||||
//цикл для заполнения строки карточек
|
||||
for (m in 0 .. 1){
|
||||
Column(
|
||||
modifier = Modifier.background(CustomYellow)
|
||||
) {
|
||||
//цикл для заполнения строки карточек
|
||||
for (m in 0 .. 1){
|
||||
Column(
|
||||
modifier = Modifier.background(CustomYellow)
|
||||
Box(
|
||||
Modifier
|
||||
.background(CustomYellow)
|
||||
.height(260.dp),
|
||||
)
|
||||
{
|
||||
Card(
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = CustomYellow,
|
||||
),
|
||||
modifier = Modifier
|
||||
.size(width = 170.dp, height = 250.dp)
|
||||
.padding(10.dp, 0.dp, 10.dp, 0.dp)
|
||||
) {
|
||||
Box(
|
||||
Modifier
|
||||
.background(CustomYellow)
|
||||
.height(260.dp),
|
||||
Image(
|
||||
painter = painterResource(id = user?.tanks?.get(index)?.image ?: R.drawable.t_34_85),
|
||||
contentDescription = stringResource(id = R.string.tanks_main_title),
|
||||
modifier = Modifier
|
||||
.height(130.dp)
|
||||
)
|
||||
Text(
|
||||
text = user?.tanks?.get(index)?.name ?: "" ,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Text(
|
||||
text = "Нация: " + nations.find{ it.uid == user?.tanks?.get(index)?.nationId }.toString(),
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Text(
|
||||
text = "Уровень: " + levels.find{ it.uid == user?.tanks?.get(index)?.levelId }.toString(),
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Text(
|
||||
text = "Стоимость: " + user?.tanks?.get(index)?.price.toString(),
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
{
|
||||
Card(
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = CustomYellow,
|
||||
),
|
||||
modifier = Modifier
|
||||
.size(width = 170.dp, height = 250.dp)
|
||||
.padding(10.dp, 0.dp, 10.dp, 0.dp)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = user.tanks[index].image),
|
||||
contentDescription = stringResource(id = R.string.tanks_main_title),
|
||||
modifier = Modifier
|
||||
.height(130.dp)
|
||||
)
|
||||
Text(
|
||||
text = user.tanks[index].name,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Text(
|
||||
text = "Нация: " + nations.find{ it.uid == user.tanks[index].nationId }.toString(),
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Text(
|
||||
text = "Уровень: " + levels.find{ it.uid == user.tanks[index].levelId }.toString(),
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
Text(
|
||||
text = "Стоимость: " + user.tanks[index].price.toString(),
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
index++
|
||||
|
||||
//если надо будет допечатать ещё один элемент
|
||||
if(n == supportCountRow && oneLastElem != 0){
|
||||
supportCountRow = oneLastElem
|
||||
}
|
||||
}
|
||||
}
|
||||
index++
|
||||
//если надо будет допечатать ещё один элемент
|
||||
if(n == supportCountRow && oneLastElem != 0){
|
||||
supportCountRow = oneLastElem
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user