Compare commits
	
		
			No commits in common. "e5de888b98714e34f34296d164a2cd2dada4c1fd" and "f663b00e3ebe396c026aafbfcc328c673f391aa5" have entirely different histories.
		
	
	
		
			e5de888b98
			...
			f663b00e3e
		
	
		
					 4 changed files with 32 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -18,23 +18,15 @@ android {
 | 
			
		|||
        applicationId = "com.pixelized.chocolate"
 | 
			
		||||
        minSdk = 26
 | 
			
		||||
        targetSdk = 36
 | 
			
		||||
        versionCode = 2
 | 
			
		||||
        versionName = "1.0.1"
 | 
			
		||||
        versionCode = 1
 | 
			
		||||
        versionName = "1.0"
 | 
			
		||||
 | 
			
		||||
        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    buildTypes {
 | 
			
		||||
        debug {
 | 
			
		||||
            applicationIdSuffix = ".debug"
 | 
			
		||||
            isMinifyEnabled = false
 | 
			
		||||
            proguardFiles(
 | 
			
		||||
                getDefaultProguardFile("proguard-android-optimize.txt"),
 | 
			
		||||
                "proguard-rules.pro"
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
        release {
 | 
			
		||||
            isMinifyEnabled = true
 | 
			
		||||
            isMinifyEnabled = false
 | 
			
		||||
            proguardFiles(
 | 
			
		||||
                getDefaultProguardFile("proguard-android-optimize.txt"),
 | 
			
		||||
                "proguard-rules.pro"
 | 
			
		||||
| 
						 | 
				
			
			@ -74,6 +66,12 @@ dependencies {
 | 
			
		|||
    implementation("androidx.compose.material3:material3-window-size-class:1.4.0")
 | 
			
		||||
    implementation("androidx.compose.material3.adaptive:adaptive-layout:1.1.0")
 | 
			
		||||
 | 
			
		||||
    // Navigation
 | 
			
		||||
    implementation("androidx.navigation3:navigation3-runtime:1.0.0-alpha11")
 | 
			
		||||
    implementation("androidx.navigation3:navigation3-ui:1.0.0-alpha11")
 | 
			
		||||
    implementation("androidx.compose.material3.adaptive:adaptive-navigation3:1.0.0-SNAPSHOT")
 | 
			
		||||
    implementation("androidx.lifecycle:lifecycle-viewmodel-navigation3:1.0.0-SNAPSHOT")
 | 
			
		||||
 | 
			
		||||
    // Injection
 | 
			
		||||
    implementation("androidx.hilt:hilt-navigation-compose:1.3.0")
 | 
			
		||||
    implementation("com.google.dagger:hilt-android:2.57.2")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -313,7 +313,7 @@ private fun MainContent(
 | 
			
		|||
                                withStyle(packageStyleSpan) {
 | 
			
		||||
                                    append("Forfait IS (")
 | 
			
		||||
                                    append(it.packageISInput)
 | 
			
		||||
                                    append("€) : ")
 | 
			
		||||
                                    append(") : ")
 | 
			
		||||
                                }
 | 
			
		||||
                                withStyle(amountStyleSpan) { append("${it.packageISValue}") }
 | 
			
		||||
                            },
 | 
			
		||||
| 
						 | 
				
			
			@ -324,7 +324,7 @@ private fun MainContent(
 | 
			
		|||
                                withStyle(packageStyleSpan) {
 | 
			
		||||
                                    append("Forfait 2B (")
 | 
			
		||||
                                    append(it.package2BInput)
 | 
			
		||||
                                    append("€) : ")
 | 
			
		||||
                                    append(") : ")
 | 
			
		||||
                                }
 | 
			
		||||
                                withStyle(amountStyleSpan) { append("${it.package2BValue}") }
 | 
			
		||||
                            },
 | 
			
		||||
| 
						 | 
				
			
			@ -333,9 +333,9 @@ private fun MainContent(
 | 
			
		|||
                            color = MaterialTheme.colorScheme.onSurface,
 | 
			
		||||
                            text = buildAnnotatedString {
 | 
			
		||||
                                withStyle(packageStyleSpan) {
 | 
			
		||||
                                    append("Forfait FA (")
 | 
			
		||||
                                    append("Forfait IS (")
 | 
			
		||||
                                    append(it.packageISInput)
 | 
			
		||||
                                    append("€) : ")
 | 
			
		||||
                                    append(") : ")
 | 
			
		||||
                                }
 | 
			
		||||
                                withStyle(amountStyleSpan) { append("${it.packageISValue}") }
 | 
			
		||||
                            },
 | 
			
		||||
| 
						 | 
				
			
			@ -412,11 +412,11 @@ private fun MainContentPreview() {
 | 
			
		|||
                    listOf(
 | 
			
		||||
                        MainScreenResult(
 | 
			
		||||
                            id = "0-1",
 | 
			
		||||
                            packageISInput = "77.29",
 | 
			
		||||
                            packageISInput = "77.29€",
 | 
			
		||||
                            packageISValue = 3,
 | 
			
		||||
                            package2BInput = "96.26",
 | 
			
		||||
                            package2BInput = "96.26€",
 | 
			
		||||
                            package2BValue = 80,
 | 
			
		||||
                            packageFAInput = "107.97",
 | 
			
		||||
                            packageFAInput = "107.97€",
 | 
			
		||||
                            packageFAValue = 64,
 | 
			
		||||
                            result = 14841.52,
 | 
			
		||||
                            delta = 0.0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -91,27 +91,27 @@ class MainViewModel @Inject constructor() : ViewModel() {
 | 
			
		|||
        precision: Double = 10.0.pow(DECIMALS),
 | 
			
		||||
    ) {
 | 
			
		||||
        val input = expected.value(precision)
 | 
			
		||||
        if (input == null || input <= 0) {
 | 
			
		||||
        if (input == null) {
 | 
			
		||||
            expected.errorFlow.value = true
 | 
			
		||||
            return
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        val valueIS = packageIS.value(precision)
 | 
			
		||||
        if (valueIS == null || valueIS <= 0) {
 | 
			
		||||
        if (valueIS == null) {
 | 
			
		||||
            packageIS.errorFlow.value = true
 | 
			
		||||
            return
 | 
			
		||||
        }
 | 
			
		||||
        val maxIS = (input / valueIS) + 1
 | 
			
		||||
 | 
			
		||||
        val value2B = package2B.value(precision)
 | 
			
		||||
        if (value2B == null || value2B <= 0) {
 | 
			
		||||
        if (value2B == null) {
 | 
			
		||||
            package2B.errorFlow.value = true
 | 
			
		||||
            return
 | 
			
		||||
        }
 | 
			
		||||
        val max2B = (input / value2B) + 1
 | 
			
		||||
 | 
			
		||||
        val valueFA = packageFA.value(precision)
 | 
			
		||||
        if (valueFA == null || valueFA <= 0) {
 | 
			
		||||
        if (valueFA == null) {
 | 
			
		||||
            packageFA.errorFlow.value = true
 | 
			
		||||
            return
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -161,11 +161,11 @@ class MainViewModel @Inject constructor() : ViewModel() {
 | 
			
		|||
                                _results.value = listOf(
 | 
			
		||||
                                    MainScreenResult(
 | 
			
		||||
                                        id = "$delta-0",
 | 
			
		||||
                                        packageISInput = inputs.value.packageIS.valueFlow.value,
 | 
			
		||||
                                        packageISInput = inputs.value.packageIS.labelFlow.value ?: "",
 | 
			
		||||
                                        packageISValue = indexIS,
 | 
			
		||||
                                        package2BInput = inputs.value.package2B.valueFlow.value,
 | 
			
		||||
                                        package2BInput = inputs.value.package2B.labelFlow.value ?: "",
 | 
			
		||||
                                        package2BValue = index2B,
 | 
			
		||||
                                        packageFAInput = inputs.value.packageFA.valueFlow.value,
 | 
			
		||||
                                        packageFAInput = inputs.value.packageFA.labelFlow.value ?: "",
 | 
			
		||||
                                        packageFAValue = indexFA,
 | 
			
		||||
                                        result = previousResult / precision,
 | 
			
		||||
                                        delta = delta,
 | 
			
		||||
| 
						 | 
				
			
			@ -179,11 +179,11 @@ class MainViewModel @Inject constructor() : ViewModel() {
 | 
			
		|||
                                    list.add(
 | 
			
		||||
                                        MainScreenResult(
 | 
			
		||||
                                            id = "$delta-${list.size}",
 | 
			
		||||
                                            packageISInput = inputs.value.packageIS.valueFlow.value,
 | 
			
		||||
                                            packageISInput = inputs.value.packageIS.labelFlow.value ?: "",
 | 
			
		||||
                                            packageISValue = indexIS,
 | 
			
		||||
                                            package2BInput = inputs.value.package2B.valueFlow.value,
 | 
			
		||||
                                            package2BInput = inputs.value.package2B.labelFlow.value ?: "",
 | 
			
		||||
                                            package2BValue = index2B,
 | 
			
		||||
                                            packageFAInput = inputs.value.packageFA.valueFlow.value,
 | 
			
		||||
                                            packageFAInput = inputs.value.packageFA.labelFlow.value ?: "",
 | 
			
		||||
                                            packageFAValue = indexFA,
 | 
			
		||||
                                            result = previousResult / precision,
 | 
			
		||||
                                            delta = delta,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,9 @@ pluginManagement {
 | 
			
		|||
        }
 | 
			
		||||
        mavenCentral()
 | 
			
		||||
        gradlePluginPortal()
 | 
			
		||||
        maven {
 | 
			
		||||
            url = uri("https://androidx.dev/snapshots/builds/13617490/artifacts/repository")
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +20,9 @@ dependencyResolutionManagement {
 | 
			
		|||
    repositories {
 | 
			
		||||
        google()
 | 
			
		||||
        mavenCentral()
 | 
			
		||||
        maven {
 | 
			
		||||
            url = uri("https://androidx.dev/snapshots/builds/13617490/artifacts/repository")
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue