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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="KotlinJpsPluginSettings">
|
<component name="KotlinJpsPluginSettings">
|
||||||
<option name="version" value="1.9.0" />
|
<option name="version" value="2.0.0" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -1,9 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
alias(libs.plugins.jetbrains.kotlin.android)
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
|
||||||
id("com.google.devtools.ksp")
|
|
||||||
|
|
||||||
// For Room (2024-12-17)
|
// For Room (2024-12-17)
|
||||||
kotlin("kapt")
|
kotlin("kapt")
|
||||||
@ -11,19 +9,16 @@ plugins {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.hyperling.expensetracker"
|
namespace = "com.hyperling.expensetracker"
|
||||||
compileSdk = 34
|
compileSdk = 35
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.hyperling.expensetracker"
|
applicationId = "com.hyperling.expensetracker"
|
||||||
minSdk = 24
|
minSdk = 24
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "0.0.1"
|
versionName = "0.0.2"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables {
|
|
||||||
useSupportLibrary = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@ -36,26 +31,15 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_11
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
}
|
}
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "11"
|
||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
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 {
|
dependencies {
|
||||||
@ -76,19 +60,10 @@ dependencies {
|
|||||||
debugImplementation(libs.androidx.ui.tooling)
|
debugImplementation(libs.androidx.ui.tooling)
|
||||||
debugImplementation(libs.androidx.ui.test.manifest)
|
debugImplementation(libs.androidx.ui.test.manifest)
|
||||||
|
|
||||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
// For Room
|
||||||
/* 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)
|
|
||||||
// https://www.youtube.com/watch?v=bOd3wO0uFr8&themeRefresh=1
|
// https://www.youtube.com/watch?v=bOd3wO0uFr8&themeRefresh=1
|
||||||
/* build.gradle version * /
|
/* build.gradle version * /
|
||||||
def room_version: String = "2.6.1"
|
def room_version: String = "2.5.0"
|
||||||
implementation"androidx.room:room-ktx:$room_version"
|
implementation"androidx.room:room-ktx:$room_version"
|
||||||
kapt "androidx.room:room-compiler:$room_version"
|
kapt "androidx.room:room-compiler:$room_version"
|
||||||
// */
|
// */
|
||||||
|
@ -7,7 +7,7 @@ import androidx.room.PrimaryKey
|
|||||||
data class Expense (
|
data class Expense (
|
||||||
val name: String,
|
val name: String,
|
||||||
val cost: String,
|
val cost: String,
|
||||||
val rate: Enum<Rate>,
|
val rate: String, //Enum<Rate>,
|
||||||
@PrimaryKey(autoGenerate = true)
|
@PrimaryKey(autoGenerate = true)
|
||||||
val ID: Int = 0,
|
val ID: Int = 0,
|
||||||
)
|
)
|
@ -21,10 +21,10 @@ interface ExpenseDao {
|
|||||||
@Query("SELECT * FROM expense ORDER BY name ASC")
|
@Query("SELECT * FROM expense ORDER BY name ASC")
|
||||||
fun selectExpensesName(): Flow<List<Expense>>
|
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")
|
@Query("SELECT * FROM expense ORDER BY cost ASC")
|
||||||
fun selectExpensesCost(): Flow<List<Expense>>
|
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)
|
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(
|
TextField(
|
||||||
value = state.cost,
|
value = state.cost,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
@ -53,7 +53,8 @@ fun ExpenseDialogAdd(
|
|||||||
},
|
},
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal)
|
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(
|
TextField(
|
||||||
value = state.rate,
|
value = state.rate,
|
||||||
onValueChange = {
|
onValueChange = {
|
||||||
@ -63,7 +64,7 @@ fun ExpenseDialogAdd(
|
|||||||
Text(text = "Rate")
|
Text(text = "Rate")
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
*/
|
// */
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
|
@ -4,7 +4,7 @@ sealed interface ExpenseEvent {
|
|||||||
object SaveExpense: ExpenseEvent
|
object SaveExpense: ExpenseEvent
|
||||||
data class SetName(val name: String): ExpenseEvent
|
data class SetName(val name: String): ExpenseEvent
|
||||||
data class SetCost(val cost: 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 ShowDialog: ExpenseEvent
|
||||||
object HideDialog: ExpenseEvent
|
object HideDialog: ExpenseEvent
|
||||||
data class SortExpenses(val sortType: SortType): ExpenseEvent
|
data class SortExpenses(val sortType: SortType): ExpenseEvent
|
||||||
|
@ -4,7 +4,7 @@ data class ExpenseState(
|
|||||||
val expenses: List<Expense> = emptyList(),
|
val expenses: List<Expense> = emptyList(),
|
||||||
val name: String = "",
|
val name: String = "",
|
||||||
val cost: String = "",
|
val cost: String = "",
|
||||||
val rate: Rate = Rate.MONTHLY,
|
val rate: String = "", // TBD / TODO: Rate = Rate.MONTHLY,
|
||||||
val isAddingExpense: Boolean = false,
|
val isAddingExpense: Boolean = false,
|
||||||
val sortType: SortType = SortType.NAME,
|
val sortType: SortType = SortType.NAME,
|
||||||
)
|
)
|
||||||
|
@ -52,7 +52,7 @@ class ExpenseViewModel (
|
|||||||
|
|
||||||
if (name.isBlank()
|
if (name.isBlank()
|
||||||
|| cost.isBlank()
|
|| cost.isBlank()
|
||||||
//|| rate.isBlank() # TBD, enable this once Rate is working.
|
|| rate.isBlank() // TBD / TODO: Enable this once Rate is working.
|
||||||
) {
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ class ExpenseViewModel (
|
|||||||
isAddingExpense = false,
|
isAddingExpense = false,
|
||||||
name = "",
|
name = "",
|
||||||
cost = "",
|
cost = "",
|
||||||
rate = Rate.MONTHLY,
|
rate = "", // TBD / TODO: Rate.MONTHLY,
|
||||||
) }
|
) }
|
||||||
}
|
}
|
||||||
is ExpenseEvent.SetName -> {
|
is ExpenseEvent.SetName -> {
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.hyperling.expensetracker
|
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.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@ -138,3 +141,4 @@ fun MainPreview() {
|
|||||||
Main()
|
Main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
@ -1,8 +1,6 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application) apply false
|
alias(libs.plugins.android.application) apply false
|
||||||
alias(libs.plugins.jetbrains.kotlin.android) apply false
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) 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
|
|
||||||
}
|
}
|
@ -1,16 +1,13 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.7.3"
|
agp = "8.7.3"
|
||||||
kotlin = "1.9.0"
|
kotlin = "2.0.0"
|
||||||
coreKtx = "1.10.1"
|
coreKtx = "1.15.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
junitVersion = "1.1.5"
|
junitVersion = "1.2.1"
|
||||||
espressoCore = "3.5.1"
|
espressoCore = "3.6.1"
|
||||||
lifecycleRuntimeKtx = "2.6.1"
|
lifecycleRuntimeKtx = "2.6.1"
|
||||||
activityCompose = "1.8.0"
|
activityCompose = "1.8.0"
|
||||||
composeBom = "2024.04.01"
|
composeBom = "2024.04.01"
|
||||||
roomCompiler = "2.6.1"
|
|
||||||
roomKtx = "2.6.1"
|
|
||||||
roomRuntime = "2.6.1"
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
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]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
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