mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-01-28 00:15:32 +00:00
Here comes the train (with more things)
- Updated available items - Created ItemsScreenController - Moved the ItemsScreen to keep code organized
This commit is contained in:
parent
305b776b52
commit
f3740d4816
Binary file not shown.
@ -1,8 +1,5 @@
|
|||||||
package com.github.nacabaro.vbhelper.components
|
package com.github.nacabaro.vbhelper.components
|
||||||
|
|
||||||
import android.graphics.drawable.Icon
|
|
||||||
import android.util.EventLogTags.Description
|
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@ -21,8 +18,6 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.layout.ContentScale
|
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
@ -30,8 +25,8 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.window.Dialog
|
import androidx.compose.ui.window.Dialog
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import com.github.nacabaro.vbhelper.R
|
import com.github.nacabaro.vbhelper.R
|
||||||
import com.github.nacabaro.vbhelper.di.VBHelper
|
|
||||||
import com.github.nacabaro.vbhelper.ui.theme.VBHelperTheme
|
import com.github.nacabaro.vbhelper.ui.theme.VBHelperTheme
|
||||||
|
import kotlin.math.absoluteValue
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ItemElement(
|
fun ItemElement(
|
||||||
@ -167,15 +162,24 @@ fun getIconResource(index: Int): Int {
|
|||||||
1 -> R.drawable.baseline_agility_24
|
1 -> R.drawable.baseline_agility_24
|
||||||
2 -> R.drawable.baseline_attack_24
|
2 -> R.drawable.baseline_attack_24
|
||||||
3 -> R.drawable.baseline_shield_24
|
3 -> R.drawable.baseline_shield_24
|
||||||
|
4 -> R.drawable.baseline_trophy_24
|
||||||
|
5 -> R.drawable.baseline_arrow_up_24
|
||||||
|
6 -> R.drawable.baseline_timer_24
|
||||||
|
7 -> R.drawable.baseline_rank_24
|
||||||
else -> R.drawable.baseline_question_mark_24
|
else -> R.drawable.baseline_question_mark_24
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLengthResource(index: Int): Int {
|
fun getLengthResource(index: Int): Int {
|
||||||
return when (index) {
|
return when (index.absoluteValue) {
|
||||||
1 -> R.drawable.baseline_15_min_timer
|
15 -> R.drawable.baseline_15_min_timer
|
||||||
2 -> R.drawable.baseline_30_min_timer
|
30 -> R.drawable.baseline_30_min_timer
|
||||||
3 -> R.drawable.baseline_60_min_timer
|
60 -> R.drawable.baseline_60_min_timer
|
||||||
|
300 -> R.drawable.baseline_5_hour_timer
|
||||||
|
600 -> R.drawable.baseline_10_hour_timer
|
||||||
|
720 -> R.drawable.baseline_12_hour_timer
|
||||||
|
1440 -> R.drawable.baseline_24_hour_timer
|
||||||
|
6000 -> R.drawable.baseline_reset_24
|
||||||
else -> R.drawable.baseline_question_mark_24
|
else -> R.drawable.baseline_question_mark_24
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package com.github.nacabaro.vbhelper.daos
|
|||||||
|
|
||||||
import androidx.room.Dao
|
import androidx.room.Dao
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import com.github.nacabaro.vbhelper.domain.items.Items
|
|
||||||
import com.github.nacabaro.vbhelper.dtos.ItemDtos
|
import com.github.nacabaro.vbhelper.dtos.ItemDtos
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
@ -11,6 +10,7 @@ interface ItemDao {
|
|||||||
SELECT Items.*, UserItems.quantity
|
SELECT Items.*, UserItems.quantity
|
||||||
FROM Items
|
FROM Items
|
||||||
LEFT JOIN UserItems ON Items.id = UserItems.itemId
|
LEFT JOIN UserItems ON Items.id = UserItems.itemId
|
||||||
|
ORDER BY Items.itemIcon ASC
|
||||||
""")
|
""")
|
||||||
suspend fun getAllItems(): List<ItemDtos.ItemsWithQuantities>
|
suspend fun getAllItems(): List<ItemDtos.ItemsWithQuantities>
|
||||||
|
|
||||||
@ -20,4 +20,18 @@ interface ItemDao {
|
|||||||
JOIN UserItems ON Items.id = UserItems.itemId
|
JOIN UserItems ON Items.id = UserItems.itemId
|
||||||
""")
|
""")
|
||||||
suspend fun getAllUserItems(): List<ItemDtos.ItemsWithQuantities>
|
suspend fun getAllUserItems(): List<ItemDtos.ItemsWithQuantities>
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
UPDATE UserItems
|
||||||
|
SET quantity = quantity - 1
|
||||||
|
WHERE itemId = :itemId
|
||||||
|
""")
|
||||||
|
fun useItem(itemId: Long)
|
||||||
|
|
||||||
|
@Query("""
|
||||||
|
UPDATE UserItems
|
||||||
|
SET quantity = quantity - :itemAmount
|
||||||
|
WHERE itemId = :itemId
|
||||||
|
""")
|
||||||
|
suspend fun purchaseItem(itemId: Long, itemAmount: Int)
|
||||||
}
|
}
|
||||||
@ -4,6 +4,7 @@ import androidx.room.Dao
|
|||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
|
import androidx.room.Upsert
|
||||||
import com.github.nacabaro.vbhelper.domain.device_data.UserCharacter
|
import com.github.nacabaro.vbhelper.domain.device_data.UserCharacter
|
||||||
import com.github.nacabaro.vbhelper.domain.device_data.BECharacterData
|
import com.github.nacabaro.vbhelper.domain.device_data.BECharacterData
|
||||||
import com.github.nacabaro.vbhelper.domain.device_data.TransformationHistory
|
import com.github.nacabaro.vbhelper.domain.device_data.TransformationHistory
|
||||||
@ -17,6 +18,12 @@ interface UserCharacterDao {
|
|||||||
@Insert
|
@Insert
|
||||||
fun insertBECharacterData(characterData: BECharacterData)
|
fun insertBECharacterData(characterData: BECharacterData)
|
||||||
|
|
||||||
|
@Upsert
|
||||||
|
fun updateCharacter(character: UserCharacter)
|
||||||
|
|
||||||
|
@Upsert
|
||||||
|
fun updateBECharacterData(characterData: BECharacterData)
|
||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
fun insertTransformationHistory(vararg transformationHistory: TransformationHistory)
|
fun insertTransformationHistory(vararg transformationHistory: TransformationHistory)
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ data class BECharacterData (
|
|||||||
val trainingHp: Int,
|
val trainingHp: Int,
|
||||||
val trainingAp: Int,
|
val trainingAp: Int,
|
||||||
val trainingBp: Int,
|
val trainingBp: Int,
|
||||||
val remainingTrainingTimeInMinutes: Int,
|
var remainingTrainingTimeInMinutes: Int,
|
||||||
val itemEffectMentalStateValue: Int,
|
val itemEffectMentalStateValue: Int,
|
||||||
val itemEffectMentalStateMinutesRemaining: Int,
|
val itemEffectMentalStateMinutesRemaining: Int,
|
||||||
val itemEffectActivityLevelValue: Int,
|
val itemEffectActivityLevelValue: Int,
|
||||||
@ -32,9 +32,9 @@ data class BECharacterData (
|
|||||||
val abilityBranch: Int,
|
val abilityBranch: Int,
|
||||||
val abilityReset: Int,
|
val abilityReset: Int,
|
||||||
val rank: Int,
|
val rank: Int,
|
||||||
val itemType: Int,
|
var itemType: Int,
|
||||||
val itemMultiplier: Int,
|
var itemMultiplier: Int,
|
||||||
val itemRemainingTime: Int,
|
var itemRemainingTime: Int,
|
||||||
val otp0: String,
|
val otp0: String,
|
||||||
val otp1: String,
|
val otp1: String,
|
||||||
val minorVersion: Int,
|
val minorVersion: Int,
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.github.nacabaro.vbhelper.domain.items
|
package com.github.nacabaro.vbhelper.domain.items
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import androidx.room.Entity
|
import androidx.room.Entity
|
||||||
import androidx.room.PrimaryKey
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
@ -10,6 +9,6 @@ data class Items(
|
|||||||
val name: String,
|
val name: String,
|
||||||
val description: String,
|
val description: String,
|
||||||
val itemIcon: Int,
|
val itemIcon: Int,
|
||||||
val lengthIcon: Int,
|
val itemLength: Int,
|
||||||
val price: Int
|
val price: Int
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.github.nacabaro.vbhelper.dtos
|
package com.github.nacabaro.vbhelper.dtos
|
||||||
|
|
||||||
import androidx.room.PrimaryKey
|
|
||||||
|
|
||||||
object ItemDtos {
|
object ItemDtos {
|
||||||
data class ItemsWithQuantities (
|
data class ItemsWithQuantities (
|
||||||
@ -8,7 +7,7 @@ object ItemDtos {
|
|||||||
val name: String,
|
val name: String,
|
||||||
val description: String,
|
val description: String,
|
||||||
val itemIcon: Int,
|
val itemIcon: Int,
|
||||||
val lengthIcon: Int,
|
val itemLength: Int,
|
||||||
val price: Int,
|
val price: Int,
|
||||||
val quantity: Int,
|
val quantity: Int,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -11,13 +11,12 @@ import com.github.nacabaro.vbhelper.screens.BattlesScreen
|
|||||||
import com.github.nacabaro.vbhelper.screens.DexScreen
|
import com.github.nacabaro.vbhelper.screens.DexScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.DiMScreen
|
import com.github.nacabaro.vbhelper.screens.DiMScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.homeScreens.HomeScreen
|
import com.github.nacabaro.vbhelper.screens.homeScreens.HomeScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.ItemsScreen
|
import com.github.nacabaro.vbhelper.screens.itemsScreen.ItemsScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.scanScreen.ScanScreen
|
import com.github.nacabaro.vbhelper.screens.scanScreen.ScanScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.scanScreen.ScanScreenControllerImpl
|
import com.github.nacabaro.vbhelper.screens.scanScreen.ScanScreenControllerImpl
|
||||||
import com.github.nacabaro.vbhelper.screens.settingsScreen.SettingsScreen
|
import com.github.nacabaro.vbhelper.screens.settingsScreen.SettingsScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.SpriteViewer
|
import com.github.nacabaro.vbhelper.screens.SpriteViewer
|
||||||
import com.github.nacabaro.vbhelper.screens.StorageScreen
|
import com.github.nacabaro.vbhelper.screens.StorageScreen
|
||||||
import com.github.nacabaro.vbhelper.screens.itemsScreen.MyItems
|
|
||||||
import com.github.nacabaro.vbhelper.screens.settingsScreen.SettingsScreenControllerImpl
|
import com.github.nacabaro.vbhelper.screens.settingsScreen.SettingsScreenControllerImpl
|
||||||
|
|
||||||
data class AppNavigationHandlers(
|
data class AppNavigationHandlers(
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
package com.github.nacabaro.vbhelper.screens
|
package com.github.nacabaro.vbhelper.screens.itemsScreen
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
@ -16,12 +14,9 @@ import androidx.compose.runtime.mutableStateOf
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import com.github.nacabaro.vbhelper.components.TopBanner
|
import com.github.nacabaro.vbhelper.components.TopBanner
|
||||||
import com.github.nacabaro.vbhelper.navigation.NavigationItems
|
import com.github.nacabaro.vbhelper.navigation.NavigationItems
|
||||||
import com.github.nacabaro.vbhelper.screens.itemsScreen.ItemsStore
|
|
||||||
import com.github.nacabaro.vbhelper.screens.itemsScreen.MyItems
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ItemsScreen(
|
fun ItemsScreen(
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package com.github.nacabaro.vbhelper.screens.itemsScreen
|
||||||
|
|
||||||
|
import com.github.nacabaro.vbhelper.domain.items.Items
|
||||||
|
|
||||||
|
interface ItemsScreenController {
|
||||||
|
suspend fun applyItem(item: Items, characterId: Long)
|
||||||
|
}
|
||||||
@ -0,0 +1,84 @@
|
|||||||
|
package com.github.nacabaro.vbhelper.screens.itemsScreen
|
||||||
|
|
||||||
|
import com.github.nacabaro.vbhelper.database.AppDatabase
|
||||||
|
import com.github.nacabaro.vbhelper.domain.device_data.BECharacterData
|
||||||
|
import com.github.nacabaro.vbhelper.domain.device_data.VBCharacterData
|
||||||
|
import com.github.nacabaro.vbhelper.domain.items.Items
|
||||||
|
import com.github.nacabaro.vbhelper.utils.DeviceType
|
||||||
|
|
||||||
|
class ItemsScreenControllerImpl (
|
||||||
|
private val database: AppDatabase
|
||||||
|
): ItemsScreenController {
|
||||||
|
private enum class ItemTypes(val id: Int) {
|
||||||
|
PPTraining(1),
|
||||||
|
HPTraining(2),
|
||||||
|
APTraining(3),
|
||||||
|
BPTraining(4),
|
||||||
|
AllTraining(5),
|
||||||
|
EvoTimer(6),
|
||||||
|
LimitTimer(7),
|
||||||
|
Vitals(8)
|
||||||
|
}
|
||||||
|
|
||||||
|
override suspend fun applyItem(item: Items, characterId: Long) {
|
||||||
|
var characterData = database.userCharacterDao().getCharacter(characterId)
|
||||||
|
var beCharacterData: BECharacterData
|
||||||
|
var vbCharacterData: VBCharacterData
|
||||||
|
if (characterData.characterType == DeviceType.BEDevice) {
|
||||||
|
beCharacterData = database.userCharacterDao().getBeData(characterId)
|
||||||
|
} else {
|
||||||
|
TODO("Not implemented")
|
||||||
|
//vbCharacterData = database.userCharacterDao().getVbData(characterId)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.itemIcon in 1 .. 5 && characterData.characterType == DeviceType.BEDevice) {
|
||||||
|
beCharacterData.itemType = item.itemIcon
|
||||||
|
beCharacterData.itemMultiplier = 3
|
||||||
|
beCharacterData.itemRemainingTime = item.itemLength
|
||||||
|
|
||||||
|
database
|
||||||
|
.userCharacterDao()
|
||||||
|
.updateBECharacterData(beCharacterData)
|
||||||
|
|
||||||
|
} else if (item.itemIcon == ItemTypes.EvoTimer.id) {
|
||||||
|
characterData.transformationCountdown = item.itemLength
|
||||||
|
if (characterData.transformationCountdown < 0) {
|
||||||
|
characterData.transformationCountdown = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
database
|
||||||
|
.userCharacterDao()
|
||||||
|
.updateCharacter(characterData)
|
||||||
|
|
||||||
|
} else if (item.itemIcon == ItemTypes.LimitTimer.id) {
|
||||||
|
beCharacterData.remainingTrainingTimeInMinutes = item.itemLength
|
||||||
|
if (beCharacterData.remainingTrainingTimeInMinutes > 6000) {
|
||||||
|
beCharacterData.remainingTrainingTimeInMinutes = 6000
|
||||||
|
}
|
||||||
|
|
||||||
|
database
|
||||||
|
.userCharacterDao()
|
||||||
|
.updateBECharacterData(beCharacterData)
|
||||||
|
|
||||||
|
} else if (item.itemIcon == ItemTypes.Vitals.id) {
|
||||||
|
characterData.vitalPoints = item.itemLength
|
||||||
|
if (characterData.vitalPoints < 0) {
|
||||||
|
characterData.vitalPoints = 0
|
||||||
|
} else if (characterData.vitalPoints > 9999) {
|
||||||
|
characterData.vitalPoints = 9999
|
||||||
|
}
|
||||||
|
|
||||||
|
database
|
||||||
|
.userCharacterDao()
|
||||||
|
.updateCharacter(characterData)
|
||||||
|
}
|
||||||
|
|
||||||
|
consumeItem(item.id)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun consumeItem(itemId: Long) {
|
||||||
|
database
|
||||||
|
.itemDao()
|
||||||
|
.useItem(itemId)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -51,7 +51,7 @@ fun ItemsStore(
|
|||||||
items(myItems.value) { index ->
|
items(myItems.value) { index ->
|
||||||
ItemElement(
|
ItemElement(
|
||||||
itemIcon = getIconResource(index.itemIcon),
|
itemIcon = getIconResource(index.itemIcon),
|
||||||
lengthIcon = getLengthResource(index.lengthIcon),
|
lengthIcon = getLengthResource(index.itemLength),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
onClick = {
|
onClick = {
|
||||||
@ -65,7 +65,7 @@ fun ItemsStore(
|
|||||||
name = myItems.value[selectedElementIndex!!].name,
|
name = myItems.value[selectedElementIndex!!].name,
|
||||||
description = myItems.value[selectedElementIndex!!].description,
|
description = myItems.value[selectedElementIndex!!].description,
|
||||||
itemIcon = getIconResource(myItems.value[selectedElementIndex!!].itemIcon),
|
itemIcon = getIconResource(myItems.value[selectedElementIndex!!].itemIcon),
|
||||||
lengthIcon = getLengthResource(myItems.value[selectedElementIndex!!].lengthIcon),
|
lengthIcon = getLengthResource(myItems.value[selectedElementIndex!!].itemLength),
|
||||||
amount = myItems.value[selectedElementIndex!!].quantity,
|
amount = myItems.value[selectedElementIndex!!].quantity,
|
||||||
onClickUse = { },
|
onClickUse = { },
|
||||||
onClickCancel = { showDialog = false }
|
onClickCancel = { showDialog = false }
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
package com.github.nacabaro.vbhelper.screens.itemsScreen
|
package com.github.nacabaro.vbhelper.screens.itemsScreen
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.grid.GridCells
|
import androidx.compose.foundation.lazy.grid.GridCells
|
||||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||||
import androidx.compose.foundation.lazy.grid.items
|
import androidx.compose.foundation.lazy.grid.items
|
||||||
import androidx.compose.material3.Scaffold
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@ -17,10 +15,8 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import com.github.nacabaro.vbhelper.R
|
|
||||||
import com.github.nacabaro.vbhelper.components.ItemDialog
|
import com.github.nacabaro.vbhelper.components.ItemDialog
|
||||||
import com.github.nacabaro.vbhelper.components.ItemElement
|
import com.github.nacabaro.vbhelper.components.ItemElement
|
||||||
import com.github.nacabaro.vbhelper.components.TopBanner
|
|
||||||
import com.github.nacabaro.vbhelper.components.getIconResource
|
import com.github.nacabaro.vbhelper.components.getIconResource
|
||||||
import com.github.nacabaro.vbhelper.components.getLengthResource
|
import com.github.nacabaro.vbhelper.components.getLengthResource
|
||||||
import com.github.nacabaro.vbhelper.di.VBHelper
|
import com.github.nacabaro.vbhelper.di.VBHelper
|
||||||
@ -55,7 +51,7 @@ fun MyItems(
|
|||||||
items(myItems.value) { index ->
|
items(myItems.value) { index ->
|
||||||
ItemElement(
|
ItemElement(
|
||||||
itemIcon = getIconResource(index.itemIcon),
|
itemIcon = getIconResource(index.itemIcon),
|
||||||
lengthIcon = getLengthResource(index.lengthIcon),
|
lengthIcon = getLengthResource(index.itemLength),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(8.dp),
|
.padding(8.dp),
|
||||||
onClick = {
|
onClick = {
|
||||||
@ -69,7 +65,7 @@ fun MyItems(
|
|||||||
name = myItems.value[selectedElementIndex!!].name,
|
name = myItems.value[selectedElementIndex!!].name,
|
||||||
description = myItems.value[selectedElementIndex!!].description,
|
description = myItems.value[selectedElementIndex!!].description,
|
||||||
itemIcon = getIconResource(myItems.value[selectedElementIndex!!].itemIcon),
|
itemIcon = getIconResource(myItems.value[selectedElementIndex!!].itemIcon),
|
||||||
lengthIcon = getLengthResource(myItems.value[selectedElementIndex!!].lengthIcon),
|
lengthIcon = getLengthResource(myItems.value[selectedElementIndex!!].itemLength),
|
||||||
amount = myItems.value[selectedElementIndex!!].quantity,
|
amount = myItems.value[selectedElementIndex!!].quantity,
|
||||||
onClickUse = { },
|
onClickUse = { },
|
||||||
onClickCancel = { showDialog = false }
|
onClickCancel = { showDialog = false }
|
||||||
|
|||||||
21
app/src/main/res/drawable/baseline_10_hour_timer.xml
Normal file
21
app/src/main/res/drawable/baseline_10_hour_timer.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="m300.57,506.26c0,-5.08 0.1,-11.73 0.29,-19.95 0.39,-8.21 0.68,-15.45 0.88,-21.71 -0.98,1.17 -3.13,3.32 -6.45,6.45 -3.13,2.93 -6.06,5.57 -8.8,7.92l-24.05,19.36L241.02,471.65 308.49,417.97l36.37,0l0,209.44L300.57,627.41Z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m518.57,522.69q0,33.73 -7.33,57.79 -7.04,24.05 -23.17,36.96 -15.84,12.91 -42.83,12.91 -37.84,0 -55.44,-28.45 -17.6,-28.75 -17.6,-79.2 0,-34.03 7.04,-58.08 7.04,-24.05 23.17,-36.96 16.13,-12.91 42.83,-12.91 37.55,0 55.44,28.45 17.89,28.45 17.89,79.49zM416.2,522.69q0,35.79 6.16,53.97 6.16,17.89 22.88,17.89 16.43,0 22.88,-17.89 6.45,-17.89 6.45,-53.97 0,-35.79 -6.45,-53.97 -6.45,-18.19 -22.88,-18.19 -16.72,0 -22.88,18.19 -6.16,18.19 -6.16,53.97z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m600.71,449.94q0,11.73 -0.88,22.59 -0.59,10.85 -1.17,15.25l2.35,0q7.63,-12.32 19.65,-17.89 12.03,-5.57 26.69,-5.57 26.11,0 41.65,14.08 15.84,13.79 15.84,44.59l0,104.43l-43.71,0l0,-93.57q0,-34.61 -25.81,-34.61 -19.65,0 -27.28,13.79 -7.33,13.49 -7.33,39.01l0,75.39l-43.71,0l0,-222.93l43.71,0z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m360,120v-80h240v80zM480,880c-49.33,0 -95.83,-9.5 -139.5,-28.5 -43.67,-19 -81.83,-44.83 -114.5,-77.5 -32.67,-32.67 -58.5,-70.83 -77.5,-114.5 -19,-43.67 -28.5,-90.17 -28.5,-139.5 0,-49.33 9.5,-95.83 28.5,-139.5 19,-43.67 44.83,-81.83 77.5,-114.5 32.67,-32.67 70.83,-58.5 114.5,-77.5 43.67,-19 90.17,-28.5 139.5,-28.5 41.33,0 81,6.67 119,20 38,13.33 73.67,32.67 107,58l56,-56 56,56 -56,56c25.33,33.33 44.67,69 58,107 13.33,38 20,77.67 20,119 0,49.33 -9.5,95.83 -28.5,139.5 -19,43.67 -44.83,81.83 -77.5,114.5 -32.67,32.67 -70.83,58.5 -114.5,77.5 -43.67,19 -90.17,28.5 -139.5,28.5zM480,800c77.33,0 143.33,-27.33 198,-82 54.67,-54.67 82,-120.67 82,-198 0,-77.33 -27.33,-143.33 -82,-198 -54.67,-54.67 -120.67,-82 -198,-82 -77.33,0 -143.33,27.33 -198,82 -54.67,54.67 -82,120.67 -82,198 0,77.33 27.33,143.33 82,198 54.67,54.67 120.67,82 198,82z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
||||||
24
app/src/main/res/drawable/baseline_12_hour_timer.xml
Normal file
24
app/src/main/res/drawable/baseline_12_hour_timer.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="m360,120v-80h240v80zM480,880c-49.33,0 -95.83,-9.5 -139.5,-28.5 -43.67,-19 -81.83,-44.83 -114.5,-77.5 -32.67,-32.67 -58.5,-70.83 -77.5,-114.5 -19,-43.67 -28.5,-90.17 -28.5,-139.5 0,-49.33 9.5,-95.83 28.5,-139.5 19,-43.67 44.83,-81.83 77.5,-114.5 32.67,-32.67 70.83,-58.5 114.5,-77.5 43.67,-19 90.17,-28.5 139.5,-28.5 41.33,0 81,6.67 119,20 38,13.33 73.67,32.67 107,58l56,-56 56,56 -56,56c25.33,33.33 44.67,69 58,107 13.33,38 20,77.67 20,119 0,49.33 -9.5,95.83 -28.5,139.5 -19,43.67 -44.83,81.83 -77.5,114.5 -32.67,32.67 -70.83,58.5 -114.5,77.5 -43.67,19 -90.17,28.5 -139.5,28.5zM480,800c77.33,0 143.33,-27.33 198,-82 54.67,-54.67 82,-120.67 82,-198 0,-77.33 -27.33,-143.33 -82,-198 -54.67,-54.67 -120.67,-82 -198,-82 -77.33,0 -143.33,27.33 -198,82 -54.67,54.67 -82,120.67 -82,198 0,77.33 27.33,143.33 82,198 54.67,54.67 120.67,82 198,82z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m287.83,506.91q0,-7.63 0.29,-19.95 0.59,-12.32 0.88,-21.71 -1.47,1.76 -6.45,6.45 -4.69,4.4 -8.8,7.92L249.7,498.99 228.29,472.3 295.75,418.62l36.37,0l0,209.44l-44.29,0z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m386.69,628.06l0,-30.8l52.51,-53.09q15.84,-16.43 25.52,-27.28 9.68,-11.15 14.08,-19.95 4.4,-9.09 4.4,-19.36 0,-12.61 -7.04,-18.77 -6.75,-6.16 -18.48,-6.16 -12.03,0 -23.47,5.57Q422.77,463.79 410.15,474.06L386.1,445.61Q395.19,437.69 405.17,430.94 415.43,424.19 428.63,420.09 442.13,415.69 460.9,415.69q20.53,0 35.2,7.63 14.96,7.33 22.88,20.24 8.21,12.61 8.21,28.75 0,17.31 -7.04,31.68 -6.75,14.37 -19.95,28.45 -12.91,14.08 -31.39,31.09l-26.99,25.23l0,2.05l91.23,0l0,37.25z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m606.98,450.59c0,7.82 -0.29,15.35 -0.88,22.59 -0.39,7.24 -0.78,12.32 -1.17,15.25L607.27,488.43C612.36,480.22 618.91,474.25 626.93,470.54 634.94,466.82 643.84,464.97 653.62,464.97c17.4,0 31.29,4.69 41.65,14.08 10.56,9.19 15.84,24.05 15.84,44.59L711.11,628.06L667.41,628.06l0,-93.57c0,-23.08 -8.6,-34.61 -25.81,-34.61 -13.1,0 -22.2,4.6 -27.28,13.79 -4.89,9 -7.33,22 -7.33,39.01L606.98,628.06L563.27,628.06L563.27,413.88l43.71,0z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</vector>
|
||||||
24
app/src/main/res/drawable/baseline_24_hour_timer.xml
Normal file
24
app/src/main/res/drawable/baseline_24_hour_timer.xml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="m360,120v-80h240v80zM480,880c-49.33,0 -95.83,-9.5 -139.5,-28.5 -43.67,-19 -81.83,-44.83 -114.5,-77.5 -32.67,-32.67 -58.5,-70.83 -77.5,-114.5 -19,-43.67 -28.5,-90.17 -28.5,-139.5 0,-49.33 9.5,-95.83 28.5,-139.5 19,-43.67 44.83,-81.83 77.5,-114.5 32.67,-32.67 70.83,-58.5 114.5,-77.5 43.67,-19 90.17,-28.5 139.5,-28.5 41.33,0 81,6.67 119,20 38,13.33 73.67,32.67 107,58l56,-56 56,56 -56,56c25.33,33.33 44.67,69 58,107 13.33,38 20,77.67 20,119 0,49.33 -9.5,95.83 -28.5,139.5 -19,43.67 -44.83,81.83 -77.5,114.5 -32.67,32.67 -70.83,58.5 -114.5,77.5 -43.67,19 -90.17,28.5 -139.5,28.5zM480,800c77.33,0 143.33,-27.33 198,-82 54.67,-54.67 82,-120.67 82,-198 0,-77.33 -27.33,-143.33 -82,-198 -54.67,-54.67 -120.67,-82 -198,-82 -77.33,0 -143.33,27.33 -198,82 -54.67,54.67 -82,120.67 -82,198 0,77.33 27.33,143.33 82,198 54.67,54.67 120.67,82 198,82z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M239.19,624.91L239.19,594.11l52.51,-53.09q15.84,-16.43 25.52,-27.28 9.68,-11.15 14.08,-19.95 4.4,-9.09 4.4,-19.36 0,-12.61 -7.04,-18.77 -6.75,-6.16 -18.48,-6.16 -12.03,0 -23.47,5.57 -11.44,5.57 -24.05,15.84L238.6,442.46Q247.7,434.54 257.67,427.79 267.94,421.05 281.14,416.94 294.63,412.54 313.4,412.54q20.53,0 35.2,7.63 14.96,7.33 22.88,20.24 8.21,12.61 8.21,28.75 0,17.31 -7.04,31.68 -6.75,14.37 -19.95,28.45 -12.91,14.08 -31.39,31.09l-26.99,25.23l0,2.05l91.23,0L385.56,624.91Z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M487.35,624.91L487.35,581.5L397.88,581.5L397.88,550.7L489.7,415.47L530.47,415.47L530.47,547.18L555.7,547.18L555.7,581.5L530.47,581.5L530.47,624.91ZM487.35,497.02q0,-10.27 0.29,-17.01 0.59,-6.75 0.88,-12.03l-1.17,0Q482.36,477.95 474.74,489.39L436.9,547.18L487.35,547.18Z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m609.48,447.47c0,7.82 -0.29,15.35 -0.88,22.59 -0.39,7.24 -0.78,12.32 -1.17,15.25L609.77,485.31C614.86,477.09 621.41,471.13 629.43,467.41 637.44,463.7 646.34,461.84 656.12,461.84c17.4,0 31.29,4.69 41.65,14.08 10.56,9.19 15.84,24.05 15.84,44.59l0,104.43L669.91,624.93l0,-93.57c0,-23.08 -8.6,-34.61 -25.81,-34.61 -13.1,0 -22.2,4.6 -27.28,13.79 -4.89,9 -7.33,22 -7.33,39.01l0,75.39L565.77,624.93L565.77,414.5l43.71,0z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"
|
||||||
|
android:strokeColor="#00000000"/>
|
||||||
|
</vector>
|
||||||
17
app/src/main/res/drawable/baseline_5_hour_timer.xml
Normal file
17
app/src/main/res/drawable/baseline_5_hour_timer.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="m381.45,481.69q20.8,0 37.12,8 16.32,8 25.6,23.36 9.6,15.36 9.6,38.08 0,37.12 -23.04,58.56 -23.04,21.12 -68.16,21.12 -17.92,0 -33.92,-3.2 -15.68,-3.2 -27.52,-9.28v-41.6q11.84,6.08 28.48,10.56 16.64,4.16 31.36,4.16 21.44,0 32.64,-8.64 11.52,-8.96 11.52,-27.52 0,-34.56 -45.76,-34.56 -8.96,0 -18.56,1.92 -9.6,1.6 -16,3.2l-19.2,-10.24 8.64,-116.48h123.84v40.96h-81.6l-4.16,44.8q5.44,-0.96 11.52,-1.92 6.4,-1.28 17.6,-1.28z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m540.81,434.01c0,8.53 -0.32,16.75 -0.96,24.64 -0.43,7.89 -0.85,13.44 -1.28,16.64h2.56c5.55,-8.96 12.69,-15.47 21.44,-19.52 8.75,-4.05 18.45,-6.08 29.12,-6.08 18.99,0 34.13,5.12 45.44,15.36 11.52,10.03 17.28,26.24 17.28,48.64v113.92h-47.68v-102.08c0,-25.17 -9.39,-37.76 -28.16,-37.76 -14.29,0 -24.21,5.01 -29.76,15.04 -5.33,9.81 -8,24 -8,42.56v82.24h-47.68v-228.82h47.68z"
|
||||||
|
android:strokeWidth="0"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
<path
|
||||||
|
android:pathData="m360,120v-80h240v80zM480,880c-49.33,0 -95.83,-9.5 -139.5,-28.5 -43.67,-19 -81.83,-44.83 -114.5,-77.5 -32.67,-32.67 -58.5,-70.83 -77.5,-114.5 -19,-43.67 -28.5,-90.17 -28.5,-139.5 0,-49.33 9.5,-95.83 28.5,-139.5 19,-43.67 44.83,-81.83 77.5,-114.5 32.67,-32.67 70.83,-58.5 114.5,-77.5 43.67,-19 90.17,-28.5 139.5,-28.5 41.33,0 81,6.67 119,20 38,13.33 73.67,32.67 107,58l56,-56 56,56 -56,56c25.33,33.33 44.67,69 58,107 13.33,38 20,77.67 20,119 0,49.33 -9.5,95.83 -28.5,139.5 -19,43.67 -44.83,81.83 -77.5,114.5 -32.67,32.67 -70.83,58.5 -114.5,77.5 -43.67,19 -90.17,28.5 -139.5,28.5zM480,800c77.33,0 143.33,-27.33 198,-82 54.67,-54.67 82,-120.67 82,-198 0,-77.33 -27.33,-143.33 -82,-198 -54.67,-54.67 -120.67,-82 -198,-82 -77.33,0 -143.33,27.33 -198,82 -54.67,54.67 -82,120.67 -82,198 0,77.33 27.33,143.33 82,198 54.67,54.67 120.67,82 198,82z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/baseline_arrow_up_24.xml
Normal file
9
app/src/main/res/drawable/baseline_arrow_up_24.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="m296,736 l-56,-56 240,-240 240,240 -56,56 -184,-183 -184,183ZM296,496 L240,440 480,200 720,440 664,496 480,313 296,496Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/baseline_reset_24.xml
Normal file
9
app/src/main/res/drawable/baseline_reset_24.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="M440,838q-121,-15 -200.5,-105.5T160,520q0,-66 26,-126.5T260,288l57,57q-38,34 -57.5,79T240,520q0,88 56,155.5T440,758v80ZM520,838v-80q87,-16 143.5,-83T720,520q0,-100 -70,-170t-170,-70h-3l44,44 -56,56 -140,-140 140,-140 56,56 -44,44h3q134,0 227,93t93,227q0,121 -79.5,211.5T520,838Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
||||||
@ -1,18 +1,18 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.7.3"
|
agp = "8.7.3"
|
||||||
datastore = "1.1.1"
|
datastore = "1.1.2"
|
||||||
kotlin = "2.0.0"
|
kotlin = "2.0.0"
|
||||||
coreKtx = "1.15.0"
|
coreKtx = "1.15.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.2.1"
|
junitVersion = "1.2.1"
|
||||||
espressoCore = "3.6.1"
|
espressoCore = "3.6.1"
|
||||||
lifecycleRuntimeKtx = "2.8.7"
|
lifecycleRuntimeKtx = "2.8.7"
|
||||||
activityCompose = "1.9.3"
|
activityCompose = "1.10.0"
|
||||||
composeBom = "2024.04.01"
|
composeBom = "2025.01.00"
|
||||||
protobufGradlePlugin = "0.9.4"
|
protobufGradlePlugin = "0.9.4"
|
||||||
protobufJavalite = "4.27.0"
|
protobufJavalite = "4.27.0"
|
||||||
roomRuntime = "2.6.1"
|
roomRuntime = "2.6.1"
|
||||||
vbNfcReader = "0.1.0"
|
vbNfcReader = "0.2.0-SNAPSHOT"
|
||||||
dimReader = "2.1.0"
|
dimReader = "2.1.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user