Compare commits
13 Commits
7b1c0db0cc
...
f2fe268b5b
Author | SHA1 | Date | |
---|---|---|---|
f2fe268b5b | |||
6e05298f3d | |||
8b8ef62cbf | |||
a6b96a0bc0 | |||
39b82fec3b | |||
57c0ebce9e | |||
ee37ba6673 | |||
65e685eef9 | |||
cdc505b478 | |||
c4aa13b608 | |||
0717eb0639 | |||
343a963e3f | |||
0e7de44a47 |
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="1.9.0" />
|
||||
<option name="version" value="2.0.0" />
|
||||
</component>
|
||||
</project>
|
@ -1,9 +1,7 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
|
||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
||||
id("com.google.devtools.ksp")
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
|
||||
// For Room (2024-12-17)
|
||||
kotlin("kapt")
|
||||
@ -11,19 +9,16 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace = "com.hyperling.expensetracker"
|
||||
compileSdk = 34
|
||||
compileSdk = 35
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.hyperling.expensetracker"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "0.0.1"
|
||||
versionName = "0.0.2"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -36,26 +31,15 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
jvmTarget = "11"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.1"
|
||||
|
||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
||||
//kotlinCompilerExtensionVersion = "1.5.11"
|
||||
}
|
||||
packaging {
|
||||
resources {
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -76,19 +60,10 @@ dependencies {
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
|
||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
||||
/* This is crazy? How are people supposed to know how to do this, and especially "fix" it when it doesn't work?
|
||||
implementation(libs.androidx.room.runtime)
|
||||
implementation(libs.androidx.room.ktx)
|
||||
ksp(libs.androidx.room.compiler)
|
||||
|
||||
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
||||
*/
|
||||
|
||||
// For Room (2024-12-17)
|
||||
// For Room
|
||||
// https://www.youtube.com/watch?v=bOd3wO0uFr8&themeRefresh=1
|
||||
/* build.gradle version * /
|
||||
def room_version: String = "2.6.1"
|
||||
def room_version: String = "2.5.0"
|
||||
implementation"androidx.room:room-ktx:$room_version"
|
||||
kapt "androidx.room:room-compiler:$room_version"
|
||||
// */
|
||||
@ -97,4 +72,4 @@ dependencies {
|
||||
implementation("androidx.room:room-ktx:$room_version")
|
||||
kapt("androidx.room:room-compiler:$room_version")
|
||||
// */
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ import androidx.room.PrimaryKey
|
||||
data class Expense (
|
||||
val name: String,
|
||||
val cost: String,
|
||||
val rate: Enum<Rate>,
|
||||
val rate: String, //Enum<Rate>,
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
val ID: Int = 0,
|
||||
)
|
@ -21,10 +21,10 @@ interface ExpenseDao {
|
||||
@Query("SELECT * FROM expense ORDER BY name ASC")
|
||||
fun selectExpensesName(): Flow<List<Expense>>
|
||||
|
||||
@Query("SELECT * FROM expense ORDER BY rate ASC")
|
||||
fun selectExpensesRate(): Flow<List<Expense>>
|
||||
|
||||
@Query("SELECT * FROM expense ORDER BY cost ASC")
|
||||
fun selectExpensesCost(): Flow<List<Expense>>
|
||||
|
||||
@Query("SELECT * FROM expense ORDER BY rate ASC")
|
||||
fun selectExpensesRate(): Flow<List<Expense>>
|
||||
|
||||
}
|
@ -42,7 +42,7 @@ fun ExpenseDialogAdd(
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Words)
|
||||
)
|
||||
// TBD: Had to make this a String, can we turn it back to a Double somehow?
|
||||
// TBD / TODO: Had to make this a String, can we turn it back to a Double somehow?
|
||||
TextField(
|
||||
value = state.cost,
|
||||
onValueChange = {
|
||||
@ -53,7 +53,8 @@ fun ExpenseDialogAdd(
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal)
|
||||
)
|
||||
/* Unsure what to do here yet, a simple Picker type does not seems to exist?
|
||||
// TBD / TODO: Unsure what to do here yet so that an Enum is possible.
|
||||
// A simple Picker type does not seems to exist? Why? Whyyy???
|
||||
TextField(
|
||||
value = state.rate,
|
||||
onValueChange = {
|
||||
@ -63,7 +64,7 @@ fun ExpenseDialogAdd(
|
||||
Text(text = "Rate")
|
||||
},
|
||||
)
|
||||
*/
|
||||
// */
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
|
@ -4,7 +4,7 @@ sealed interface ExpenseEvent {
|
||||
object SaveExpense: ExpenseEvent
|
||||
data class SetName(val name: String): ExpenseEvent
|
||||
data class SetCost(val cost: String): ExpenseEvent
|
||||
data class SetRate(val rate: Rate): ExpenseEvent
|
||||
data class SetRate(val rate: String): ExpenseEvent // TBD / TODO: Make this the enum.
|
||||
object ShowDialog: ExpenseEvent
|
||||
object HideDialog: ExpenseEvent
|
||||
data class SortExpenses(val sortType: SortType): ExpenseEvent
|
||||
|
@ -4,7 +4,7 @@ data class ExpenseState(
|
||||
val expenses: List<Expense> = emptyList(),
|
||||
val name: String = "",
|
||||
val cost: String = "",
|
||||
val rate: Rate = Rate.MONTHLY,
|
||||
val rate: String = "", // TBD / TODO: Rate = Rate.MONTHLY,
|
||||
val isAddingExpense: Boolean = false,
|
||||
val sortType: SortType = SortType.NAME,
|
||||
)
|
||||
|
@ -52,7 +52,7 @@ class ExpenseViewModel (
|
||||
|
||||
if (name.isBlank()
|
||||
|| cost.isBlank()
|
||||
//|| rate.isBlank() # TBD, enable this once Rate is working.
|
||||
|| rate.isBlank() // TBD / TODO: Enable this once Rate is working.
|
||||
) {
|
||||
return
|
||||
}
|
||||
@ -67,7 +67,7 @@ class ExpenseViewModel (
|
||||
isAddingExpense = false,
|
||||
name = "",
|
||||
cost = "",
|
||||
rate = Rate.MONTHLY,
|
||||
rate = "", // TBD / TODO: Rate.MONTHLY,
|
||||
) }
|
||||
}
|
||||
is ExpenseEvent.SetName -> {
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.hyperling.expensetracker
|
||||
|
||||
/* TBD / TODO: This file exists temporarily for viewing what the old version was doing.
|
||||
// TBD / TODO: Remove this file.
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@ -137,4 +140,5 @@ fun MainPreview() {
|
||||
ExpenseTrackerTheme {
|
||||
Main()
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
@ -1,8 +1,6 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
alias(libs.plugins.android.application) apply false
|
||||
alias(libs.plugins.jetbrains.kotlin.android) apply false
|
||||
|
||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
||||
id("com.google.devtools.ksp") version "1.9.23-1.0.19" apply false
|
||||
alias(libs.plugins.kotlin.android) apply false
|
||||
alias(libs.plugins.kotlin.compose) apply false
|
||||
}
|
@ -1,16 +1,13 @@
|
||||
[versions]
|
||||
agp = "8.7.3"
|
||||
kotlin = "1.9.0"
|
||||
coreKtx = "1.10.1"
|
||||
kotlin = "2.0.0"
|
||||
coreKtx = "1.15.0"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.1.5"
|
||||
espressoCore = "3.5.1"
|
||||
junitVersion = "1.2.1"
|
||||
espressoCore = "3.6.1"
|
||||
lifecycleRuntimeKtx = "2.6.1"
|
||||
activityCompose = "1.8.0"
|
||||
composeBom = "2024.04.01"
|
||||
roomCompiler = "2.6.1"
|
||||
roomKtx = "2.6.1"
|
||||
roomRuntime = "2.6.1"
|
||||
|
||||
[libraries]
|
||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
@ -30,5 +27,6 @@ androidx-material3 = { group = "androidx.compose.material3", name = "material3"
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user