Compare commits
No commits in common. "f2fe268b5bd773c585b37ef97fe9fb79f121ebe9" and "7b1c0db0cc9d1b8ca7605e36ca4a1033dc2de2d0" have entirely different histories.
f2fe268b5b
...
7b1c0db0cc
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="2.0.0" />
|
||||
<option name="version" value="1.9.0" />
|
||||
</component>
|
||||
</project>
|
@ -1,7 +1,9 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
|
||||
// https://medium.com/@rowaido.game/implementing-the-room-library-with-jetpack-compose-590d13101fa7
|
||||
id("com.google.devtools.ksp")
|
||||
|
||||
// For Room (2024-12-17)
|
||||
kotlin("kapt")
|
||||
@ -9,16 +11,19 @@ plugins {
|
||||
|
||||
android {
|
||||
namespace = "com.hyperling.expensetracker"
|
||||
compileSdk = 35
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.hyperling.expensetracker"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "0.0.2"
|
||||
versionName = "0.0.1"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@ -31,15 +36,26 @@ android {
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
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 {
|
||||
@ -60,10 +76,19 @@ dependencies {
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
|
||||
// For Room
|
||||
// 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)
|
||||
// https://www.youtube.com/watch?v=bOd3wO0uFr8&themeRefresh=1
|
||||
/* build.gradle version * /
|
||||
def room_version: String = "2.5.0"
|
||||
def room_version: String = "2.6.1"
|
||||
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: String, //Enum<Rate>,
|
||||
val rate: 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 cost ASC")
|
||||
fun selectExpensesCost(): 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>>
|
||||
|
||||
}
|
@ -42,7 +42,7 @@ fun ExpenseDialogAdd(
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Words)
|
||||
)
|
||||
// TBD / TODO: Had to make this a String, can we turn it back to a Double somehow?
|
||||
// TBD: Had to make this a String, can we turn it back to a Double somehow?
|
||||
TextField(
|
||||
value = state.cost,
|
||||
onValueChange = {
|
||||
@ -53,8 +53,7 @@ fun ExpenseDialogAdd(
|
||||
},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Decimal)
|
||||
)
|
||||
// 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???
|
||||
/* Unsure what to do here yet, a simple Picker type does not seems to exist?
|
||||
TextField(
|
||||
value = state.rate,
|
||||
onValueChange = {
|
||||
@ -64,7 +63,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: String): ExpenseEvent // TBD / TODO: Make this the enum.
|
||||
data class SetRate(val rate: Rate): ExpenseEvent
|
||||
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: String = "", // TBD / TODO: Rate = Rate.MONTHLY,
|
||||
val rate: 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 / TODO: Enable this once Rate is working.
|
||||
//|| rate.isBlank() # TBD, enable this once Rate is working.
|
||||
) {
|
||||
return
|
||||
}
|
||||
@ -67,7 +67,7 @@ class ExpenseViewModel (
|
||||
isAddingExpense = false,
|
||||
name = "",
|
||||
cost = "",
|
||||
rate = "", // TBD / TODO: Rate.MONTHLY,
|
||||
rate = Rate.MONTHLY,
|
||||
) }
|
||||
}
|
||||
is ExpenseEvent.SetName -> {
|
||||
|
@ -1,8 +1,5 @@
|
||||
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
|
||||
@ -141,4 +138,3 @@ fun MainPreview() {
|
||||
Main()
|
||||
}
|
||||
}
|
||||
*/
|
@ -1,6 +1,8 @@
|
||||
// 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.kotlin.android) apply false
|
||||
alias(libs.plugins.kotlin.compose) 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
|
||||
}
|
@ -1,13 +1,16 @@
|
||||
[versions]
|
||||
agp = "8.7.3"
|
||||
kotlin = "2.0.0"
|
||||
coreKtx = "1.15.0"
|
||||
kotlin = "1.9.0"
|
||||
coreKtx = "1.10.1"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.2.1"
|
||||
espressoCore = "3.6.1"
|
||||
junitVersion = "1.1.5"
|
||||
espressoCore = "3.5.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" }
|
||||
@ -27,6 +30,5 @@ androidx-material3 = { group = "androidx.compose.material3", name = "material3"
|
||||
|
||||
[plugins]
|
||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user