Filter is working!
This commit is contained in:
parent
b0fbd2704f
commit
61d31fee9c
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
46
compose/.idea/assetWizardSettings.xml
generated
Normal file
46
compose/.idea/assetWizardSettings.xml
generated
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="WizardSettings">
|
||||||
|
<option name="children">
|
||||||
|
<map>
|
||||||
|
<entry key="vectorWizard">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="children">
|
||||||
|
<map>
|
||||||
|
<entry key="vectorAssetStep">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="children">
|
||||||
|
<map>
|
||||||
|
<entry key="clipartAsset">
|
||||||
|
<value>
|
||||||
|
<PersistentState>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="url" value="file:/$USER_HOME$/AppData/Local/Android/Sdk/icons/material/materialicons/drive_file_rename_outline/baseline_drive_file_rename_outline_24.xml" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="values">
|
||||||
|
<map>
|
||||||
|
<entry key="outputName" value="baseline_drive_file_rename_outline_24" />
|
||||||
|
<entry key="sourceFile" value="C:\Users\egore\Desktop\MyProjects\ULSTU\TankAppMobile\TanksApp\compose" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</PersistentState>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -154,7 +154,7 @@ fun ColumnItem(
|
|||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
containerColor = CustomRed,
|
containerColor = CustomRed,
|
||||||
contentColor = CustomDark),
|
contentColor = CustomDark),
|
||||||
onClick = { }
|
onClick = { onClick(tank.tankId) }
|
||||||
) {
|
) {
|
||||||
//navController?.navigate(Screen.Hangar.route)
|
//navController?.navigate(Screen.Hangar.route)
|
||||||
//navController?.navigate(studentId)
|
//navController?.navigate(studentId)
|
||||||
|
@ -15,7 +15,7 @@ class TankListViewModel(
|
|||||||
private val tankRepository: TankRepository,
|
private val tankRepository: TankRepository,
|
||||||
private var userId: Long = 100L
|
private var userId: Long = 100L
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
val tankListUiState: StateFlow<TankListUiState> = tankRepository.getAll().map {
|
val tankListUiState: StateFlow<TankListUiState> = tankRepository.getForUserAll(userId).map {
|
||||||
TankListUiState(it)
|
TankListUiState(it)
|
||||||
}.stateIn(
|
}.stateIn(
|
||||||
scope = viewModelScope,
|
scope = viewModelScope,
|
||||||
|
@ -35,6 +35,11 @@ interface TankDao {
|
|||||||
)
|
)
|
||||||
fun getUserTanks(uid: Long): Flow<List<TankWithNationAndLevel>>
|
fun getUserTanks(uid: Long): Flow<List<TankWithNationAndLevel>>
|
||||||
|
|
||||||
|
@Query(
|
||||||
|
"SELECT t.* FROM tanks AS t WHERE t.tankId NOT IN (SELECT ut.tankId FROM UserTankCrossRef AS ut WHERE ut.userId = :uid)"
|
||||||
|
)
|
||||||
|
fun getNotUserTank(uid: Long): Flow<List<Tank>>
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
suspend fun insert(tank: Tank)
|
suspend fun insert(tank: Tank)
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ class OfflineTankRepository(
|
|||||||
) : TankRepository {
|
) : TankRepository {
|
||||||
override fun getAll(): Flow<List<Tank>> = tankDao.getAll()
|
override fun getAll(): Flow<List<Tank>> = tankDao.getAll()
|
||||||
|
|
||||||
|
override fun getForUserAll(userId: Long): Flow<List<Tank>> = tankDao.getNotUserTank(userId)
|
||||||
|
|
||||||
override fun getTank(uid: Long): Flow<Tank?> = tankDao.getTankUid(uid)
|
override fun getTank(uid: Long): Flow<Tank?> = tankDao.getTankUid(uid)
|
||||||
|
|
||||||
override fun getUserTanks(uid: Long): Flow<List<TankWithNationAndLevel>> = tankDao.getUserTanks(uid)
|
override fun getUserTanks(uid: Long): Flow<List<TankWithNationAndLevel>> = tankDao.getUserTanks(uid)
|
||||||
|
@ -8,6 +8,7 @@ import ru.ulstu.`is`.pmu.tank.model.TankWithNationAndLevel
|
|||||||
|
|
||||||
interface TankRepository {
|
interface TankRepository {
|
||||||
fun getAll(): Flow<List<Tank>>
|
fun getAll(): Flow<List<Tank>>
|
||||||
|
fun getForUserAll(userId: Long): Flow<List<Tank>>
|
||||||
fun getTank(uid: Long): Flow<Tank?>
|
fun getTank(uid: Long): Flow<Tank?>
|
||||||
fun getUserTanks(uid: Long): Flow<List<TankWithNationAndLevel>>
|
fun getUserTanks(uid: Long): Flow<List<TankWithNationAndLevel>>
|
||||||
suspend fun insertTank(tank: Tank, image: Bitmap)
|
suspend fun insertTank(tank: Tank, image: Bitmap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user